gui: adjusted climate window and SensorWatch to latest changes.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -643,9 +536,8 @@ SensorWatch_DefaultSignalmap:
|
||||
; header
|
||||
.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 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
||||
.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