Skip to content

Commit db8e7f7

Browse files
committed
Rename button/state LEARN to RECORD.
1 parent c01de01 commit db8e7f7

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
@@ -6,7 +6,7 @@
66
#define COLOR_ORANGE 0xE47128
77

88
enum states {
9-
LEARN,
9+
RECORD,
1010
REPLAY,
1111
ZERO_POSITION
1212
};
@@ -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", "REPLAY", "\n", "ZERO_POSITION", "\n", "\0" };
24+
static const char * btnm_map[] = { "RECORD", "\n", "REPLAY", "\n", "ZERO_POSITION", "\n", "\0" };
2525

2626

2727
static void eventHandlerMenu(lv_event_t * e) {
@@ -37,31 +37,31 @@ static void eventHandlerMenu(lv_event_t * e) {
3737
uint32_t id = lv_btnmatrix_get_selected_btn(obj);
3838
const char * txt = lv_btnmatrix_get_btn_text(obj, id);
3939

40-
if (state == LEARN) {
40+
if (state == RECORD) {
4141
final_idx = idx;
4242
}
4343

4444
idx = values;
4545

4646
switch (id) {
4747
case 0: // if the button pressed is the first one
48-
if (txt == "LEARN") {
49-
state = LEARN;
48+
if (txt == "RECORD") {
49+
state = RECORD;
5050
Braccio.disengage(); // allow the user to freely move the braccio
5151
lv_btnmatrix_set_btn_ctrl(btnm, 0, LV_BTNMATRIX_CTRL_CHECKED);
52-
Serial.println("LEARN");
52+
Serial.println("RECORD");
5353
lv_btnmatrix_clear_btn_ctrl(btnm, 1, LV_BTNMATRIX_CTRL_DISABLED); // remove disabled state of the replay button
5454
btnm_map[0] = "STOP"; // change the label of the first button to "STOP"
5555
}
5656
else if (txt == "STOP") {
5757
state = ZERO_POSITION;
5858
Braccio.engage(); // enable the steppers so that the braccio stands still
5959
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"
6161
}
6262
break;
6363
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"
6565
if (txt == "REPLAY"){
6666
state = REPLAY;
6767
btnm_map[2] = "STOP"; // change the label of the second button to "STOP"
@@ -80,7 +80,7 @@ static void eventHandlerMenu(lv_event_t * e) {
8080

8181
default:
8282
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"
8484
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
8585
Braccio.engage();
8686
delay(500);
@@ -140,7 +140,7 @@ void setup() {
140140
}
141141

142142
void loop() {
143-
if (state == LEARN) {
143+
if (state == RECORD) {
144144
Braccio.positions(idx);
145145
idx += 6;
146146
}

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
@@ -6,7 +6,7 @@
66
#define COLOR_ORANGE 0xE47128
77

88
enum states {
9-
LEARN,
9+
RECORD,
1010
REPLAY,
1111
ZERO_POSITION
1212
};
@@ -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", "REPLAY", "\n", "ZERO_POSITION", "\n", "\0" };
24+
static const char * btnm_map[] = { "RECORD", "\n", "REPLAY", "\n", "ZERO_POSITION", "\n", "\0" };
2525

2626

2727
static void eventHandlerMenu(lv_event_t * e) {
@@ -37,31 +37,31 @@ static void eventHandlerMenu(lv_event_t * e) {
3737
uint32_t id = lv_btnmatrix_get_selected_btn(obj);
3838
const char * txt = lv_btnmatrix_get_btn_text(obj, id);
3939

40-
if (state == LEARN) {
40+
if (state == RECORD) {
4141
final_idx = idx;
4242
}
4343

4444
idx = values;
4545

4646
switch (id) {
4747
case 0: // if the button pressed is the first one
48-
if (txt == "LEARN") {
49-
state = LEARN;
48+
if (txt == "RECORD") {
49+
state = RECORD;
5050
Braccio.disengage(); // allow the user to freely move the braccio
5151
lv_btnmatrix_set_btn_ctrl(btnm, 0, LV_BTNMATRIX_CTRL_CHECKED);
52-
Serial.println("LEARN");
52+
Serial.println("RECORD");
5353
lv_btnmatrix_clear_btn_ctrl(btnm, 1, LV_BTNMATRIX_CTRL_DISABLED); // remove disabled state of the replay button
5454
btnm_map[0] = "STOP"; // change the label of the first button to "STOP"
5555
}
5656
else if (txt == "STOP") {
5757
state = ZERO_POSITION;
5858
Braccio.engage(); // enable the steppers so that the braccio stands still
5959
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"
6161
}
6262
break;
6363
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"
6565
if (txt == "REPLAY"){
6666
state = REPLAY;
6767
btnm_map[2] = "STOP"; // change the label of the second button to "STOP"
@@ -80,7 +80,7 @@ static void eventHandlerMenu(lv_event_t * e) {
8080

8181
default:
8282
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"
8484
btnm_map[2] = "REPLAY"; // reset the label of the first button back to "REPLAY"
8585
Braccio.engage();
8686
delay(500);
@@ -140,7 +140,7 @@ void setup() {
140140
}
141141

142142
void loop() {
143-
if (state == LEARN) {
143+
if (state == RECORD) {
144144
Braccio.positions(idx);
145145
idx += 6;
146146
}

0 commit comments

Comments
 (0)