Commit 9a5a2ae2 authored by Philippe Kalaf's avatar Philippe Kalaf

Move to mbed-os 5.10.4 and fix warnings

parent 98adab7b
Pipeline #38843973 failed with stages
in 1 minute and 6 seconds
......@@ -155,6 +155,12 @@ uint8_t brew_params[NUM_BREW_MENUS][3][3]= {
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0} } // stub for steam (no sub menu)
};
#define LEFT static_cast<int>(1 << 0)
#define UP static_cast<int>(1 << 1)
#define RIGHT static_cast<int>(1 << 2)
#define DOWN static_cast<int>(1 << 3)
#define FIRE static_cast<int>(1 << 4)
uint8_t active_menu = 0;
uint8_t menu_level = L_STANDBY;
......@@ -357,15 +363,15 @@ void menu_handler()
{
while(true) {
// wait on joystick action
osEvent event = Thread::signal_wait(0, 500);
if (event.status == osEventTimeout)
uint32_t flags = ThisThread::flags_wait_any_for(LEFT | UP | RIGHT | DOWN | FIRE, 500);
if (flags == osFlagsErrorTimeout)
{
draw_menu();
continue;
}
// fire
if (event.value.signals == 0x05) {
if (flags == FIRE) {
switch (menu_level)
{
case L_STANDBY: break;
......@@ -390,7 +396,7 @@ void menu_handler()
}
}
// left
else if (event.value.signals == 0x01) {
else if (flags == LEFT) {
switch (menu_level)
{
case L_STANDBY: break;
......@@ -417,7 +423,7 @@ void menu_handler()
}
}
// up
else if (event.value.signals == 0x02) {
else if (flags == UP) {
switch (menu_level)
{
case L_STANDBY: menu_level = L_MENU; break;
......@@ -433,7 +439,7 @@ void menu_handler()
}
}
// right
else if (event.value.signals == 0x03) {
else if (flags == RIGHT) {
switch (menu_level)
{
case L_STANDBY: menu_level = L_MENU; break;
......@@ -459,7 +465,7 @@ void menu_handler()
}
}
// down
else if (event.value.signals == 0x04) {
else if (flags == DOWN) {
switch (menu_level)
{
case L_STANDBY: menu_level = L_MENU; break;
......@@ -531,31 +537,31 @@ void cycle_up()
{
check_power_save();
if(check_js_timer())
menu_thread.signal_set(0x02);
menu_thread.flags_set(UP);
}
void cycle_down()
{
check_power_save();
if(check_js_timer())
menu_thread.signal_set(0x04);
menu_thread.flags_set(DOWN);
}
void cycle_left()
{
check_power_save();
if(check_js_timer())
menu_thread.signal_set(0x01);
menu_thread.flags_set(LEFT);
}
void cycle_right()
{
check_power_save();
if(check_js_timer())
menu_thread.signal_set(0x03);
menu_thread.flags_set(RIGHT);
}
void fire_away()
{
check_power_save();
if(check_js_timer())
menu_thread.signal_set(0x05);
menu_thread.flags_set(FIRE);
}
// print the actual contrast
......@@ -690,7 +696,7 @@ int main()
brew_control.get_last_pulse_count_top()
);
#endif
Thread::wait(100); // wait 0.1s
ThisThread::sleep_for(100); // wait 0.1s
// If there has been no keypress for POWER_SAVE_TIMEOUT_S, go to powersaving mode
if (power_save_timer.read() > POWER_SAVE_TIMEOUT_S)
enter_power_save();
......
https://github.com/ARMmbed/mbed-os/
https://github.com/ARMmbed/mbed-os/#2fd0c5cfbd83fce62da6308f9d64c0ab64e1f0d6
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