sensorwatch: introduce upper and lower limits.
This commit is contained in:
@@ -174,7 +174,9 @@ winClimate_signalmap:
|
|||||||
.dw STYLE_WIN_FOREGROUND ; front color
|
.dw STYLE_WIN_FOREGROUND ; front color
|
||||||
.dw STYLE_WIN_BACKGROUND ; back color
|
.dw STYLE_WIN_BACKGROUND ; back color
|
||||||
.dw STYLE_WIN_FONT*2 ; font
|
.dw STYLE_WIN_FONT*2 ; font
|
||||||
.dw winClimateSensor1_ramdata ; ptr to SDRAM
|
.dw winClimateSensor1_ramdata ; ptr to SDRAM
|
||||||
|
; SENSORWATCH
|
||||||
|
.db 0, 0 ; baseValueId, eepromId
|
||||||
|
|
||||||
|
|
||||||
winClimateSensor1Title:
|
winClimateSensor1Title:
|
||||||
@@ -271,6 +273,8 @@ winClimate_signalmap:
|
|||||||
.dw STYLE_WIN_BACKGROUND ; back color
|
.dw STYLE_WIN_BACKGROUND ; back color
|
||||||
.dw STYLE_WIN_FONT*2 ; font
|
.dw STYLE_WIN_FONT*2 ; font
|
||||||
.dw winClimateSensor2_ramdata ; ptr to SDRAM
|
.dw winClimateSensor2_ramdata ; ptr to SDRAM
|
||||||
|
; SENSORWATCH
|
||||||
|
.db 0, 0 ; baseValueId, eepromId
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -367,7 +371,9 @@ winClimate_signalmap:
|
|||||||
.dw STYLE_WIN_FOREGROUND ; front color
|
.dw STYLE_WIN_FOREGROUND ; front color
|
||||||
.dw STYLE_WIN_BACKGROUND ; back color
|
.dw STYLE_WIN_BACKGROUND ; back color
|
||||||
.dw STYLE_WIN_FONT*2 ; font
|
.dw STYLE_WIN_FONT*2 ; font
|
||||||
.dw winClimateSensor3_ramdata ; ptr to SDRAM
|
.dw winClimateSensor3_ramdata ; ptr to SDRAM
|
||||||
|
; SENSORWATCH
|
||||||
|
.db 0, 0 ; baseValueId, eepromId
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -235,19 +235,19 @@ test:
|
|||||||
; set source
|
; set source
|
||||||
ldi r16, SENSORWATCH_SIGNAL_SETSOURCE
|
ldi r16, SENSORWATCH_SIGNAL_SETSOURCE
|
||||||
clr r17
|
clr r17
|
||||||
ldi xl, 191 ; node address
|
ldi xl, 98 ; node address
|
||||||
ldi xh, 10 ; value 0x0a (SGP30_CO2)
|
ldi xh, 10 ; value 0x0a (SGP30_CO2)
|
||||||
bigcall OBJ_HandleSignal
|
bigcall OBJ_HandleSignal
|
||||||
|
|
||||||
; set warning limit
|
; set warning limit
|
||||||
ldi r16, SENSORWATCH_SIGNAL_SETLIMWARN
|
ldi r16, SENSORWATCH_SIGNAL_SETUPPERLIMWARN
|
||||||
clr r17
|
clr r17
|
||||||
ldi xl, LOW(800)
|
ldi xl, LOW(800)
|
||||||
ldi xh, HIGH(800)
|
ldi xh, HIGH(800)
|
||||||
bigcall OBJ_HandleSignal
|
bigcall OBJ_HandleSignal
|
||||||
|
|
||||||
; set critical limit
|
; set critical limit
|
||||||
ldi r16, SENSORWATCH_SIGNAL_SETLIMCRIT
|
ldi r16, SENSORWATCH_SIGNAL_SETUPPERLIMCRIT
|
||||||
clr r17
|
clr r17
|
||||||
ldi xl, LOW(2000)
|
ldi xl, LOW(2000)
|
||||||
ldi xh, HIGH(2000)
|
ldi xh, HIGH(2000)
|
||||||
|
|||||||
@@ -1,15 +1,25 @@
|
|||||||
|
|
||||||
|
- sensor watch:
|
||||||
|
- SDRAM vars:
|
||||||
|
- change limits
|
||||||
|
- SENSORWATCH_SD_OFFS_UPPERLIMIT_WARN_LO
|
||||||
|
- SENSORWATCH_SD_OFFS_LOWERLIMIT_WARN_LO
|
||||||
|
- SENSORWATCH_SD_OFFS_UPPERLIMIT_CRIT_LO
|
||||||
|
- SENSORWATCH_SD_OFFS_LOWERLIMIT_CRIT_LO
|
||||||
|
- add private flags (HAVE_VALUE, USE_UPPERWARNLIMIT, USE_LOWERWARNLIMIT, USE_UPPERCRITLIMIT, USE_LOWERCRITLIMIT)
|
||||||
|
|
||||||
|
|
||||||
- new pages:
|
- new pages:
|
||||||
- main window
|
- main window
|
||||||
- buttons for climate, netstats, light, doors
|
- buttons for climate, netstats, light, doors
|
||||||
- about window (version, logo etc)
|
- about window (version, logo etc)
|
||||||
- lights
|
- lights
|
||||||
-
|
- mode: on, off, auto
|
||||||
|
- color: R, G, B, W
|
||||||
|
- calibrate screen
|
||||||
|
|
||||||
- valueEdit
|
- digitEdit
|
||||||
- arrow_down - valueLabel - arrow_up
|
- arrow_up, below digit, below arrow_down
|
||||||
- for every digit: arrow_up, below digit, arrow_down
|
|
||||||
- min/max values
|
|
||||||
|
|
||||||
|
|
||||||
- label:
|
- label:
|
||||||
@@ -37,15 +47,6 @@
|
|||||||
- use timer to blink/flash label, e.g. when values change
|
- use timer to blink/flash label, e.g. when values change
|
||||||
|
|
||||||
|
|
||||||
- sensor watch:
|
|
||||||
- SDRAM vars:
|
|
||||||
- change limits
|
|
||||||
- SENSORWATCH_SD_OFFS_UPPERLIMIT_WARN_LO
|
|
||||||
- SENSORWATCH_SD_OFFS_LOWERLIMIT_WARN_LO
|
|
||||||
- SENSORWATCH_SD_OFFS_UPPERLIMIT_CRIT_LO
|
|
||||||
- SENSORWATCH_SD_OFFS_LOWERLIMIT_CRIT_LO
|
|
||||||
- add private flags (HAVE_VALUE, USE_UPPERWARNLIMIT, USE_LOWERWARNLIMIT, USE_UPPERCRITLIMIT, USE_LOWERCRITLIMIT)
|
|
||||||
|
|
||||||
- widgets:
|
- widgets:
|
||||||
- value (flashingLabel)
|
- value (flashingLabel)
|
||||||
|
|
||||||
|
|||||||
@@ -35,27 +35,35 @@
|
|||||||
; defines
|
; defines
|
||||||
|
|
||||||
; SensorWatch in flash
|
; SensorWatch in flash
|
||||||
.equ SENSORWATCH_OFFS_SENSORWATCH = WIDGET_SIZE
|
.equ SENSORWATCH_OFFS_BEGIN = WIDGET_SIZE
|
||||||
.equ SENSORWATCH_SIZE = SENSORWATCH_OFFS_SENSORWATCH+0
|
.equ SENSORWATCH_OFFS_BASEVALUEID = SENSORWATCH_OFFS_BEGIN+0
|
||||||
|
.equ SENSORWATCH_OFFS_EEPROMID = SENSORWATCH_OFFS_BEGIN+1
|
||||||
|
.equ SENSORWATCH_SIZE = SENSORWATCH_OFFS_BEGIN+2
|
||||||
|
|
||||||
; SDRAM data for SensorWatch
|
; SDRAM data for SensorWatch
|
||||||
.equ SENSORWATCH_SD_OFFS_SENSORWATCH = WIDGET_SD_SIZE
|
.equ SENSORWATCH_SD_OFFS_SENSORWATCH = WIDGET_SD_SIZE
|
||||||
.equ SENSORWATCH_SD_OFFS_NODEADDR = SENSORWATCH_SD_OFFS_SENSORWATCH+0
|
.equ SENSORWATCH_SD_OFFS_NODEADDR = SENSORWATCH_SD_OFFS_SENSORWATCH+0
|
||||||
.equ SENSORWATCH_SD_OFFS_VALUEID = SENSORWATCH_SD_OFFS_SENSORWATCH+1
|
.equ SENSORWATCH_SD_OFFS_VALUEID = SENSORWATCH_SD_OFFS_SENSORWATCH+1
|
||||||
.equ SENSORWATCH_SD_OFFS_LIMIT_WARN_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+2
|
.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+2
|
||||||
.equ SENSORWATCH_SD_OFFS_LIMIT_WARN_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+3
|
.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+3
|
||||||
.equ SENSORWATCH_SD_OFFS_LIMIT_CRIT_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+4
|
.equ SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+4
|
||||||
.equ SENSORWATCH_SD_OFFS_LIMIT_CRIT_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+5
|
.equ SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+5
|
||||||
.equ SENSORWATCH_SD_OFFS_VALUE_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+6
|
.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+6
|
||||||
.equ SENSORWATCH_SD_OFFS_VALUE_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+7
|
.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+7
|
||||||
.equ SENSORWATCH_SD_SIZE = SENSORWATCH_SD_OFFS_SENSORWATCH+8
|
.equ SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+8
|
||||||
|
.equ SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+9
|
||||||
|
.equ SENSORWATCH_SD_OFFS_VALUE_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+10
|
||||||
|
.equ SENSORWATCH_SD_OFFS_VALUE_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+11
|
||||||
|
.equ SENSORWATCH_SD_SIZE = SENSORWATCH_SD_OFFS_SENSORWATCH+12
|
||||||
|
|
||||||
|
|
||||||
; signals
|
; signals
|
||||||
.equ SENSORWATCH_SIGNAL_SETSOURCE = WIDGET_SIGNAL_NEXTFREE+0
|
.equ SENSORWATCH_SIGNAL_SETSOURCE = WIDGET_SIGNAL_NEXTFREE+0
|
||||||
.equ SENSORWATCH_SIGNAL_SETLIMWARN = WIDGET_SIGNAL_NEXTFREE+1
|
.equ SENSORWATCH_SIGNAL_SETUPPERLIMWARN = WIDGET_SIGNAL_NEXTFREE+1
|
||||||
.equ SENSORWATCH_SIGNAL_SETLIMCRIT = WIDGET_SIGNAL_NEXTFREE+2
|
.equ SENSORWATCH_SIGNAL_SETLOWERLIMWARN = WIDGET_SIGNAL_NEXTFREE+2
|
||||||
.equ SENSORWATCH_SIGNAL_NEXTFREE = WIDGET_SIGNAL_NEXTFREE+3
|
.equ SENSORWATCH_SIGNAL_SETUPPERLIMCRIT = WIDGET_SIGNAL_NEXTFREE+3
|
||||||
|
.equ SENSORWATCH_SIGNAL_SETLOWERLIMCRIT = WIDGET_SIGNAL_NEXTFREE+4
|
||||||
|
.equ SENSORWATCH_SIGNAL_NEXTFREE = WIDGET_SIGNAL_NEXTFREE+5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -128,21 +136,43 @@ SensorWatch_OnSetSource_ret:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine SensorWatch_OnSetLimitWarn @global
|
; @routine SensorWatch_OnSetLowerLimitWarn @global
|
||||||
;
|
;
|
||||||
; @param Z byte address of widget object (for LPM!)
|
; @param Z byte address of widget object (for LPM!)
|
||||||
; @param X value
|
; @param X value
|
||||||
; @return CFLAG set if signal handled
|
; @return CFLAG set if signal handled
|
||||||
; @clobbers any, !Z
|
; @clobbers any, !Z
|
||||||
|
|
||||||
SensorWatch_OnSetLimitWarn:
|
SensorWatch_OnSetLowerLimitWarn:
|
||||||
bigcall OBJ_IsObject ; (none)
|
bigcall OBJ_IsObject ; (none)
|
||||||
brcc SensorWatch_OnSetLimitWarn_ret
|
brcc SensorWatch_OnSetLowerLimitWarn_ret
|
||||||
bigcall Widget_GetSdramPtr ; (none)
|
bigcall Widget_GetSdramPtr ; (none)
|
||||||
std Y+SENSORWATCH_SD_OFFS_LIMIT_WARN_LO, xl
|
std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_LO, xl
|
||||||
std Y+SENSORWATCH_SD_OFFS_LIMIT_WARN_HI, xh
|
std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_HI, xh
|
||||||
rcall sensorWatchSetColor
|
rcall sensorWatchSetColor
|
||||||
SensorWatch_OnSetLimitWarn_ret:
|
SensorWatch_OnSetLowerLimitWarn_ret:
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine SensorWatch_OnSetUpperLimitWarn @global
|
||||||
|
;
|
||||||
|
; @param Z byte address of widget object (for LPM!)
|
||||||
|
; @param X value
|
||||||
|
; @return CFLAG set if signal handled
|
||||||
|
; @clobbers any, !Z
|
||||||
|
|
||||||
|
SensorWatch_OnSetUpperLimitWarn:
|
||||||
|
bigcall OBJ_IsObject ; (none)
|
||||||
|
brcc SensorWatch_OnSetUpperLimitWarn_ret
|
||||||
|
bigcall Widget_GetSdramPtr ; (none)
|
||||||
|
std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO, xl
|
||||||
|
std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_HI, xh
|
||||||
|
rcall sensorWatchSetColor
|
||||||
|
SensorWatch_OnSetUpperLimitWarn_ret:
|
||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
@@ -157,14 +187,36 @@ SensorWatch_OnSetLimitWarn_ret:
|
|||||||
; @return CFLAG set if signal handled
|
; @return CFLAG set if signal handled
|
||||||
; @clobbers any, !Z
|
; @clobbers any, !Z
|
||||||
|
|
||||||
SensorWatch_OnSetLimitCrit:
|
SensorWatch_OnSetLowerLimitCrit:
|
||||||
bigcall OBJ_IsObject ; (none)
|
bigcall OBJ_IsObject ; (none)
|
||||||
brcc SensorWatch_OnSetLimitCrit_ret
|
brcc SensorWatch_OnSetLowerLimitCrit_ret
|
||||||
rcall Widget_GetSdramPtr ; (none)
|
rcall Widget_GetSdramPtr ; (none)
|
||||||
std Y+SENSORWATCH_SD_OFFS_LIMIT_CRIT_LO, xl
|
std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_LO, xl
|
||||||
std Y+SENSORWATCH_SD_OFFS_LIMIT_CRIT_HI, xh
|
std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_HI, xh
|
||||||
rcall sensorWatchSetColor
|
rcall sensorWatchSetColor
|
||||||
SensorWatch_OnSetLimitCrit_ret:
|
SensorWatch_OnSetLowerLimitCrit_ret:
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine SensorWatch_OnSetUpperLimitCrit @global
|
||||||
|
;
|
||||||
|
; @param Z byte address of widget object (for LPM!)
|
||||||
|
; @param X value
|
||||||
|
; @return CFLAG set if signal handled
|
||||||
|
; @clobbers any, !Z
|
||||||
|
|
||||||
|
SensorWatch_OnSetUpperLimitCrit:
|
||||||
|
bigcall OBJ_IsObject ; (none)
|
||||||
|
brcc SensorWatch_OnSetUpperLimitCrit_ret
|
||||||
|
rcall Widget_GetSdramPtr ; (none)
|
||||||
|
std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO, xl
|
||||||
|
std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_HI, xh
|
||||||
|
rcall sensorWatchSetColor
|
||||||
|
SensorWatch_OnSetUpperLimitCrit_ret:
|
||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
@@ -187,6 +239,8 @@ SensorWatch_OnMsgReceived:
|
|||||||
sbiw xh:xl, 2
|
sbiw xh:xl, 2
|
||||||
cpi r16, NETMSG_CMD_VALUE_REPORT
|
cpi r16, NETMSG_CMD_VALUE_REPORT
|
||||||
breq SensorWatch_OnMsgReceived_report
|
breq SensorWatch_OnMsgReceived_report
|
||||||
|
cpi r16, NETMSG_CMD_VALUE_SET
|
||||||
|
breq SensorWatch_OnMsgReceived_set
|
||||||
rjmp SensorWatch_OnMsgReceived_ret
|
rjmp SensorWatch_OnMsgReceived_ret
|
||||||
SensorWatch_OnMsgReceived_report:
|
SensorWatch_OnMsgReceived_report:
|
||||||
bigcall Widget_GetSdramPtr ; (none)
|
bigcall Widget_GetSdramPtr ; (none)
|
||||||
@@ -205,6 +259,12 @@ SensorWatch_OnMsgReceived_report:
|
|||||||
; setup background color
|
; setup background color
|
||||||
rcall sensorWatchSetColor ; (any, !Y, !Z)
|
rcall sensorWatchSetColor ; (any, !Y, !Z)
|
||||||
rcall sensorWatchSetValueLabel ; (any, !Y, !Z)
|
rcall sensorWatchSetValueLabel ; (any, !Y, !Z)
|
||||||
|
rjmp SensorWatch_OnMsgReceived_ret
|
||||||
|
|
||||||
|
SensorWatch_OnMsgReceived_set:
|
||||||
|
bigcall Widget_GetSdramPtr ; (none)
|
||||||
|
bigcall NETMSG_ValueRead ; R17=valueId, R22=nodeAddr R19:R18=value R21:R20=denom (none)
|
||||||
|
; TODO: check valueid, read and set value
|
||||||
SensorWatch_OnMsgReceived_ret:
|
SensorWatch_OnMsgReceived_ret:
|
||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
@@ -288,34 +348,30 @@ sensorWatchSetColor:
|
|||||||
or r16, r21
|
or r16, r21
|
||||||
breq sensorWatchSetColor_ret ; do nothing
|
breq sensorWatchSetColor_ret ; do nothing
|
||||||
|
|
||||||
; check against critical limit
|
; check against critical limits
|
||||||
ldd r22, Y+SENSORWATCH_SD_OFFS_LIMIT_CRIT_LO
|
adiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO
|
||||||
ldd r23, Y+SENSORWATCH_SD_OFFS_LIMIT_CRIT_HI
|
rcall sensorWatchCheckAgainstLimit ; (r16, r17, r22, r23)
|
||||||
mov r16, r22
|
sbiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO
|
||||||
or r16, r23
|
brcs sensorWatchSetColor_setRed
|
||||||
breq sensorWatchSetColor_checkWarn
|
|
||||||
cp r20, r22
|
; check against warning limits
|
||||||
cpc r21, r23
|
adiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO
|
||||||
brcc sensorWatchSetColor_setRed
|
rcall sensorWatchCheckAgainstLimit ; (r16, r17, r22, r23)
|
||||||
sensorWatchSetColor_checkWarn:
|
sbiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO
|
||||||
; check against warning limit
|
brcs sensorWatchSetColor_setYellow
|
||||||
ldd r22, Y+SENSORWATCH_SD_OFFS_LIMIT_WARN_LO
|
|
||||||
ldd r23, Y+SENSORWATCH_SD_OFFS_LIMIT_WARN_HI
|
|
||||||
mov r16, r22
|
|
||||||
or r16, r23
|
|
||||||
breq sensorWatchSetColor_ret ; do nothing
|
|
||||||
cp r20, r22
|
|
||||||
cpc r21, r23
|
|
||||||
brcc sensorWatchSetColor_setYellow
|
|
||||||
; set green background
|
; set green background
|
||||||
rjmp sensorWatchSetColor_setColor
|
rjmp sensorWatchSetColor_setColor
|
||||||
|
|
||||||
sensorWatchSetColor_setRed:
|
sensorWatchSetColor_setRed:
|
||||||
ldi xl, LOW(DISPLAY_COLOR_RED)
|
ldi xl, LOW(DISPLAY_COLOR_RED)
|
||||||
ldi xh, HIGH(DISPLAY_COLOR_RED)
|
ldi xh, HIGH(DISPLAY_COLOR_RED)
|
||||||
rjmp sensorWatchSetColor_setColor
|
rjmp sensorWatchSetColor_setColor
|
||||||
|
|
||||||
sensorWatchSetColor_setYellow:
|
sensorWatchSetColor_setYellow:
|
||||||
ldi xl, LOW(DISPLAY_COLOR_YELLOW)
|
ldi xl, LOW(DISPLAY_COLOR_YELLOW)
|
||||||
ldi xh, HIGH(DISPLAY_COLOR_YELLOW)
|
ldi xh, HIGH(DISPLAY_COLOR_YELLOW)
|
||||||
|
|
||||||
sensorWatchSetColor_setColor:
|
sensorWatchSetColor_setColor:
|
||||||
rcall SensorWatch_GetImageView ; (none)
|
rcall SensorWatch_GetImageView ; (none)
|
||||||
brcc sensorWatchSetColor_ret
|
brcc sensorWatchSetColor_ret
|
||||||
@@ -334,6 +390,47 @@ sensorWatchSetColor_ret:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchCheckAgainstLimit
|
||||||
|
;
|
||||||
|
; @param R21:R20 value to check against limit
|
||||||
|
; @param Y points to upper limit (lo/hi), followed by lower limit (lo/hi)
|
||||||
|
; @return CFLAG set if limit triggered, cleared if between upper and lower limit
|
||||||
|
; @clobbers r16, r17, r22, r23
|
||||||
|
|
||||||
|
sensorWatchCheckAgainstLimit:
|
||||||
|
; check against upper limit (if any)
|
||||||
|
ldd r22, Y+0
|
||||||
|
ldd r23, Y+1
|
||||||
|
mov r16, r22
|
||||||
|
or r16, r23 ; zero?
|
||||||
|
clc
|
||||||
|
breq sensorWatchCheckAgainstLimit_ret ; yes, jmp
|
||||||
|
cp r20, r22
|
||||||
|
cpc r21, r23
|
||||||
|
brcc sensorWatchCheckAgainstLimit_secRet
|
||||||
|
|
||||||
|
; check against lower limit (if any)
|
||||||
|
ldd r22, Y+2
|
||||||
|
ldd r23, Y+3
|
||||||
|
mov r16, r22
|
||||||
|
or r16, r23 ; zero?
|
||||||
|
clc
|
||||||
|
breq sensorWatchCheckAgainstLimit_ret ; yes, jmp
|
||||||
|
|
||||||
|
cp r22, r20
|
||||||
|
cpc r23, r21
|
||||||
|
brcc sensorWatchCheckAgainstLimit_secRet
|
||||||
|
clc
|
||||||
|
rjmp sensorWatchCheckAgainstLimit_ret
|
||||||
|
sensorWatchCheckAgainstLimit_secRet:
|
||||||
|
sec
|
||||||
|
sensorWatchCheckAgainstLimit_ret:
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine sensorWatchSetValueLabel
|
; @routine sensorWatchSetValueLabel
|
||||||
;
|
;
|
||||||
@@ -364,12 +461,14 @@ sensorWatchSetValueLabel_ret:
|
|||||||
|
|
||||||
|
|
||||||
SensorWatch_DefaultSignalmap:
|
SensorWatch_DefaultSignalmap:
|
||||||
.db 0, OBJECT_SIGNAL_CREATE, LOW(SensorWatch_OnCreate), HIGH(SensorWatch_OnCreate)
|
.db 0, OBJECT_SIGNAL_CREATE, LOW(SensorWatch_OnCreate), HIGH(SensorWatch_OnCreate)
|
||||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
||||||
.db 0, OBJECT_SIGNAL_RECVMSG, LOW(SensorWatch_OnMsgReceived), HIGH(SensorWatch_OnMsgReceived)
|
.db 0, OBJECT_SIGNAL_RECVMSG, LOW(SensorWatch_OnMsgReceived), HIGH(SensorWatch_OnMsgReceived)
|
||||||
.db 0, SENSORWATCH_SIGNAL_SETSOURCE, LOW(SensorWatch_OnSetSource), HIGH(SensorWatch_OnSetSource)
|
.db 0, SENSORWATCH_SIGNAL_SETSOURCE, LOW(SensorWatch_OnSetSource), HIGH(SensorWatch_OnSetSource)
|
||||||
.db 0, SENSORWATCH_SIGNAL_SETLIMWARN, LOW(SensorWatch_OnSetLimitWarn), HIGH(SensorWatch_OnSetLimitWarn)
|
.db 0, SENSORWATCH_SIGNAL_SETUPPERLIMWARN, LOW(SensorWatch_OnSetUpperLimitWarn), HIGH(SensorWatch_OnSetUpperLimitWarn)
|
||||||
.db 0, SENSORWATCH_SIGNAL_SETLIMCRIT, LOW(SensorWatch_OnSetLimitCrit), HIGH(SensorWatch_OnSetLimitCrit)
|
.db 0, SENSORWATCH_SIGNAL_SETLOWERLIMWARN, LOW(SensorWatch_OnSetLowerLimitWarn), HIGH(SensorWatch_OnSetLowerLimitWarn)
|
||||||
|
.db 0, SENSORWATCH_SIGNAL_SETUPPERLIMCRIT, LOW(SensorWatch_OnSetUpperLimitCrit), HIGH(SensorWatch_OnSetUpperLimitCrit)
|
||||||
|
.db 0, SENSORWATCH_SIGNAL_SETLOWERLIMCRIT, LOW(SensorWatch_OnSetLowerLimitCrit), HIGH(SensorWatch_OnSetLowerLimitCrit)
|
||||||
.db 0, 0, 0, 0 ; end of table
|
.db 0, 0, 0, 0 ; end of table
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user