Minor changes to avoid infinite loops inside companion9x

This commit is contained in:
bsongis
2011-12-08 19:02:38 +00:00
parent aefc409173
commit 9c40d8b9b3
3 changed files with 33 additions and 12 deletions
+15 -2
View File
@@ -480,7 +480,11 @@ inline uint8_t keyDown()
void clearKeyEvents()
{
while(keyDown()); // loop until all keys are up
#ifdef SIMU
while (keyDown() && main_thread_running);
#else
while (keyDown()); // loop until all keys are up
#endif
putEvent(0);
}
@@ -512,7 +516,9 @@ void doSplash()
uint16_t tgtime = get_tmr10ms() + SPLASH_TIMEOUT; //2sec splash screen
while(tgtime != get_tmr10ms())
{
#ifndef SIMU
#ifdef SIMU
if (!main_thread_running) return;
#else
getADC_filt();
#endif
uint16_t tsum = 0;
@@ -606,6 +612,10 @@ void checkSwitches()
//loop until all switches are reset
while (1)
{
#ifdef SIMU
if (!main_thread_running) return;
#endif
uint8_t i;
for(i=SW_BASE; i<SW_Trainer; i++)
{
@@ -645,6 +655,9 @@ void alert(const prog_char * s, bool defaults)
clearKeyEvents();
while(1)
{
#ifdef SIMU
if (!main_thread_running) return;
#endif
if(keyDown()) return; //wait for key release
if(getSwitch(g_eeGeneral.lightSw,0) || g_eeGeneral.lightAutoOff || defaults)