|
| egoShield (void) |
| Constructor of egoShield class. More...
|
|
void | setup (uint16_t acc=1500, uint16_t vel=1000, uint8_t uStep=SIXTEEN, uint16_t fTol=10, uint16_t fHys=5, float P=1.0, float I=0.02, float D=0.006) |
| Initializes buttons, OLED, uStepper and BT-module. More...
|
|
void | loop (void) |
| Contains the main logic of the shield functionality, e.g. transition between states (idle, play, record and pause).
|
|
|
uStepper | stepper |
| Creates an uStepper instance.
|
|
|
void | inputs (void) |
| Reads the four buttons and writes their value; no push, short push or long push, to global variables.
|
|
uint8_t | buttonState (uint8_t button, uint8_t nmbr) |
| Returns the button state of the appropriate button. More...
|
|
void | idleMode (void) |
| Holds the idle logic; page to show, what buttons to enable etc.
|
|
void | playMode (void) |
| Holds the play logic, showing play page and running the recorded sequence.
|
|
void | recordMode (void) |
| Holds the record logic, showing the record page and recording positions from user input.
|
|
void | pauseMode (void) |
| Holds the pause logic, showing the pause page and pausing the playing of a sequence.
|
|
void | fastForward (void) |
| Holds the fast forward logic for driving the stepper motor manually with the pushbuttons.
|
|
void | fastBackward (void) |
| Holds the fast backward logic for driving the stepper motor manually with the pushbuttons.
|
|
void | startPage (void) |
| Holds the code for the start page of the OLED.
|
|
void | idlePage (bool pidMode, float pos) |
| Holds the code for the idle page of the OLED. More...
|
|
void | recordPage (bool pidMode, bool recorded, uint8_t index, float pos) |
| Holds the code for the record page of the OLED. More...
|
|
void | playPage (bool loopMode, bool pidMode, uint8_t index) |
| Holds the code for the play page of the OLED. More...
|
|
void | pausePage (bool loopMode, bool pidMode, uint8_t index) |
| Holds the code for the pause page of the OLED. More...
|
|
Definition at line 176 of file egoShield.h.
◆ egoShield()
egoShield::egoShield |
( |
void |
| ) |
|
Constructor of egoShield class.
This is the constructor of the egoShield class. No arguments are present in the constructor.
Definition at line 66 of file egoShield.cpp.
◆ buttonState()
uint8_t egoShield::buttonState |
( |
uint8_t |
button, |
|
|
uint8_t |
nmbr |
|
) |
| |
|
private |
Returns the button state of the appropriate button.
- Parameters
-
[in] | button | is set to either of the four available buttons. |
[in] | nmbr | is used for indexing in the longPushFlag array. |
- Returns
- 0 - no push detected.
-
1 - short push detected.
-
2 - long push detected.
Definition at line 311 of file egoShield.cpp.
◆ idlePage()
void egoShield::idlePage |
( |
bool |
pidMode, |
|
|
float |
pos |
|
) |
| |
|
private |
Holds the code for the idle page of the OLED.
- Parameters
-
[in] | pidMode | tells if the display should show PID ON or PID OFF. |
[in] | pos | is the encoder position to be displayed. |
Definition at line 381 of file egoShield.cpp.
◆ pausePage()
void egoShield::pausePage |
( |
bool |
loopMode, |
|
|
bool |
pidMode, |
|
|
uint8_t |
index |
|
) |
| |
|
private |
Holds the code for the pause page of the OLED.
- Parameters
-
[in] | loopMode | tells if the display should show loop symbol. |
[in] | pidMode | tells if the display should show PID ON or PID OFF. |
[in] | index | tells which step we are at. |
Definition at line 516 of file egoShield.cpp.
◆ playPage()
void egoShield::playPage |
( |
bool |
loopMode, |
|
|
bool |
pidMode, |
|
|
uint8_t |
index |
|
) |
| |
|
private |
Holds the code for the play page of the OLED.
- Parameters
-
[in] | loopMode | tells if the display should show loop symbol. |
[in] | pidMode | tells if the display should show PID ON or PID OFF. |
[in] | index | tells which step we are at. |
Definition at line 473 of file egoShield.cpp.
◆ recordPage()
void egoShield::recordPage |
( |
bool |
pidMode, |
|
|
bool |
recorded, |
|
|
uint8_t |
index, |
|
|
float |
pos |
|
) |
| |
|
private |
Holds the code for the record page of the OLED.
- Parameters
-
[in] | pidMode | tells if the display should show PID ON or PID OFF. |
[in] | recorded | tells if a step has been recorded. |
[in] | index | tells which step we are at. |
[in] | pos | is the encoder position to be displayed. |
Definition at line 423 of file egoShield.cpp.
◆ setup()
void egoShield::setup |
( |
uint16_t |
acc = 1500 , |
|
|
uint16_t |
vel = 1000 , |
|
|
uint8_t |
uStep = SIXTEEN , |
|
|
uint16_t |
fTol = 10 , |
|
|
uint16_t |
fHys = 5 , |
|
|
float |
P = 1.0 , |
|
|
float |
I = 0.02 , |
|
|
float |
D = 0.006 |
|
) |
| |
Initializes buttons, OLED, uStepper and BT-module.
- Parameters
-
[in] | acc | takes in the maximum acceleration in play mode. |
[in] | vel | takes in the maximum velocity in play mode. |
[in] | uStep | takes in the microstepping setting. |
[in] | fTol | takes in the fault tolerance for the PID in steps, i.e. how much error is allowed before correction. |
[in] | fHys | takes fault hysteresis in steps, i.e. when is the PID deactivated again. |
[in] | P | takes in the PID P term. |
[in] | I | takes in the PID I term. |
[in] | D | takes in the PID D term. |
Definition at line 71 of file egoShield.cpp.
◆ acceleration
uint16_t egoShield::acceleration |
|
private |
This variable holds the acceleration used during playback of the sequence
Definition at line 250 of file egoShield.h.
◆ bw
This variable holds the current state of the backward button, which tells whether no, short or long push has been detected
Definition at line 246 of file egoShield.h.
◆ dTerm
This variable holds the PID D term
Definition at line 264 of file egoShield.h.
◆ endmove
uint8_t egoShield::endmove |
|
private |
This variable holds the final step number in the recorded sequence
Definition at line 226 of file egoShield.h.
◆ faultHysteresis
uint16_t egoShield::faultHysteresis |
|
private |
This variable holds the fault hysteresis setting
Definition at line 258 of file egoShield.h.
◆ faultTolerance
uint16_t egoShield::faultTolerance |
|
private |
This variable holds the fault tolerance setting
Definition at line 256 of file egoShield.h.
◆ fw
This variable holds the current state of the forward button, which tells whether no, short or long push has been detected
Definition at line 244 of file egoShield.h.
◆ iTerm
This variable holds the PID I term
Definition at line 262 of file egoShield.h.
◆ longPushFlag
bool egoShield::longPushFlag[4] |
|
private |
This array indicates whether one of the buttons have experienced a long duration push
Definition at line 236 of file egoShield.h.
◆ loopMode
This variable indicates whether we are in loop mode during playback
Definition at line 234 of file egoShield.h.
◆ microStepping
uint8_t egoShield::microStepping |
|
private |
This variable holds the microstepping setting
Definition at line 254 of file egoShield.h.
◆ pidFlag
This variable indicates if PID is enabled
Definition at line 230 of file egoShield.h.
◆ place
This variable holds the step number in the recorded sequence
Definition at line 224 of file egoShield.h.
◆ play
This variable holds the current state of the play button, which tells whether no, short or long push has been detected
Definition at line 242 of file egoShield.h.
◆ pos
float egoShield::pos[CNT] |
|
private |
This array holds the encoder value at the recorded positions
Definition at line 228 of file egoShield.h.
◆ pTerm
This variable holds the PID P term
Definition at line 260 of file egoShield.h.
◆ rec
This variable holds the current state of the record button, which tells whether no, short or long push has been detected
Definition at line 240 of file egoShield.h.
◆ record
This variable indicates whether we are recording
Definition at line 232 of file egoShield.h.
◆ setPoint
float egoShield::setPoint |
|
private |
This variable holds the current set-point to the PID, either from manual control or during playback of the sequence
Definition at line 248 of file egoShield.h.
◆ state
This variable holds the current state of the program, which tells whether the program is in idle, play, record or pause mode
Definition at line 238 of file egoShield.h.
◆ u8g2
U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI* egoShield::u8g2 |
|
private |
Creates an u8g2 (OLED) instance
Definition at line 222 of file egoShield.h.
◆ velocity
uint16_t egoShield::velocity |
|
private |
This variable holds the velocity used during playback of the sequence
Definition at line 252 of file egoShield.h.
The documentation for this class was generated from the following files: