avr: optimized app MA_LIGHT (from 3295 to 3222 words).
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
; copyright : (C) 2025 by Martin Preuss
|
; copyright : (C) 2026 by Martin Preuss
|
||||||
; email : martin@libchipcard.de
|
; email : martin@libchipcard.de
|
||||||
;
|
;
|
||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
@@ -16,10 +16,12 @@
|
|||||||
|
|
||||||
|
|
||||||
appMotionLightDataBegin:
|
appMotionLightDataBegin:
|
||||||
appMotionLightSources: .byte APP_MOTIONLIGHT_SOURCE_NUM*APP_MOTIONLIGHT_SOURCE_SIZE
|
appMotionLightSettings:
|
||||||
appMotionLightLSourceAddr: .byte 1
|
appMotionLightOnTime: .byte 2
|
||||||
appMotionLightLSourceValueId: .byte 1
|
appMotionLightMSources: .byte APP_MOTIONLIGHT_SOURCE_NUM*APP_MOTIONLIGHT_SOURCE_SIZE
|
||||||
|
appMotionLightLSource: .byte APP_MOTIONLIGHT_SOURCE_SIZE
|
||||||
appMotionLightLSourceValue: .byte 2
|
appMotionLightLSourceValue: .byte 2
|
||||||
|
|
||||||
appMotionLightLastBrightness: .byte 2
|
appMotionLightLastBrightness: .byte 2
|
||||||
appMotionLightFlags: .byte 1
|
appMotionLightFlags: .byte 1
|
||||||
appMotionLightDataEnd:
|
appMotionLightDataEnd:
|
||||||
|
|||||||
@@ -23,3 +23,17 @@
|
|||||||
.equ APP_MOTIONLIGHT_FLAGS_HAVELIGHT = 0x01
|
.equ APP_MOTIONLIGHT_FLAGS_HAVELIGHT = 0x01
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_ONTIME_LO = 0
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_ONTIME_HI = 1
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_MSRC1_ADDR = 2
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_MSRC1_VALUEID = 3
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_MSRC2_ADDR = 4
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_MSRC2_VALUEID = 5
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_BSRC1_ADDR = 6
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_BSRC1_VALUEID = 7
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_BLIMIT_LO = 8
|
||||||
|
.equ APP_MOTIONLIGHT_EE_OFFS_BLIMIT_HI = 9
|
||||||
|
.equ APP_MOTIONLIGHT_EE_SIZE = 10
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ AppMotionLight_Init:
|
|||||||
ldi r17, (appMotionLightDataEnd-appMotionLightDataBegin)
|
ldi r17, (appMotionLightDataEnd-appMotionLightDataBegin)
|
||||||
rcall Utils_FillSram
|
rcall Utils_FillSram
|
||||||
|
|
||||||
rcall appMotionLightReadConfFromEeprom
|
rcall appMotionLightReadConfFromEeprom ; (r16, r17, X, Y)
|
||||||
|
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
@@ -53,23 +53,17 @@ AppMotionLight_Fini:
|
|||||||
; @clobbers r16, r24, Y
|
; @clobbers r16, r24, Y
|
||||||
|
|
||||||
appMotionLightHasSource:
|
appMotionLightHasSource:
|
||||||
ldi yl, LOW(appMotionLightSources)
|
ldi yl, LOW(appMotionLightMSources)
|
||||||
ldi yh, HIGH(appMotionLightSources)
|
ldi yh, HIGH(appMotionLightMSources)
|
||||||
ldi r24, APP_MOTIONLIGHT_SOURCE_NUM
|
ldi r24, APP_MOTIONLIGHT_SOURCE_NUM
|
||||||
appMotionLightHasSource_loop:
|
appMotionLightHasSource_loop:
|
||||||
ldd r16, Y+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR
|
rcall appMotionLightCheckMsgSrc
|
||||||
cp r16, r22
|
brcs appMotionLightHasSource_ret
|
||||||
brne appMotionLightHasSource_next
|
|
||||||
ldd r16, Y+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID
|
|
||||||
cp r16, r17
|
|
||||||
brne appMotionLightHasSource_next
|
|
||||||
sec
|
|
||||||
ret
|
|
||||||
appMotionLightHasSource_next:
|
|
||||||
adiw yh:yl, APP_MOTIONLIGHT_SOURCE_SIZE
|
adiw yh:yl, APP_MOTIONLIGHT_SOURCE_SIZE
|
||||||
dec r24
|
dec r24
|
||||||
brne appMotionLightHasSource_loop
|
brne appMotionLightHasSource_loop
|
||||||
clc
|
clc
|
||||||
|
appMotionLightHasSource_ret:
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -81,20 +75,37 @@ appMotionLightHasSource_next:
|
|||||||
; @return CFLAGS set if we have a matching source entry, cleared otherwise
|
; @return CFLAGS set if we have a matching source entry, cleared otherwise
|
||||||
; @param r17 value id
|
; @param r17 value id
|
||||||
; @param r22 source address
|
; @param r22 source address
|
||||||
; @clobbers R16
|
; @clobbers R16, Y
|
||||||
|
|
||||||
appMotionLightIsBrightnessSource:
|
appMotionLightIsBrightnessSource:
|
||||||
lds r16, appMotionLightLSourceAddr
|
ldi yl, LOW(appMotionLightLSource)
|
||||||
cp r16, r22
|
ldi yh, HIGH(appMotionLightLSource)
|
||||||
brne appMotionLightIsBrightnessSource_no
|
rjmp appMotionLightCheckMsgSrc
|
||||||
lds r16, appMotionLightLSourceValueId
|
; @end
|
||||||
cp r16, r17
|
|
||||||
brne appMotionLightIsBrightnessSource_no
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine appMotionLightCheckMsgSrc
|
||||||
|
;
|
||||||
|
; @return CFLAGS set if we have a matching source entry, cleared otherwise
|
||||||
|
; @param r17 value id
|
||||||
|
; @param r22 source address
|
||||||
|
; @param Y pointer to addr/valueid pair to investigate
|
||||||
|
; @clobbers R16
|
||||||
|
|
||||||
|
appMotionLightCheckMsgSrc:
|
||||||
|
ldd r16, Y+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR
|
||||||
|
cp r16, r22 ; check node addr
|
||||||
|
brne appMotionLightCheckMsgSrc_no
|
||||||
|
ldd r16, Y+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID
|
||||||
|
cp r16, r17 ; check value id
|
||||||
|
brne appMotionLightCheckMsgSrc_no
|
||||||
sec
|
sec
|
||||||
rjmp appMotionLightIsBrightnessSource_ret
|
rjmp appMotionLightCheckMsgSrc_ret
|
||||||
appMotionLightIsBrightnessSource_no:
|
appMotionLightCheckMsgSrc_no:
|
||||||
clc
|
clc
|
||||||
appMotionLightIsBrightnessSource_ret:
|
appMotionLightCheckMsgSrc_ret:
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -103,56 +114,29 @@ appMotionLightIsBrightnessSource_ret:
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appMotionLightReadConfFromEeprom
|
; @routine appMotionLightReadConfFromEeprom
|
||||||
;
|
;
|
||||||
; @clobbers
|
; @clobbers r16, r17, X, Y
|
||||||
|
|
||||||
appMotionLightReadConfFromEeprom:
|
appMotionLightReadConfFromEeprom:
|
||||||
push r15
|
ldi xl, LOW(EEPROM_OFFS_MAL_CONF)
|
||||||
in r15, SREG
|
ldi xh, HIGH(EEPROM_OFFS_MAL_CONF)
|
||||||
cli
|
ldi yl, LOW(appMotionLightSettings)
|
||||||
ldi xl, LOW(EEPROM_OFFS_MAL_CONF_ONTIME)
|
ldi yh, HIGH(appMotionLightSettings)
|
||||||
ldi xh, HIGH(EEPROM_OFFS_MAL_CONF_ONTIME)
|
ldi r17, APP_MOTIONLIGHT_EE_SIZE
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
bigcall Eeprom_ReadBytes ; (r16, r17, X, Y)
|
||||||
mov r18, r16
|
brcc appMotionLightReadConfFromEeprom_ret
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
mov r19, r16
|
lds r18, appMotionLightOnTime
|
||||||
and r16, r18
|
lds r19, appMotionLightOnTime+1
|
||||||
cpi r16, 0xff
|
mov r16, r18
|
||||||
breq appMotionLightReadConfFromEeprom_end
|
and r16, r19
|
||||||
|
inc r16
|
||||||
|
brne appMotionLightReadConfFromEeprom_reload
|
||||||
|
ldi r18, LOW(APP_MOTIONLIGHT_DEFAULT_ONTIME)
|
||||||
|
ldi r19, HIGH(APP_MOTIONLIGHT_DEFAULT_ONTIME)
|
||||||
|
appMotionLightReadConfFromEeprom_reload:
|
||||||
bigcall SK6812_SetAutoTimerReload ; (none)
|
bigcall SK6812_SetAutoTimerReload ; (none)
|
||||||
|
|
||||||
; read source 1
|
appMotionLightReadConfFromEeprom_ret:
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
mov r18, r16
|
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
mov r19, r16
|
|
||||||
sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR, r18
|
|
||||||
sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID, r19
|
|
||||||
|
|
||||||
; read source 2
|
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
mov r18, r16
|
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
mov r19, r16
|
|
||||||
sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR, r18
|
|
||||||
sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID, r19
|
|
||||||
|
|
||||||
; read brightness source
|
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
sts appMotionLightLSourceAddr, r16
|
|
||||||
|
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
sts appMotionLightLSourceValueId, r16
|
|
||||||
|
|
||||||
; read brightness limit
|
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
mov r18, r16
|
|
||||||
rcall Utils_ReadEepromIncr ; (R16)
|
|
||||||
mov r19, r16
|
|
||||||
sts appMotionLightLSourceValue, r18
|
|
||||||
sts appMotionLightLSourceValue+1, r19
|
|
||||||
appMotionLightReadConfFromEeprom_end:
|
|
||||||
out SREG, r15
|
|
||||||
pop r15
|
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -161,59 +145,15 @@ appMotionLightReadConfFromEeprom_end:
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appMotionLightWriteConfToEeprom
|
; @routine appMotionLightWriteConfToEeprom
|
||||||
;
|
;
|
||||||
; @clobbers r16, r17, X
|
; @clobbers r16, r17, X, Y
|
||||||
|
|
||||||
appMotionLightWriteConfToEeprom:
|
appMotionLightWriteConfToEeprom:
|
||||||
push r15
|
ldi xl, LOW(EEPROM_OFFS_MAL_CONF)
|
||||||
in r15, SREG
|
ldi xh, HIGH(EEPROM_OFFS_MAL_CONF)
|
||||||
cli
|
ldi yl, LOW(appMotionLightSettings)
|
||||||
ldi xl, LOW(EEPROM_OFFS_MAL_CONF_ONTIME)
|
ldi yh, HIGH(appMotionLightSettings)
|
||||||
ldi xh, HIGH(EEPROM_OFFS_MAL_CONF_ONTIME)
|
ldi r17, APP_MOTIONLIGHT_EE_SIZE
|
||||||
|
bigjmp Eeprom_WriteBytes ; (r16, r17, r18, X, Y)
|
||||||
rcall SK6812_GetAutoTimerReload
|
|
||||||
mov r16, r18
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
mov r16, r19
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
|
|
||||||
; write source 1
|
|
||||||
lds r16, appMotionLightSources+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
lds r16, appMotionLightSources+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
|
|
||||||
; write source 2
|
|
||||||
lds r16, appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
lds r16, appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
|
|
||||||
; write brightness source
|
|
||||||
lds r16, appMotionLightLSourceAddr
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
lds r16, appMotionLightLSourceValueId
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
|
|
||||||
; write brightness limit
|
|
||||||
lds r16, appMotionLightLSourceValue
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
lds r16, appMotionLightLSourceValue+1
|
|
||||||
rcall Eeprom_WriteByteIfChanged ; (R17)
|
|
||||||
adiw xh:xl, 1
|
|
||||||
|
|
||||||
out SREG, r15
|
|
||||||
pop r15
|
|
||||||
ret
|
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
; copyright : (C) 2025 by Martin Preuss
|
; copyright : (C) 2026 by Martin Preuss
|
||||||
; email : martin@libchipcard.de
|
; email : martin@libchipcard.de
|
||||||
;
|
;
|
||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
@@ -30,21 +30,31 @@ AppMotionLight_OnPacketReceived:
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appMotionLightHandleReport
|
; @routine appMotionLightHandleReport
|
||||||
;
|
;
|
||||||
|
; @param R17 value id
|
||||||
|
; @param R19:R18 value
|
||||||
|
; @param R21:R20 denom (e.g. 100, meaning value must be divided by 100)
|
||||||
|
; @param R22 source address
|
||||||
|
; @param R23 command
|
||||||
|
; @param R25:R24 message id
|
||||||
|
|
||||||
appMotionLightHandleReport:
|
appMotionLightHandleReport:
|
||||||
rcall appMotionLightIsBrightnessSource ; (R16)
|
; is brightness source?
|
||||||
|
rcall appMotionLightIsBrightnessSource ; (R16, Y)
|
||||||
brcs appMotionLightHandleReport_brightness
|
brcs appMotionLightHandleReport_brightness
|
||||||
; motion source?
|
; is motion source?
|
||||||
|
rcall appMotionLightHasSource ; (r16, r24, Y)
|
||||||
|
brcc appMotionLightHandleReport_ret
|
||||||
|
; motion detected?
|
||||||
mov r16, r18
|
mov r16, r18
|
||||||
or r16, r19
|
or r16, r19
|
||||||
breq appMotionLightHandleReport_ret ; zero value, ignore
|
breq appMotionLightHandleReport_ret ; zero value, ignore
|
||||||
rcall appMotionLightHasSource ; (r16, r24, Y)
|
|
||||||
brcc appMotionLightHandleReport_ret
|
|
||||||
|
|
||||||
; motion detected, check for brightness source
|
; motion detected, check for brightness source
|
||||||
lds r16, appMotionLightLSourceAddr ; do we have a source for brightness value?
|
lds r16, (appMotionLightLSource+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR) ; do we have a source for brightness value?
|
||||||
tst r16
|
tst r16
|
||||||
breq appMotionLightHandleReport_trigger ; no, jmp and don't check brightness
|
breq appMotionLightHandleReport_trigger ; no, jmp and don't check brightness
|
||||||
|
cpi r16, 0xff
|
||||||
|
breq appMotionLightHandleReport_trigger ; no, jmp and don't check brightness
|
||||||
; we have a brightness source configured, do we have a value?
|
; we have a brightness source configured, do we have a value?
|
||||||
lds r16, appMotionLightFlags ; check last brightness reported
|
lds r16, appMotionLightFlags ; check last brightness reported
|
||||||
andi r16, APP_MOTIONLIGHT_FLAGS_HAVELIGHT
|
andi r16, APP_MOTIONLIGHT_FLAGS_HAVELIGHT
|
||||||
@@ -68,7 +78,7 @@ appMotionLightHandleReport_brightness:
|
|||||||
ori r16, APP_MOTIONLIGHT_FLAGS_HAVELIGHT
|
ori r16, APP_MOTIONLIGHT_FLAGS_HAVELIGHT
|
||||||
sts appMotionLightFlags, r16
|
sts appMotionLightFlags, r16
|
||||||
appMotionLightHandleReport_ret:
|
appMotionLightHandleReport_ret:
|
||||||
clc
|
clc ; don't send ACK
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -77,20 +87,35 @@ appMotionLightHandleReport_ret:
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appMotionLightSetValueOnTime
|
; @routine appMotionLightSetValueOnTime
|
||||||
;
|
;
|
||||||
|
; @param R17 value id
|
||||||
|
; @param R19:R18 value
|
||||||
|
; @param R21:R20 denom (e.g. 100, meaning value must be divided by 100)
|
||||||
|
; @param R22 source address
|
||||||
|
; @param R23 command
|
||||||
|
; @param R25:R24 message id
|
||||||
|
|
||||||
appMotionLightSetValueOnTime:
|
appMotionLightSetValueOnTime:
|
||||||
|
sts appMotionLightOnTime, r18
|
||||||
|
sts appMotionLightOnTime+1, r19
|
||||||
rcall SK6812_SetAutoTimerReload
|
rcall SK6812_SetAutoTimerReload
|
||||||
rjmp appMotionLightSetValueReturn
|
rjmp appMotionLightSetValueReturn
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appMotionLightSetValueSource1
|
; @routine appMotionLightSetValueSource1
|
||||||
;
|
;
|
||||||
|
; @param R17 value id
|
||||||
|
; @param R19:R18 value
|
||||||
|
; @param R21:R20 denom (e.g. 100, meaning value must be divided by 100)
|
||||||
|
; @param R22 source address
|
||||||
|
; @param R23 command
|
||||||
|
; @param R25:R24 message id
|
||||||
|
|
||||||
appMotionLightSetValueSource1:
|
appMotionLightSetValueSource1:
|
||||||
sts appMotionLightSources, r18 ; peerAddr
|
sts (appMotionLightMSources+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR), r18 ; peerAddr
|
||||||
sts appMotionLightSources+1, r19 ; valueId
|
sts (appMotionLightMSources+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID), r19 ; valueId
|
||||||
rjmp appMotionLightSetValueReturn
|
rjmp appMotionLightSetValueReturn
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -99,10 +124,16 @@ appMotionLightSetValueSource1:
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appMotionLightSetValueSource2
|
; @routine appMotionLightSetValueSource2
|
||||||
;
|
;
|
||||||
|
; @param R17 value id
|
||||||
|
; @param R19:R18 value
|
||||||
|
; @param R21:R20 denom (e.g. 100, meaning value must be divided by 100)
|
||||||
|
; @param R22 source address
|
||||||
|
; @param R23 command
|
||||||
|
; @param R25:R24 message id
|
||||||
|
|
||||||
appMotionLightSetValueSource2:
|
appMotionLightSetValueSource2:
|
||||||
sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE, r18 ; peerAddr
|
sts (appMotionLightMSources+APP_MOTIONLIGHT_SOURCE_SIZE+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR), r18 ; peerAddr
|
||||||
sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE+1, r19 ; valueId
|
sts (appMotionLightMSources+APP_MOTIONLIGHT_SOURCE_SIZE+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID), r19 ; valueId
|
||||||
rjmp appMotionLightSetValueReturn
|
rjmp appMotionLightSetValueReturn
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -111,10 +142,16 @@ appMotionLightSetValueSource2:
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appMotionLightSetValueBValue
|
; @routine appMotionLightSetValueBValue
|
||||||
;
|
;
|
||||||
|
; @param R17 value id
|
||||||
|
; @param R19:R18 value
|
||||||
|
; @param R21:R20 denom (e.g. 100, meaning value must be divided by 100)
|
||||||
|
; @param R22 source address
|
||||||
|
; @param R23 command
|
||||||
|
; @param R25:R24 message id
|
||||||
|
|
||||||
appMotionLightSetValueBValue:
|
appMotionLightSetValueBValue:
|
||||||
sts appMotionLightSources, r18 ; peerAddr
|
sts (appMotionLightMSources+APP_MOTIONLIGHT_SOURCE_OFFS_ADDR), r18 ; peerAddr
|
||||||
sts appMotionLightSources+1, r19 ; valueId
|
sts (appMotionLightMSources+APP_MOTIONLIGHT_SOURCE_OFFS_VALUEID), r19 ; valueId
|
||||||
rjmp appMotionLightSetValueReturn
|
rjmp appMotionLightSetValueReturn
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -126,7 +163,7 @@ appMotionLightSetValueBValue:
|
|||||||
; Common return code
|
; Common return code
|
||||||
|
|
||||||
appMotionLightSetValueReturn:
|
appMotionLightSetValueReturn:
|
||||||
rcall appMotionLightWriteConfToEeprom
|
rcall appMotionLightWriteConfToEeprom ; (r16, r17, X, Y)
|
||||||
ldi r23, NETMSG_CMD_VALUE_SET_ACK
|
ldi r23, NETMSG_CMD_VALUE_SET_ACK
|
||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
|
|||||||
@@ -77,15 +77,7 @@
|
|||||||
.equ EEPROM_OFFS_OSCCAL_SLOW = 12 ; 1 byte
|
.equ EEPROM_OFFS_OSCCAL_SLOW = 12 ; 1 byte
|
||||||
.equ EEPROM_OFFS_OSCCAL_FAST = 13 ; 1 byte
|
.equ EEPROM_OFFS_OSCCAL_FAST = 13 ; 1 byte
|
||||||
|
|
||||||
.equ EEPROM_OFFS_MAL_CONF_ONTIME = 14 ; 2 bytes
|
.equ EEPROM_OFFS_MAL_CONF = 14 ; 10 bytes
|
||||||
.equ EEPROM_OFFS_MAL_CONF_SRC1_ADDR = 16 ; 1 byte
|
|
||||||
.equ EEPROM_OFFS_MAL_CONF_SRC1_VALUEID = 17 ; 1 byte
|
|
||||||
.equ EEPROM_OFFS_MAL_CONF_SRC2_ADDR = 18 ; 1 byte
|
|
||||||
.equ EEPROM_OFFS_MAL_CONF_SRC2_VALUEID = 19 ; 1 byte
|
|
||||||
|
|
||||||
.equ EEPROM_OFFS_MAL_CONF_BSRC_ADDR = 20 ; 1 byte light source addr
|
|
||||||
.equ EEPROM_OFFS_MAL_CONF_BSRC_VALUEID = 21 ; 1 byte light source value id
|
|
||||||
.equ EEPROM_OFFS_MAL_CONF_BSRC_VALUE = 22 ; 2 bytes light source trigger value
|
|
||||||
|
|
||||||
.equ EEPROM_OFFS_ROUTER_RANGE_BEGIN = 24 ; 1 byte
|
.equ EEPROM_OFFS_ROUTER_RANGE_BEGIN = 24 ; 1 byte
|
||||||
.equ EEPROM_OFFS_ROUTER_RANGE_END = 25 ; 1 byte
|
.equ EEPROM_OFFS_ROUTER_RANGE_END = 25 ; 1 byte
|
||||||
|
|||||||
@@ -57,11 +57,10 @@
|
|||||||
#define MODULES_OWI_MASTER
|
#define MODULES_OWI_MASTER
|
||||||
#define MODULES_DS18B20
|
#define MODULES_DS18B20
|
||||||
#define MODULES_SK6812
|
#define MODULES_SK6812
|
||||||
;#define MODULES_MOTION_LIGHT
|
|
||||||
|
|
||||||
#define APPS_NETWORK
|
#define APPS_NETWORK
|
||||||
#define APPS_REPORTSENSORS
|
#define APPS_REPORTSENSORS
|
||||||
;#define APPS_STATS
|
#define APPS_STATS
|
||||||
#define APPS_MA_LIGHT
|
#define APPS_MA_LIGHT
|
||||||
|
|
||||||
|
|
||||||
@@ -69,12 +68,6 @@
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; defines for modules
|
; defines for modules
|
||||||
|
|
||||||
;.equ VALUE_ID_SI7021_TEMP = 0x01
|
|
||||||
;.equ VALUE_ID_SI7021_HUM = 0x02
|
|
||||||
|
|
||||||
;.equ VALUE_ID_ADC = 0x03
|
|
||||||
;.equ VALUE_ID_REED1 = 0x04
|
|
||||||
;.equ VALUE_ID_REED2 = 0x05
|
|
||||||
.equ VALUE_ID_DS18B20_TEMP = 0x06
|
.equ VALUE_ID_DS18B20_TEMP = 0x06
|
||||||
.equ VALUE_ID_MAL_STATE = 0x07
|
.equ VALUE_ID_MAL_STATE = 0x07
|
||||||
|
|
||||||
@@ -91,7 +84,7 @@
|
|||||||
.equ VALUE_ID_LED_MODE = 0x8b
|
.equ VALUE_ID_LED_MODE = 0x8b
|
||||||
.equ VALUE_ID_LED_TYPE = 0x8c
|
.equ VALUE_ID_LED_TYPE = 0x8c
|
||||||
|
|
||||||
.equ VALUE_ID_LEDSIMPLE_TIMING = 0x88
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
.equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming)
|
.equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming)
|
||||||
.equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound)
|
.equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound)
|
||||||
|
|
||||||
.equ DEVICE_SEND_MINUTES = 3 ; send "DEVICE" message very 3 minutes
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user