avr: call Motion_Run if enabled.
This commit is contained in:
@@ -219,6 +219,15 @@ runModules_ComEnd:
|
|||||||
rcall Ds18b20_Run
|
rcall Ds18b20_Run
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MODULES_MOTION
|
||||||
|
rcall Motion_Run
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MODULES_MOTION_LIGHT
|
||||||
|
; rcall MotionLight_Run
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULES_TCRT1000
|
#ifdef MODULES_TCRT1000
|
||||||
rcall TCRT1K_Run
|
rcall TCRT1K_Run
|
||||||
|
|||||||
@@ -15,9 +15,10 @@
|
|||||||
.equ MOTION_SEND_2_AFTER = 11 ; send motion message after 1100ms
|
.equ MOTION_SEND_2_AFTER = 11 ; send motion message after 1100ms
|
||||||
.equ MOTION_RESTART_AFTER = 100 ; restart motion report counter after 10s
|
.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_UPCOUNTER_VALUE = 50 ; keep MOTION state active for at least 5s
|
||||||
|
|
||||||
|
.equ MOTION_FLAGS_REPORT_MOTION_BIT = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
.dseg
|
.dseg
|
||||||
|
|
||||||
motionDataBegin:
|
motionDataBegin:
|
||||||
|
motionFlags: .byte 1
|
||||||
motionStateCounter: .byte 1
|
motionStateCounter: .byte 1
|
||||||
motionUpCounter: .byte 1
|
motionUpCounter: .byte 1
|
||||||
motionDataEnd:
|
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
|
; @routine Motion_Every100ms @global
|
||||||
;
|
;
|
||||||
@@ -118,8 +144,10 @@ Motion_Every100ms_handleStateCounter:
|
|||||||
sts motionStateCounter, r17
|
sts motionStateCounter, r17
|
||||||
ret
|
ret
|
||||||
Motion_Every100ms_send:
|
Motion_Every100ms_send:
|
||||||
ldi r18, 1
|
lds r16, motionFlags
|
||||||
rjmp Motion_SendReport
|
ori r16, (1<<MOTION_FLAGS_REPORT_MOTION_BIT)
|
||||||
|
sts motionFlags, r16
|
||||||
|
ret
|
||||||
Motion_Every100ms_end:
|
Motion_Every100ms_end:
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|||||||
Reference in New Issue
Block a user