Skip to content

Commit c01de01

Browse files
committed
Rename button/state REPEAT to REPLAY.
1 parent ff78a9c commit c01de01

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

examples/Braccio_Learn_and_Repeat/Braccio_Learn_and_Repeat.ino

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
enum states {
99
LEARN,
10-
REPEAT, // for consistency is better to name this REPEAT or rename the button label repeat TODO
10+
REPLAY,
1111
ZERO_POSITION
1212
};
1313

@@ -21,7 +21,7 @@ float homePos[6] = {157.5, 157.5, 157.5, 157.5, 157.5, 90.0};
2121
static lv_obj_t * counter;
2222
static lv_obj_t * btnm;
2323

24-
static const char * btnm_map[] = { "LEARN", "\n", "REPEAT", "\n", "ZERO_POSITION", "\n", "\0" };
24+
static const char * btnm_map[] = { "LEARN", "\n", "REPLAY", "\n", "ZERO_POSITION", "\n", "\0" };
2525

2626

2727
static void eventHandlerMenu(lv_event_t * e) {
@@ -62,26 +62,26 @@ static void eventHandlerMenu(lv_event_t * e) {
6262
break;
6363
case 1:
6464
btnm_map[0] = "LEARN"; // reset the label of the first button back to "LEARN"
65-
if (txt == "REPEAT"){
66-
state = REPEAT;
65+
if (txt == "REPLAY"){
66+
state = REPLAY;
6767
btnm_map[2] = "STOP"; // change the label of the second button to "STOP"
6868
Braccio.engage();
6969
lv_btnmatrix_set_btn_ctrl(btnm, 1, LV_BTNMATRIX_CTRL_CHECKED);
70-
Serial.println("REPEAT");
70+
Serial.println("REPLAY");
7171
}
7272
else if (txt=="STOP"){
7373
state = ZERO_POSITION;
7474
Braccio.engage(); // enable the steppers so that the braccio stands still
7575
lv_btnmatrix_set_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_CHECKED);
76-
btnm_map[2] = "REPEAT"; // reset the label of the first button back to "REPEAT"
76+
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
7777
}
7878

7979
break;
8080

8181
default:
8282
state = ZERO_POSITION;
8383
btnm_map[0] = "LEARN"; // reset the label of the first button back to "LEARN"
84-
btnm_map[2] = "REPEAT"; // reset the label of the first button back to "REPEAT"
84+
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
8585
Braccio.engage();
8686
delay(500);
8787
Braccio.moveTo(homePos[0], homePos[1], homePos[2], homePos[3], homePos[4], homePos[5]);
@@ -144,13 +144,13 @@ void loop() {
144144
Braccio.positions(idx);
145145
idx += 6;
146146
}
147-
if (state == REPEAT) {
147+
if (state == REPLAY) {
148148
Braccio.moveTo(idx[0], idx[1], idx[2], idx[3], idx[4], idx[5]);
149149
idx += 6;
150150
if (idx >= final_idx) {
151-
Serial.println("Repeat done");
151+
Serial.println("REPLAY done");
152152
state = ZERO_POSITION;
153-
btnm_map[2] = "REPEAT"; // reset the label of the first button back to "REPEAT"
153+
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
154154
lv_btnmatrix_set_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_CHECKED);
155155
}
156156
}

examples/Platform_Tutorials/projects/p03-learning-mode/01_Braccio_learning_mode/01_Braccio_learning_mode.ino

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
enum states {
99
LEARN,
10-
REPEAT, // for consistency is better to name this REPEAT or rename the button label repeat TODO
10+
REPLAY,
1111
ZERO_POSITION
1212
};
1313

@@ -21,7 +21,7 @@ float homePos[6] = {157.5, 157.5, 157.5, 157.5, 157.5, 90.0};
2121
static lv_obj_t * counter;
2222
static lv_obj_t * btnm;
2323

24-
static const char * btnm_map[] = { "LEARN", "\n", "REPEAT", "\n", "ZERO_POSITION", "\n", "\0" };
24+
static const char * btnm_map[] = { "LEARN", "\n", "REPLAY", "\n", "ZERO_POSITION", "\n", "\0" };
2525

2626

2727
static void eventHandlerMenu(lv_event_t * e) {
@@ -62,26 +62,26 @@ static void eventHandlerMenu(lv_event_t * e) {
6262
break;
6363
case 1:
6464
btnm_map[0] = "LEARN"; // reset the label of the first button back to "LEARN"
65-
if (txt == "REPEAT"){
66-
state = REPEAT;
65+
if (txt == "REPLAY"){
66+
state = REPLAY;
6767
btnm_map[2] = "STOP"; // change the label of the second button to "STOP"
6868
Braccio.engage();
6969
lv_btnmatrix_set_btn_ctrl(btnm, 1, LV_BTNMATRIX_CTRL_CHECKED);
70-
Serial.println("REPEAT");
70+
Serial.println("REPLAY");
7171
}
7272
else if (txt=="STOP"){
7373
state = ZERO_POSITION;
7474
Braccio.engage(); // enable the steppers so that the braccio stands still
7575
lv_btnmatrix_set_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_CHECKED);
76-
btnm_map[2] = "REPEAT"; // reset the label of the first button back to "REPEAT"
76+
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
7777
}
7878

7979
break;
8080

8181
default:
8282
state = ZERO_POSITION;
8383
btnm_map[0] = "LEARN"; // reset the label of the first button back to "LEARN"
84-
btnm_map[2] = "REPEAT"; // reset the label of the first button back to "REPEAT"
84+
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
8585
Braccio.engage();
8686
delay(500);
8787
Braccio.moveTo(homePos[0], homePos[1], homePos[2], homePos[3], homePos[4], homePos[5]);
@@ -144,13 +144,13 @@ void loop() {
144144
Braccio.positions(idx);
145145
idx += 6;
146146
}
147-
if (state == REPEAT) {
147+
if (state == REPLAY) {
148148
Braccio.moveTo(idx[0], idx[1], idx[2], idx[3], idx[4], idx[5]);
149149
idx += 6;
150150
if (idx >= final_idx) {
151-
Serial.println("Repeat done");
151+
Serial.println("REPLAY done");
152152
state = ZERO_POSITION;
153-
btnm_map[2] = "REPEAT"; // reset the label of the first button back to "REPEAT"
153+
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
154154
lv_btnmatrix_set_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_CHECKED);
155155
}
156156
}

0 commit comments

Comments
 (0)