Commit da2dd42b authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Made all apps return on BUT_TL as well

Also removed second (for now) redundant GPS coordinate app screen
parent 38e0cf16
...@@ -108,7 +108,8 @@ void clock_main(void* params) { ...@@ -108,7 +108,8 @@ void clock_main(void* params) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL)
return; // go back to the main menu return; // go back to the main menu
// no break; fall through // no break; fall through
......
...@@ -135,7 +135,8 @@ void compass_main(void *params) ...@@ -135,7 +135,8 @@ void compass_main(void *params)
if(xQueueReceive(appQueue, &evt, 50 / portTICK_RATE_MS)) { if(xQueueReceive(appQueue, &evt, 50 / portTICK_RATE_MS)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL)
return; return;
/*if(evt.data.button == BUT_BR) { /*if(evt.data.button == BUT_BR) {
......
...@@ -129,7 +129,8 @@ void game_main(void *params) ...@@ -129,7 +129,8 @@ void game_main(void *params)
if(xQueueReceive(appQueue, &evt, 30 / portTICK_RATE_MS)) { if(xQueueReceive(appQueue, &evt, 30 / portTICK_RATE_MS)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) { if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL) {
vibra_disable(); vibra_disable();
buzzer_disable(); buzzer_disable();
return; return;
......
...@@ -157,16 +157,17 @@ void gpscoord_main(void *params) ...@@ -157,16 +157,17 @@ void gpscoord_main(void *params)
if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) { if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) { switch (evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if (evt.data.button == BUT_TR) if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL)
return; return;
else if (evt.data.button == BUT_BR) { // else if (evt.data.button == BUT_BR) {
/* // /*
* Toggle between coordinate and // * Toggle between coordinate and
* elevation screens // * elevation screens
*/ // */
gpsscreen += 1; // gpsscreen += 1;
gpsscreen %= 2; // gpsscreen %= 2;
} // }
/* fall through */ /* fall through */
case GPS_TICK: case GPS_TICK:
......
...@@ -33,49 +33,50 @@ ...@@ -33,49 +33,50 @@
static void reset_redraw(struct ui_widget *w) static void reset_redraw(struct ui_widget *w)
{ {
gfx_text(&w->dc, &font_helv22b, 10, 50, "Bottom right", 0); gfx_text(&w->dc, &font_helv22b, 10, 50, "Bottom right", 0);
gfx_text(&w->dc, &font_helv22b, 20, 70, "to reset", 0); gfx_text(&w->dc, &font_helv22b, 20, 70, "to reset", 0);
} }
static struct ui_widget reset_screen = { static struct ui_widget reset_screen = {
reset_redraw, reset_redraw,
NULL, NULL,
{0, 0, 127, 127}, {0, 0, 127, 127},
0, 0,
WF_ACTIVE | WF_VISIBLE WF_ACTIVE | WF_VISIBLE
}; };
void reset_main(void *params) void reset_main(void *params)
{ {
(void) params; // suppress warnings (void) params; // suppress warnings
struct event evt; struct event evt;
/* Init UI */ /* Init UI */
ui_clear(); ui_clear();
ui_init_widget(&reset_screen); ui_init_widget(&reset_screen);
ui_add_widget(&reset_screen); ui_add_widget(&reset_screen);
ui_init_widget(&status_bar); ui_init_widget(&status_bar);
ui_add_widget(&status_bar); ui_add_widget(&status_bar);
ui_update(NULL); ui_update(NULL);
while(1) { while(1) {
if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) { if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) { switch (evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if (evt.data.button == BUT_TR) if (evt.data.button == BUT_TR ||
return; evt.data.button == BUT_TL)
/* Reset on bottom right and bottom left buttons return;
* pressed */ /* Reset on bottom right and bottom left buttons
if (evt.data.button == BUT_BR) * pressed */
SCB->AIRCR = 0x05FA0004; if (evt.data.button == BUT_BR)
break; SCB->AIRCR = 0x05FA0004;
} break;
} }
} }
}
} }
application reset = { application reset = {
.name = "Reset", .name = "Reset",
.main = reset_main .main = reset_main
}; };
...@@ -93,7 +93,8 @@ void usb_ms_main(void* params) { ...@@ -93,7 +93,8 @@ void usb_ms_main(void* params) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, 0)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) { if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL) {
if (mutexours) { if (mutexours) {
mutexours = 0; mutexours = 0;
USBD_Stop(); USBD_Stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment