From 535a695c5028f2fc9ffbc085c1da9be152041e1e Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sat, 12 Jul 2025 20:16:34 +0200 Subject: [PATCH] limit number of loops inside main_runLoop. --- avr/devices/all/main.asm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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