From 3485449e005561a3fa6f00316a2c8664aeaf6dfb Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 19 Mar 2023 23:22:08 +0100 Subject: [PATCH] avr: moved code outside of ifdef/endif pair (fixes a bug). --- avr/main.asm | 70 ++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/avr/main.asm b/avr/main.asm index b9e6a96..bf47593 100644 --- a/avr/main.asm +++ b/avr/main.asm @@ -140,6 +140,41 @@ runModulesUntilIdle_ComEnd: +; --------------------------------------------------------------------------- +; initialWait +; +; Initial wait to desync nodes. +; +; This routine waits for between 10 to 2560 milliseconds (derived from UID) +; +; IN: +; - nothing +; OUT: +; - nothing +; USED: r16, r17, r18, r19, r20, r21, r22, X + +initialWait: + ; setup initial wait loop + rcall Utils_ReadUid ; (R16, X) + clr r16 + eor r16, r18 + eor r16, r19 + eor r16, r20 + eor r16, r21 + +initialWait_l1: ; wait R16 x 10 milliseconds + ldi r17, 200 +initialWait_l2: ; wait for 10ms + Utils_WaitNanoSecs 50000, 0, r22 ; wait for 50 microseconds + dec r17 + brne initialWait_l2 + dec r16 + brne initialWait_l1 + ret + + + + #ifdef MODULES_LCD printSendStats: @@ -275,41 +310,6 @@ sendValueMsg_done: ret - -; --------------------------------------------------------------------------- -; initialWait -; -; Initial wait to desync nodes. -; -; This routine waits for between 10 to 2560 milliseconds (derived from UID) -; -; IN: -; - nothing -; OUT: -; - nothing -; USED: r16, r17, r18, r19, r20, r21, r22, X - -initialWait: - ; setup initial wait loop - rcall Utils_ReadUid ; (R16, X) - clr r16 - eor r16, r18 - eor r16, r19 - eor r16, r20 - eor r16, r21 - -initialWait_l1: ; wait R16 x 10 milliseconds - ldi r17, 200 -initialWait_l2: ; wait for 10ms - Utils_WaitNanoSecs 50000, 0, r22 ; wait for 50 microseconds - dec r17 - brne initialWait_l2 - dec r16 - brne initialWait_l1 - ret - - - textStatsPacketsIn: .db "In : ", 0 textStatsPacketsRecvErr: .db "RecvErr: ", 0 textStatsPacketsOut: .db "Out : ", 0