diff --git a/avr/devices/all/main.asm b/avr/devices/all/main.asm index a2c94e1..3d29c32 100644 --- a/avr/devices/all/main.asm +++ b/avr/devices/all/main.asm @@ -57,7 +57,9 @@ main_loop: bigcall systemSleep ; system-dependant ; run loop as long as some run function returns with CFLAG set + clr r17 main_runLoop: + push r17 clr r16 push r16 bigcall runModules @@ -72,10 +74,16 @@ main_runLoop: push r16 bigcall onEveryLoop ; call into main app pop r16 + pop r17 + + tst r16 + breq main_endRunLoop + inc r17 + cpi r17, 2 + brcc main_endRunLoop + brne main_runLoop +main_endRunLoop: - tst r16 - brne main_runLoop - #ifdef MODULES_NETWORK #ifndef MAIN_WITHOUT_MSG_HANDLING rcall mainHandleMessages