@@ -132,19 +132,20 @@ ESOS_CHILD_TASK(menu) {
132
132
133
133
ESOS_USER_TASK (loop ) {
134
134
static uint16_t u16_data ;
135
- static ESOS_TASK_HANDLE th_child ; //declare storage for handle to child task
136
- ESOS_TASK_BEGIN ();{
137
- for (;;) { //same as while(true)
135
+ static ESOS_TASK_HANDLE th_child_bar_graph ; //declare storage for handle to child task
136
+ static ESOS_TASK_HANDLE th_child_menu
137
+ ESOS_TASK_BEGIN ();
138
+ for (;;) { //same as while(true)
138
139
139
140
ESOS_TASK_WAIT_UNTIL (esos_uiF14_isSW1Pressed () || esos_uiF14_isSW2Pressed ()); //on either switch, start the DO loop
140
- if (esos_uiF14_isSW2Pressed ()){
141
- b_keepLooping = TRUE; //if sw2 then keep looping; checked at the bottom while statement
142
- }
143
- else {b_keepLooping = FALSE; //if sw1 don't keep looping just do once
144
- }
141
+ if (esos_uiF14_isSW2Pressed ()){
142
+ b_keepLooping = TRUE; //if sw2 then keep looping; checked at the bottom while statement
143
+ }
144
+ else {b_keepLooping = FALSE; //if sw1 don't keep looping just do once
145
+ }
145
146
ESOS_TASK_WAIT_UNTIL (esos_uiF14_isSW1Released () && esos_uiF14_isSW2Released ()); /*wait for the release so
146
- sw1 can exit the loop when pressed again. The loop is fast enough to go around and sense sw1 still pressed
147
- and begin again*/
147
+ sw1 can exit the loop when pressed again. The loop is fast enough to go around and sense sw1 still pressed
148
+ and begin again*/
148
149
do { //claim the ADC, setup for CH2(potentiometer) and 3V3 for upper Vref
149
150
ESOS_TASK_WAIT_ON_AVAILABLE_SENSOR (ESOS_SENSOR_CH02 , ESOS_SENSOR_VREF_3V3 );
150
151
@@ -156,8 +157,8 @@ ESOS_USER_TASK(loop) {
156
157
157
158
ESOS_TASK_WAIT_ON_SEND_UINT16_AS_HEX_STRING (u16_data ); //extra zeros but acceptable
158
159
159
- ESOS_ALLOCATE_CHILD_TASK (th_child );
160
- ESOS_TASK_SPAWN_AND_WAIT (th_child , barGraph_child , u16_data );
160
+ ESOS_ALLOCATE_CHILD_TASK (th_child_bar_graph );
161
+ ESOS_TASK_SPAWN_AND_WAIT (th_child_bar_graph , barGraph_child , u16_data );
161
162
162
163
ESOS_TASK_WAIT_ON_SEND_STRING ("\n" );
163
164
ESOS_TASK_WAIT_ON_SEND_STRING (buffer ); //wait for data in buffer to be sent and release UART
@@ -172,19 +173,18 @@ ESOS_USER_TASK(loop) {
172
173
ESOS_TASK_WAIT_UNTIL (esos_uiF14_isSW2Released ());
173
174
b_keepLooping = FALSE;
174
175
}
175
-
176
176
if (esos_uiF14_isSW3Pressed ()){ //sw1 will stop the sw2 initiated continous looping
177
177
ESOS_TASK_WAIT_UNTIL (esos_uiF14_isSW3Released ());
178
178
b_keepLooping = FALSE;
179
- ESOS_TASK_SPAWN_AND_WAIT (th_child , menu );
179
+ ESOS_ALLOCATE_CHILD_TASK (th_child_menu );
180
+ ESOS_TASK_SPAWN_AND_WAIT (th_child_menu , menu );
180
181
}
181
182
ESOS_TASK_WAIT_TICKS (LOOP_DELAY /2 ); //the other half of the loop sw2 sensor reading delay
182
183
}while (b_keepLooping ); //keep doing the DO loop if sw2 initiated it
183
-
184
+
184
185
//Release the potentiometer
185
186
ESOS_SENSOR_CLOSE ();
186
- }
187
- }
187
+ }
188
188
ESOS_TASK_END ();
189
189
}
190
190
0 commit comments