avr: fixed bug in ma_light
This commit is contained in:
@@ -23,6 +23,7 @@ appMotionLightDataBegin:
|
||||
appMotionLightLSourceValueId: .byte 1
|
||||
appMotionLightLSourceValue: .byte 2
|
||||
appMotionLightLastBrightness: .byte 2
|
||||
appMotionLightFlags: .byte 1
|
||||
appMotionLightDataEnd:
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
.equ APP_MOTIONLIGHT_SOURCE_SIZE = 2
|
||||
|
||||
|
||||
|
||||
.equ APP_MOTIONLIGHT_FLAGS_HAVELIGHT = 0x01
|
||||
|
||||
|
||||
|
||||
@@ -45,12 +45,9 @@ AppMotionLight_OnPacketReceived_turnOn:
|
||||
lds r16, appMotionLightLSourceAddr ; do we have a source for brightness value?
|
||||
tst r16
|
||||
breq AppMotionLight_OnPacketReceived_checkTimer ; no, jmp and don't check brightness
|
||||
lds r16, appMotionLightLastBrightness
|
||||
lds r17, appMotionLightLastBrightness+1
|
||||
tst r16
|
||||
brne AppMotionLight_OnPacketReceived_checkBrightness
|
||||
tst r17
|
||||
breq AppMotionLight_OnPacketReceived_secRet ; we don't have a brightness value, keep light off
|
||||
lds r16, appMotionLightFlags ; check last brightness reported
|
||||
andi r16, APP_MOTIONLIGHT_FLAGS_HAVELIGHT
|
||||
breq AppMotionLight_OnPacketReceived_secRet ; no brightness, yet
|
||||
AppMotionLight_OnPacketReceived_checkBrightness:
|
||||
lds r16, appMotionLightLSourceValue ; check last brightness reported
|
||||
lds r17, appMotionLightLSourceValue+1
|
||||
@@ -77,6 +74,9 @@ AppMotionLight_OnPacketReceived_secRet:
|
||||
AppMotionLight_OnPacketReceived_isBrightness:
|
||||
sts appMotionLightLastBrightness, r18
|
||||
sts appMotionLightLastBrightness+1, r19
|
||||
lds r16, appMotionLightFlags
|
||||
ori r16, APP_MOTIONLIGHT_FLAGS_HAVELIGHT
|
||||
sts appMotionLightFlags, r16
|
||||
sec
|
||||
ret
|
||||
; "set value" message
|
||||
|
||||
Reference in New Issue
Block a user