6
6
#define COLOR_ORANGE 0xE47128
7
7
8
8
enum states {
9
- LEARN ,
9
+ RECORD ,
10
10
REPLAY,
11
11
ZERO_POSITION
12
12
};
@@ -21,7 +21,7 @@ float homePos[6] = {157.5, 157.5, 157.5, 157.5, 157.5, 90.0};
21
21
static lv_obj_t * counter;
22
22
static lv_obj_t * btnm;
23
23
24
- static const char * btnm_map[] = { " LEARN " , " \n " , " REPLAY" , " \n " , " ZERO_POSITION" , " \n " , " \0 " };
24
+ static const char * btnm_map[] = { " RECORD " , " \n " , " REPLAY" , " \n " , " ZERO_POSITION" , " \n " , " \0 " };
25
25
26
26
27
27
static void eventHandlerMenu (lv_event_t * e) {
@@ -37,31 +37,31 @@ static void eventHandlerMenu(lv_event_t * e) {
37
37
uint32_t id = lv_btnmatrix_get_selected_btn (obj);
38
38
const char * txt = lv_btnmatrix_get_btn_text (obj, id);
39
39
40
- if (state == LEARN ) {
40
+ if (state == RECORD ) {
41
41
final_idx = idx;
42
42
}
43
43
44
44
idx = values;
45
45
46
46
switch (id) {
47
47
case 0 : // if the button pressed is the first one
48
- if (txt == " LEARN " ) {
49
- state = LEARN ;
48
+ if (txt == " RECORD " ) {
49
+ state = RECORD ;
50
50
Braccio.disengage (); // allow the user to freely move the braccio
51
51
lv_btnmatrix_set_btn_ctrl (btnm, 0 , LV_BTNMATRIX_CTRL_CHECKED);
52
- Serial.println (" LEARN " );
52
+ Serial.println (" RECORD " );
53
53
lv_btnmatrix_clear_btn_ctrl (btnm, 1 , LV_BTNMATRIX_CTRL_DISABLED); // remove disabled state of the replay button
54
54
btnm_map[0 ] = " STOP" ; // change the label of the first button to "STOP"
55
55
}
56
56
else if (txt == " STOP" ) {
57
57
state = ZERO_POSITION;
58
58
Braccio.engage (); // enable the steppers so that the braccio stands still
59
59
lv_btnmatrix_set_btn_ctrl (btnm, 2 , LV_BTNMATRIX_CTRL_CHECKED);
60
- btnm_map[0 ] = " LEARN " ; // reset the label of the first button back to "LEARN "
60
+ btnm_map[0 ] = " RECORD " ; // reset the label of the first button back to "RECORD "
61
61
}
62
62
break ;
63
63
case 1 :
64
- btnm_map[0 ] = " LEARN " ; // reset the label of the first button back to "LEARN "
64
+ btnm_map[0 ] = " RECORD " ; // reset the label of the first button back to "RECORD "
65
65
if (txt == " REPLAY" ){
66
66
state = REPLAY;
67
67
btnm_map[2 ] = " STOP" ; // change the label of the second button to "STOP"
@@ -80,7 +80,7 @@ static void eventHandlerMenu(lv_event_t * e) {
80
80
81
81
default :
82
82
state = ZERO_POSITION;
83
- btnm_map[0 ] = " LEARN " ; // reset the label of the first button back to "LEARN "
83
+ btnm_map[0 ] = " RECORD " ; // reset the label of the first button back to "RECORD "
84
84
btnm_map[2 ] = " REPLAY" ; // reset the label of the first button back to "REPLAY"
85
85
Braccio.engage ();
86
86
delay (500 );
@@ -140,7 +140,7 @@ void setup() {
140
140
}
141
141
142
142
void loop () {
143
- if (state == LEARN ) {
143
+ if (state == RECORD ) {
144
144
Braccio.positions (idx);
145
145
idx += 6 ;
146
146
}
0 commit comments