menu: avoid starving other processes in menu_handle()
[bertos.git] / bertos / gui / menu.c
index 49f056c95eacb2ac2313b1ca100668dcd3dbf051..432927895e28e03f63bf4243259378877cb50969 100644 (file)
@@ -49,6 +49,8 @@
 #include <gfx/font.h>
 #include <gfx/text.h>
 
+#include <cpu/power.h>
+
 #include <drv/kbd.h>
 
 #include <string.h> /* strcpy() */
@@ -464,6 +466,7 @@ iptr_t menu_handle(const struct Menu *menu)
 
                #if CONFIG_MENU_SMOOTH || (CONFIG_MENU_TIMEOUT != 0)
                        key = kbd_peek();
+                       cpu_relax();
                #else
                        key = kbd_get();
                #endif
@@ -532,9 +535,7 @@ iptr_t menu_handle(const struct Menu *menu)
 
        /* Store currently selected item before leaving. */
        if (menu->flags & MF_SAVESEL)
-               #if (ARCH & ARCH_NIGHTTEST)
-                       #warning __FILTER_NEXT_WARNING__
-               #endif
+               #warning __FILTER_NEXT_WARNING__
                CONST_CAST(struct Menu *, menu)->selected = selected;
 
        return result;