Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | #include "menu.h" |
2 | |||
3 | bool Menu::OnInitialState() |
||
4 | { |
||
5 | menuItems[itemSelected].screenItem->Highlight(true); |
||
6 | Screen::Set(screenId); |
||
7 | return true; |
||
8 | }; |
||
9 | |||
10 | bool Menu::OnEncoderChanged(int8_t value) |
||
11 | { |
||
12 | menuItems[itemSelected].screenItem->Highlight(false); |
||
13 | |||
14 | int8_t new_val = (int8_t)itemSelected + value; |
||
15 | |||
16 | if (new_val < 0) |
||
17 | itemSelected = 0; |
||
18 | else if (new_val >= numItems) |
||
19 | itemSelected = numItems - 1; |
||
20 | else |
||
21 | itemSelected = (uint8_t)new_val; |
||
22 | |||
23 | menuItems[itemSelected].screenItem->Highlight(true); |
||
24 | |||
25 | return true; |
||
26 | }; |
||
27 | |||
28 | bool Menu::OnEncButtonDown() |
||
29 | { |
||
30 | if (menuItems[itemSelected].ptrFunction) |
||
31 | (menuItems[itemSelected].ptrFunction)(); |
||
32 | }; |
||
33 | |||
34 | bool Menu::OnExtButtonDown() |
||
35 | { |
||
36 | if (returnState) |
||
37 | StateMachine::SetState(returnState); |
||
38 | }; |
||
39 |