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