From 9c40d8b9b331289e15dd3af70ab518635004a492 Mon Sep 17 00:00:00 2001 From: bsongis Date: Thu, 8 Dec 2011 19:02:38 +0000 Subject: [PATCH] Minor changes to avoid infinite loops inside companion9x --- src/gruvin9x.cpp | 17 +++++++++++++++-- src/simpgmspace.cpp | 21 ++++++++++++--------- src/simpgmspace.h | 7 ++++++- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/gruvin9x.cpp b/src/gruvin9x.cpp index b6f8acef2..d1ca7bdd9 100644 --- a/src/gruvin9x.cpp +++ b/src/gruvin9x.cpp @@ -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