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) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
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
// no break; fall through
......
......@@ -135,7 +135,8 @@ void compass_main(void *params)
if(xQueueReceive(appQueue, &evt, 50 / portTICK_RATE_MS)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TR)
if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL)
return;
/*if(evt.data.button == BUT_BR) {
......
......@@ -129,7 +129,8 @@ void game_main(void *params)
if(xQueueReceive(appQueue, &evt, 30 / portTICK_RATE_MS)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) {
if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL) {
vibra_disable();
buzzer_disable();
return;
......
......@@ -157,16 +157,17 @@ void gpscoord_main(void *params)
if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) {
case BUTTON_PRESSED:
if (evt.data.button == BUT_TR)
if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL)
return;
else if (evt.data.button == BUT_BR) {
/*
* Toggle between coordinate and
* elevation screens
*/
gpsscreen += 1;
gpsscreen %= 2;
}
// else if (evt.data.button == BUT_BR) {
// /*
// * Toggle between coordinate and
// * elevation screens
// */
// gpsscreen += 1;
// gpsscreen %= 2;
// }
/* fall through */
case GPS_TICK:
......
......@@ -33,49 +33,50 @@
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, 20, 70, "to reset", 0);
gfx_text(&w->dc, &font_helv22b, 10, 50, "Bottom right", 0);
gfx_text(&w->dc, &font_helv22b, 20, 70, "to reset", 0);
}
static struct ui_widget reset_screen = {
reset_redraw,
NULL,
{0, 0, 127, 127},
0,
WF_ACTIVE | WF_VISIBLE
reset_redraw,
NULL,
{0, 0, 127, 127},
0,
WF_ACTIVE | WF_VISIBLE
};
void reset_main(void *params)
{
(void) params; // suppress warnings
struct event evt;
(void) params; // suppress warnings
struct event evt;
/* Init UI */
ui_clear();
ui_init_widget(&reset_screen);
ui_add_widget(&reset_screen);
ui_init_widget(&status_bar);
ui_add_widget(&status_bar);
ui_update(NULL);
/* Init UI */
ui_clear();
ui_init_widget(&reset_screen);
ui_add_widget(&reset_screen);
ui_init_widget(&status_bar);
ui_add_widget(&status_bar);
ui_update(NULL);
while(1) {
if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) {
case BUTTON_PRESSED:
if (evt.data.button == BUT_TR)
return;
/* Reset on bottom right and bottom left buttons
* pressed */
if (evt.data.button == BUT_BR)
SCB->AIRCR = 0x05FA0004;
break;
}
}
while(1) {
if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) {
case BUTTON_PRESSED:
if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL)
return;
/* Reset on bottom right and bottom left buttons
* pressed */
if (evt.data.button == BUT_BR)
SCB->AIRCR = 0x05FA0004;
break;
}
}
}
}
application reset = {
.name = "Reset",
.main = reset_main
.name = "Reset",
.main = reset_main
};
......@@ -93,7 +93,8 @@ void usb_ms_main(void* params) {
if(xQueueReceive(appQueue, &evt, 0)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) {
if (evt.data.button == BUT_TR ||
evt.data.button == BUT_TL) {
if (mutexours) {
mutexours = 0;
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