From a435b995a8cec6fc6a64f9c73373bcb5dcf528b7 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Tue, 17 Dec 2024 20:53:18 +0100 Subject: [PATCH] avr: beautifications. --- avr/modules/ma_light/main.asm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/avr/modules/ma_light/main.asm b/avr/modules/ma_light/main.asm index fb66b5a..03d0c90 100644 --- a/avr/modules/ma_light/main.asm +++ b/avr/modules/ma_light/main.asm @@ -8,7 +8,10 @@ ; *************************************************************************** -.equ MOTIONLIGHT_DEFAULT_ONTIME = 3000 ; 5min +; *************************************************************************** +; defines + +.equ MOTIONLIGHT_DEFAULT_ONTIME = 3000 ; 5min (in 1/10 secs) .equ MOTIONLIGHT_SOURCE_NUM = 2 @@ -17,6 +20,10 @@ .equ MOTIONLIGHT_SOURCE_SIZE = 2 + +; *************************************************************************** +; data + .dseg @@ -30,6 +37,9 @@ motionLightDataEnd: +; *************************************************************************** +; code + .cseg MOTIONLIGHT_BEGIN: @@ -88,15 +98,12 @@ MotionLight_Fini: MotionLight_Every100ms: lds r24, motionLightTimer lds r25, motionLightTimer+1 - mov r16, r24 - or r16, r25 - brne MotionLight_Every100ms_dec - ret -MotionLight_Every100ms_dec: sbiw r25:r24, 1 + brcs MotionLight_Every100ms_ret sts motionLightTimer, r24 sts motionLightTimer+1, r25 breq MotionLight_Every100ms_off +MotionLight_Every100ms_ret: ret MotionLight_Every100ms_off: rjmp motionLightTurnOff ; (r16, r17, r18, r19, r20, r21, r23)