Skip to content

Commit a801ac3

Browse files
committed
Move button enable code within the application.
1 parent e4b1be0 commit a801ac3

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

examples/Braccio_Learn_and_Repeat/AppState.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ static void event_handler_menu(lv_event_t * e)
6262
}
6363
}
6464

65-
6665
void custom_main_menu()
6766
{
6867
Braccio.lvgl_lock();
@@ -251,3 +250,14 @@ void ZeroState::onExit()
251250
{
252251
lv_btnmatrix_clear_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_CHECKED);
253252
}
253+
254+
/**************************************************************************************
255+
* LearnAndRepeatApp
256+
**************************************************************************************/
257+
258+
void LearnAndRepeatApp::enableButtons()
259+
{
260+
/* Enable buttons once init is complete. */
261+
lv_btnmatrix_clear_btn_ctrl(btnm, 0, LV_BTNMATRIX_CTRL_DISABLED);
262+
lv_btnmatrix_clear_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_DISABLED);
263+
}

examples/Braccio_Learn_and_Repeat/AppState.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class LearnAndRepeatApp
125125
static ReplayState _replay_state;
126126
static ZeroState _zero_state;
127127

128+
void enableButtons();
129+
128130
void update(EventSource const evt_src)
129131
{
130132
mbed::ScopedLock<rtos::Mutex> lock(_mtx);

examples/Braccio_Learn_and_Repeat/Braccio_Learn_and_Repeat.ino

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* GLOBAL VARIABLES
1111
**************************************************************************************/
1212

13-
extern lv_obj_t * btnm;
1413
LearnAndRepeatApp app;
1514

1615
/**************************************************************************************
@@ -19,11 +18,9 @@ LearnAndRepeatApp app;
1918

2019
void setup()
2120
{
22-
Braccio.begin(custom_main_menu);
23-
24-
/* Enable buttons once init is complete. */
25-
lv_btnmatrix_clear_btn_ctrl(btnm, 0, LV_BTNMATRIX_CTRL_DISABLED);
26-
lv_btnmatrix_clear_btn_ctrl(btnm, 2, LV_BTNMATRIX_CTRL_DISABLED);
21+
if (Braccio.begin(custom_main_menu)) {
22+
app.enableButtons();
23+
}
2724
}
2825

2926
void loop()

0 commit comments

Comments
 (0)