diff --git a/avr/devices/c03/main/main.asm b/avr/devices/c03/main/main.asm
index e87e956..38b21c2 100644
--- a/avr/devices/c03/main/main.asm
+++ b/avr/devices/c03/main/main.asm
@@ -63,13 +63,10 @@
;#define MODULES_LCD
;#define LCD_MINIMAL_FONT
;#define MODULES_SI7021
-;#define MODULES_SGP30
-;#define MODULES_SGP40
;#define MODULES_STATS
;#define MODULES_OWI_MASTER
-;#define MODULES_DS18B20
;#define MODULES_MOTION
-;#define MODULES_CCS811
+;#define MODULES_BRIGHTNESS
#define APPS_NETWORK
;#define APPS_MOTION
@@ -526,29 +523,24 @@ Debug_Style:
.include "style.asm"
-GUI2_MODULE_BEGIN:
-.include "modules/lcd2/gui2/base/object.asm"
-.include "modules/lcd2/gui2/base/widget.asm"
-;.include "modules/lcd2/gui2/base/layout.asm"
-;.include "modules/lcd2/gui2/base/hlayout.asm"
-;.include "modules/lcd2/gui2/base/vlayout.asm"
-;.include "modules/lcd2/gui2/base/mlayout.asm"
-;.include "modules/lcd2/gui2/base/mlayout_column.asm"
-.include "modules/lcd2/gui2/base/guiapp.asm"
-.include "modules/lcd2/gui2/base/rootwindow.asm"
-.include "modules/lcd2/gui2/base/label.asm"
-.include "modules/lcd2/gui2/base/button.asm"
-.include "modules/lcd2/gui2/base/imageview.asm"
-.include "modules/lcd2/gui2/base/valuelabel.asm"
-.include "modules/lcd2/gui2/base/layout.asm"
-.include "modules/lcd2/gui2/base/hlayout.asm"
-.include "modules/lcd2/gui2/base/vlayout.asm"
-.include "modules/lcd2/gui2/base/mclayout.asm"
-.include "modules/lcd2/gui2/base/mainwindow.asm"
-.include "modules/lcd2/gui2/aqhome/sensorwatch.asm"
-.include "modules/lcd2/gui2/screensavers/simple.asm"
-GUI2_MODULE_END:
-.equ MODULE_SIZE_GUI2 = GUI2_MODULE_END-GUI2_MODULE_BEGIN
+GUI_MODULE_BEGIN:
+.include "modules/lcd2/gui/base/object.asm"
+.include "modules/lcd2/gui/base/widget.asm"
+.include "modules/lcd2/gui/base/guiapp.asm"
+.include "modules/lcd2/gui/base/rootwindow.asm"
+.include "modules/lcd2/gui/base/label.asm"
+.include "modules/lcd2/gui/base/button.asm"
+.include "modules/lcd2/gui/base/imageview.asm"
+.include "modules/lcd2/gui/base/valuelabel.asm"
+.include "modules/lcd2/gui/base/layout.asm"
+.include "modules/lcd2/gui/base/hlayout.asm"
+.include "modules/lcd2/gui/base/vlayout.asm"
+.include "modules/lcd2/gui/base/mclayout.asm"
+.include "modules/lcd2/gui/base/mainwindow.asm"
+.include "modules/lcd2/gui/aqhome/sensorwatch.asm"
+.include "modules/lcd2/gui/screensavers/simple.asm"
+GUI_MODULE_END:
+.equ MODULE_SIZE_GUI = GUI_MODULE_END-GUI_MODULE_BEGIN
.include "a_c03.asm"
.include "w_menu.asm"
diff --git a/avr/modules/lcd2/gui/0BUILD b/avr/modules/lcd2/gui/0BUILD
index 0823627..ea98aaf 100644
--- a/avr/modules/lcd2/gui/0BUILD
+++ b/avr/modules/lcd2/gui/0BUILD
@@ -2,10 +2,16 @@
+
+ aqhome
+ base
+ screensavers
+
+
- sensorwatch.asm
+ README.md
+
-
diff --git a/avr/modules/lcd2/gui2/README.md b/avr/modules/lcd2/gui/README.md
similarity index 100%
rename from avr/modules/lcd2/gui2/README.md
rename to avr/modules/lcd2/gui/README.md
diff --git a/avr/modules/lcd2/gui/TODO b/avr/modules/lcd2/gui/TODO
deleted file mode 100644
index 6ca1031..0000000
--- a/avr/modules/lcd2/gui/TODO
+++ /dev/null
@@ -1,207 +0,0 @@
-
-
-object:
-- next 2 2
-- parent 2 4
-- child 2 6
-- opts 2 8
-- flags 1 9
-- selector 1 10
-- target 2 12
-- signalMap 2 14
-
-widget:
-- X 1 15
-- Y 1 16
-- W 1 17
-- H 1 18
-- style 2 (ptr) 20
- - frontCol 2 2
- - backCol 2 4
- - borderCol 2 6
- - borderWidth 1 7
- - font 2 9
- - charWidth 1 10
- - charHeight 1 11
-
-
-
-page: light
-- up to 8 light bulbs, each for one device
-- lightPage:
- - SDRAM: ptr to lightData
- - address of target device (1 byte)
- - currentMode (1 byte)
- - currentColor (4 bytes)
-
-- 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:
-
- Mode: [Auto] [On] [Off]
- Color: [Preset1] [Preset2] [Preset3]
- Red: [123]
- Green: [123]
- Blue: [123]
- White: [123]
-
-page: numInput (g_win_numinput)
-- SDRAM:
- - prevPage
- - flags
- - minNum
- - maxNum
- - currPos
- - editBuffer[7]
-- widgets:
-
-
-textField:
-- SDRAM:
- - ptrText
- - slots:
- - setText(newText)
- - draw(): draw text and a cursor behind it
-
-
- [123 ]
- ------------
- [7] [8] [9]
- [4] [5] [6]
- [1] [2] [3]
- [,] [0] [<]
- ------------
- [Okay] [Abort]
-
-
-- new pages:
- - main window
- - buttons for climate, netstats, light, doors
- - about window (version, logo etc)
- - lights
- - mode: on, off, auto
- - color: R, G, B, W
- - calibrate screen
-
-- digitEdit
- - arrow_up, below digit, below arrow_down
-
-
-- label:
- - use ressource id instead of pointer to text!
-
-
-- print hex numbers (bytes, words, dwords)
-- room value:
- - bits 0-2: cardinal number (0-7, as in "Buero 1")
- - bits 7-3: room type number (32)
- - Flur
- - Wohnzimmer
- - Schlafzimmer
- - Kueche
- - Buero
- - Kinderzimmer
- - Abstellraum
- - Bad
-
-- new classes:
- - choice
- - "< TEXT >" (choose by clicking buttons left/right)
- - roomLabel (uses room value to print a string)
- - flashingLabel
- - use timer to blink/flash label, e.g. when values change
-
-
- - widgets:
- - value (flashingLabel)
-
-
-
-
-
-
-- imageViewer (use code from testWin)
-- generate bigger images (96x96 px)
- - light
- - window_open
- - window_closed
-
- |--------------------------------------|
- | CO2-Value Temp Humidity |
- | |--------| |--------| |--------| |
- | | Cloud | | Temp | | Hum | |
- | | | | | | | |
- | |--------| |--------| |--------| |
- | |
- | |-----------| |---| |
- | | 1 7 : 4 5 | | S | |
- | |-----------| |---| |
- | |
- |--------------------------------------|
-
-
-
- |--------------------------------------|
- | CO2-Value Temp Humidity |
- | |--------| |--------| |--------| |
- | | Cloud | | Temp | | Hum | |
- | | | | | | | |
- | |--------| |--------| |--------| |
- | |
- | |---| |---| |---| |---| |---| |
- | | < | | N | | L | | ? | | > | |
- | |---| |---| |---| |---| |---| |
- | |
- |--------------------------------------|
-
-Object:
-- next
-- parent
-- firstChild
-- options (2 bytes)
-- signal handling
- - targetAddr (like in FOX)
- - selector
- - handlerMap:
- - selector/signal (00: end), handlerAddr
-Widgets:
-- x (2 bytes)
-- y (2 bytes)
-- width (2 bytes)
-- height (2 bytes)
-- font (2 bytes)
-- frontColor (2 bytes)
-- backColor (2 bytes)
-
-Labels:
-- text
-
-
-Signals:
-- CREATE
-- DESTROY
-- SHOW
-- HIDE
-- DRAW
-- TIMER
-- TOUCH
-[- KEY]
-- USER = 16
-
-
-
-OBJ:
-- SDRAM pointer hierher verschieben
-- speichere dort:
- - FLAGS_LO, FLAGS_HI (2 bytes)
- - NEXT, PARENT, CHILD (6 bytes)
-
-- OBJ_AddNeighbour()
-- OBJ_AddChild()
-- OBJ_Unlink()
diff --git a/avr/modules/lcd2/gui/aqhome/0BUILD b/avr/modules/lcd2/gui/aqhome/0BUILD
new file mode 100644
index 0000000..207e683
--- /dev/null
+++ b/avr/modules/lcd2/gui/aqhome/0BUILD
@@ -0,0 +1,11 @@
+
+
+
+
+
+ sensorwatch.asm
+
+
+
+
+
diff --git a/avr/modules/lcd2/gui2/aqhome/sensorwatch.asm b/avr/modules/lcd2/gui/aqhome/sensorwatch.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/aqhome/sensorwatch.asm
rename to avr/modules/lcd2/gui/aqhome/sensorwatch.asm
diff --git a/avr/modules/lcd2/gui2/base/0BUILD b/avr/modules/lcd2/gui/base/0BUILD
similarity index 88%
rename from avr/modules/lcd2/gui2/base/0BUILD
rename to avr/modules/lcd2/gui/base/0BUILD
index 3e41430..0995f99 100644
--- a/avr/modules/lcd2/gui2/base/0BUILD
+++ b/avr/modules/lcd2/gui/base/0BUILD
@@ -10,9 +10,11 @@
label.asm
layout.asm
mainwindow.asm
+ mclayout.asm
object.asm
rootwindow.asm
valuelabel.asm
+ vlayout.asm
widget.asm
diff --git a/avr/modules/lcd2/gui2/base/button.asm b/avr/modules/lcd2/gui/base/button.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/button.asm
rename to avr/modules/lcd2/gui/base/button.asm
diff --git a/avr/modules/lcd2/gui2/base/guiapp.asm b/avr/modules/lcd2/gui/base/guiapp.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/guiapp.asm
rename to avr/modules/lcd2/gui/base/guiapp.asm
diff --git a/avr/modules/lcd2/gui2/base/hlayout.asm b/avr/modules/lcd2/gui/base/hlayout.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/hlayout.asm
rename to avr/modules/lcd2/gui/base/hlayout.asm
diff --git a/avr/modules/lcd2/gui2/base/imageview.asm b/avr/modules/lcd2/gui/base/imageview.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/imageview.asm
rename to avr/modules/lcd2/gui/base/imageview.asm
diff --git a/avr/modules/lcd2/gui2/base/label.asm b/avr/modules/lcd2/gui/base/label.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/label.asm
rename to avr/modules/lcd2/gui/base/label.asm
diff --git a/avr/modules/lcd2/gui2/base/layout.asm b/avr/modules/lcd2/gui/base/layout.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/layout.asm
rename to avr/modules/lcd2/gui/base/layout.asm
diff --git a/avr/modules/lcd2/gui2/base/mainwindow.asm b/avr/modules/lcd2/gui/base/mainwindow.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/mainwindow.asm
rename to avr/modules/lcd2/gui/base/mainwindow.asm
diff --git a/avr/modules/lcd2/gui2/base/mclayout.asm b/avr/modules/lcd2/gui/base/mclayout.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/mclayout.asm
rename to avr/modules/lcd2/gui/base/mclayout.asm
diff --git a/avr/modules/lcd2/gui2/base/object.asm b/avr/modules/lcd2/gui/base/object.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/object.asm
rename to avr/modules/lcd2/gui/base/object.asm
diff --git a/avr/modules/lcd2/gui2/base/rootwindow.asm b/avr/modules/lcd2/gui/base/rootwindow.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/rootwindow.asm
rename to avr/modules/lcd2/gui/base/rootwindow.asm
diff --git a/avr/modules/lcd2/gui2/base/valuelabel.asm b/avr/modules/lcd2/gui/base/valuelabel.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/valuelabel.asm
rename to avr/modules/lcd2/gui/base/valuelabel.asm
diff --git a/avr/modules/lcd2/gui2/base/vlayout.asm b/avr/modules/lcd2/gui/base/vlayout.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/vlayout.asm
rename to avr/modules/lcd2/gui/base/vlayout.asm
diff --git a/avr/modules/lcd2/gui2/base/widget.asm b/avr/modules/lcd2/gui/base/widget.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/base/widget.asm
rename to avr/modules/lcd2/gui/base/widget.asm
diff --git a/avr/modules/lcd2/gui/eepromdump.asm b/avr/modules/lcd2/gui/eepromdump.asm
deleted file mode 100644
index eb10d1f..0000000
--- a/avr/modules/lcd2/gui/eepromdump.asm
+++ /dev/null
@@ -1,339 +0,0 @@
-; ***************************************************************************
-; 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_EEPROMDUMP_ASM
-#define AQH_AVR_GUI2_EEPROMDUMP_ASM
-
-
-
-; ***************************************************************************
-; defines
-
-
-.equ EEPROMDUMP_FONT = ili9341Font6x8_1
-.equ EEPROMDUMP_FONT_WIDTH = 6
-.equ EEPROMDUMP_FONT_HEIGHT = 8
-
-.equ EEPROMDUMP_BYTESPERLINE = 8
-.equ EEPROMDUMP_LINESPERPAGE = 18
-
-; SDRAM data for EepromDump
-.equ EEPROMDUMP_SD_OFFS_BEGIN = WIDGET_SD_SIZE
-.equ EEPROMDUMP_SD_OFFS_STARTADDR_LO = EEPROMDUMP_SD_OFFS_BEGIN+0
-.equ EEPROMDUMP_SD_OFFS_STARTADDR_HI = EEPROMDUMP_SD_OFFS_BEGIN+1
-.equ EEPROMDUMP_SD_SIZE = EEPROMDUMP_SD_OFFS_BEGIN+2
-
-
-
-; ***************************************************************************
-; code
-
-.cseg
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_OnCreate @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @param XL node addr
-; @param XH value id
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-EepromDump_OnCreate:
- bigcall OBJ_IsObject ; (none)
- brcc EepromDump_OnCreate_ret
-
- ; preset SDRAM
- bigcall Widget_GetSdramPtr ; (none)
- clr r16
- ldi r17, EEPROMDUMP_SD_SIZE
- push yl
- push yh
-EepromDump_OnCreate_loop:
- st Y+, r16
- dec r17
- brne EepromDump_OnCreate_loop
- pop yh
- pop yl
-
- bigcall Widget_OnCreate
-
-EepromDump_OnCreate_ret:
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine EepromDump_OnUp @global
-;
-; @param Z byte address of object (for LPM!)
-
-EepromDump_OnUp:
- bigcall Widget_GetSdramPtr ; (none)
- ldd xl, Y+EEPROMDUMP_SD_OFFS_STARTADDR_LO
- ldd xh, Y+EEPROMDUMP_SD_OFFS_STARTADDR_HI
- ldi r16, LOW(EEPROMDUMP_BYTESPERLINE*EEPROMDUMP_LINESPERPAGE)
- ldi r17, HIGH(EEPROMDUMP_BYTESPERLINE*EEPROMDUMP_LINESPERPAGE)
- sub xl, r16
- sbc xh, r17
- brcc EepromDump_OnUp_set
- clr xl
- clr xh
-EepromDump_OnUp_set:
- std Y+EEPROMDUMP_SD_OFFS_STARTADDR_LO, xl
- std Y+EEPROMDUMP_SD_OFFS_STARTADDR_HI, xh
-
- ldd r17, Y+WIDGET_SD_OFFS_FLAGS
- ori r17, (1<
-
-
-
-
- button.asm
- guiapp.asm
- imageview.asm
- label.asm
- object.asm
- rootwidget.asm
- valuelabel.asm
- widget.asm
-
-
-
-
-
diff --git a/avr/modules/lcd2/gui/generic/button.asm b/avr/modules/lcd2/gui/generic/button.asm
deleted file mode 100644
index 6e9dd48..0000000
--- a/avr/modules/lcd2/gui/generic/button.asm
+++ /dev/null
@@ -1,95 +0,0 @@
-; ***************************************************************************
-; 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_BUTTON_ASM
-#define AQH_AVR_GUI2_BUTTON_ASM
-
-
-; ***************************************************************************
-; code
-
-.cseg
-
-
-; ---------------------------------------------------------------------------
-; @routine Button_OnTouch @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @param X pointer to TOUCH event (see @ref WIDGET_DATA_TOUCH_OFFS_X_LO)
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-Button_OnTouch:
- rcall Widget_GetSdramPtr ; Y:=SDRAM data for widget
-
- ; read touch signal data from X
- ld r18, X+ ; WIDGET_DATA_TOUCH_OFFS_X_LO
- ld r19, X+ ; WIDGET_DATA_TOUCH_OFFS_X_HI
- ld r20, X+ ; WIDGET_DATA_TOUCH_OFFS_Y_LO
- ld r21, X+ ; WIDGET_DATA_TOUCH_OFFS_Z_HI
- ld r22, X ; WIDGET_DATA_TOUCH_OFFS_STATE
- sbiw xh:xl, 4
-
- sbrs r22, DISPLAY_IFLAGS_PRESSED_BIT
- rjmp Button_OnTouch_up
- ; down (active touch)
- ldd r16, Y+WIDGET_SD_OFFS_FLAGS
- sbrc r16, WIDGET_FLAGS_PRESSED_BIT
- rjmp Button_OnTouch_ret ; already pressed, jmp
- ; newly pressed
- rcall widgetLoadCoordsForFullWidget ; get X, Y, W, H (none)
- rcall Widget_MakeAbsPos ; (R16, R17)
- rcall Widget_IsPointInRect ; (R16, R17)
- brcc Button_OnTouch_ret ; touch not inside this widget, jmp
-
- ; touch down inside this widget, handle
- bigcall Widget_GrabTouchEvents ; (r16, r17, r18, r19, X)
- brcc Button_OnTouch_ret
- ldi r16, (1<cntrl: X=WIDGET to raise
-.equ GUIAPP_SIGNAL_SHOW = OBJECT_SIGNAL_NEXTFREE+1 ; cntrl->app
-.equ GUIAPP_SIGNAL_HIDE = OBJECT_SIGNAL_NEXTFREE+2 ; cntrl->app
-.equ GUIAPP_SIGNAL_DEBUG = OBJECT_SIGNAL_NEXTFREE+3
-.equ GUIAPP_SIGNAL_NEXTFREE = OBJECT_SIGNAL_NEXTFREE+4
-
-; SDRAM data for guiapp
-.equ GUIAPP_SD_OFFS_FLAGS = 0
-.equ GUIAPP_SD_OFFS_DRAWTIMER = 1
-.equ GUIAPP_SD_OFFS_CURRENTWIDGET_LO = 2
-.equ GUIAPP_SD_OFFS_CURRENTWIDGET_HI = 3
-.equ GUIAPP_SD_OFFS_TOUCHWIDGET_LO = 4
-.equ GUIAPP_SD_OFFS_TOUCHWIDGET_HI = 5
-.equ GUIAPP_SD_SIZE = 6
-
-
-.equ GUIAPP_DRAWTIMER = 2
-
-
-
-; ***************************************************************************
-; data
-
-.dseg
-
-guiapp_touch_event:
- .byte WIDGET_DATA_TOUCH_SIZE
-
-
-
-; ***************************************************************************
-; code
-
-.cseg
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_Init
-;
-; @param Z byte address of guiapp object (for LPM!)
-
-GuiApp_Init:
- ldi r16, OBJECT_SIGNAL_CREATE
- clr r17
- bigcall OBJ_HandleSignal
- rcall GuiApp_ShowFirstView
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_Every100ms @global
-;
-; @param Z byte address of guiapp object (for LPM!)
-
-GuiApp_Every100ms:
- ldi r16, OBJECT_SIGNAL_TIMER
- clr r17
- bigcall OBJ_HandleSignal
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_MsgReceived @global
-;
-; @param Z byte address of guiapp object (for LPM!)
-
-GuiApp_MsgReceived:
- ldi r16, OBJECT_SIGNAL_RECVMSG
- clr r17
- bigcall OBJ_HandleSignal
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_OnTimer
-;
-; @param Z byte address of guiapp object (for LPM!)
-
-GuiApp_OnTimer:
- ; check for touch event
- rcall guiAppCheckTouch
-
- ; send timer signal to all accepting widgets
- push zl
- push zh
- adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
- lpm r16, Z+
- lpm zh, Z
- mov zl, r16
- or r17, zh
- breq GuiApp_OnTimer_l1
- bigcall Widget_Tree_SendTimerSignal
-GuiApp_OnTimer_l1:
- pop zh
- pop zl
-
- ; possibly draw widgets
- rcall GuiApp_GetSdramPtr
- ldd r16, Y+GUIAPP_SD_OFFS_DRAWTIMER
- tst r16
- breq GuiApp_OnTimer_ret
- dec r16
- brne GuiApp_OnTimer_writeDrawTimer
- push yl
- push yh
- rcall guiAppDrawWidgets
- pop yh
- pop yl
- ldi r16, GUIAPP_DRAWTIMER
-GuiApp_OnTimer_writeDrawTimer:
- std Y+GUIAPP_SD_OFFS_DRAWTIMER, r16
-GuiApp_OnTimer_ret:
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_OnTouch
-;
-; @param Z byte address of guiapp object (for LPM!)
-; @param X pointer to touch event in SDRAM
-
-GuiApp_OnTouch:
- push zl
- push zh
- rcall GuiApp_GetSdramPtr
- ldd r18, Y+GUIAPP_SD_OFFS_TOUCHWIDGET_LO
- ldd r19, Y+GUIAPP_SD_OFFS_TOUCHWIDGET_HI
- mov r16, r18
- or r16, r19
- breq GuiApp_OnTouch_sendToAll
- mov zl, r18
- mov zh, r19
- ldi r16, WIDGET_SIGNAL_TOUCH
- clr r17
- bigcall OBJ_HandleSignal
- rjmp GuiApp_OnTouch_done
-GuiApp_OnTouch_sendToAll:
- rcall GuiApp_GetRootWidgetToZ
- brcc GuiApp_OnTouch_done
- ; send touch signal
- bigcall Widget_Tree_SendTouchSignal
-GuiApp_OnTouch_done:
- pop zh
- pop zl
- ; send keepAlive to screensaver (if not active!)
- rcall guiAppSendKeepAliveIfScreenSaverInactive
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine guiAppSendKeepAliveIfScreenSaverInactive
-;
-; @param Z byte address of guiapp object (for LPM!)
-; @clobbers any
-
-guiAppSendKeepAliveIfScreenSaverInactive:
- push zl
- push zh
- rcall GuiApp_GetSdramPtr
- adiw zh:zl, GUIAPP_OFFS_SCREENSAVER_LO
- lpm r20, Z+
- lpm r21, Z
- sbiw zh:zl, GUIAPP_OFFS_SCREENSAVER_LO+1
- ldd r16, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO
- cp r16, r20
- brne guiAppSendKeepAliveIfScreenSaverInactive_send
- ldd r16, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI
- cp r16, r21
- breq guiAppSendKeepAliveIfScreenSaverInactive_end
-guiAppSendKeepAliveIfScreenSaverInactive_send:
- mov zl, r20
- mov zh, r21
- bigcall ScreenSaver_KeepAlive
-guiAppSendKeepAliveIfScreenSaverInactive_end:
- pop zh
- pop zl
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_OnMsgReceived @global
-;
-; @param Z byte address of guiapp object (for LPM!)
-; @param X pointer to message received in SDRAM
-
-GuiApp_OnMsgReceived:
- push zl
- push zh
- rcall GuiApp_GetRootWidgetToZ
- brcc GuiApp_OnMsgReceived_done
- bigcall Widget_Tree_SendMsgRecvSignal
-GuiApp_OnMsgReceived_done:
- pop zh
- pop zl
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_OnCreate @global
-;
-; @param Z byte address of object (for LPM!)
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-GuiApp_OnCreate:
- ; init sdram data
- rcall GuiApp_GetSdramPtr
- ldi r17, GUIAPP_SD_SIZE
- clr r16
- push yl
- push yh
-GuiApp_OnCreate_loop:
- st Y+, r16
- dec r17
- brne GuiApp_OnCreate_loop
- pop yh
- pop yl
- clr r16
- std Y+GUIAPP_SD_OFFS_FLAGS, r16
- ldi r16, GUIAPP_DRAWTIMER
- std Y+GUIAPP_SD_OFFS_DRAWTIMER, r16
-
- rcall guiAppInitWidgets
-
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_GetSdramPtr @global
-;
-; @param Z byte address of object (for LPM!)
-; @return Y pointer to SDRAM data for widget
-; @clobbers none
-
-GuiApp_GetSdramPtr:
- adiw zh:zl, GUIAPP_OFFS_SDRAM_LO
- lpm yl, Z+
- lpm yh, Z
- sbiw zh:zl, GUIAPP_OFFS_SDRAM_LO+1
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_GetRootWidgetToZ @global
-;
-; @param Z byte address of object (for LPM!)
-; @return CFLAG set if there is a root widget, cleared otherwise
-; @return Z byte address pointer to root widget (for LPM!), if CFLAG set, garbage otherwise
-; @clobbers none
-
-GuiApp_GetRootWidgetToZ:
- rcall OBJ_IsObject
- brcc GuiApp_GetRootWidgetToZ_ret
- adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
- lpm r16, Z+
- lpm zh, Z
- mov zl, r16
- rcall OBJ_IsObject
-GuiApp_GetRootWidgetToZ_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_ShowFirstView @global
-;
-; @param Z byte address of guiapp object (for LPM!)
-
-GuiApp_ShowFirstView:
- push zl
- push zh
- rcall GuiApp_GetRootWidgetToZ
- brcc GuiApp_ShowFirstView_error
-
- bigcall OBJ_GetFirstChild
- brcc GuiApp_ShowFirstView_error
- mov xl, r18
- mov xh, r19
- pop zh
- pop zl
- rcall GuiApp_ShowView
- rjmp GuiApp_ShowFirstView_ret
-GuiApp_ShowFirstView_error:
- pop zh
- pop zl
-GuiApp_ShowFirstView_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_ShowView @global
-;
-; @param Z byte address of object (for LPM!)
-; @param X byte address of object to show (for LPM!)
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-GuiApp_ShowView:
- rcall GuiApp_GetSdramPtr ; Y=SDRAM
- ldd r18, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO
- ldd r19, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI
- eor r18, xl ; 0 if same
- eor r19, xh ; 0 if same
- or r18, r19 ; 0 if r19:r18==X
- breq GuiApp_ShowView_ret ; same, no change
-
- push yl
- push yh
- rcall guiAppHideCurrent ; (any, !X, !Z)
- pop yh
- pop yl
-
- ; store new view
- std Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO, xl
- std Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI, xh
-
- ; show new (if any)
- rcall guiAppShowCurrent
-
-GuiApp_ShowView_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_GetCurrentView @global
-;
-; @param Z byte address of object (for LPM!)
-; @return X byte address of current view object (for LPM!)
-; @clobbers Y
-
-GuiApp_GetCurrentView:
- rcall GuiApp_GetSdramPtr ; Y=SDRAM
- ldd xl, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO
- ldd xh, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI
- ret
-; @end
-
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_GrabTouchEvents
-;
-; @param Z byte address of gui app object (for LPM!)
-; @param X byte address of widget grabbing touch events
-; @return CFLAG set if grabbed, cleared otherwise
-; @clobbers R16, R17, Y
-
-GuiApp_GrabTouchEvents:
- rcall OBJ_IsObject ; (none)
- brcc GuiApp_GrabTouchEvents_ret
- rcall GuiApp_GetSdramPtr ; (none)
- ldd r16, Y+GUIAPP_SD_OFFS_TOUCHWIDGET_LO
- ldd r17, Y+GUIAPP_SD_OFFS_TOUCHWIDGET_HI
- or r16, r17
- clc
- brne GuiApp_GrabTouchEvents_ret ; only grab if not already grabbed!
- std Y+GUIAPP_SD_OFFS_TOUCHWIDGET_LO, xl
- std Y+GUIAPP_SD_OFFS_TOUCHWIDGET_HI, xh
- sec
-GuiApp_GrabTouchEvents_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine GuiApp_UngrabTouchEvents
-;
-; @param Z byte address of gui app object (for LPM!)
-; @param X byte address of widget ungrabbing touch events
-; @return CFLAG set if ungrabbed, cleared otherwise
-; @clobbers R16, R17
-
-GuiApp_UngrabTouchEvents:
- rcall OBJ_IsObject ; (none)
- brcc GuiApp_UngrabTouchEvents_ret
- rcall GuiApp_GetSdramPtr ; (none)
- ldd r16, Y+GUIAPP_SD_OFFS_TOUCHWIDGET_LO
- ldd r17, Y+GUIAPP_SD_OFFS_TOUCHWIDGET_HI
- eor r16, xl
- eor r17, xh
- or r16, r17
- clc
- brne GuiApp_UngrabTouchEvents_ret ; only ungrab same widget!
- clr r16
- std Y+GUIAPP_SD_OFFS_TOUCHWIDGET_LO, r16
- std Y+GUIAPP_SD_OFFS_TOUCHWIDGET_HI, r16
- sec
-GuiApp_UngrabTouchEvents_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine guiAppHideCurrent
-;
-; @param Z byte address of gui app object (for LPM!)
-; @clobbers any, !X, !Z
-
-guiAppHideCurrent:
- push zl
- push zh
- rcall GuiApp_GetSdramPtr ; Y=SDRAM
- ldd zl, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO
- ldd zh, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI
- mov r16, zl
- or r16, zh
- breq guiAppHideCurrent_done
- ldi r16, WIDGET_SIGNAL_HIDE
- clr r17
- bigcall OBJ_HandleSignal ; (any, !X, !Y. !Z)
- ldi r16, (1<
+
+
+
+
+ simple.asm
+
+
+
+
+
diff --git a/avr/modules/lcd2/gui2/screensavers/simple.asm b/avr/modules/lcd2/gui/screensavers/simple.asm
similarity index 100%
rename from avr/modules/lcd2/gui2/screensavers/simple.asm
rename to avr/modules/lcd2/gui/screensavers/simple.asm
diff --git a/avr/modules/lcd2/gui/sensorwatch.asm b/avr/modules/lcd2/gui/sensorwatch.asm
deleted file mode 100644
index 7d06247..0000000
--- a/avr/modules/lcd2/gui/sensorwatch.asm
+++ /dev/null
@@ -1,608 +0,0 @@
-; ***************************************************************************
-; 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
-
-
-; ***************************************************************************
-; SensorWatch
-;
-; This widget has three subwidgets:
-; - Title (Label)
-; - Image (ImageView)
-; - Value (Label)
-;
-; It watches received messages and reacts on those matching the stored
-; combination of NodeAddr and ValueId by colouring the image according to
-; the value received and also shows the value beloe the image.
-;
-; Please note that this widget needs to have the option bit
-; "WIDGET_OPTSLO_MSGRECV_BIT" set in order to receive MsgReceived signals.
-;
-; ***************************************************************************
-
-
-
-
-; ***************************************************************************
-; defines
-
-; SensorWatch in flash
-.equ SENSORWATCH_OFFS_BEGIN = WIDGET_SIZE
-.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
-.equ SENSORWATCH_SD_OFFS_SENSORWATCH = WIDGET_SD_SIZE
-.equ SENSORWATCH_SD_OFFS_NODEADDR = SENSORWATCH_SD_OFFS_SENSORWATCH+0
-.equ SENSORWATCH_SD_OFFS_VALUEID = SENSORWATCH_SD_OFFS_SENSORWATCH+1
-.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+2
-.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+3
-.equ SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+4
-.equ SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+5
-.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO = SENSORWATCH_SD_OFFS_SENSORWATCH+6
-.equ SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_HI = SENSORWATCH_SD_OFFS_SENSORWATCH+7
-.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
-
-
-; EEPROM data for SensorWatch
-.equ SENSORWATCH_EE_OFFS_NODEADDR = 0
-.equ SENSORWATCH_EE_OFFS_VALUEID = 1
-.equ SENSORWATCH_EE_OFFS_UPPER_LIMIT_WARN_LO = 2
-.equ SENSORWATCH_EE_OFFS_UPPER_LIMIT_WARN_HI = 3
-.equ SENSORWATCH_EE_OFFS_LOWER_LIMIT_WARN_LO = 4
-.equ SENSORWATCH_EE_OFFS_LOWER_LIMIT_WARN_HI = 5
-.equ SENSORWATCH_EE_OFFS_UPPER_LIMIT_CRIT_LO = 6
-.equ SENSORWATCH_EE_OFFS_UPPER_LIMIT_CRIT_HI = 7
-.equ SENSORWATCH_EE_OFFS_LOWER_LIMIT_CRIT_LO = 8
-.equ SENSORWATCH_EE_OFFS_LOWER_LIMIT_CRIT_HI = 9
-.equ SENSORWATCH_EE_SIZE = 10
-
-
-; signals
-.equ SENSORWATCH_SIGNAL_SETSOURCE = WIDGET_SIGNAL_NEXTFREE+0
-.equ SENSORWATCH_SIGNAL_SETUPPERLIMWARN = WIDGET_SIGNAL_NEXTFREE+1
-.equ SENSORWATCH_SIGNAL_SETLOWERLIMWARN = WIDGET_SIGNAL_NEXTFREE+2
-.equ SENSORWATCH_SIGNAL_SETUPPERLIMCRIT = WIDGET_SIGNAL_NEXTFREE+3
-.equ SENSORWATCH_SIGNAL_SETLOWERLIMCRIT = WIDGET_SIGNAL_NEXTFREE+4
-.equ SENSORWATCH_SIGNAL_NEXTFREE = WIDGET_SIGNAL_NEXTFREE+5
-
-
-
-; ***************************************************************************
-; code
-
-.cseg
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_OnCreate @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-SensorWatch_OnCreate:
- bigcall OBJ_IsObject ; (none)
- brcc SensorWatch_OnCreate_ret
-
- ; preset SDRAM
- bigcall Widget_GetSdramPtr ; (none)
- clr r16
- ldi r17, SENSORWATCH_SD_SIZE
- push yl
- push yh
-SensorWatch_OnCreate_loop:
- st Y+, r16
- dec r17
- brne SensorWatch_OnCreate_loop
- pop yh
- pop yl
-
- bigcall Widget_OnCreate
-
- rcall sensorWatchReadFromEeprom ; (R16, R18, X, Y)
-
-SensorWatch_OnCreate_ret:
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_OnSetSource @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @param XL node addr
-; @param XH value id
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-SensorWatch_OnSetSource:
- bigcall OBJ_IsObject ; (none)
- brcc SensorWatch_OnSetSource_ret
- push zl
- push zh
- bigcall Widget_GetSdramPtr ; (none)
- std Y+SENSORWATCH_SD_OFFS_NODEADDR, xl
- std Y+SENSORWATCH_SD_OFFS_VALUEID, xh
- pop zh
- pop zl
-SensorWatch_OnSetSource_ret:
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_OnSetLowerLimitWarn @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @param X value
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-SensorWatch_OnSetLowerLimitWarn:
- bigcall OBJ_IsObject ; (none)
- brcc SensorWatch_OnSetLowerLimitWarn_ret
- bigcall Widget_GetSdramPtr ; (none)
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_LO, xl
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_HI, xh
- rcall sensorWatchSetColor
-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
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_OnSetLimitCrit @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @param X value
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-SensorWatch_OnSetLowerLimitCrit:
- bigcall OBJ_IsObject ; (none)
- brcc SensorWatch_OnSetLowerLimitCrit_ret
- rcall Widget_GetSdramPtr ; (none)
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_LO, xl
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_HI, xh
- rcall sensorWatchSetColor
-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
- ret
-; @end
-
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_OnMsgReceived @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @param XL node addr
-; @param XH value id
-; @return CFLAG set if signal handled
-; @clobbers any, !Z
-
-SensorWatch_OnMsgReceived:
- adiw xh:xl, 2 ; command
- ld r16, X
- sbiw xh:xl, 2
- cpi r16, NETMSG_CMD_VALUE_REPORT
- breq SensorWatch_OnMsgReceived_report
- cpi r16, NETMSG_CMD_VALUE_SET
- breq SensorWatch_OnMsgReceived_set
- rjmp SensorWatch_OnMsgReceived_ret
-SensorWatch_OnMsgReceived_report:
- bigcall Widget_GetSdramPtr ; (none)
- bigcall NETMSG_ValueRead ; R17=valueId, R22=nodeAddr R19:R18=value (none)
- ; check node addr
- ldd r16, Y+SENSORWATCH_SD_OFFS_NODEADDR
- cp r16, r22
- brne SensorWatch_OnMsgReceived_ret
- ; check value id
- ldd r16, Y+SENSORWATCH_SD_OFFS_VALUEID
- cp r16, r17
- brne SensorWatch_OnMsgReceived_ret
- ; store value
- std Y+SENSORWATCH_SD_OFFS_VALUE_LO, r18
- std Y+SENSORWATCH_SD_OFFS_VALUE_HI, r19
- ; setup background color
- rcall sensorWatchSetColor ; (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 (none)
- adiw zh:zl, SENSORWATCH_OFFS_BASEVALUEID
- lpm r16, Z
- sbiw zh:zl, SENSORWATCH_OFFS_BASEVALUEID
- sub r17, r16
- brcs SensorWatch_OnMsgReceived_ret ; not my value
- cpi r17, 3
- brcc SensorWatch_OnMsgReceived_ret ; not my value
- cpi r17, 0
- breq SensorWatch_OnMsgReceived_setSource
- cpi r17, 1
- breq SensorWatch_OnMsgReceived_setLimWarn
- cpi r17, 2
- breq SensorWatch_OnMsgReceived_setLimCrit
- rjmp SensorWatch_OnMsgReceived_ret
-SensorWatch_OnMsgReceived_setSource:
- std Y+SENSORWATCH_SD_OFFS_NODEADDR, r18
- std Y+SENSORWATCH_SD_OFFS_VALUEID, r19
- rjmp SensorWatch_OnMsgReceived_sendACK
-SensorWatch_OnMsgReceived_setLimWarn:
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_LO, r18
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_WARN_HI, r19
- std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO, r20
- std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_HI, r21
- rjmp SensorWatch_OnMsgReceived_sendACK
-SensorWatch_OnMsgReceived_setLimCrit:
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_LO, r18
- std Y+SENSORWATCH_SD_OFFS_LOWER_LIMIT_CRIT_HI, r19
- std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO, r20
- std Y+SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_HI, r21
-SensorWatch_OnMsgReceived_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, !Z)
- rcall sensorWatchWriteToEeprom ; (R16, R17, R18, R20, R21, X, Y)
- pop xh
- pop xl
-SensorWatch_OnMsgReceived_ret:
- sec
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_GetImageView @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @return CFLAG set if widget found, cleared otherwise
-; @return R19:R18 byte address pointer to image view (for LPM!)
-; @clobbers none
-
-SensorWatch_GetImageView:
- bigcall OBJ_IsObject ; (none)
- brcc SensorWatch_GetImageView_ret
- push zl
- push zh
- bigcall OBJ_GetFirstChild ; (none)
- brcc SensorWatch_GetImageView_done
- mov zl, r18
- mov zh, r19
- bigcall OBJ_GetNext ; 2nd child
-SensorWatch_GetImageView_done:
- pop zh
- pop zl
-SensorWatch_GetImageView_ret:
- ret
-; @end
-
-
-
-
-; ---------------------------------------------------------------------------
-; @routine SensorWatch_GetValueLabel @global
-;
-; @param Z byte address of widget object (for LPM!)
-; @return CFLAG set if widget found, cleared otherwise
-; @return R19:R18 byte address pointer to image view (for LPM!)
-; @clobbers none
-
-SensorWatch_GetValueLabel:
- bigcall OBJ_IsObject ; (none)
- brcc SensorWatch_GetValueLabel_ret
- push zl
- push zh
- bigcall OBJ_GetFirstChild ; (none)
- brcc SensorWatch_GetValueLabel_done
- mov zl, r18
- mov zh, r19
- bigcall OBJ_GetNext ; 2nd child
- brcc SensorWatch_GetValueLabel_done
- mov zl, r18
- mov zh, r19
- bigcall OBJ_GetNext ; 3nd child
-SensorWatch_GetValueLabel_done:
- pop zh
- pop zl
-SensorWatch_GetValueLabel_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine sensorWatchSetColor
-;
-; @param Z byte address of widget object (for LPM!)
-; @param Y pointer to SDRAM data
-; @clobbers any, !Y, !Z
-
-sensorWatchSetColor:
- push yl
- push yh
- ; default color is green
- ldi xl, LOW(DISPLAY_COLOR_DARKGREEN)
- ldi xh, HIGH(DISPLAY_COLOR_DARKGREEN)
- ldd r20, Y+SENSORWATCH_SD_OFFS_VALUE_LO
- ldd r21, Y+SENSORWATCH_SD_OFFS_VALUE_HI
- mov r16, r20
- or r16, r21
- breq sensorWatchSetColor_ret ; do nothing
-
- ; check against critical limits
- adiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO
- rcall sensorWatchCheckAgainstLimit ; (r16, r17, r22, r23)
- brcs sensorWatchSetColor_setRed
- sbiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_CRIT_LO
-
- ; check against warning limits
- adiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO
- rcall sensorWatchCheckAgainstLimit ; (r16, r17, r22, r23)
- brcs sensorWatchSetColor_setYellow
- sbiw yh:yl, SENSORWATCH_SD_OFFS_UPPER_LIMIT_WARN_LO
-
- ; set green background
- rjmp sensorWatchSetColor_setColor
-
-sensorWatchSetColor_setRed:
- ldi xl, LOW(DISPLAY_COLOR_RED)
- ldi xh, HIGH(DISPLAY_COLOR_RED)
- rjmp sensorWatchSetColor_setColor
-
-sensorWatchSetColor_setYellow:
- ldi xl, LOW(DISPLAY_COLOR_YELLOW)
- ldi xh, HIGH(DISPLAY_COLOR_YELLOW)
-
-sensorWatchSetColor_setColor:
- rcall SensorWatch_GetImageView ; (none)
- brcc sensorWatchSetColor_ret
- push zl
- push zh
- mov zl, r18
- mov zh, r19
- ldi r16, IMGVIEW_SIGNAL_SETBGCOL
- clr r17
- bigcall OBJ_HandleSignal ; (any, !X, !Y, !Z)
- pop zh
- pop zl
-sensorWatchSetColor_ret:
- pop yh
- pop yl
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @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
-;
-; @param Z byte address of widget object (for LPM!)
-; @param Y pointer to SDRAM data
-; @clobbers any, !Y, !Z
-
-sensorWatchSetValueLabel:
- rcall SensorWatch_GetValueLabel ; (none)
- brcc sensorWatchSetValueLabel_ret
- push zl
- push zh
- mov zl, r18
- mov zh, r19
- ldd xl, Y+SENSORWATCH_SD_OFFS_VALUE_LO
- ldd xh, Y+SENSORWATCH_SD_OFFS_VALUE_HI
-
- ldi r16, VLABEL_SIGNAL_SETVALUE
- clr r17
- bigcall OBJ_HandleSignal ; (any, !X, !Y, !Z)
- pop zh
- pop zl
-sensorWatchSetValueLabel_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine sensorWatchWriteToEeprom
-;
-; @param Z byte address of widget object (for LPM!)
-; @return CFLAG set if data found and read, cleared on error
-; @clobbers R16, R17, R18, R20, R21, X, Y
-
-sensorWatchWriteToEeprom:
- adiw zh:zl, SENSORWATCH_OFFS_EEPROMID
- lpm r16, Z
- sbiw zh:zl, 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:
- bigcall Widget_GetSdramPtr ; (none)
- adiw yh:yl, SENSORWATCH_SD_OFFS_NODEADDR
- ldi r18, SENSORWATCH_EE_SIZE
-sensorWatchWriteToEeprom_loop:
- ld r16, Y+
- bigcall Eeprom_WriteByteIfChanged ; (R17)
- brcc sensorWatchWriteToEeprom_ret
- adiw xh:xl, 1
- dec r18
- brne sensorWatchWriteToEeprom_loop
- sec
-sensorWatchWriteToEeprom_ret:
- ret
-; @end
-
-
-
-; ---------------------------------------------------------------------------
-; @routine sensorWatchReadFromEeprom
-;
-; @param Z byte address of widget object (for LPM!)
-; @return CFLAG set if data found and read, cleared on error
-; @clobbers R16, R18, X, Y
-
-sensorWatchReadFromEeprom:
- adiw zh:zl, SENSORWATCH_OFFS_EEPROMID
- lpm r16, Z
- sbiw zh:zl, SENSORWATCH_OFFS_EEPROMID
- bigcall EepromTlv_FindFirst ; (R18)
- brcc sensorWatchReadFromEeprom_ret
- bigcall Widget_GetSdramPtr ; (none)
- adiw yh:yl, SENSORWATCH_SD_OFFS_NODEADDR
- ldi r18, SENSORWATCH_EE_SIZE
-sensorWatchReadFromEeprom_loop:
- bigcall Eeprom_ReadByte ; R16=byte (none)
- brcc sensorWatchReadFromEeprom_ret
- st Y+, r16
- adiw xh:xl, 1
- dec r18
- brne sensorWatchReadFromEeprom_loop
- sec
-sensorWatchReadFromEeprom_ret:
- ret
-; @end
-
-
-
-
-SensorWatch_DefaultSignalmap:
- .db 0, OBJECT_SIGNAL_CREATE, LOW(SensorWatch_OnCreate), HIGH(SensorWatch_OnCreate)
- .db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
- .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_SETUPPERLIMWARN, LOW(SensorWatch_OnSetUpperLimitWarn), HIGH(SensorWatch_OnSetUpperLimitWarn)
- .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
-
-
-
-
-
-#endif
-