gui2: started working on SensorWatch for GUI2. Works so far.
This commit is contained in:
@@ -266,46 +266,21 @@ test:
|
|||||||
bigcall MainWindow_new
|
bigcall MainWindow_new
|
||||||
bigcall MainWindow_GetContentWidget
|
bigcall MainWindow_GetContentWidget
|
||||||
brcc DEBUG_STOP
|
brcc DEBUG_STOP
|
||||||
mov xl, yl
|
mov xl, yl ; X=MainWindow
|
||||||
mov xh, yh
|
mov xh, yh
|
||||||
push xl
|
push xl ; mainWindow
|
||||||
push xh
|
push xh
|
||||||
mov xl, r18
|
mov xl, r18 ; contentWindow
|
||||||
mov xh, r19
|
mov xh, r19
|
||||||
|
|
||||||
push xl ; content window
|
|
||||||
push xh
|
|
||||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | (1<<WIDGET_OPTS_INPUT_BIT) ; OPTS
|
|
||||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
||||||
ldi r20, BUTTON_MODE_NORMAL
|
|
||||||
bigcall Button_new
|
|
||||||
mov xl, yl
|
|
||||||
mov xh, yh
|
|
||||||
|
|
||||||
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
|
||||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) |\
|
|
||||||
(WIDGET_PACK_BEGIN<<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VCONTENT0_BIT)
|
|
||||||
ldi r20, LOW(RESSSOURCE_TXT_BUERO)
|
|
||||||
ldi r21, HIGH(RESSSOURCE_TXT_BUERO)
|
|
||||||
bigcall Label_new
|
|
||||||
pop xh
|
|
||||||
pop xl
|
|
||||||
|
|
||||||
push xl
|
push xl
|
||||||
push xh
|
push xh
|
||||||
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | (1<<WIDGET_OPTS_INPUT_BIT) ; OPTS
|
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | (1<<WIDGET_OPTS_INPUT_BIT) | (1<<WIDGET_OPTS_BORDER_BIT) ; OPTS
|
||||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||||
ldi r20, BUTTON_MODE_NORMAL
|
ldi r20, VALUE_ID_SENSOR_CO2_BASE
|
||||||
bigcall Button_new
|
ldi r21, C03_EEID_SENSOR_CO2
|
||||||
mov xl, yl
|
ldi r22, SENSORWATCH_TYPE_CO2
|
||||||
mov xh, yh
|
bigcall SensorWatch_new
|
||||||
|
|
||||||
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
|
||||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) |\
|
|
||||||
(WIDGET_PACK_BEGIN<<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VCONTENT0_BIT)
|
|
||||||
ldi r20, LOW(RESSSOURCE_IMG_TEMP96)
|
|
||||||
ldi r21, HIGH(RESSSOURCE_IMG_TEMP96)
|
|
||||||
bigcall ImageView_new
|
|
||||||
pop xh
|
pop xh
|
||||||
pop xl
|
pop xl
|
||||||
|
|
||||||
@@ -365,6 +340,7 @@ DEBUG_STOP3:
|
|||||||
.include "style.asm"
|
.include "style.asm"
|
||||||
|
|
||||||
|
|
||||||
|
GUI2_MODULE_BEGIN:
|
||||||
.include "modules/lcd2/gui2/base/object.asm"
|
.include "modules/lcd2/gui2/base/object.asm"
|
||||||
.include "modules/lcd2/gui2/base/widget.asm"
|
.include "modules/lcd2/gui2/base/widget.asm"
|
||||||
.include "modules/lcd2/gui2/base/layout.asm"
|
.include "modules/lcd2/gui2/base/layout.asm"
|
||||||
@@ -377,6 +353,10 @@ DEBUG_STOP3:
|
|||||||
.include "modules/lcd2/gui2/base/button.asm"
|
.include "modules/lcd2/gui2/base/button.asm"
|
||||||
.include "modules/lcd2/gui2/base/imageview.asm"
|
.include "modules/lcd2/gui2/base/imageview.asm"
|
||||||
.include "modules/lcd2/gui2/base/valuelabel.asm"
|
.include "modules/lcd2/gui2/base/valuelabel.asm"
|
||||||
|
.include "modules/lcd2/gui2/aqhome/sensorwatch.asm"
|
||||||
|
GUI2_MODULE_END:
|
||||||
|
|
||||||
|
.equ MODULE_SIZE_GUI2 = GUI2_MODULE_END-GUI2_MODULE_BEGIN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
.org RESSOURCE_ADDR
|
.org RESSOURCE_ADDR
|
||||||
|
|
||||||
RessourceTable:
|
RessourceTable:
|
||||||
.dw 29 ; num of ressources
|
.dw 33 ; num of ressources
|
||||||
.dw (resImageNetwork*2) ; 0: RESSSOURCE_IMG_NETWORK
|
.dw (resImageNetwork*2) ; 0: RESSSOURCE_IMG_NETWORK
|
||||||
.dw (resImageCloud*2) ; 1: RESSSOURCE_IMG_CLOUD
|
.dw (resImageCloud*2) ; 1: RESSSOURCE_IMG_CLOUD
|
||||||
.dw (resImageTemp*2) ; 2: RESSSOURCE_IMG_TEMP
|
.dw (resImageTemp*2) ; 2: RESSSOURCE_IMG_TEMP
|
||||||
@@ -54,6 +54,10 @@ RessourceTable:
|
|||||||
.dw (resTextAttic*2) ; 26: RESSSOURCE_TXT_ATTIC
|
.dw (resTextAttic*2) ; 26: RESSSOURCE_TXT_ATTIC
|
||||||
.dw (resImageReset*2) ; 27: RESSSOURCE_IMG_RESET
|
.dw (resImageReset*2) ; 27: RESSSOURCE_IMG_RESET
|
||||||
.dw (resImageDebugEeprom*2) ; 28: RESSSOURCE_IMG_DEBUGEEPROM
|
.dw (resImageDebugEeprom*2) ; 28: RESSSOURCE_IMG_DEBUGEEPROM
|
||||||
|
.dw (resTextC02_s*2) ; 29: RESSSOURCE_TXT_CO2_S
|
||||||
|
.dw (resTextTemp_s*2) ; 30: RESSSOURCE_TXT_TEMP_S
|
||||||
|
.dw (resTextHum_s*2) ; 31: RESSSOURCE_TXT_HUM_S
|
||||||
|
.dw (resTextUnknown_s*2) ; 32: RESSSOURCE_TXT_UNKNOWN_S
|
||||||
|
|
||||||
|
|
||||||
resImageNetwork:
|
resImageNetwork:
|
||||||
@@ -1023,6 +1027,18 @@ resTextCellar:
|
|||||||
resTextAttic:
|
resTextAttic:
|
||||||
.db "Dachboden", 0
|
.db "Dachboden", 0
|
||||||
|
|
||||||
|
resTextC02_s:
|
||||||
|
.db "CO2", 0
|
||||||
|
|
||||||
|
resTextTemp_s:
|
||||||
|
.db "Temp", 0, 0
|
||||||
|
|
||||||
|
resTextHum_s:
|
||||||
|
.db "Feuchte", 0
|
||||||
|
|
||||||
|
resTextUnknown_s:
|
||||||
|
.db "???", 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,10 @@
|
|||||||
.equ RESSSOURCE_TXT_ATTIC = 26
|
.equ RESSSOURCE_TXT_ATTIC = 26
|
||||||
.equ RESSSOURCE_IMG_RESET = 27
|
.equ RESSSOURCE_IMG_RESET = 27
|
||||||
.equ RESSSOURCE_IMG_DEBUGEEPROM = 28
|
.equ RESSSOURCE_IMG_DEBUGEEPROM = 28
|
||||||
|
.equ RESSSOURCE_TXT_CO2_S = 29
|
||||||
|
.equ RESSSOURCE_TXT_TEMP_S = 30
|
||||||
|
.equ RESSSOURCE_TXT_HUM_S = 31
|
||||||
|
.equ RESSSOURCE_TXT_UNKNOWN_S = 32
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
316
avr/modules/lcd2/gui2/aqhome/sensorwatch.asm
Normal file
316
avr/modules/lcd2/gui2/aqhome/sensorwatch.asm
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; copyright : (C) 2026 by Martin Preuss
|
||||||
|
; email : martin@libchipcard.de
|
||||||
|
;
|
||||||
|
; ***************************************************************************
|
||||||
|
; * This file is part of the project "AqHome". *
|
||||||
|
; * Please see toplevel file COPYING of that project for license details. *
|
||||||
|
; ***************************************************************************
|
||||||
|
|
||||||
|
#ifndef AQH_AVR_GUI2_SENSORWATCH_ASM
|
||||||
|
#define AQH_AVR_GUI2_SENSORWATCH_ASM
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; defines
|
||||||
|
|
||||||
|
.equ SENSORWATCH_OFFS_BEGIN = VLAYOUT_SIZE
|
||||||
|
.equ SENSORWATCH_OFFS_BASEVALUEID = SENSORWATCH_OFFS_BEGIN+0
|
||||||
|
.equ SENSORWATCH_OFFS_EEPROMID = SENSORWATCH_OFFS_BEGIN+1
|
||||||
|
.equ SENSORWATCH_OFFS_NODEADDR = SENSORWATCH_OFFS_BEGIN+2
|
||||||
|
.equ SENSORWATCH_OFFS_VALUEID = SENSORWATCH_OFFS_BEGIN+3
|
||||||
|
.equ SENSORWATCH_OFFS_UPPER_LIMIT_WARN_LO = SENSORWATCH_OFFS_BEGIN+4
|
||||||
|
.equ SENSORWATCH_OFFS_UPPER_LIMIT_WARN_HI = SENSORWATCH_OFFS_BEGIN+5
|
||||||
|
.equ SENSORWATCH_OFFS_LOWER_LIMIT_WARN_LO = SENSORWATCH_OFFS_BEGIN+6
|
||||||
|
.equ SENSORWATCH_OFFS_LOWER_LIMIT_WARN_HI = SENSORWATCH_OFFS_BEGIN+7
|
||||||
|
.equ SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_LO = SENSORWATCH_OFFS_BEGIN+8
|
||||||
|
.equ SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_HI = SENSORWATCH_OFFS_BEGIN+9
|
||||||
|
.equ SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_LO = SENSORWATCH_OFFS_BEGIN+10
|
||||||
|
.equ SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_HI = SENSORWATCH_OFFS_BEGIN+11
|
||||||
|
.equ SENSORWATCH_OFFS_VALUE_LO = SENSORWATCH_OFFS_BEGIN+12
|
||||||
|
.equ SENSORWATCH_OFFS_VALUE_HI = SENSORWATCH_OFFS_BEGIN+13
|
||||||
|
.equ SENSORWATCH_OFFS_TYPE = SENSORWATCH_OFFS_BEGIN+14
|
||||||
|
.equ SENSORWATCH_SIZE = SENSORWATCH_OFFS_BEGIN+15
|
||||||
|
|
||||||
|
|
||||||
|
.equ SENSORWATCH_VALUE = WIDGET_VALUE_NEXTFREE+0
|
||||||
|
.equ SENSORWATCH_VALUE_NEXTFREE = SENSORWATCH_VALUE+1
|
||||||
|
|
||||||
|
|
||||||
|
.equ SENSORWATCH_TYPE_CO2 = 1
|
||||||
|
.equ SENSORWATCH_TYPE_TEMP = 2
|
||||||
|
.equ SENSORWATCH_TYPE_HUM = 3
|
||||||
|
.equ SENSORWATCH_TYPE_NEXTFREE = 4
|
||||||
|
|
||||||
|
|
||||||
|
; descriptors
|
||||||
|
.equ SENSORWATCH_DESCR_OFFS_TITLERES = 0
|
||||||
|
.equ SENSORWATCH_DESCR_OFFS_IMGRES = 2
|
||||||
|
.equ SENSORWATCH_DESCR_OFFS_POSTKOMMADIGITS = 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; code
|
||||||
|
|
||||||
|
.cseg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine SensorWatch_new @global
|
||||||
|
;
|
||||||
|
; @return CFLAG set of okay, cleared otherwise
|
||||||
|
; @return Y address of newly created object
|
||||||
|
; @param X parent widget
|
||||||
|
; @param r16 value for OBJECT_OFFS_OPTS
|
||||||
|
; @param r17 value for WIDGET_OFFS_PACK
|
||||||
|
; @param r20 base value id
|
||||||
|
; @param r21 eeprom id
|
||||||
|
; @param r22 type (see @ref SENSORWATCH_TYPE_CO2)
|
||||||
|
; @clobbers any
|
||||||
|
|
||||||
|
SensorWatch_new:
|
||||||
|
push r20
|
||||||
|
push r21
|
||||||
|
push r22
|
||||||
|
ldi r24, LOW(SENSORWATCH_SIZE)
|
||||||
|
ldi r25, HIGH(SENSORWATCH_SIZE)
|
||||||
|
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||||
|
pop r22
|
||||||
|
pop r21
|
||||||
|
pop r20
|
||||||
|
brcc SensorWatch_new_ret
|
||||||
|
rcall SensorWatch_Init ; (r16, r17, X)
|
||||||
|
sec
|
||||||
|
SensorWatch_new_ret:
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine SensorWatch_Init @global
|
||||||
|
;
|
||||||
|
; @param Y address of widget
|
||||||
|
; @param X parent widget (if any)
|
||||||
|
; @param r16 value for OBJECT_OFFS_OPTS
|
||||||
|
; @param r17 value for WIDGET_OFFS_PACK
|
||||||
|
; @param r20 base value id
|
||||||
|
; @param r21 eeprom id
|
||||||
|
; @param r22 type (see @ref SENSORWATCH_TYPE_CO2)
|
||||||
|
; @clobbers r16, r17, X
|
||||||
|
|
||||||
|
SensorWatch_Init:
|
||||||
|
push r20
|
||||||
|
push r21
|
||||||
|
push r22
|
||||||
|
; call base class
|
||||||
|
bigcall VLayout_Init
|
||||||
|
pop r22
|
||||||
|
pop r21
|
||||||
|
pop r20
|
||||||
|
|
||||||
|
; setup valueLabel data
|
||||||
|
std Y+SENSORWATCH_OFFS_BASEVALUEID, r20
|
||||||
|
std Y+SENSORWATCH_OFFS_EEPROMID, r21
|
||||||
|
std Y+SENSORWATCH_OFFS_TYPE, r22
|
||||||
|
|
||||||
|
; set default signal map
|
||||||
|
ldi r16, LOW(SensorWatch_DefaultSignalmap*2)
|
||||||
|
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||||
|
ldi r16, HIGH(SensorWatch_DefaultSignalmap*2)
|
||||||
|
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||||
|
|
||||||
|
; create sub windows
|
||||||
|
rcall sensorWatchCreateTitleLabel
|
||||||
|
rcall sensorWatchCreateImageViewer
|
||||||
|
rcall sensorWatchCreateValueLabel
|
||||||
|
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchGetTitleResId
|
||||||
|
;
|
||||||
|
; @param r16 sensor type (see @ref SENSORWATCH_TYPE_CO2)
|
||||||
|
; @return r21:r20 ressource for sensor title
|
||||||
|
|
||||||
|
sensorWatchGetTitleResId:
|
||||||
|
rcall sensorWatchGetDescriptor ; (r17, r18, r19)
|
||||||
|
adiw zh:zl, SENSORWATCH_DESCR_OFFS_TITLERES
|
||||||
|
lpm r20, Z+
|
||||||
|
lpm r21, Z
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchGetImgResId
|
||||||
|
;
|
||||||
|
; @param r16 sensor type (see @ref SENSORWATCH_TYPE_CO2)
|
||||||
|
; @return r21:r20 ressource for sensor title
|
||||||
|
|
||||||
|
sensorWatchGetImgResId:
|
||||||
|
rcall sensorWatchGetDescriptor ; (r17, r18, r19)
|
||||||
|
adiw zh:zl, SENSORWATCH_DESCR_OFFS_IMGRES
|
||||||
|
lpm r20, Z+
|
||||||
|
lpm r21, Z
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchGetPostKommaDigits
|
||||||
|
;
|
||||||
|
; @param r16 sensor type (see @ref SENSORWATCH_TYPE_CO2)
|
||||||
|
; @return r20 postkomma digits
|
||||||
|
|
||||||
|
sensorWatchGetPostKommaDigits:
|
||||||
|
rcall sensorWatchGetDescriptor ; (r17, r18, r19)
|
||||||
|
adiw zh:zl, SENSORWATCH_DESCR_OFFS_POSTKOMMADIGITS
|
||||||
|
lpm r20, Z
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchGetDescriptor
|
||||||
|
;
|
||||||
|
; @param r16 sensor type (see @ref SENSORWATCH_TYPE_CO2)
|
||||||
|
; @return Z byte address of start of descriptor for sensor type (for LPM!)
|
||||||
|
; @clobbers r17, r18, r19
|
||||||
|
|
||||||
|
sensorWatchGetDescriptor:
|
||||||
|
cpi r16, SENSORWATCH_TYPE_NEXTFREE
|
||||||
|
brcs sensorWatchGetDescriptor_get
|
||||||
|
clr r16 ; default to entry 0
|
||||||
|
sensorWatchGetDescriptor_get:
|
||||||
|
ldi zl, LOW(SensorWatch_Descriptors*2)
|
||||||
|
ldi zh, HIGH(SensorWatch_Descriptors*2)
|
||||||
|
clr r17
|
||||||
|
mov r18, r16
|
||||||
|
mov r19, r17
|
||||||
|
lsl r18 ; *2
|
||||||
|
rol r19
|
||||||
|
add r18, r16 ; *3
|
||||||
|
adc r19, r17
|
||||||
|
lsl r18 ; *6
|
||||||
|
rol r19
|
||||||
|
add zl, r18
|
||||||
|
adc zh, r19
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchCreateTitleLabel
|
||||||
|
;
|
||||||
|
; @param Y address of main window widget
|
||||||
|
; @param r21:r20 ressource id for title
|
||||||
|
; @return CFLAG set of okay, cleared otherwise
|
||||||
|
|
||||||
|
sensorWatchCreateTitleLabel:
|
||||||
|
push yl
|
||||||
|
push yh
|
||||||
|
ldd r16, Y+SENSORWATCH_OFFS_TYPE
|
||||||
|
rcall sensorWatchGetTitleResId ; r21:r20=ressource id for title
|
||||||
|
mov xl, yl
|
||||||
|
mov xh, yh
|
||||||
|
ldi r16, 0
|
||||||
|
ldi r17, (WIDGET_PACK_CENTER<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VSELF0_BIT) | \
|
||||||
|
(WIDGET_PACK_CENTER<<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT)
|
||||||
|
bigcall Label_new
|
||||||
|
pop yh
|
||||||
|
pop yl
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchCreateImageViewer
|
||||||
|
;
|
||||||
|
; @param Y address of main window widget
|
||||||
|
; @param r21:r20 ressource id for image
|
||||||
|
; @return CFLAG set of okay, cleared otherwise
|
||||||
|
|
||||||
|
sensorWatchCreateImageViewer:
|
||||||
|
push yl
|
||||||
|
push yh
|
||||||
|
ldd r16, Y+SENSORWATCH_OFFS_TYPE
|
||||||
|
rcall sensorWatchGetImgResId ; r21:r20=ressource id for image
|
||||||
|
mov xl, yl
|
||||||
|
mov xh, yh
|
||||||
|
ldi r16, 0
|
||||||
|
ldi r17, (WIDGET_PACK_CENTER<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) | \
|
||||||
|
(WIDGET_PACK_CENTER <<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT)
|
||||||
|
bigcall ImageView_new
|
||||||
|
pop yh
|
||||||
|
pop yl
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine sensorWatchCreateValueLabel
|
||||||
|
;
|
||||||
|
; @param Y address of main window widget
|
||||||
|
; @return CFLAG set of okay, cleared otherwise
|
||||||
|
|
||||||
|
sensorWatchCreateValueLabel:
|
||||||
|
push yl
|
||||||
|
push yh
|
||||||
|
ldd r16, Y+SENSORWATCH_OFFS_TYPE
|
||||||
|
rcall sensorWatchGetPostKommaDigits ; r20=postkomma digits
|
||||||
|
mov xl, yl
|
||||||
|
mov xh, yh
|
||||||
|
ldi r16, 0
|
||||||
|
ldi r17, (WIDGET_PACK_CENTER<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) | \
|
||||||
|
(WIDGET_PACK_CENTER <<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT)
|
||||||
|
bigcall ValueLabel_new
|
||||||
|
pop yh
|
||||||
|
pop yl
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; data in FLASH
|
||||||
|
|
||||||
|
SensorWatch_DefaultSignalmap:
|
||||||
|
; header
|
||||||
|
.dw VLayout_DefaultSignalmap*2 ; next table to use
|
||||||
|
; entries
|
||||||
|
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
||||||
|
.db 0, 0, 0, 0 ; end of table
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SensorWatch_Descriptors:
|
||||||
|
; res for title res for image post-komma digits
|
||||||
|
.dw RESSSOURCE_TXT_UNKNOWN_S, RESSSOURCE_IMG_CLOUD96, 0 ; unknown
|
||||||
|
.dw RESSSOURCE_TXT_CO2_S, RESSSOURCE_IMG_CLOUD96, 0 ; co2
|
||||||
|
.dw RESSSOURCE_TXT_TEMP_S, RESSSOURCE_IMG_TEMP96, 2 ; temp
|
||||||
|
.dw RESSSOURCE_TXT_HUM_S, RESSSOURCE_IMG_HUMIDITY96, 0 ; hum
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -244,7 +244,8 @@ hLayoutVertically_setHeight:
|
|||||||
std Y+WIDGET_OFFS_HEIGHT_HI, r13
|
std Y+WIDGET_OFFS_HEIGHT_HI, r13
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
mov yl, xl
|
ldd r17, Y+WIDGET_OFFS_PACK
|
||||||
|
mov yl, xl ; use parent
|
||||||
mov yh, xh
|
mov yh, xh
|
||||||
rcall Widget_PackSelfY ; R7:R6=new pos (r17, r18, r19, r20, r21)
|
rcall Widget_PackSelfY ; R7:R6=new pos (r17, r18, r19, r20, r21)
|
||||||
pop yh
|
pop yh
|
||||||
|
|||||||
@@ -130,10 +130,11 @@ Label_OnDraw:
|
|||||||
bigcall Widget_Clear
|
bigcall Widget_Clear
|
||||||
rcall labelWriteText
|
rcall labelWriteText
|
||||||
|
|
||||||
ldd r16, Y+OBJECT_OFFS_OPTS
|
; DEBUG
|
||||||
andi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
; ldd r16, Y+OBJECT_OFFS_OPTS
|
||||||
breq Label_OnDraw_done
|
; andi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
||||||
bigcall Widget_DrawBorder
|
; breq Label_OnDraw_done
|
||||||
|
; bigcall Widget_DrawBorder
|
||||||
|
|
||||||
Label_OnDraw_done:
|
Label_OnDraw_done:
|
||||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||||
|
|||||||
@@ -258,7 +258,8 @@ vLayoutHorizontally_setWidth:
|
|||||||
std Y+WIDGET_OFFS_WIDTH_HI, r13
|
std Y+WIDGET_OFFS_WIDTH_HI, r13
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
mov yl, xl
|
ldd r17, Y+WIDGET_OFFS_PACK
|
||||||
|
mov yl, xl ; use parent
|
||||||
mov yh, xh
|
mov yh, xh
|
||||||
rcall Widget_PackSelfX ; R5:R4=new pos (r17, r18, r19, r20, r21)
|
rcall Widget_PackSelfX ; R5:R4=new pos (r17, r18, r19, r20, r21)
|
||||||
pop yh
|
pop yh
|
||||||
|
|||||||
@@ -519,6 +519,11 @@ Widget_OnDraw:
|
|||||||
; clear widget background
|
; clear widget background
|
||||||
rcall Widget_Clear ; (any, !Y)
|
rcall Widget_Clear ; (any, !Y)
|
||||||
|
|
||||||
|
ldd r17, Y+OBJECT_OFFS_OPTS
|
||||||
|
sbrs r17, WIDGET_OPTS_BORDER_BIT
|
||||||
|
rjmp Widget_OnDraw_ret
|
||||||
|
bigcall Widget_DrawBorder
|
||||||
|
|
||||||
Widget_OnDraw_ret:
|
Widget_OnDraw_ret:
|
||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
@@ -1051,13 +1056,13 @@ Widget_CalcStringWidthSDRAM_done:
|
|||||||
;
|
;
|
||||||
; @param Y address of widget
|
; @param Y address of widget
|
||||||
; @param R13:R12 width of object to align
|
; @param R13:R12 width of object to align
|
||||||
|
; @param r17 pack mode (see @ref WIDGET_PACK_BEGIN)
|
||||||
; @return R5:R4 X
|
; @return R5:R4 X
|
||||||
; @clobbers r17, r18, r19, r20, r21
|
; @clobbers r17, r18, r19, r20, r21
|
||||||
|
|
||||||
Widget_PackSelfX:
|
Widget_PackSelfX:
|
||||||
ldd r18, Y+WIDGET_OFFS_WIDTH_LO
|
ldd r18, Y+WIDGET_OFFS_WIDTH_LO
|
||||||
ldd r19, Y+WIDGET_OFFS_WIDTH_HI
|
ldd r19, Y+WIDGET_OFFS_WIDTH_HI
|
||||||
ldd r17, Y+WIDGET_OFFS_PACK
|
|
||||||
andi r17, 3 ; WIDGET_PACK_HSELF0_BIT = 0, no shift necessary
|
andi r17, 3 ; WIDGET_PACK_HSELF0_BIT = 0, no shift necessary
|
||||||
rcall widgetPack ; r21:r20=new pos (r17, r18, r19)
|
rcall widgetPack ; r21:r20=new pos (r17, r18, r19)
|
||||||
mov r4, r20
|
mov r4, r20
|
||||||
@@ -1074,13 +1079,13 @@ Widget_PackSelfX:
|
|||||||
;
|
;
|
||||||
; @param Y address of widget
|
; @param Y address of widget
|
||||||
; @param R13:R12 height of object to align
|
; @param R13:R12 height of object to align
|
||||||
|
; @param r17 pack mode (see @ref WIDGET_PACK_BEGIN)
|
||||||
; @return R7:R6 Y
|
; @return R7:R6 Y
|
||||||
; @clobbers r17, r18, r19, r20, r21
|
; @clobbers r17, r18, r19, r20, r21
|
||||||
|
|
||||||
Widget_PackSelfY:
|
Widget_PackSelfY:
|
||||||
ldd r18, Y+WIDGET_OFFS_HEIGHT_LO
|
ldd r18, Y+WIDGET_OFFS_HEIGHT_LO
|
||||||
ldd r19, Y+WIDGET_OFFS_HEIGHT_HI
|
ldd r19, Y+WIDGET_OFFS_HEIGHT_HI
|
||||||
ldd r17, Y+WIDGET_OFFS_PACK
|
|
||||||
lsr r17 ; WIDGET_PACK_VSELF0_BIT = 2 -> shift 2 times right
|
lsr r17 ; WIDGET_PACK_VSELF0_BIT = 2 -> shift 2 times right
|
||||||
lsr r17
|
lsr r17
|
||||||
andi r17, 3
|
andi r17, 3
|
||||||
|
|||||||
Reference in New Issue
Block a user