avr: more work on fan- and light controller app and modules.

This commit is contained in:
Martin Preuss
2026-08-07 23:45:21 +02:00
parent 296ead3241
commit f973ce1b14
9 changed files with 132 additions and 39 deletions

View File

@@ -11,7 +11,7 @@
#define AQH_AVR_APPS_LIGHT_CONTROL_MAIN_ASM
.equ APP_LIGHTCONTROL_LIGHT_LIMIT = 15
.equ APP_LIGHTCONTROL_LIGHT_LIMIT = 20
@@ -139,9 +139,10 @@ appLightControlUpdate:
appLightControlUpdate_auto:
sbr r16, (1<<HTIM_FLAGBIT_ACTIVE) | (1<<HTIM_FLAGBIT_ACTORENABLED) ; enable timer
std Y+HTIM_RAM_OFFS_FLAGS, r16
sbrs r16, HTIM_FLAGBIT_STATE
rjmp appLightControlUpdate_ret ; jump if clear (actor is off)
rcall appLightControlActorOn
bigcall HTIM_Trigger
; sbrs r16, HTIM_FLAGBIT_STATE
; rjmp appLightControlUpdate_ret ; jump if clear (actor is off)
; rcall appLightControlActorOn
rjmp appLightControlUpdate_ret
appLightControlUpdate_on:
rcall appLightControlActorOn
@@ -185,16 +186,16 @@ appLightControlReadEeprom_ret:
appLightControlWriteEeprom:
ldi r16, APP_LIGHTCONTROL_EEID
bigcall EepromTlv_FindFirst
bigcall EepromTlv_FindFirst ; X=ptr, r17=length (r16, r18)
brcs appLightControlWriteEeprom_write
; create eeprom TLV
ldi r16, APP_LIGHTCONTROL_EEID
ldi r17, APP_LIGHTCONTROL_EE_SIZE
bigcall EepromTlv_AddTlv
bigcall EepromTlv_AddTlv ; X=ptr (r16, r20, r21, r18)
brcc appLightControlWriteEeprom_ret
appLightControlWriteEeprom_write:
; let base class write
bigcall TCA_WriteEepromAt
bigcall TCA_WriteEepromAt ;
brcc appLightControlWriteEeprom_ret
push yl
push yh
@@ -220,12 +221,8 @@ appLightControlActorOn:
ldd r20, Y+APP_LIGHTCONTROL_RAM_OFFS_VALUE_BLUE
ldd r21, Y+APP_LIGHTCONTROL_RAM_OFFS_VALUE_WHITE
bigcall SK6812_SetRGBW ; (r16, r24, r25)
ldi r18, 1
push yl
push yh
bigcall AppLightControl_ReportState
pop yh
pop yl
bigcall AppLightControl_ReportState
ret
; @end
@@ -243,14 +240,32 @@ appLightControlActorOff:
clr r20
clr r21
bigcall SK6812_SetRGBW ; (r16, r24, r25)
ldi r18, 0
bigcall AppLightControl_ReportState
ret
; @end
#if 0
appLightControlDebug:
; debug
ldi r17, 0xf0
ldd r18, Y+HTIM_RAM_OFFS_FLAGS
ldd r19, Y+HTIM_RAM_OFFS_MODE
ldd r20, Y+HTIM_RAM_OFFS_CURRVAL_LO
ldd r21, Y+HTIM_RAM_OFFS_CURRVAL_HI
ldi r22, AQHOME_VALUETYPE_ONOFF
push yl
push yh
bigcall AppLightControl_ReportState
rcall Main_SendValueReport ; (R16, R17, R18, R19, R20, R21, R23, R24, R25, X)
pop yh
pop yl
ret
; @end
#endif