avr: call Motion_Run if enabled.

This commit is contained in:
Martin Preuss
2024-12-17 20:53:37 +01:00
parent a435b995a8
commit a7adf15bf6
2 changed files with 40 additions and 3 deletions

View File

@@ -219,6 +219,15 @@ runModules_ComEnd:
rcall Ds18b20_Run
#endif
#ifdef MODULES_MOTION
rcall Motion_Run
#endif
#ifdef MODULES_MOTION_LIGHT
; rcall MotionLight_Run
#endif
#ifdef MODULES_TCRT1000
rcall TCRT1K_Run

View File

@@ -15,9 +15,10 @@
.equ MOTION_SEND_2_AFTER = 11 ; send motion message after 1100ms
.equ MOTION_RESTART_AFTER = 100 ; restart motion report counter after 10s
.equ MOTION_UPCOUNTER_VALUE = 50 ; keep MOTION state active for at least 5s
.equ MOTION_FLAGS_REPORT_MOTION_BIT = 0
; ***************************************************************************
@@ -26,6 +27,7 @@
.dseg
motionDataBegin:
motionFlags: .byte 1
motionStateCounter: .byte 1
motionUpCounter: .byte 1
motionDataEnd:
@@ -76,6 +78,30 @@ Motion_Fini:
; ---------------------------------------------------------------------------
; @routine Motion_Run @global
;
; @clobbers none
Motion_Run:
lds r16, motionFlags
andi r16, (1<<MOTION_FLAGS_REPORT_MOTION_BIT)
breq Motion_Run_retnc
ldi r18, 1
rcall Motion_SendReport
brcc Motion_Run_retnc
lds r16, motionFlags
andi r16, ~(1<<MOTION_FLAGS_REPORT_MOTION_BIT)
sts motionFlags, r16
sec
ret
Motion_Run_retnc:
clc
ret
; @end
; ---------------------------------------------------------------------------
; @routine Motion_Every100ms @global
;
@@ -118,8 +144,10 @@ Motion_Every100ms_handleStateCounter:
sts motionStateCounter, r17
ret
Motion_Every100ms_send:
ldi r18, 1
rjmp Motion_SendReport
lds r16, motionFlags
ori r16, (1<<MOTION_FLAGS_REPORT_MOTION_BIT)
sts motionFlags, r16
ret
Motion_Every100ms_end:
ret
; @end