Skip to content

Commit 23f23da

Browse files
committed
Finish menu
1 parent 798730b commit 23f23da

File tree

3 files changed

+57
-34
lines changed

3 files changed

+57
-34
lines changed

BUILD_DIR/test.c

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ ESOS_USER_TASK(menu) {
118118
ESOS_TASK_BEGIN();
119119

120120
for (;;) {
121-
ledflashing:
121+
switchconfig:
122122

123123
ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM();
124-
ESOS_TASK_WAIT_ON_SEND_STRING("Pick LED 2 flash period \n");
125-
ESOS_TASK_WAIT_ON_SEND_STRING("1 -> 500 ms \n");
126-
ESOS_TASK_WAIT_ON_SEND_STRING("2 -> 1000 ms \n");
127-
ESOS_TASK_WAIT_ON_SEND_STRING("3 -> 3000 ms \n");
128-
ESOS_TASK_WAIT_ON_SEND_STRING("9 -> Configure switches \n");
124+
ESOS_TASK_WAIT_ON_SEND_STRING("\n\nPick switch double press limit \n");
125+
ESOS_TASK_WAIT_ON_SEND_STRING("1 -> 250 ms \n");
126+
ESOS_TASK_WAIT_ON_SEND_STRING("2 -> 400 ms \n");
127+
ESOS_TASK_WAIT_ON_SEND_STRING("3 -> 600 ms \n");
128+
ESOS_TASK_WAIT_ON_SEND_STRING("9 -> Configure RPG \n");
129129
ESOS_TASK_WAIT_ON_SEND_STRING("Choice: ");
130130
ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM();
131131

@@ -138,25 +138,28 @@ ESOS_USER_TASK(menu) {
138138
ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM();
139139

140140
if (buffer[0] == '1') {
141-
esos_uiF14_flashLED2(500);
141+
esos_uiF14_setDoublePressPeriod(250);
142142
} else if (buffer[0] == '2') {
143-
esos_uiF14_flashLED2(1000);
143+
esos_uiF14_setDoublePressPeriod(400);
144144
} else if (buffer[0] == '3') {
145-
esos_uiF14_flashLED2(3000);
145+
esos_uiF14_setDoublePressPeriod(600);
146146
} else if (buffer[0] == '9') {
147-
goto switchconfig;
147+
goto rpgconfig;
148148
}
149149

150-
goto ledflashing;
151-
152-
switchconfig:
150+
goto switchconfig;
153151

154-
ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM();
155-
ESOS_TASK_WAIT_ON_SEND_STRING("Pick switch double press limit \n");
156-
ESOS_TASK_WAIT_ON_SEND_STRING("1 -> 250 ms \n");
157-
ESOS_TASK_WAIT_ON_SEND_STRING("2 -> 400 ms \n");
158-
ESOS_TASK_WAIT_ON_SEND_STRING("3 -> 600 ms \n");
159-
ESOS_TASK_WAIT_ON_SEND_STRING("9 -> Configure RPG \n");
152+
rpgconfig:
153+
154+
ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM();
155+
ESOS_TASK_WAIT_ON_SEND_STRING("\n\nPick RPG timings \n");
156+
ESOS_TASK_WAIT_ON_SEND_STRING("1 -> Slow: 300 \n");
157+
ESOS_TASK_WAIT_ON_SEND_STRING("2 -> SLow: 250 ms \n");
158+
ESOS_TASK_WAIT_ON_SEND_STRING("3 -> Medium: 200 ms \n");
159+
ESOS_TASK_WAIT_ON_SEND_STRING("4 -> Medium: 150 ms \n");
160+
ESOS_TASK_WAIT_ON_SEND_STRING("5 -> Fast: 100 ms \n");
161+
ESOS_TASK_WAIT_ON_SEND_STRING("6 -> Fast: 75 ms \n");
162+
ESOS_TASK_WAIT_ON_SEND_STRING("9 -> Configure Switch \n");
160163
ESOS_TASK_WAIT_ON_SEND_STRING("Choice: ");
161164
ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM();
162165

@@ -168,21 +171,23 @@ ESOS_USER_TASK(menu) {
168171
ESOS_TASK_WAIT_ON_SEND_STRING(buffer);
169172
ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM();
170173

171-
if (buffer[0] == '1') {
172-
//We're not required to have functions which modify the
173-
//double press bound, so just set the value directly
174-
esos_uiF14_setDoublePressPeriod(250);
175-
} else if (buffer[0] == '2') {
176-
esos_uiF14_setDoublePressPeriod(400);
177-
} else if (buffer[0] == '3') {
178-
esos_uiF14_setDoublePressPeriod(600);
179-
} else if (buffer[0] == '9') {
180-
goto switchconfig;
181-
}
182-
183-
goto switchconfig;
174+
switch(buffer[0]) {
175+
case '1': esos_uiF14_setRPGNotMovingToSlowPeriodMs(300);
176+
break;
177+
case '2': esos_uiF14_setRPGNotMovingToSlowPeriodMs(250);
178+
break;
179+
case '3': esos_uiF14_setRPGSlowToMediumPeriodMs(200);
180+
break;
181+
case '4': esos_uiF14_setRPGSlowToMediumPeriodMs(150);
182+
break;
183+
case '5': esos_uiF14_setRPGMediumToFastPeriodMs(100);
184+
break;
185+
case '6': esos_uiF14_setRPGMediumToFastPeriodMs(75);
186+
break;
187+
case '9': goto switchconfig;
188+
}
184189

185-
// rpgconfig:
190+
goto rpgconfig;
186191

187192
}
188193
ESOS_TASK_END();
@@ -192,6 +197,6 @@ void user_init(void){
192197
config_esos_uiF14();
193198
esos_RegisterTask(menu);
194199
esos_RegisterTask(demoLEDsAndSwitches);
195-
esos_RegisterTask(drawDisplay);
200+
// esos_RegisterTask(drawDisplay);
196201

197202
}

esos/include/esos_f14ui.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ inline uint16_t _esos_uiF14_getRPGPeriod (void);
7272

7373
inline void esos_uiF14_setDoublePressPeriod(uint16_t);
7474

75+
inline void esos_uiF14_setRPGNotMovingToSlowPeriodMs(uint16_t);
76+
inline void esos_uiF14_setRPGSlowToMediumPeriodMs(uint16_t);
77+
inline void esos_uiF14_setRPGMediumToFastPeriodMs(uint16_t);
78+
7579
inline BOOL esos_uiF14_isSW1Pressed (void);
7680
inline BOOL esos_uiF14_isSW1Released (void);
7781
inline BOOL esos_uiF14_isSW1DoublePressed (void);

esos/src/esos_f14ui.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,18 @@ inline void esos_uiF14_setDoublePressPeriod(uint16_t limit) {
261261
return;
262262
}
263263

264+
inline void esos_uiF14_setRPGNotMovingToSlowPeriodMs(uint16_t time) {
265+
_st_esos_uiF14Data.u16_RPGNotMovingToSlowPeriodMs = time;
266+
}
267+
268+
inline void esos_uiF14_setRPGSlowToMediumPeriodMs(uint16_t time) {
269+
_st_esos_uiF14Data.u16_RPGSlowToMediumPeriodMs = time;
270+
}
271+
272+
inline void esos_uiF14_setRPGMediumToFastPeriodMs(uint16_t time) {
273+
_st_esos_uiF14Data.u16_RPGMediumToFastPeriodMs = time;
274+
}
275+
264276
// UIF14 task to manage user-interface
265277
ESOS_USER_TASK(__esos_uiF14_task){
266278
static uint16_t LED1_counter = 0;
@@ -287,6 +299,8 @@ ESOS_USER_TASK(__esos_uiF14_task){
287299
ESOS_TASK_BEGIN();
288300
while(TRUE) {
289301

302+
printf("run through\N");
303+
290304
//-------- LED Initial States
291305
// LED1 (Red)
292306
LED1 = _st_esos_uiF14Data.b_LED1On;

0 commit comments

Comments
 (0)