gui: adjusted climate window and SensorWatch to latest changes.
This commit is contained in:
@@ -14,8 +14,32 @@
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ CLIMATEWIN_OFFS_BEGIN = MAINWINDOW_SIZE
|
||||
.equ CLIMATEWIN_SIZE = CLIMATEWIN_OFFS_BEGIN+0
|
||||
.equ CLIMATEWIN_OFFS_BEGIN = DIALOG_SIZE
|
||||
.equ CLIMATEWIN_OFFS_CO2_NODEADDR = CLIMATEWIN_OFFS_BEGIN+0
|
||||
.equ CLIMATEWIN_OFFS_CO2_VALUEID = CLIMATEWIN_OFFS_BEGIN+1
|
||||
.equ CLIMATEWIN_OFFS_TEMP_NODEADDR = CLIMATEWIN_OFFS_BEGIN+2
|
||||
.equ CLIMATEWIN_OFFS_TEMP_VALUEID = CLIMATEWIN_OFFS_BEGIN+3
|
||||
.equ CLIMATEWIN_OFFS_HUM_NODEADDR = CLIMATEWIN_OFFS_BEGIN+4
|
||||
.equ CLIMATEWIN_OFFS_HUM_VALUEID = CLIMATEWIN_OFFS_BEGIN+5
|
||||
|
||||
.equ CLIMATEWIN_OFFS_CO2_VALUE_LO = CLIMATEWIN_OFFS_BEGIN+6
|
||||
.equ CLIMATEWIN_OFFS_CO2_VALUE_HI = CLIMATEWIN_OFFS_BEGIN+7
|
||||
.equ CLIMATEWIN_OFFS_TEMP_VALUE_LO = CLIMATEWIN_OFFS_BEGIN+8
|
||||
.equ CLIMATEWIN_OFFS_TEMP_VALUE_HI = CLIMATEWIN_OFFS_BEGIN+9
|
||||
.equ CLIMATEWIN_OFFS_HUM_VALUE_LO = CLIMATEWIN_OFFS_BEGIN+10
|
||||
.equ CLIMATEWIN_OFFS_HUM_VALUE_HI = CLIMATEWIN_OFFS_BEGIN+11
|
||||
|
||||
.equ CLIMATEWIN_OFFS_NODEADDR = CLIMATEWIN_OFFS_BEGIN+12
|
||||
.equ CLIMATEWIN_OFFS_VALUEID = CLIMATEWIN_OFFS_BEGIN+13
|
||||
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_WARN_LO = CLIMATEWIN_OFFS_BEGIN+14
|
||||
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_WARN_HI = CLIMATEWIN_OFFS_BEGIN+15
|
||||
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_WARN_LO = CLIMATEWIN_OFFS_BEGIN+16
|
||||
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_WARN_HI = CLIMATEWIN_OFFS_BEGIN+17
|
||||
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_CRIT_LO = CLIMATEWIN_OFFS_BEGIN+18
|
||||
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_CRIT_HI = CLIMATEWIN_OFFS_BEGIN+19
|
||||
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_CRIT_LO = CLIMATEWIN_OFFS_BEGIN+20
|
||||
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_CRIT_HI = CLIMATEWIN_OFFS_BEGIN+21
|
||||
.equ CLIMATEWIN_SIZE = CLIMATEWIN_OFFS_BEGIN+22
|
||||
|
||||
|
||||
|
||||
@@ -58,29 +82,22 @@ ClimateWin_new_ret:
|
||||
; @clobbers any, !Y
|
||||
|
||||
ClimateWin_Init:
|
||||
ldi r16, 0 ; OPTS
|
||||
ldi r16, (1<<OBJECT_OPTS_MSGRECV_BIT) ; OPTS
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, LOW(RESSOURCE_TXT_ROOMCLIMATE)
|
||||
ldi r21, HIGH(RESSOURCE_TXT_ROOMCLIMATE)
|
||||
bigcall MainWindow_new ; Y=main window
|
||||
bigcall Dialog_Init ; Y=main window
|
||||
brcc ClimateWin_Init_ret
|
||||
|
||||
bigcall MainWindow_GetContentWidget ; r19:r18=content window
|
||||
brcc ClimateWin_Init_ret
|
||||
mov xl, r18 ; use content window as parent
|
||||
mov xh, r19
|
||||
; set default signal map
|
||||
ldi r16, LOW(ClimateWin_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(ClimateWin_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
; init
|
||||
rcall climateWinReadSourcesFromEeprom
|
||||
|
||||
; Y=MainWindow
|
||||
push yl ; main window
|
||||
push yh
|
||||
push xl ; content window
|
||||
push xh
|
||||
rcall climateWinCreateSensorWatches
|
||||
pop xh ; content window
|
||||
pop xl
|
||||
bigcall C03App_CreateBackButton
|
||||
pop yh ; main window
|
||||
pop yl
|
||||
ClimateWin_Init_ret:
|
||||
ret
|
||||
; @end
|
||||
@@ -100,9 +117,9 @@ climateWinCreateSensorWatches:
|
||||
bigcall HLayout_new
|
||||
brcc climateWinCreateSensorWatches_ret
|
||||
|
||||
ldi r16, LOW(ClimateWindow_HLayoutStyle*2)
|
||||
ldi r16, LOW(ClimateWin_HLayoutStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(ClimateWindow_HLayoutStyle*2)
|
||||
ldi r16, HIGH(ClimateWin_HLayoutStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
|
||||
mov xl, yl ; use HLayout as parent
|
||||
@@ -111,9 +128,7 @@ climateWinCreateSensorWatches:
|
||||
; CO2 sensor watch
|
||||
push xl ; HLayout
|
||||
push xh
|
||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | \
|
||||
(1<<WIDGET_OPTS_INPUT_BIT) | \
|
||||
(1<<OBJECT_OPTS_MSGRECV_BIT) ; OPTS
|
||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) ; OPTS
|
||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
|
||||
(WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, VALUE_ID_SENSOR_CO2_BASE
|
||||
@@ -127,9 +142,7 @@ climateWinCreateSensorWatches:
|
||||
; temp sensor watch
|
||||
push xl ; HLayout
|
||||
push xh
|
||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | \
|
||||
(1<<WIDGET_OPTS_INPUT_BIT) | \
|
||||
(1<<OBJECT_OPTS_MSGRECV_BIT); OPTS
|
||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) ; OPTS
|
||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
|
||||
(WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, VALUE_ID_SENSOR_TEMP_BASE
|
||||
@@ -143,9 +156,7 @@ climateWinCreateSensorWatches:
|
||||
; humidity sensor watch
|
||||
push xl ; HLayout
|
||||
push xh
|
||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | \
|
||||
(1<<WIDGET_OPTS_INPUT_BIT) | \
|
||||
(1<<OBJECT_OPTS_MSGRECV_BIT); OPTS
|
||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) ; OPTS
|
||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
|
||||
(WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, VALUE_ID_SENSOR_HUM_BASE
|
||||
@@ -161,13 +172,452 @@ climateWinCreateSensorWatches_ret:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinReadEeprom
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
|
||||
climateWinReadSourcesFromEeprom:
|
||||
ldi r16, C03_EEID_SENSOR_CO2
|
||||
rcall climateWinReadEeprom ; (none)
|
||||
brcc climateWinReadSourcesFromEeprom_readTemp
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_NODEADDR
|
||||
std Y+CLIMATEWIN_OFFS_CO2_NODEADDR, r16
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_VALUEID
|
||||
std Y+CLIMATEWIN_OFFS_CO2_VALUEID, r16
|
||||
climateWinReadSourcesFromEeprom_readTemp:
|
||||
ldi r16, C03_EEID_SENSOR_TEMP
|
||||
rcall climateWinReadEeprom ; (none)
|
||||
brcc climateWinReadSourcesFromEeprom_readHum
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_NODEADDR
|
||||
std Y+CLIMATEWIN_OFFS_TEMP_NODEADDR, r16
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_VALUEID
|
||||
std Y+CLIMATEWIN_OFFS_TEMP_VALUEID, r16
|
||||
climateWinReadSourcesFromEeprom_readHum:
|
||||
ldi r16, C03_EEID_SENSOR_HUM
|
||||
rcall climateWinReadEeprom ; (none)
|
||||
brcc climateWinReadSourcesFromEeprom_ret
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_NODEADDR
|
||||
std Y+CLIMATEWIN_OFFS_HUM_NODEADDR, r16
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_VALUEID
|
||||
std Y+CLIMATEWIN_OFFS_HUM_VALUEID, r16
|
||||
climateWinReadSourcesFromEeprom_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinReadEeprom
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param R16 eeprom tlv id
|
||||
; @return CFLAG set if data found and read, cleared on error
|
||||
; @clobbers none
|
||||
|
||||
climateWinReadEeprom:
|
||||
push xl
|
||||
push xh
|
||||
push r18
|
||||
bigcall EepromTlv_FindFirst ; (R18)
|
||||
pop r18
|
||||
brcc climateWinReadEeprom_ret
|
||||
push yl
|
||||
push yh
|
||||
adiw yh:yl, CLIMATEWIN_OFFS_NODEADDR
|
||||
push r16
|
||||
push r17
|
||||
ldi r17, SENSORWATCH_EE_SIZE
|
||||
bigcall Eeprom_ReadBytes ; (r16, r17, X, Y)
|
||||
pop r17
|
||||
pop r16
|
||||
pop yh
|
||||
pop yl
|
||||
climateWinReadEeprom_ret:
|
||||
pop xh
|
||||
pop xl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinWriteEeprom
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param R16 eeprom tlv id
|
||||
; @return CFLAG set if data found and read, cleared on error
|
||||
; @clobbers R16, R18, R20, R21
|
||||
|
||||
climateWinWriteEeprom:
|
||||
push xl
|
||||
push xh
|
||||
push r17
|
||||
tst r16
|
||||
clc
|
||||
breq climateWinWriteEeprom_ret
|
||||
push r16
|
||||
bigcall EepromTlv_FindFirst ; (R18)
|
||||
pop r16
|
||||
brcs climateWinWriteEeprom_write
|
||||
ldi r17, SENSORWATCH_EE_SIZE
|
||||
bigcall EepromTlv_AddTlv ; X=pointer to EEPROM data (R16, R18, R20, R21)
|
||||
brcc climateWinWriteEeprom_ret
|
||||
climateWinWriteEeprom_write:
|
||||
push yl
|
||||
push yh
|
||||
adiw yh:yl, CLIMATEWIN_OFFS_NODEADDR
|
||||
ldi r18, SENSORWATCH_EE_SIZE
|
||||
climateWinWriteEeprom_loop:
|
||||
ld r16, Y+
|
||||
bigcall Eeprom_WriteByteIfChanged ; (R17)
|
||||
brcc climateWinWriteEeprom_loopEnd
|
||||
adiw xh:xl, 1
|
||||
dec r18
|
||||
brne climateWinWriteEeprom_loop
|
||||
sec
|
||||
climateWinWriteEeprom_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
climateWinWriteEeprom_ret:
|
||||
pop r17
|
||||
pop xh
|
||||
pop xl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; signal handlers
|
||||
|
||||
|
||||
|
||||
ClimateWin_OnMkContent:
|
||||
bigcall MainWindow_GetContentWidget ; r19:r18=content window
|
||||
brcc ClimateWin_OnMkContent_ret
|
||||
mov xl, r18 ; use content window as parent
|
||||
mov xh, r19
|
||||
|
||||
; Y=MainWindow, X=content window
|
||||
push yl ; main window
|
||||
push yh
|
||||
push xl ; content window
|
||||
push xh
|
||||
rcall climateWinCreateSensorWatches
|
||||
pop xh ; content window
|
||||
pop xl
|
||||
bigcall C03App_CreateBackButton
|
||||
pop yh ; main window
|
||||
pop yl
|
||||
|
||||
; send values to watches
|
||||
ldi r16, 0
|
||||
ldd r18, Y+CLIMATEWIN_OFFS_CO2_VALUE_LO
|
||||
ldd r19, Y+CLIMATEWIN_OFFS_CO2_VALUE_LO
|
||||
rcall climateWinSendValue
|
||||
|
||||
ldi r16, 1
|
||||
ldd r18, Y+CLIMATEWIN_OFFS_TEMP_VALUE_LO
|
||||
ldd r19, Y+CLIMATEWIN_OFFS_TEMP_VALUE_LO
|
||||
rcall climateWinSendValue
|
||||
|
||||
ldi r16, 2
|
||||
ldd r18, Y+CLIMATEWIN_OFFS_HUM_VALUE_LO
|
||||
ldd r19, Y+CLIMATEWIN_OFFS_HUM_VALUE_LO
|
||||
rcall climateWinSendValue
|
||||
|
||||
ClimateWin_OnMkContent_ret:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine ClimateWin_OnRecvSet @global
|
||||
;
|
||||
; @clobbers any, !Y
|
||||
|
||||
ClimateWin_OnRecvSet:
|
||||
bigcall NETMSG_ValueRead
|
||||
ldi zl, LOW(ClimateWin_MsgTable*2)
|
||||
ldi zh, HIGH(ClimateWin_MsgTable*2)
|
||||
bigcall Main_HandleValueMsg
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine ClimateWin_OnRecvReport @global
|
||||
;
|
||||
; @clobbers any, !Y
|
||||
|
||||
ClimateWin_OnRecvReport:
|
||||
bigcall NETMSG_ValueRead
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_CO2_NODEADDR
|
||||
cp r16, r22
|
||||
brne ClimateWin_OnRecvReport_checkTemp
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_CO2_VALUEID
|
||||
cp r16, r17
|
||||
brne ClimateWin_OnRecvReport_checkTemp
|
||||
std Y+CLIMATEWIN_OFFS_CO2_VALUE_LO, r18
|
||||
std Y+CLIMATEWIN_OFFS_CO2_VALUE_HI, r19
|
||||
clr r16
|
||||
rjmp ClimateWin_OnRecvReport_sendValue
|
||||
ClimateWin_OnRecvReport_checkTemp:
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_TEMP_NODEADDR
|
||||
cp r16, r22
|
||||
brne ClimateWin_OnRecvReport_checkHum
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_TEMP_VALUEID
|
||||
cp r16, r17
|
||||
brne ClimateWin_OnRecvReport_checkHum
|
||||
std Y+CLIMATEWIN_OFFS_TEMP_VALUE_LO, r18
|
||||
std Y+CLIMATEWIN_OFFS_TEMP_VALUE_HI, r19
|
||||
ldi r16, 1
|
||||
rjmp ClimateWin_OnRecvReport_sendValue
|
||||
ClimateWin_OnRecvReport_checkHum:
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_HUM_NODEADDR
|
||||
cp r16, r22
|
||||
brne ClimateWin_OnRecvReport_done
|
||||
ldd r16, Y+CLIMATEWIN_OFFS_HUM_VALUEID
|
||||
cp r16, r17
|
||||
brne ClimateWin_OnRecvReport_done
|
||||
std Y+CLIMATEWIN_OFFS_HUM_VALUE_LO, r18
|
||||
std Y+CLIMATEWIN_OFFS_HUM_VALUE_HI, r19
|
||||
ldi r16, 2
|
||||
ClimateWin_OnRecvReport_sendValue:
|
||||
rcall climateWinSendValue
|
||||
ClimateWin_OnRecvReport_done:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
ClimateWin_OnMsgSetCo2Source:
|
||||
ldi r16, C03_EEID_SENSOR_CO2
|
||||
ldi r17, 0
|
||||
rjmp climateWinSetSource
|
||||
|
||||
ClimateWin_OnMsgSetCo2LimWarn:
|
||||
ldi r16, C03_EEID_SENSOR_CO2
|
||||
ldi r17, 0
|
||||
rjmp climateWinSetLimWarn
|
||||
|
||||
ClimateWin_OnMsgSetCo2LimCrit:
|
||||
ldi r16, C03_EEID_SENSOR_CO2
|
||||
ldi r17, 0
|
||||
rjmp climateWinSetLimCrit
|
||||
|
||||
|
||||
ClimateWin_OnMsgSetTempSource:
|
||||
ldi r16, C03_EEID_SENSOR_TEMP
|
||||
ldi r17, 1
|
||||
rjmp climateWinSetSource
|
||||
|
||||
ClimateWin_OnMsgSetTempLimWarn:
|
||||
ldi r16, C03_EEID_SENSOR_TEMP
|
||||
ldi r17, 1
|
||||
rjmp climateWinSetLimWarn
|
||||
|
||||
ClimateWin_OnMsgSetTempLimCrit:
|
||||
ldi r16, C03_EEID_SENSOR_TEMP
|
||||
ldi r17, 1
|
||||
rjmp climateWinSetLimCrit
|
||||
|
||||
|
||||
ClimateWin_OnMsgSetHumSource:
|
||||
ldi r16, C03_EEID_SENSOR_HUM
|
||||
ldi r17, 2
|
||||
rjmp climateWinSetSource
|
||||
|
||||
ClimateWin_OnMsgSetHumLimWarn:
|
||||
ldi r16, C03_EEID_SENSOR_HUM
|
||||
ldi r17, 2
|
||||
rjmp climateWinSetLimWarn
|
||||
|
||||
ClimateWin_OnMsgSetHumLimCrit:
|
||||
ldi r16, C03_EEID_SENSOR_HUM
|
||||
ldi r17, 2
|
||||
rjmp climateWinSetLimCrit
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinSetSource
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param r16 EEPROM tlv id
|
||||
; @param r17 widget child idx
|
||||
|
||||
climateWinSetSource:
|
||||
rcall climateWinReadEeprom ; (none)
|
||||
std Y+SENSORWATCH_OFFS_NODEADDR, r18
|
||||
std Y+SENSORWATCH_OFFS_VALUEID, r19
|
||||
rjmp climateWinWriteUpdateAck
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinSetLimWarn
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param r16 eeprom tlv id
|
||||
; @param r17 widget child idx
|
||||
|
||||
climateWinSetLimWarn:
|
||||
rcall climateWinReadEeprom ; (none)
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_WARN_LO, r18
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_WARN_HI, r19
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_WARN_LO, r20
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_WARN_HI, r21
|
||||
rjmp climateWinWriteUpdateAck
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinSetLimCrit
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param r16 eeprom tlv id
|
||||
; @param r17 widget child idx
|
||||
|
||||
climateWinSetLimCrit:
|
||||
rcall climateWinReadEeprom ; (none)
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_LO, r18
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_HI, r19
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_LO, r20
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_HI, r21
|
||||
rjmp climateWinWriteUpdateAck
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinWriteUpdateAck
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param r16 EEPROM tlv id
|
||||
; @param r17 widget child idx
|
||||
|
||||
climateWinWriteUpdateAck:
|
||||
rcall climateWinWriteEeprom ; (R16, R18, R20, R21)
|
||||
mov r16, r17
|
||||
rcall climateWinUpdateWidget
|
||||
ldi r23, NETMSG_CMD_VALUE_SET_ACK
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinUpdateWidget
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param r16 idx of child widget
|
||||
|
||||
climateWinUpdateWidget:
|
||||
ldd r17, Y+OBJECT_OFFS_FLAGS
|
||||
sbrs r17, WIDGET_FLAGS_VISIBLE_BIT
|
||||
rjmp climateWinUpdateWidget_ret
|
||||
push r16
|
||||
bigcall MainWindow_GetFirstChildOfContentWidget
|
||||
pop r16
|
||||
brcc climateWinUpdateWidget_ret
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall OBJ_GetChildAt
|
||||
pop yh
|
||||
pop yl
|
||||
brcc climateWinUpdateWidget_ret
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall SensorWatch_fromEeprom
|
||||
pop yh
|
||||
pop yl
|
||||
climateWinUpdateWidget_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine climateWinSendValue
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param r16 idx of child widget
|
||||
; @param r19:r18 value
|
||||
|
||||
climateWinSendValue:
|
||||
ldd r17, Y+OBJECT_OFFS_FLAGS
|
||||
sbrs r17, WIDGET_FLAGS_VISIBLE_BIT
|
||||
rjmp climateWinSendValue_ret
|
||||
; visible
|
||||
mov xl, r18
|
||||
mov xh, r19
|
||||
push r16
|
||||
bigcall MainWindow_GetFirstChildOfContentWidget ; (r16)
|
||||
pop r16
|
||||
brcc climateWinSendValue_ret
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall OBJ_GetChildAt ; (r16)
|
||||
pop yh
|
||||
pop yl
|
||||
brcc climateWinSendValue_ret
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall Widget_SetCurrentValue
|
||||
pop yh
|
||||
pop yl
|
||||
climateWinSendValue_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
ClimateWin_MsgTable:
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_CO2_SOURCE, LOW(ClimateWin_OnMsgSetCo2Source), HIGH(ClimateWin_OnMsgSetCo2Source)
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_CO2_LIMWARN, LOW(ClimateWin_OnMsgSetCo2LimWarn), HIGH(ClimateWin_OnMsgSetCo2LimWarn)
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_CO2_LIMWARN, LOW(ClimateWin_OnMsgSetCo2LimCrit), HIGH(ClimateWin_OnMsgSetCo2LimCrit)
|
||||
|
||||
ClimateWindow_HLayoutStyle:
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_TEMP_SOURCE, LOW(ClimateWin_OnMsgSetTempSource), HIGH(ClimateWin_OnMsgSetTempSource)
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_TEMP_LIMWARN, LOW(ClimateWin_OnMsgSetTempLimWarn), HIGH(ClimateWin_OnMsgSetTempLimWarn)
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_TEMP_LIMWARN, LOW(ClimateWin_OnMsgSetTempLimCrit), HIGH(ClimateWin_OnMsgSetTempLimCrit)
|
||||
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_HUM_SOURCE, LOW(ClimateWin_OnMsgSetHumSource), HIGH(ClimateWin_OnMsgSetHumSource)
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_HUM_LIMWARN, LOW(ClimateWin_OnMsgSetHumLimWarn), HIGH(ClimateWin_OnMsgSetHumLimWarn)
|
||||
.db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_HUM_LIMWARN, LOW(ClimateWin_OnMsgSetHumLimCrit), HIGH(ClimateWin_OnMsgSetHumLimCrit)
|
||||
|
||||
.db 0, 0, 0, 0
|
||||
|
||||
|
||||
ClimateWin_HLayoutStyle:
|
||||
.dw DISPLAY_COLOR_BLACK ; frontCol_norm
|
||||
.dw DISPLAY_COLOR_LIGHTGREY ; backCol_norm
|
||||
.dw DISPLAY_COLOR_BLACK ; borderCol_norm
|
||||
@@ -184,5 +634,17 @@ ClimateWindow_HLayoutStyle:
|
||||
|
||||
|
||||
|
||||
ClimateWin_DefaultSignalmap:
|
||||
; header
|
||||
.dw Dialog_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
.db NETMSG_CMD_VALUE_REPORT, OBJECT_SIGNAL_RECVMSG, LOW(ClimateWin_OnRecvReport), HIGH(ClimateWin_OnRecvReport)
|
||||
.db NETMSG_CMD_VALUE_SET, OBJECT_SIGNAL_RECVMSG, LOW(ClimateWin_OnRecvSet), HIGH(ClimateWin_OnRecvSet)
|
||||
.db 0, DIALOG_SIGNAL_MKCONTENT, LOW(ClimateWin_OnMkContent), HIGH(ClimateWin_OnMkContent)
|
||||
; end of table
|
||||
.db 0, 0, 0, 0
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
.equ SENSORWATCH_OFFS_TYPE = SENSORWATCH_OFFS_BEGIN+14
|
||||
.equ SENSORWATCH_SIZE = SENSORWATCH_OFFS_BEGIN+15
|
||||
|
||||
; values (not used for now)
|
||||
.equ SENSORWATCH_VALUE = WIDGET_VALUE_NEXTFREE+0
|
||||
.equ SENSORWATCH_VALUE_NEXTFREE = SENSORWATCH_VALUE+1
|
||||
|
||||
; sensor types
|
||||
.equ SENSORWATCH_TYPE_CO2 = 1
|
||||
.equ SENSORWATCH_TYPE_TEMP = 2
|
||||
@@ -66,6 +62,13 @@
|
||||
.equ SENSORWATCH_EE_SIZE = 10
|
||||
|
||||
|
||||
; values
|
||||
.equ SENSORWATCH_VALUE_UPPERLIMITWARN = WIDGET_VALUE_NEXTFREE+0
|
||||
.equ SENSORWATCH_VALUE_LOWERLIMITWARN = WIDGET_VALUE_NEXTFREE+1
|
||||
.equ SENSORWATCH_VALUE_UPPERLIMITCRIT = WIDGET_VALUE_NEXTFREE+2
|
||||
.equ SENSORWATCH_VALUE_LOWERLIMITCRIT = WIDGET_VALUE_NEXTFREE+3
|
||||
.equ SENSORWATCH_VALUE_NEXT = WIDGET_VALUE_NEXTFREE+4
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
@@ -145,7 +148,7 @@ SensorWatch_Init:
|
||||
rcall sensorWatchCreateImageViewer
|
||||
rcall sensorWatchCreateValueLabel
|
||||
|
||||
rcall sensorWatchReadFromEeprom ; (R16, R18, X)
|
||||
rcall SensorWatch_fromEeprom ; (R16, R18, X)
|
||||
|
||||
ret
|
||||
; @end
|
||||
@@ -337,26 +340,15 @@ SensorWatch_GetValueLabel:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine SensorWatch_OnRecvReport @global
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param X pointer to message
|
||||
SensorWatch_OnSetCurrentValue:
|
||||
std Y+SENSORWATCH_OFFS_VALUE_LO, xl
|
||||
std Y+SENSORWATCH_OFFS_VALUE_HI, xh
|
||||
rjmp sensorWatchUpdate
|
||||
; @end
|
||||
|
||||
SensorWatch_OnRecvReport:
|
||||
bigcall NETMSG_ValueRead ; R17=valueId, R22=nodeAddr R19:R18=value (none)
|
||||
; check node addr
|
||||
ldd r16, Y+SENSORWATCH_OFFS_NODEADDR
|
||||
cp r16, r22
|
||||
brne SensorWatch_OnRecvReport_ret
|
||||
; check value id
|
||||
ldd r16, Y+SENSORWATCH_OFFS_VALUEID
|
||||
cp r16, r17
|
||||
brne SensorWatch_OnRecvReport_ret
|
||||
; store value
|
||||
std Y+SENSORWATCH_OFFS_VALUE_LO, r18
|
||||
std Y+SENSORWATCH_OFFS_VALUE_HI, r19
|
||||
|
||||
|
||||
sensorWatchUpdate:
|
||||
; setup background color
|
||||
push xl
|
||||
push xh
|
||||
@@ -364,65 +356,7 @@ SensorWatch_OnRecvReport:
|
||||
rcall sensorWatchSetValueLabel ; (any, !Y)
|
||||
pop xh
|
||||
pop xl
|
||||
SensorWatch_OnRecvReport_ret:
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine SensorWatch_OnRecvSet @global
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param X pointer to message
|
||||
|
||||
SensorWatch_OnRecvSet:
|
||||
bigcall NETMSG_ValueRead ; R17=valueId, R22=nodeAddr R19:R18=value (none)
|
||||
ldd r16, Y+SENSORWATCH_OFFS_BASEVALUEID
|
||||
sub r17, r16
|
||||
brcs SensorWatch_OnRecvSet_clcRet
|
||||
cpi r17, 0
|
||||
breq SensorWatch_OnRecvSet_setSource
|
||||
cpi r17, 1
|
||||
breq SensorWatch_OnRecvSet_setLimWarn
|
||||
cpi r17, 2
|
||||
breq SensorWatch_OnRecvSet_setLimCrit
|
||||
rjmp SensorWatch_OnRecvSet_clcRet
|
||||
SensorWatch_OnRecvSet_setSource:
|
||||
std Y+SENSORWATCH_OFFS_NODEADDR, r18
|
||||
std Y+SENSORWATCH_OFFS_VALUEID, r19
|
||||
rjmp SensorWatch_OnRecvSet_sendACK
|
||||
SensorWatch_OnRecvSet_setLimWarn:
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_WARN_LO, r18
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_WARN_HI, r19
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_WARN_LO, r20
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_WARN_HI, r21
|
||||
rjmp SensorWatch_OnRecvSet_sendACK
|
||||
SensorWatch_OnRecvSet_setLimCrit:
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_LO, r18
|
||||
std Y+SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_HI, r19
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_LO, r20
|
||||
std Y+SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_HI, r21
|
||||
SensorWatch_OnRecvSet_sendACK:
|
||||
add r17, r16 ; restore valueId
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
ldi r23, NETMSG_CMD_VALUE_SET_ACK
|
||||
bigcall Main_SendValueResponse ; (clobbers all except Z)
|
||||
pop yh
|
||||
pop yl
|
||||
rcall sensorWatchSetColor ; (any, !Y)
|
||||
rcall sensorWatchWriteToEeprom ; (R16, R17, R18, R20, R21, X)
|
||||
pop xh
|
||||
pop xl
|
||||
sec
|
||||
rjmp SensorWatch_OnRecvSet_ret
|
||||
SensorWatch_OnRecvSet_clcRet:
|
||||
clc
|
||||
SensorWatch_OnRecvSet_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -559,73 +493,32 @@ sensorWatchCheckAgainstLimit_ret:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine sensorWatchWriteToEeprom
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @return CFLAG set if data found and read, cleared on error
|
||||
; @clobbers R16, R17, R18, R20, R21, X
|
||||
|
||||
sensorWatchWriteToEeprom:
|
||||
ldd r16, Y+SENSORWATCH_OFFS_EEPROMID
|
||||
tst r16
|
||||
clc
|
||||
breq sensorWatchWriteToEeprom_ret
|
||||
push r16
|
||||
bigcall EepromTlv_FindFirst ; (R18)
|
||||
pop r16
|
||||
brcs sensorWatchWriteToEeprom_write
|
||||
ldi r17, SENSORWATCH_EE_SIZE
|
||||
bigcall EepromTlv_AddTlv ; X=pointer to EEPROM data (R16, R18, R20, R21)
|
||||
brcc sensorWatchWriteToEeprom_ret
|
||||
sensorWatchWriteToEeprom_write:
|
||||
push yl
|
||||
push yh
|
||||
adiw yh:yl, SENSORWATCH_OFFS_NODEADDR
|
||||
ldi r18, SENSORWATCH_EE_SIZE
|
||||
sensorWatchWriteToEeprom_loop:
|
||||
ld r16, Y+
|
||||
bigcall Eeprom_WriteByteIfChanged ; (R17)
|
||||
brcc sensorWatchWriteToEeprom_loopEnd
|
||||
adiw xh:xl, 1
|
||||
dec r18
|
||||
brne sensorWatchWriteToEeprom_loop
|
||||
sec
|
||||
sensorWatchWriteToEeprom_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
sensorWatchWriteToEeprom_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine sensorWatchReadFromEeprom
|
||||
; @routine SensorWatch_fromEeprom
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @return CFLAG set if data found and read, cleared on error
|
||||
; @clobbers R16, R18, X
|
||||
|
||||
sensorWatchReadFromEeprom:
|
||||
SensorWatch_fromEeprom:
|
||||
ldd r16, Y+SENSORWATCH_OFFS_EEPROMID
|
||||
bigcall EepromTlv_FindFirst ; (R18)
|
||||
brcc sensorWatchReadFromEeprom_ret
|
||||
brcc SensorWatch_fromEeprom_ret
|
||||
push yl
|
||||
push yh
|
||||
adiw yh:yl, SENSORWATCH_OFFS_NODEADDR
|
||||
ldi r18, SENSORWATCH_EE_SIZE
|
||||
sensorWatchReadFromEeprom_loop:
|
||||
SensorWatch_fromEeprom_loop:
|
||||
bigcall Eeprom_ReadByte ; R16=byte (none)
|
||||
brcc sensorWatchReadFromEeprom_loopEnd
|
||||
brcc SensorWatch_fromEeprom_loopEnd
|
||||
st Y+, r16
|
||||
adiw xh:xl, 1
|
||||
dec r18
|
||||
brne sensorWatchReadFromEeprom_loop
|
||||
brne SensorWatch_fromEeprom_loop
|
||||
sec
|
||||
sensorWatchReadFromEeprom_loopEnd:
|
||||
SensorWatch_fromEeprom_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
sensorWatchReadFromEeprom_ret:
|
||||
SensorWatch_fromEeprom_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -644,8 +537,7 @@ SensorWatch_DefaultSignalmap:
|
||||
.dw VLayout_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
||||
.db NETMSG_CMD_VALUE_REPORT, OBJECT_SIGNAL_RECVMSG, LOW(SensorWatch_OnRecvReport), HIGH(SensorWatch_OnRecvReport)
|
||||
.db NETMSG_CMD_VALUE_SET, OBJECT_SIGNAL_RECVMSG, LOW(SensorWatch_OnRecvSet), HIGH(SensorWatch_OnRecvSet)
|
||||
.db WIDGET_VALUE_CURRENTVALUE, WIDGET_SIGNAL_SETVALUE, LOW(SensorWatch_OnSetCurrentValue), HIGH(SensorWatch_OnSetCurrentValue)
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
@@ -659,5 +551,6 @@ SensorWatch_Descriptors:
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user