From bfd991a7688b9df1c2ccac89f3a22904d28cb418 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Mon, 16 Feb 2026 01:09:39 +0100 Subject: [PATCH] avr: removed old GUI code, renamed gui2 to gui --- avr/devices/all/includes.asm | 18 - avr/devices/all/main.asm | 4 - avr/devices/all/modules.asm | 4 - avr/devices/c03/main/0BUILD | 7 + avr/devices/c03/main/main.asm | 24 +- avr/modules/lcd2/0BUILD | 2 +- avr/modules/lcd2/README | 2 +- avr/modules/lcd2/gui/0BUILD | 7 +- avr/modules/lcd2/gui/TODO | 141 +++- avr/modules/lcd2/gui/button.asm | 262 ------ avr/modules/lcd2/gui/defs.asm | 52 -- avr/modules/lcd2/gui/dialog.asm | 314 ------- avr/modules/lcd2/{gui2 => gui}/eepromdump.asm | 0 avr/modules/lcd2/{gui2 => gui}/generic/0BUILD | 0 .../lcd2/{gui2 => gui}/generic/button.asm | 0 .../lcd2/{gui2 => gui}/generic/guiapp.asm | 0 .../lcd2/{gui2 => gui}/generic/imageview.asm | 0 .../lcd2/{gui2 => gui}/generic/label.asm | 0 .../lcd2/{gui2 => gui}/generic/object.asm | 0 .../lcd2/{gui2 => gui}/generic/rootwidget.asm | 0 .../{gui2 => gui}/generic/screensaver.asm | 0 .../lcd2/{gui2 => gui}/generic/valuelabel.asm | 0 .../lcd2/{gui2 => gui}/generic/widget.asm | 0 avr/modules/lcd2/gui/main.asm | 27 - .../lcd2/{gui2 => gui}/sensorwatch.asm | 0 avr/modules/lcd2/gui/style.asm | 32 - avr/modules/lcd2/gui/titlewindow.asm | 231 ------ avr/modules/lcd2/gui/titlewindow2.asm | 157 ---- avr/modules/lcd2/gui/window.asm | 558 ------------- avr/modules/lcd2/gui2/0BUILD | 11 - avr/modules/lcd2/gui2/TODO | 136 ---- avr/modules/lcd2/staticgui/0BUILD | 16 - avr/modules/lcd2/staticgui/TODO | 13 - avr/modules/lcd2/staticgui/defs.asm | 65 -- avr/modules/lcd2/staticgui/dialog.asm | 288 ------- avr/modules/lcd2/staticgui/main.asm | 27 - avr/modules/lcd2/staticgui/style.asm | 24 - avr/modules/lcd2/staticgui/titlewindow.asm | 158 ---- avr/modules/lcd2/staticgui/window.asm | 512 ------------ avr/modules/lcd2/win/defs.asm | 115 --- avr/modules/lcd2/win/gui.asm | 22 - avr/modules/lcd2/win/object.asm | 263 ------ avr/modules/lcd2/win/w_layout.asm | 770 ------------------ avr/modules/lcd2/win/widget.asm | 234 ------ 44 files changed, 154 insertions(+), 4342 deletions(-) delete mode 100644 avr/modules/lcd2/gui/button.asm delete mode 100644 avr/modules/lcd2/gui/defs.asm delete mode 100644 avr/modules/lcd2/gui/dialog.asm rename avr/modules/lcd2/{gui2 => gui}/eepromdump.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/0BUILD (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/button.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/guiapp.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/imageview.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/label.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/object.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/rootwidget.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/screensaver.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/valuelabel.asm (100%) rename avr/modules/lcd2/{gui2 => gui}/generic/widget.asm (100%) delete mode 100644 avr/modules/lcd2/gui/main.asm rename avr/modules/lcd2/{gui2 => gui}/sensorwatch.asm (100%) delete mode 100644 avr/modules/lcd2/gui/style.asm delete mode 100644 avr/modules/lcd2/gui/titlewindow.asm delete mode 100644 avr/modules/lcd2/gui/titlewindow2.asm delete mode 100644 avr/modules/lcd2/gui/window.asm delete mode 100644 avr/modules/lcd2/gui2/0BUILD delete mode 100644 avr/modules/lcd2/gui2/TODO delete mode 100644 avr/modules/lcd2/staticgui/0BUILD delete mode 100644 avr/modules/lcd2/staticgui/TODO delete mode 100644 avr/modules/lcd2/staticgui/defs.asm delete mode 100644 avr/modules/lcd2/staticgui/dialog.asm delete mode 100644 avr/modules/lcd2/staticgui/main.asm delete mode 100644 avr/modules/lcd2/staticgui/style.asm delete mode 100644 avr/modules/lcd2/staticgui/titlewindow.asm delete mode 100644 avr/modules/lcd2/staticgui/window.asm delete mode 100644 avr/modules/lcd2/win/defs.asm delete mode 100644 avr/modules/lcd2/win/gui.asm delete mode 100644 avr/modules/lcd2/win/object.asm delete mode 100644 avr/modules/lcd2/win/w_layout.asm delete mode 100644 avr/modules/lcd2/win/widget.asm diff --git a/avr/devices/all/includes.asm b/avr/devices/all/includes.asm index b3c05d0..f1a7738 100644 --- a/avr/devices/all/includes.asm +++ b/avr/devices/all/includes.asm @@ -272,24 +272,6 @@ .include "modules/lcd2/font/main.asm" #endif -#ifdef MODULES_WIN -.include "common/list.asm" -.include "common/tree.asm" -.include "modules/lcd2/win/defs.asm" -.include "modules/lcd2/win/object.asm" -.include "modules/lcd2/win/widget.asm" -.include "modules/lcd2/win/gui.asm" -#endif - - - -#ifdef MODULES_GUI -.include "modules/lcd2/gui/defs.asm" -.include "modules/lcd2/gui/main.asm" -.include "modules/lcd2/gui/window.asm" -#endif - - #ifdef MODULES_FONT_8X8 .include "modules/lcd2/font/defs.asm" .include "modules/lcd2/font/font8x8.asm" diff --git a/avr/devices/all/main.asm b/avr/devices/all/main.asm index 8d4e8bf..876d337 100644 --- a/avr/devices/all/main.asm +++ b/avr/devices/all/main.asm @@ -184,10 +184,6 @@ onSystemTimerTick: bigcall Brightness_Every100ms #endif -#ifdef MODULES_GUI - bigcall GUI_Every100ms -#endif - #ifdef MODULES_XPT2046 bigcall XPT2046_Every100ms #endif diff --git a/avr/devices/all/modules.asm b/avr/devices/all/modules.asm index f750e53..420fec7 100644 --- a/avr/devices/all/modules.asm +++ b/avr/devices/all/modules.asm @@ -201,10 +201,6 @@ initModules: bigcall XPT2046_Init #endif -#ifdef MODULES_GUI - bigcall GUI_Init -#endif - #ifdef MODULES_BRIGHTNESS bigcall Brightness_Init #endif diff --git a/avr/devices/c03/main/0BUILD b/avr/devices/c03/main/0BUILD index 72f56fe..c59f341 100644 --- a/avr/devices/c03/main/0BUILD +++ b/avr/devices/c03/main/0BUILD @@ -44,6 +44,13 @@ data.asm + g_app.asm + g_win_climate.asm + g_win_eepromdump.asm + g_win_network.asm + g_win_screensaver.asm + main.asm + style.asm diff --git a/avr/devices/c03/main/main.asm b/avr/devices/c03/main/main.asm index 3683753..2c54d19 100644 --- a/avr/devices/c03/main/main.asm +++ b/avr/devices/c03/main/main.asm @@ -1,5 +1,5 @@ ; *************************************************************************** -; copyright : (C) 2025 by Martin Preuss +; copyright : (C) 2026 by Martin Preuss ; email : martin@libchipcard.de ; ; *************************************************************************** @@ -290,17 +290,17 @@ test: .include "style.asm" -.include "modules/lcd2/gui2/generic/object.asm" -.include "modules/lcd2/gui2/generic/widget.asm" -.include "modules/lcd2/gui2/generic/rootwidget.asm" -.include "modules/lcd2/gui2/generic/label.asm" -.include "modules/lcd2/gui2/generic/button.asm" -.include "modules/lcd2/gui2/generic/imageview.asm" -.include "modules/lcd2/gui2/generic/valuelabel.asm" -.include "modules/lcd2/gui2/generic/guiapp.asm" -.include "modules/lcd2/gui2/generic/screensaver.asm" -.include "modules/lcd2/gui2/sensorwatch.asm" -.include "modules/lcd2/gui2/eepromdump.asm" +.include "modules/lcd2/gui/generic/object.asm" +.include "modules/lcd2/gui/generic/widget.asm" +.include "modules/lcd2/gui/generic/rootwidget.asm" +.include "modules/lcd2/gui/generic/label.asm" +.include "modules/lcd2/gui/generic/button.asm" +.include "modules/lcd2/gui/generic/imageview.asm" +.include "modules/lcd2/gui/generic/valuelabel.asm" +.include "modules/lcd2/gui/generic/guiapp.asm" +.include "modules/lcd2/gui/generic/screensaver.asm" +.include "modules/lcd2/gui/sensorwatch.asm" +.include "modules/lcd2/gui/eepromdump.asm" .include "g_app.asm" .include "g_win_climate.asm" diff --git a/avr/modules/lcd2/0BUILD b/avr/modules/lcd2/0BUILD index 8c457e7..9578593 100644 --- a/avr/modules/lcd2/0BUILD +++ b/avr/modules/lcd2/0BUILD @@ -4,7 +4,7 @@ font - gui2 + gui ili9341 xpt2046 diff --git a/avr/modules/lcd2/README b/avr/modules/lcd2/README index 5fb2388..935ad28 100644 --- a/avr/modules/lcd2/README +++ b/avr/modules/lcd2/README @@ -1,2 +1,2 @@ -Current GUI is gui2. +Current GUI is gui. diff --git a/avr/modules/lcd2/gui/0BUILD b/avr/modules/lcd2/gui/0BUILD index 7ad68a8..0823627 100644 --- a/avr/modules/lcd2/gui/0BUILD +++ b/avr/modules/lcd2/gui/0BUILD @@ -3,12 +3,7 @@ - defs.asm - dialog.asm - main.asm - style.asm - titlewindow.asm - window.asm + sensorwatch.asm diff --git a/avr/modules/lcd2/gui/TODO b/avr/modules/lcd2/gui/TODO index 898a149..f89cdcf 100644 --- a/avr/modules/lcd2/gui/TODO +++ b/avr/modules/lcd2/gui/TODO @@ -1,13 +1,136 @@ +- 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) + -- Screen - - functions: - - show - - unshow - - touch - - key - - activeAreas: - - x, y, w, h (in FLASH) - - only small variable data in SRAM, no need for heap! +- 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/button.asm b/avr/modules/lcd2/gui/button.asm deleted file mode 100644 index 77162f4..0000000 --- a/avr/modules/lcd2/gui/button.asm +++ /dev/null @@ -1,262 +0,0 @@ -; *************************************************************************** -; copyright : (C) 2025 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_GUI_BUTTON_ASM -#define AQH_AVR_GUI_BUTTON_ASM - - -.equ BUTTON_STATE_DOWN_BIT = 0 -.equ BUTTON_STATE_ACTIVATED_BIT = 1 - - - -.cseg - - -; --------------------------------------------------------------------------- -; @routine Button_Draw_Up @global -; -; Draw button in state "UP". -; -; @param Y pointer to window in SDRAM -; @param Z pointer to button data in FLASH (byte address for LPM) -; @clobbers any, !Y - -Button_Draw_Up: - clr r14 - rjmp buttonDraw -; @end - - - -; --------------------------------------------------------------------------- -; @routine Button_Draw_Down @global -; -; Draw button in state "DOWN". -; -; @param Y pointer to window in SDRAM -; @param Z pointer to button data in FLASH (byte address for LPM) -; @clobbers any, !Y - -Button_Draw_Down: - ldi r16, 1 - mov r14, r16 - rjmp buttonDraw -; @end - - - -; --------------------------------------------------------------------------- -; @routine Button_HandleTouch @global -; -; @param r18 flags -; @param r19 current state of button (bit 0: pressed, bit 1: activated) -; @param r5:r4 x -; @param r7:r6 Y -; @param Z pointer to button data in FLASH -; @return r19 new state of button (0=normal, 1=pressed) - -Button_HandleTouch: - cbr r19, (1< rel X? - cpc r19, r17 - brcc Window_IsPointInRect_ret - ; check height - lpm r16, Z+ ; height - lpm r17, Z+ - cp r20, r16 ; height > rel Y? - cpc r21, r17 - rjmp Window_IsPointInRect_ret ; CF set if inside rect -Window_IsPointInRect_clcRet: - clc -Window_IsPointInRect_ret: - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine Window_DrawTextFlash @global -; -; @param Y pointer to screen object in SDRAM -; @param R5:R4 X (dest) -; @param R7:R6 Y (dest) -; @return R5:R4 X pos behind string - -; @clobbers any, !Y, !R6, !R7 - -Window_DrawTextFlash: - ldd r0, Y+WIN_OFFS_BG_COL_LO - ldd r1, Y+WIN_OFFS_BG_COL_HI - ldd r2, Y+WIN_OFFS_FG_COL_LO - ldd r3, Y+WIN_OFFS_FG_COL_HI - - rjmp Window_DrawColorTextFlash -; @end - - - -; --------------------------------------------------------------------------- -; @routine Window_DrawColorTextFlash @global -; -; @param Y pointer to screen object in SDRAM -; @param Z pointer to null-terminated string -; @param R1:R0 background color -; @param R3:R2 foreground color -; @param R5:R4 X (dest) -; @param R7:R6 Y (dest) -; @return R5:R4 X pos behind string - -; @clobbers any, !Y, !R6, !R7 - -Window_DrawColorTextFlash: - rcall winCalcAbsPosAndBorders ; (R18, R19) -Window_DrawColorTextFlash_loop: - lpm r16, Z - tst r16 - breq Window_DrawColorTextFlash_loopEnd - rcall winDrawChar - brcc Window_DrawColorTextFlash_loopEnd - adiw zh:zl, 1 ; next char - rjmp Window_DrawColorTextFlash_loop -Window_DrawColorTextFlash_loopEnd: - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine Window_DrawCharAt @global -; -; @param Y pointer to screen object in SDRAM -; @param R16 char to write -; @param R5:R4 X (dest) -; @param R7:R6 Y (dest) -; @return R5:R4 X pos behind char -; @clobbers any, !Y - -Window_DrawCharAt: - rcall winCalcAbsPosAndBorders - - ldd r0, Y+WIN_OFFS_BG_COL_LO - ldd r1, Y+WIN_OFFS_BG_COL_HI - ldd r2, Y+WIN_OFFS_FG_COL_LO - ldd r3, Y+WIN_OFFS_FG_COL_HI - - rjmp winDrawChar -; @end - - - -; --------------------------------------------------------------------------- -; @routine winCalcAbsPosAndBorders -; -; @param Y pointer to screen object in SDRAM -; @param R5:R4 X relative to window -; @param R7:R6 Y relative to window -; @return R9:R8 first X pos right of windows -; @return R5:R4 X relative to screen -; @return R7:R6 Y relative to screen -; @return R9:R8 first X pos right of window (abs) -; @return R11:R10 first Y pos below window (abs) -; @clobbers r18, r19 - -winCalcAbsPosAndBorders: - ; calc abs X pos - ldd r18, Y+WIN_OFFS_X_LO - ldd r19, Y+WIN_OFFS_X_HI - add r4, r18 ; add X of window - adc r5, r19 - - ; calc first X pos behind window - ldd r8, Y+WIN_OFFS_WIDTH_LO - ldd r9, Y+WIN_OFFS_WIDTH_HI - add r8, r18 - adc r9, r19 - - ; calc abs Y pos - ldd r18, Y+WIN_OFFS_Y_LO - ldd r19, Y+WIN_OFFS_Y_HI - add r6, r18 ; add Y of window - adc r7, r19 - - ; calc first Y pos behind window - ldd r10, Y+WIN_OFFS_HEIGHT_LO - ldd r11, Y+WIN_OFFS_HEIGHT_HI - add r10, r18 - adc r11, r19 - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine winDrawChar -; -; @param Y pointer to screen object in SDRAM -; @param R16 char to write -; @param R5:R4 absolute X on screen -; @param R7:R6 absolute Y on screen -; @param R9:R8 first X pos right of windows -; @return R5:R4 X pos behind char -; @clobbers any, !Y, !R6, !R7, !R8, !R9, !R10, !R11 - -winDrawChar: - push zl - push zh - mov r12, r16 - ldd zl, Y+WIN_OFFS_FONT_LO - ldd zh, Y+WIN_OFFS_FONT_HI - - ; check whether the char fits inside window - bigcall FONT_GetCharWidth ; r16=char width - - clr r17 - add r16, r4 ; char width+X - adc r17, r5 - sub r16, r8 ; check against window width - sbc r17, r9 - brcc winDrawChar_ret ; not fit, jmp - - ; actually draw char - mov r16, r12 - push r8 - push r9 - push r10 - push r11 - bigcall Display_DrawChar - pop r11 - pop r10 - pop r9 - pop r8 - clr r16 - add r4, r18 ; increment X - adc r5, r16 - sec ; write succeeded -winDrawChar_ret: - pop zh - pop zl - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine Window_WriteHexWordAt @global -; -; @param Y pointer to screen object in SDRAM -; @param R17:R16 word to write -; @param R5:R4 X (dest) -; @param R7:R6 Y (dest) -; @return R5:R4 X pos behind string -; @clobbers any, !Y - -Window_WriteHexWordAt: - push r16 - mov r16, r17 - rcall Window_WriteHexByteAt - pop r16 - rcall Window_WriteHexByteAt - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine Window_WriteHexByteAt @global -; -; @param Y pointer to screen object in SDRAM -; @param R16 byte to write -; @param R5:R4 X (dest) -; @param R7:R6 Y (dest) -; @return R5:R4 X pos behind string -; @clobbers any, !Y - -Window_WriteHexByteAt: - push r16 - swap r16 - rcall winWriteNibble - pop r16 - rcall winWriteNibble - ret -; @end - - - -winWriteNibble: - push r4 - push r5 - push r6 - push r7 - rcall winNibbleToAscii ; write high nibble (r16, r17) - rcall Window_DrawCharAt ; draw - pop r7 - pop r6 - pop r5 - pop r4 - clr r17 - add r4, r18 - adc r5, r17 - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine winNibbleToAscii -; -; Convert a nibble to an ASCII char. -; @return R16 ASCII representation of that nibble (e.g. '0' for 0) -; @param R16 byte (in bits 0-3) -; @clobbers r16, r17 - -winNibbleToAscii: - andi r16, 0xf - cpi r16, 10 - brcs winNibbleToAscii_l1 - ldi r17, 7 - add r16, r17 -winNibbleToAscii_l1: - ldi r17, '0' - add r16, r17 - ret -; @end - - - - - - -#if 0 -; --------------------------------------------------------------------------- -; @routine Window_DrawTextFlash @global -; -; @param Y pointer to screen object in SDRAM -; @param R5:R4 X (dest) -; @param R7:R6 Y (dest) -; @return R5:R4 X pos behind string -; @return R7:R6 Y pos behind string -; @clobbers any, !Y - -Window_DrawTextFlash: - ; calc abs X pos - ldd r18, Y+WIN_OFFS_X_LO - ldd r19, Y+WIN_OFFS_X_HI - add r4, r18 ; add X of window - adc r5, r19 - - ; calc first X pos behind window - ldd r8, Y+WIN_OFFS_WIDTH_LO - ldd r9, Y+WIN_OFFS_WIDTH_HI - add r8, r18 - adc r9, r19 - - ; calc abs Y pos - ldd r18, Y+WIN_OFFS_Y_LO - ldd r19, Y+WIN_OFFS_Y_HI - add r6, r18 ; add Y of window - adc r7, r19 - - ; calc first Y pos behind window - ldd r10, Y+WIN_OFFS_HEIGHT_LO - ldd r11, Y+WIN_OFFS_HEIGHT_HI - add r10, r18 - adc r11, r19 - -Window_DrawTextFlash_loop: - push zl - push zh - rcall winCalcLengthWordFlash - pop zh - pop zl - mov r18, r4 - mov r19, r5 - add r18, r12 - adc r19, r13 - sub r18, r8 - sbc r19, r9 - brcs Window_DrawTextFlash_xOkay - ; we need to go to the beginning of the next line - rcall Window_DrawTextFlash_nextLine - brcc Window_DrawTextFlash_loopEnd ; outside the window, jmp -Window_DrawTextFlash_xOkay: - rcall winDrawWordFlash ; Z points at blank/0 byte after call - lpm r16, Z+ - tst r16 ; end of string? - breq Window_DrawTextFlash_loopEnd - cpi r16, 13 - breq Window_DrawTextFlash_handle13 - ; insert other handled chars here - ; write blank char - push zl - push zh - ldd zl, Y+WIN_OFFS_FONT_LO - ldd zh, Y+WIN_OFFS_FONT_HI - ldi r16, 32 ; space - bigcall Display_DrawChar - pop zh - pop zl - add r4, r8 ; increment X - adc r5, r9 - - - rjmp Window_DrawTextFlash_loopNext -Window_DrawTextFlash_handle13: - rcall Window_DrawTextFlash_nextLine -Window_DrawTextFlash_loopNext: - rjmp Window_DrawTextFlash_loop -Window_DrawTextFlash_nextLine: - push zl - push zh - ldd zl, Y+WIN_OFFS_FONT_LO - ldd zh, Y+WIN_OFFS_FONT_HI - bigcall FONT_GetCharWidth ; r16=char width - pop zh - pop zl - ldd r4, Y+WIN_OFFS_X_LO ; X=left border - ldd r5, Y+WIN_OFFS_X_HI - clr r17 - add r6, r16 ; increment Y by font height - adc r7, r17 - mov r16, r6 ; check against lower border of window - mov r17, r7 - sub r16, r10 - sbc r17, r11 ; CF set if inside window, cleared otherwise - ret -Window_DrawTextFlash_loopEnd: - ret -; @end - - - - -; --------------------------------------------------------------------------- -; @routine winDrawWordFlash -; -; @param Y pointer to screen object in SDRAM -; @param Z pointer to string in FLASH -; @param R1:R0 background color -; @param R3:R2 foreground color -; @param R5:R4 X (dest) -; @param R7:R6 Y (dest) -; @return r5:r4 next X pos -; @return Z pointer to next char behind current word -; @clobbers any, !Y, !r1-r15 - -winDrawWordFlash: -winDrawWordFlash_loop: - lpm r16, Z - cpi r16, 33 - brcs winDrawWordFlash_ret - push zl - push zh - ldd zl, Y+WIN_OFFS_FONT_LO - ldd zh, Y+WIN_OFFS_FONT_HI - bigcall Display_DrawChar - pop zh - pop zl - clr r16 - add r4, r18 ; increment X - adc r5, r16 - adiw zh:zl, 1 - rjmp winDrawWordFlash_loop -winDrawWordFlash_ret: - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine winCalcLengthWordFlash -; -; @param Y pointer to screen object in SDRAM -; @param Z pointer to string in FLASH -; @return r13:r12 width of next word in pixels -; @return Z pointer to next char behind current word -; @clobbers any, !Y, !r1-r11, !r14, !r15 - -winCalcLengthWordFlash: - clr r12 - clr r13 -winCalcLengthWordFlash_loop: - lpm r16, Z - cpi r16, 33 - brcs winCalcLengthWordFlash_ret - push zl - push zh - ldd zl, Y+WIN_OFFS_FONT_LO - ldd zh, Y+WIN_OFFS_FONT_HI - bigcall FONT_GetCharWidth ; r16=char width - clr r17 - add r12, r16 - adc r13, r17 - pop zh - pop zl - brcs winCalcLengthWordFlash_error - adiw zh:zl, 1 ; next char - rjmp winCalcLengthWordFlash_loop -winCalcLengthWordFlash_error: - ldi r12, 0xff - ldi r13, 0xff -winCalcLengthWordFlash_ret: - ret -; @end - -#endif ; if 0 - - - -#endif - diff --git a/avr/modules/lcd2/gui2/0BUILD b/avr/modules/lcd2/gui2/0BUILD deleted file mode 100644 index 0823627..0000000 --- a/avr/modules/lcd2/gui2/0BUILD +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - sensorwatch.asm - - - - - diff --git a/avr/modules/lcd2/gui2/TODO b/avr/modules/lcd2/gui2/TODO deleted file mode 100644 index f89cdcf..0000000 --- a/avr/modules/lcd2/gui2/TODO +++ /dev/null @@ -1,136 +0,0 @@ - -- 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: - - 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/staticgui/0BUILD b/avr/modules/lcd2/staticgui/0BUILD deleted file mode 100644 index 7ad68a8..0000000 --- a/avr/modules/lcd2/staticgui/0BUILD +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - defs.asm - dialog.asm - main.asm - style.asm - titlewindow.asm - window.asm - - - - - diff --git a/avr/modules/lcd2/staticgui/TODO b/avr/modules/lcd2/staticgui/TODO deleted file mode 100644 index 898a149..0000000 --- a/avr/modules/lcd2/staticgui/TODO +++ /dev/null @@ -1,13 +0,0 @@ - - -- Screen - - functions: - - show - - unshow - - touch - - key - - activeAreas: - - x, y, w, h (in FLASH) - - only small variable data in SRAM, no need for heap! - - diff --git a/avr/modules/lcd2/staticgui/defs.asm b/avr/modules/lcd2/staticgui/defs.asm deleted file mode 100644 index 0ea9fcd..0000000 --- a/avr/modules/lcd2/staticgui/defs.asm +++ /dev/null @@ -1,65 +0,0 @@ -; *************************************************************************** -; copyright : (C) 2025 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_STATICGUI_DEFS_ASM -#define AQH_AVR_STATICGUI_DEFS_ASM - - -; all offsets in byte size (to be used with LPM) -.equ WIN_F_OFFS_X_LO = 0 -.equ WIN_F_OFFS_X_HI = 1 -.equ WIN_F_OFFS_Y_LO = 2 -.equ WIN_F_OFFS_Y_HI = 3 -.equ WIN_F_OFFS_WIDTH_LO = 4 -.equ WIN_F_OFFS_WIDTH_HI = 5 -.equ WIN_F_OFFS_HEIGHT_LO = 6 -.equ WIN_F_OFFS_HEIGHT_HI = 7 -.equ WIN_F_SIZE = 8 - -.equ COLORWIN_F_OFFS_WIN = WIN_F_SIZE -.equ COLORWIN_F_OFFS_BG_COLOR_LO = WIN_F_SIZE -.equ COLORWIN_F_OFFS_BG_COLOR_HI = WIN_F_SIZE+1 -.equ COLORWIN_F_OFFS_FG_COLOR_LO = WIN_F_SIZE+2 -.equ COLORWIN_F_OFFS_FG_COLOR_HI = WIN_F_SIZE+3 -.equ COLORWIN_F_SIZE = WIN_F_SIZE+4 - -.equ TEXTWIN_F_OFFS_WIN = COLORWIN_F_SIZE -.equ TEXTWIN_F_OFFS_FONT_LO = COLORWIN_F_SIZE -.equ TEXTWIN_F_OFFS_FONT_HI = COLORWIN_F_SIZE+1 -.equ TEXTWIN_F_SIZE = COLORWIN_F_SIZE+2 - - - -.equ WIN_OFFS_X_LO = 0 -.equ WIN_OFFS_X_HI = 1 -.equ WIN_OFFS_Y_LO = 2 -.equ WIN_OFFS_Y_HI = 3 -.equ WIN_OFFS_WIDTH_LO = 4 -.equ WIN_OFFS_WIDTH_HI = 5 -.equ WIN_OFFS_HEIGHT_LO = 6 -.equ WIN_OFFS_HEIGHT_HI = 7 -.equ WIN_OFFS_BG_COL_LO = 8 -.equ WIN_OFFS_BG_COL_HI = 9 -.equ WIN_OFFS_FG_COL_LO = 10 -.equ WIN_OFFS_FG_COL_HI = 11 -.equ WIN_OFFS_FONT_LO = 12 ;byte address! -.equ WIN_OFFS_FONT_HI = 13 -.equ WIN_SIZE = 14 - - - -.equ WIN_EVENT_DESTROY = 1 -.equ WIN_EVENT_SHOW = 2 -.equ WIN_EVENT_HIDE = 3 -.equ WIN_EVENT_DRAW = 4 -.equ WIN_EVENT_TIMER = 5 - - -#endif ; AQH_AVR_STATICGUI_DEFS_ASM - diff --git a/avr/modules/lcd2/staticgui/dialog.asm b/avr/modules/lcd2/staticgui/dialog.asm deleted file mode 100644 index a865699..0000000 --- a/avr/modules/lcd2/staticgui/dialog.asm +++ /dev/null @@ -1,288 +0,0 @@ -; *************************************************************************** -; copyright : (C) 2025 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 AQHOME_AVR_MODS_STATICGUI_DIALOG_ASM -#define AQHOME_AVR_MODS_STATICGUI_DIALOG_ASM - - - -; *************************************************************************** -; defines - -.equ DIALOG_MAX_ACTIVE = 8 - -.equ DIALOG_OFFS_HANDLER_LO = 0 -.equ DIALOG_OFFS_HANDLER_HI = 1 -.equ DIALOG_OFFS_OPTIONS = 2 -.equ DIALOG_OFFS_COUNTER = 3 -.equ DIALOG_SIZE = 4 - - -.equ DIALOG_OPT_ACTIVE_BIT = 7 - - -.equ DIALOG_FN_INIT = 0 -.equ DIALOG_FN_FINI = 1 -.equ DIALOG_FN_SHOW = 2 -.equ DIALOG_FN_HIDE = 3 -.equ DIALOG_FN_DRAW = 4 -.equ DIALOG_FN_TOUCH = 5 -.equ DIALOG_FN_TIMER = 6 - - - -; *************************************************************************** -; data - -.dseg - -dialogCurrent: .byte 2 -dialogStack: .byte DIALOG_MAX_ACTIVE*2 -dialogStackPos: .byte 1 - -dialogWindow: .byte WIN_SIZE - - - -; *************************************************************************** -; code - -.cseg - - -; --------------------------------------------------------------------------- -; @routine GraphApp_Init @global -; - -DialogMgr_Init: - clr r16 - sts dialogStackPos, r16 - sts dialogCurrent, r16 - sts dialogCurrent+1, r16 - - ldi yl, LOW(dialogWindow) - ldi yh, HIGH(dialogWindow) - bigcall TitleWindow_Init - - ldi zl, LOW(ili9341Font12x20_1*2) - ldi zh, HIGH(ili9341Font12x20_1*2) - std Y+WIN_OFFS_FONT_LO, zl - std Y+WIN_OFFS_FONT_HI, zh - - bigcall TitleWindow_SetFullSize - bigcall TitleWindow_SetStyleColors - - bigcall Window_Clear - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine DialogMgr_Every100ms @global -; -; Handle display touch events -; Send timer event to every app in the stack (started with last added app). - -DialogMgr_Every100ms: - ; check for touch input changes - rcall Display_InputGetState ; r16=flags, r5:r4=x, r7:r6=y - mov r17, r16 - andi r17, (1< count all visible children - rcall wGetSumOfMatchingVisibleChildrenHeights ; r19:r18=sum of all children heights - pop r22 - clr r23 ; r23:r22=number of visible expandable children - ; calculate number of bytes to add to each expandable child widget - ldd r20, Y+WID_OFFS_HEIGHT_LO ; total height - ldd r21, Y+WID_OFFS_HEIGHT_HI - clr r16 - ldd r17, Y+WID_OFFS_BORDER_TOP ; subtract top border - sub r20, r17 - sbc r21, r16 - brcs wVLayout_heightTooSmall ; jmp if too small - ldd r17, Y+WID_OFFS_BORDER_BOT ; subtract bottom border - sub r20, r17 - sbc r21, r16 - brcs wVLayout_heightTooSmall ; jmp if too small - - sub r20, r18 ; r21:r20 = HEIGHT-SUM_OF_VIS_CHILDREN_HEIGHTS - sbc r21, r19 - brcc wVLayout_heightTooSmall - breq wVLayout_yDone ; nothing to distribute - bigcall Utils_Divu16_16_16 ; r17:r16 = r21:r20 / r23:r22 - ; add additional pixel to heights of expandable child widgets - rcall wAddToHeightsOfExpandableVisibleChildren - -wVLayout_yDone: - rcall wSetRelYFromHeightInVisibleChildren - rcall wAlignChildrenHorizontally -; rcall wSetAbsoluteCoords call in GUI loop after calling layout on all widgets -wVLayout_heightTooSmall: - ; TODO: how to handle this case? - ret -; @end - - - -wSetAbsoluteCoords: - push yl - push yh -wSetAbsoluteCoords_loop: - ldd r18, Y+OBJ_OFFS_OPTIONS - andi r18, WID_OPTIONS0_BIT_VISIBLE - breq wSetAbsoluteCoords_nextSibling - push yl - push yh - bigcall Tree_GetParentObject - clr r18 - clr r19 - clr r20 - clr r21 - mov r17, xl - or r17, xh - breq wSetAbsoluteCoords_r1820set - mov yl, xl - mov yh, xh - ldd r18, Y+WID_OFFS_ABS_X_LO - ldd r19, Y+WID_OFFS_ABS_X_HI - ldd r20, Y+WID_OFFS_ABS_Y_LO - ldd r21, Y+WID_OFFS_ABS_Y_HI -wSetAbsoluteCoords_r1820set: - pop yh - pop yl - ; handle X - ldd r16, Y+WID_OFFS_REL_X_LO - ldd r17, Y+WID_OFFS_REL_X_HI - add r16, r18 - adc r17, r19 - std Y+WID_OFFS_ABS_X_LO, r16 - std Y+WID_OFFS_ABS_X_HI, r17 - ; handle Y - ldd r16, Y+WID_OFFS_REL_Y_LO - ldd r17, Y+WID_OFFS_REL_Y_HI - add r16, r20 - adc r17, r21 - std Y+WID_OFFS_ABS_Y_LO, r16 - std Y+WID_OFFS_ABS_Y_HI, r17 - bigcall Tree_GetObjectBelow - rjmp wSetAbsoluteCoords_loopEnd -wSetAbsoluteCoords_nextSibling: - bigcall Tree_GetNextSibling -wSetAbsoluteCoords_loopEnd: - mov r17, xl - or r17, xh - breq wSetAbsoluteCoords_end - mov yl, xl - mov yh, xh - rjmp wSetAbsoluteCoords_loop -wSetAbsoluteCoords_end: - pop yh - pop yl - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine wAlignChildrenHorizontally -; -; Horizontally align children within the width of the parent widget. -; Only changes Y+WID_OFFS_REL_X_LO/HI. -; -; @param Y pointer to object SRAM -; @clobbers r16, r17, r18, r19, r24, r25 - -wAlignChildrenHorizontally: - push yl - push yh - ldd r24, Y+WID_OFFS_WIDTH_LO ; parent width - ldd r25, Y+WID_OFFS_WIDTH_HI - ldd r19, Y+WID_OFFS_BORDER_LEFT ; subtract left border - mov r16, r19 - clr r17 - sub r24, r16 - sbc r25, r17 - ldd r16, Y+WID_OFFS_BORDER_RIGHT ; subtract right border - sub r24, r16 - sbc r25, r17 ; r25:r24=parent width minus lateral borders, r19=left border - rcall Tree_GetFirstChildObject ; (none) -wAlignChildrenHorizontally_loop: - mov r17, xl - or r17, xh - breq wAlignChildrenHorizontally_loopEnd - mov yl, xl - mov yh, yl - ldd r18, Y+OBJ_OFFS_OPTIONS - andi r18, WID_OPTIONS0_BIT_VISIBLE - breq wAlignChildrenHorizontally_loopNext - push r24 - push r25 - push r19 - rcall wAlignHorizontally - pop r19 - add r24, r19 - adc r25, r19 - sub r25, r19 - std Y+WID_OFFS_REL_X_LO, r24 - std Y+WID_OFFS_REL_X_HI, r25 - pop r25 - pop r24 -wAlignChildrenHorizontally_loopNext: - rcall Tree_GetNextSibling ; (none) - rjmp wAlignChildrenHorizontally_loop -wAlignChildrenHorizontally_loopEnd: - pop yh - pop yl - ret -; @end - - - -; --------------------------------------------------------------------------- -; @routine wAlignHorizontally -; -; @param r25:r24 parent width minus lateral borders -; @return r25:r24 proposed X position relative to parent -; @clobbers r16, r17 - -wAlignHorizontally: - ldd r16, Y+WID_OFFS_OPTIONS1 - sbrc r16, WID_OPTIONS1_BIT_STRETCH_X - rjmp wAlignHorizontally_stretch - andi r16, (WID_OPTIONS1_BIT_HALIGN0 | WID_OPTIONS1_BIT_HALIGN1) - cpi r16, (0<