1
Developers Corner / play menu timeout
« on: 23.03.2007 at 19:33:57 »
Hi MIS,
I changed a few lines in main.c to achieve the following goals considering the menu timeout:
There is one small handling problem with deactivating the timeout and the backlight timeout: if you are still in "select mode", UP/DOWN while the display light is off will still scroll through the icon menu instead of executing a function.
Maybe you can update the SVN with this code.
Kay.
I changed a few lines in main.c to achieve the following goals considering the menu timeout:
- simplify changing the timeout value
- offer possibility to deactivate the timeout completely
There is one small handling problem with deactivating the timeout and the backlight timeout: if you are still in "select mode", UP/DOWN while the display light is off will still scroll through the icon menu instead of executing a function.
Maybe you can update the SVN with this code.
Kay.
Code: [Select]
--- main.c (revision 179)
+++ main.c (working copy)
@@ -118,7 +118,8 @@
uint8_t mnu_scroll_in_progress = 0; // for menu scrolling
uint32_t mnu_speed; // speed of menu scrolling;
uint32_t last_time; // helper for menu scrolling speed
-uint8_t mnu_tout = 20; // select menu timeout (10 sec). After this time menu switch to volume settings
+#define MNU_TOUT 20 // select menu timeout (10 sec). After this time menu switch to volume settings. -1 will deactivate timeout
+uint8_t mnu_timer = MNU_TOUT; // the timer counting down from MNU_TOUT
playstate_t playstate = {0}; //!< Actual status of playing file
@@ -416,7 +417,7 @@
mnu_speed = 8;
break;
}
- mnu_tout = 20;
+ mnu_timer = MNU_TOUT;
}
/** \fn int get_playmenu(void)
@@ -1144,10 +1145,10 @@
insearch = 0;
volume_adjust(0); // update volume sign
}
- if(mnu_tout)
+ if(mnu_timer>=0)
{
- mnu_tout--;
- if(mnu_tout == 0)
+ mnu_timer--;
+ if(mnu_timer == 0)
{
mnuent = 1;
mnuofs = 0;
@@ -1165,7 +1166,7 @@
mnu_scroll(1);
else
{
- mnu_tout = 20;
+ mnu_timer = MNU_TOUT;
switch(get_playmenu())
{
default: break;
@@ -1196,7 +1197,7 @@
mnu_scroll(2);
else
{
- mnu_tout = 20;
+ mnu_timer = MNU_TOUT;
switch(get_playmenu())
{
default: break;
@@ -1221,7 +1222,7 @@
mnu_scroll(-1);
else
{
- mnu_tout = 20;
+ mnu_timer = MNU_TOUT;
switch(get_playmenu())
{
default: break;
@@ -1253,7 +1254,7 @@
mnu_scroll(-2);
else
{
- mnu_tout = 20;
+ mnu_timer = MNU_TOUT;
switch(get_playmenu())
{
default: break;
@@ -1274,7 +1275,7 @@
break;
case EV_PRESS:
- mnu_tout = 20;
+ mnu_timer = MNU_TOUT;
mnuent = !mnuent;
disp_mnuicon(mnuofs);
if(mnuent)
@@ -1292,7 +1293,7 @@
if(ev != EV_PLAYING_STARTED && ev != EV_LONGPRESS)
playinfo();
set_event(ev);
- mnu_tout = 20;
+ mnu_timer = MNU_TOUT;
mnuent = 1;
break;
case MNU_VOLUME: