Skip to content

Commit 770378b

Browse files
committed
Extract code for ZERO_POSITION state into separate function.
1 parent 87ee676 commit 770378b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

examples/Braccio_Learn_and_Repeat/Braccio_Learn_and_Repeat.ino

+13-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ void loop()
188188

189189
if (state == State::ZERO_POSITION)
190190
{
191-
Braccio.engage();
192-
Braccio.moveTo(homePos[0], homePos[1], homePos[2], homePos[3], homePos[4], homePos[5]);
191+
state = handle_ZERO_POSITION();
193192
}
194193
}
195194
}
@@ -208,8 +207,12 @@ State handle_RECORD()
208207
Braccio.lvgl_lock();
209208
btnm_map[0] = "RECORD";
210209
lv_btnmatrix_set_btn_ctrl(btnm, 0, LV_BTNMATRIX_CTRL_CHECKABLE);
210+
lv_label_set_text_fmt(counter, "Counter: %d" , 0);
211211
Braccio.lvgl_unlock();
212212

213+
Braccio.engage();
214+
Braccio.moveTo(homePos[0], homePos[1], homePos[2], homePos[3], homePos[4], homePos[5]);
215+
213216
return State::ZERO_POSITION;
214217
}
215218

@@ -232,8 +235,11 @@ State handle_REPLAY()
232235
Braccio.lvgl_lock();
233236
btnm_map[2] = "REPLAY";
234237
lv_btnmatrix_set_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_CHECKED);
238+
lv_label_set_text_fmt(counter, "Counter: %d" , 0);
235239
Braccio.lvgl_unlock();
236240

241+
Braccio.moveTo(homePos[0], homePos[1], homePos[2], homePos[3], homePos[4], homePos[5]);
242+
237243
return State::ZERO_POSITION;
238244
}
239245

@@ -246,3 +252,8 @@ State handle_REPLAY()
246252

247253
return State::REPLAY;
248254
}
255+
256+
State handle_ZERO_POSITION()
257+
{
258+
return State::ZERO_POSITION;
259+
}

0 commit comments

Comments
 (0)