c03: more work on climate and netstats windows.

This commit is contained in:
Martin Preuss
2026-04-07 23:56:14 +02:00
parent d7074388e6
commit 5a9bff2d0b
2 changed files with 55 additions and 23 deletions

View File

@@ -38,18 +38,39 @@ ClimateWin_new:
brcc ClimateWin_new_ret
mov xl, r18 ; use root window as parent for main window
mov xh, r19
ldi r24, LOW(CLIMATEWIN_SIZE)
ldi r25, HIGH(CLIMATEWIN_SIZE)
bigcall Object_Alloc ; Y=space (!r16, !r17, !X)
brcc ClimateWin_new_ret
rcall ClimateWin_Init
ClimateWin_new_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine ClimateWin_new @global
;
; @param Y pointer to newly allocated widget data
; @param X pointer to root window
; @return CFLAG set of okay, cleared otherwise
; @clobbers any, !Y
ClimateWin_Init:
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_TXT_ROOMCLIMATE)
ldi r21, HIGH(RESSSOURCE_TXT_ROOMCLIMATE)
bigcall MainWindow_new ; Y=main window
brcc ClimateWin_new_ret
brcc ClimateWin_Init_ret
bigcall MainWindow_GetContentWidget ; r19:r18=content window
brcc ClimateWin_new_ret
brcc ClimateWin_Init_ret
mov xl, r18 ; use content window as parent
mov xh, r19
; Y=MainWindow
push yl ; main window
push yh
push xl ; content window
@@ -60,7 +81,7 @@ ClimateWin_new:
bigcall C03App_CreateBackButton
pop yh ; main window
pop yl
ClimateWin_new_ret:
ClimateWin_Init_ret:
ret
; @end
@@ -71,7 +92,6 @@ ClimateWin_new_ret:
;
; @param X pointer to MainWindow content window (becomes parent)
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object
climateWinCreateSensorWatches:
ldi r16, 0 ; OPTS

View File

@@ -78,22 +78,20 @@ NetStatWin_Init:
ldi r16, NETSTATWIN_TIMERVAL
std Y+NETSTATWIN_OFFS_TIMER, r16
bigcall MainWindow_GetContentWidget ; r19:r18=content window
brcc NetStatWin_Init_ret
mov xl, r18 ; use content window as parent
mov xh, r19
; Y=MainWindow
push yl
push yh
bigcall MainWindow_GetContentWidget ; r19:r18=content window
brcc NetStatWin_Init_popRet
mov xl, r18 ; use content window as parent
mov xh, r19
push xl ; content window
push xh
rcall netStatWinCreateContent
pop xh
pop xl
brcc NetStatWin_Init_popRet
bigcall C03App_CreateBackButton
NetStatWin_Init_popRet:
pop yh
pop yl
NetStatWin_Init_ret:
@@ -127,6 +125,22 @@ NetStatWin_OnTimer_ret:
NetStatWin_OnShow:
bigcall Widget_OnShow
push yl
push yh
rcall netStatWinUpdate
pop yh
pop yl
; reset timer
ldi r16, NETSTATWIN_TIMERVAL
std Y+NETSTATWIN_OFFS_TIMER, r16
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine netStatWinCreateContent
;
@@ -136,19 +150,16 @@ NetStatWin_OnTimer_ret:
netStatWinCreateContent:
; create MLayout
push yl
push yh
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, MLAYOUT_MODE_COLUMNS
ldi r21, 2 ; columns per row
bigcall MLayout_new
mov xl, yl ; use MLayout as parent
mov xh, yh
pop yh
pop yl
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, MLAYOUT_MODE_COLUMNS
ldi r21, 2 ; columns per row
bigcall MLayout_new
brcc netStatWinCreateContent_ret
mov xl, yl ; use MLayout as parent
mov xh, yh
ldi r20, LOW(RESSSOURCE_TXT_PACKETSIN)
ldi r21, HIGH(RESSSOURCE_TXT_PACKETSIN)
rcall netStatWinCreateWidgetPair ; (any, !X, !Y)
@@ -342,7 +353,8 @@ NetStatWin_DefaultSignalmap:
; header
.dw MainWindow_DefaultSignalmap*2 ; next table to use
; entries
.db 0, OBJECT_SIGNAL_TIMER, LOW(NetStatWin_OnTimer), HIGH(NetStatWin_OnTimer)
.db 0, OBJECT_SIGNAL_TIMER, LOW(NetStatWin_OnTimer), HIGH(NetStatWin_OnTimer)
.db 0, WIDGET_SIGNAL_SHOW, LOW(NetStatWin_OnShow), HIGH(NetStatWin_OnShow)
.db 0, 0, 0, 0 ; end of table