; ***************************************************************************
; 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_W_CLIMATE_ASM
#define AQH_AVR_W_CLIMATE_ASM


; ***************************************************************************
; defines

.equ CLIMATEWIN_OFFS_BEGIN               = DIALOG_SIZE
.equ CLIMATEWIN_OFFS_CO2_NODEADDR        = CLIMATEWIN_OFFS_BEGIN+0
.equ CLIMATEWIN_OFFS_CO2_VALUEID         = CLIMATEWIN_OFFS_BEGIN+1
.equ CLIMATEWIN_OFFS_TEMP_NODEADDR       = CLIMATEWIN_OFFS_BEGIN+2
.equ CLIMATEWIN_OFFS_TEMP_VALUEID        = CLIMATEWIN_OFFS_BEGIN+3
.equ CLIMATEWIN_OFFS_HUM_NODEADDR        = CLIMATEWIN_OFFS_BEGIN+4
.equ CLIMATEWIN_OFFS_HUM_VALUEID         = CLIMATEWIN_OFFS_BEGIN+5

.equ CLIMATEWIN_OFFS_CO2_VALUE_LO        = CLIMATEWIN_OFFS_BEGIN+6
.equ CLIMATEWIN_OFFS_CO2_VALUE_HI        = CLIMATEWIN_OFFS_BEGIN+7
.equ CLIMATEWIN_OFFS_TEMP_VALUE_LO       = CLIMATEWIN_OFFS_BEGIN+8
.equ CLIMATEWIN_OFFS_TEMP_VALUE_HI       = CLIMATEWIN_OFFS_BEGIN+9
.equ CLIMATEWIN_OFFS_HUM_VALUE_LO        = CLIMATEWIN_OFFS_BEGIN+10
.equ CLIMATEWIN_OFFS_HUM_VALUE_HI        = CLIMATEWIN_OFFS_BEGIN+11

.equ CLIMATEWIN_OFFS_NODEADDR            = CLIMATEWIN_OFFS_BEGIN+12
.equ CLIMATEWIN_OFFS_VALUEID             = CLIMATEWIN_OFFS_BEGIN+13
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_WARN_LO = CLIMATEWIN_OFFS_BEGIN+14
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_WARN_HI = CLIMATEWIN_OFFS_BEGIN+15
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_WARN_LO = CLIMATEWIN_OFFS_BEGIN+16
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_WARN_HI = CLIMATEWIN_OFFS_BEGIN+17
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_CRIT_LO = CLIMATEWIN_OFFS_BEGIN+18
.equ CLIMATEWIN_OFFS_UPPER_LIMIT_CRIT_HI = CLIMATEWIN_OFFS_BEGIN+19
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_CRIT_LO = CLIMATEWIN_OFFS_BEGIN+20
.equ CLIMATEWIN_OFFS_LOWER_LIMIT_CRIT_HI = CLIMATEWIN_OFFS_BEGIN+21
.equ CLIMATEWIN_SIZE                     = CLIMATEWIN_OFFS_BEGIN+22



; ***************************************************************************
; code

.cseg



; ---------------------------------------------------------------------------
; @routine ClimateWin_new @global
;
; @param Y pointer to GUIAPP
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object

ClimateWin_new:
  bigcall GuiApp_GetRootWindow
  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, (1<<OBJECT_OPTS_MSGRECV_BIT)                                                                ; OPTS
  ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
  ldi r20, LOW(RESSOURCE_TXT_ROOMCLIMATE)
  ldi r21, HIGH(RESSOURCE_TXT_ROOMCLIMATE)
  bigcall Dialog_Init               ; Y=main window
  brcc ClimateWin_Init_ret

  ; set default signal map
  ldi r16, LOW(ClimateWin_DefaultSignalmap*2)
  std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
  ldi r16, HIGH(ClimateWin_DefaultSignalmap*2)
  std Y+OBJECT_OFFS_SIGNALMAP_HI, r16

  ; init
  rcall climateWinReadSourcesFromEeprom

ClimateWin_Init_ret:
  ret
; @end



; ---------------------------------------------------------------------------
; @routine climateWinCreateSensorWatches
;
; @param X pointer to MainWindow content window (becomes parent)
; @return CFLAG set of okay, cleared otherwise

climateWinCreateSensorWatches:
  ldi r16, 0                                                                                           ; OPTS
  ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
  ldi r20, HLAYOUT_MODE_SPREAD
  bigcall HLayout_new
  brcc climateWinCreateSensorWatches_ret

  ldi r16, LOW(ClimateWin_HLayoutStyle*2)
  std Y+WIDGET_OFFS_STYLE_LO, r16
  ldi r16, HIGH(ClimateWin_HLayoutStyle*2)
  std Y+WIDGET_OFFS_STYLE_HI, r16

  mov xl, yl                          ; use HLayout as parent
  mov xh, yh

  ; CO2 sensor watch
  push xl    ; HLayout
    push xh
      ldi r16, (1<<OBJECT_OPTS_TIMER_BIT)                      ; OPTS
      ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
               (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT)     ; PACK
      ldi r20, VALUE_ID_SENSOR_CO2_BASE
      ldi r21, C03_EEID_SENSOR_CO2
      ldi r22, SENSORWATCH_TYPE_CO2
      bigcall SensorWatch_new
    pop xh
  pop xl
  brcc climateWinCreateSensorWatches_ret

  ; temp sensor watch
  push xl    ; HLayout
    push xh
      ldi r16, (1<<OBJECT_OPTS_TIMER_BIT)                      ; OPTS
      ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
               (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT)     ; PACK
      ldi r20, VALUE_ID_SENSOR_TEMP_BASE
      ldi r21, C03_EEID_SENSOR_TEMP
      ldi r22, SENSORWATCH_TYPE_TEMP
      bigcall SensorWatch_new
    pop xh
  pop xl
  brcc climateWinCreateSensorWatches_ret

  ; humidity sensor watch
  push xl    ; HLayout
    push xh
      ldi r16, (1<<OBJECT_OPTS_TIMER_BIT)                      ; OPTS
      ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
               (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT)     ; PACK
      ldi r20, VALUE_ID_SENSOR_HUM_BASE
      ldi r21, C03_EEID_SENSOR_HUM
      ldi r22, SENSORWATCH_TYPE_HUM
      bigcall SensorWatch_new
    pop xh
  pop xl

climateWinCreateSensorWatches_ret:
  ret
; @end



; ---------------------------------------------------------------------------
; @routine climateWinReadEeprom
;
; @param Y pointer to widget

climateWinReadSourcesFromEeprom:
  ldi r16, C03_EEID_SENSOR_CO2
  rcall climateWinReadEeprom           ; (none)
  brcc climateWinReadSourcesFromEeprom_readTemp
  ldd r16, Y+CLIMATEWIN_OFFS_NODEADDR
  std Y+CLIMATEWIN_OFFS_CO2_NODEADDR, r16
  ldd r16, Y+CLIMATEWIN_OFFS_VALUEID
  std Y+CLIMATEWIN_OFFS_CO2_VALUEID, r16
climateWinReadSourcesFromEeprom_readTemp:
  ldi r16, C03_EEID_SENSOR_TEMP
  rcall climateWinReadEeprom           ; (none)
  brcc climateWinReadSourcesFromEeprom_readHum
  ldd r16, Y+CLIMATEWIN_OFFS_NODEADDR
  std Y+CLIMATEWIN_OFFS_TEMP_NODEADDR, r16
  ldd r16, Y+CLIMATEWIN_OFFS_VALUEID
  std Y+CLIMATEWIN_OFFS_TEMP_VALUEID, r16
climateWinReadSourcesFromEeprom_readHum:
  ldi r16, C03_EEID_SENSOR_HUM
  rcall climateWinReadEeprom           ; (none)
  brcc climateWinReadSourcesFromEeprom_ret
  ldd r16, Y+CLIMATEWIN_OFFS_NODEADDR
  std Y+CLIMATEWIN_OFFS_HUM_NODEADDR, r16
  ldd r16, Y+CLIMATEWIN_OFFS_VALUEID
  std Y+CLIMATEWIN_OFFS_HUM_VALUEID, r16
climateWinReadSourcesFromEeprom_ret:
  ret
; @end



; ---------------------------------------------------------------------------
; @routine climateWinReadEeprom
;
; @param Y pointer to widget
; @param R16 eeprom tlv id
; @return CFLAG set if data found and read, cleared on error
; @clobbers none

climateWinReadEeprom:
  push xl
    push xh
      push r18
        bigcall EepromTlv_FindFirst                    ; (R18)
      pop r18
      brcc climateWinReadEeprom_ret
      push yl
        push yh
          adiw yh:yl, CLIMATEWIN_OFFS_NODEADDR
          push r16
            push r17
              ldi r17, SENSORWATCH_EE_SIZE
              bigcall Eeprom_ReadBytes              ; (r16, r17, X, Y)
            pop r17
          pop r16
        pop yh
      pop yl
climateWinReadEeprom_ret:
    pop xh
  pop xl
  ret
; @end



; ---------------------------------------------------------------------------
; @routine climateWinWriteEeprom
;
; @param Y pointer to widget
; @param R16 eeprom tlv id
; @return CFLAG set if data found and read, cleared on error
; @clobbers R16, R18, R20, R21

climateWinWriteEeprom:
  push xl
    push xh
      push r17
        tst r16
        clc
        breq climateWinWriteEeprom_ret
        push r16
          bigcall EepromTlv_FindFirst                  ; (R18)
        pop r16
        brcs climateWinWriteEeprom_write
        ldi r17, SENSORWATCH_EE_SIZE
        bigcall EepromTlv_AddTlv                       ; X=pointer to EEPROM data (R16, R18, R20, R21)
        brcc climateWinWriteEeprom_ret
climateWinWriteEeprom_write:
        push yl
          push yh
            adiw yh:yl, CLIMATEWIN_OFFS_NODEADDR
            ldi r18, SENSORWATCH_EE_SIZE
climateWinWriteEeprom_loop:
              ld r16, Y+
              bigcall Eeprom_WriteByteIfChanged            ; (R17)
              brcc climateWinWriteEeprom_loopEnd
              adiw xh:xl, 1
              dec r18
            brne climateWinWriteEeprom_loop
            sec
climateWinWriteEeprom_loopEnd:
          pop yh
        pop yl
climateWinWriteEeprom_ret:
      pop r17
    pop xh
  pop xl  
  ret
; @end





; ***************************************************************************
; signal handlers



ClimateWin_OnMkContent:
  bigcall MainWindow_GetContentWidget  ; r19:r18=content window
  brcc ClimateWin_OnMkContent_ret
  mov xl, r18                          ; use content window as parent
  mov xh, r19

  ; Y=MainWindow, X=content window
  push yl                              ; main window
    push yh
      push xl                          ; content window
        push xh
          rcall climateWinCreateSensorWatches
        pop xh                         ; content window
      pop xl
      bigcall C03App_CreateBackButton
    pop yh                             ; main window
  pop yl
  
  ; send values to watches
  ldi r16, 0
  ldd r18, Y+CLIMATEWIN_OFFS_CO2_VALUE_LO
  ldd r19, Y+CLIMATEWIN_OFFS_CO2_VALUE_HI
  rcall climateWinSendValue

  ldi r16, 1
  ldd r18, Y+CLIMATEWIN_OFFS_TEMP_VALUE_LO
  ldd r19, Y+CLIMATEWIN_OFFS_TEMP_VALUE_HI
  rcall climateWinSendValue

  ldi r16, 2
  ldd r18, Y+CLIMATEWIN_OFFS_HUM_VALUE_LO
  ldd r19, Y+CLIMATEWIN_OFFS_HUM_VALUE_HI
  rcall climateWinSendValue

ClimateWin_OnMkContent_ret:
  sec
  ret
; @end




; ---------------------------------------------------------------------------
; @routine ClimateWin_OnRecvSet @global
;
; @clobbers any, !Y

ClimateWin_OnRecvSet:
  bigcall NETMSG_ValueRead
  ldi zl, LOW(ClimateWin_MsgTable*2)
  ldi zh, HIGH(ClimateWin_MsgTable*2)
  bigcall Main_HandleValueMsg
  sec
  ret
; @end



; ---------------------------------------------------------------------------
; @routine ClimateWin_OnRecvReport @global
;
; @clobbers any, !Y

ClimateWin_OnRecvReport:
  bigcall NETMSG_ValueRead
  ldd r16, Y+CLIMATEWIN_OFFS_CO2_NODEADDR
  cp r16, r22
  brne ClimateWin_OnRecvReport_checkTemp
  ldd r16, Y+CLIMATEWIN_OFFS_CO2_VALUEID
  cp r16, r17
  brne ClimateWin_OnRecvReport_checkTemp
  std Y+CLIMATEWIN_OFFS_CO2_VALUE_LO, r18
  std Y+CLIMATEWIN_OFFS_CO2_VALUE_HI, r19
  clr r16
  rjmp ClimateWin_OnRecvReport_sendValue
ClimateWin_OnRecvReport_checkTemp:
  ldd r16, Y+CLIMATEWIN_OFFS_TEMP_NODEADDR
  cp r16, r22
  brne ClimateWin_OnRecvReport_checkHum
  ldd r16, Y+CLIMATEWIN_OFFS_TEMP_VALUEID
  cp r16, r17
  brne ClimateWin_OnRecvReport_checkHum
  std Y+CLIMATEWIN_OFFS_TEMP_VALUE_LO, r18
  std Y+CLIMATEWIN_OFFS_TEMP_VALUE_HI, r19
  ldi r16, 1
  rjmp ClimateWin_OnRecvReport_sendValue
ClimateWin_OnRecvReport_checkHum:
  ldd r16, Y+CLIMATEWIN_OFFS_HUM_NODEADDR
  cp r16, r22
  brne ClimateWin_OnRecvReport_done
  ldd r16, Y+CLIMATEWIN_OFFS_HUM_VALUEID
  cp r16, r17
  brne ClimateWin_OnRecvReport_done
  std Y+CLIMATEWIN_OFFS_HUM_VALUE_LO, r18
  std Y+CLIMATEWIN_OFFS_HUM_VALUE_HI, r19
  ldi r16, 2
ClimateWin_OnRecvReport_sendValue:
  rcall climateWinSendValue
ClimateWin_OnRecvReport_done:
  sec
  ret
; @end



ClimateWin_OnMsgSetCo2Source:
  ldi r16, C03_EEID_SENSOR_CO2
  ldi r17, 0
  rjmp climateWinSetSource
  
ClimateWin_OnMsgSetCo2LimWarn:
  ldi r16, C03_EEID_SENSOR_CO2
  ldi r17, 0
  rjmp climateWinSetLimWarn

ClimateWin_OnMsgSetCo2LimCrit:
  ldi r16, C03_EEID_SENSOR_CO2
  ldi r17, 0
  rjmp climateWinSetLimCrit


ClimateWin_OnMsgSetTempSource:
  ldi r16, C03_EEID_SENSOR_TEMP
  ldi r17, 1
  rjmp climateWinSetSource

ClimateWin_OnMsgSetTempLimWarn:
  ldi r16, C03_EEID_SENSOR_TEMP
  ldi r17, 1
  rjmp climateWinSetLimWarn

ClimateWin_OnMsgSetTempLimCrit:
  ldi r16, C03_EEID_SENSOR_TEMP
  ldi r17, 1
  rjmp climateWinSetLimCrit


ClimateWin_OnMsgSetHumSource:
  ldi r16, C03_EEID_SENSOR_HUM
  ldi r17, 2
  rjmp climateWinSetSource

ClimateWin_OnMsgSetHumLimWarn:
  ldi r16, C03_EEID_SENSOR_HUM
  ldi r17, 2
  rjmp climateWinSetLimWarn

ClimateWin_OnMsgSetHumLimCrit:
  ldi r16, C03_EEID_SENSOR_HUM
  ldi r17, 2
  rjmp climateWinSetLimCrit


; ---------------------------------------------------------------------------
; @routine climateWinSetSource
;
; @param Y pointer to widget
; @param r16 EEPROM tlv id
; @param r17 widget child idx

climateWinSetSource:
  rcall climateWinReadEeprom           ; (none)
  std Y+SENSORWATCH_OFFS_NODEADDR, r18
  std Y+SENSORWATCH_OFFS_VALUEID, r19
  rjmp climateWinWriteUpdateAck
; @end



; ---------------------------------------------------------------------------
; @routine climateWinSetLimWarn
;
; @param Y pointer to widget
; @param r16 eeprom tlv id
; @param r17 widget child idx

climateWinSetLimWarn:
  rcall climateWinReadEeprom                      ; (none)
  std Y+SENSORWATCH_OFFS_LOWER_LIMIT_WARN_LO, r18
  std Y+SENSORWATCH_OFFS_LOWER_LIMIT_WARN_HI, r19
  std Y+SENSORWATCH_OFFS_UPPER_LIMIT_WARN_LO, r20
  std Y+SENSORWATCH_OFFS_UPPER_LIMIT_WARN_HI, r21
  rjmp climateWinWriteUpdateAck
; @end



; ---------------------------------------------------------------------------
; @routine climateWinSetLimCrit
;
; @param Y pointer to widget
; @param r16 eeprom tlv id
; @param r17 widget child idx

climateWinSetLimCrit:
  rcall climateWinReadEeprom                      ; (none)
  std Y+SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_LO, r18
  std Y+SENSORWATCH_OFFS_LOWER_LIMIT_CRIT_HI, r19
  std Y+SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_LO, r20
  std Y+SENSORWATCH_OFFS_UPPER_LIMIT_CRIT_HI, r21
  rjmp climateWinWriteUpdateAck
; @end



; ---------------------------------------------------------------------------
; @routine climateWinWriteUpdateAck
;
; @param Y pointer to widget
; @param r16 EEPROM tlv id
; @param r17 widget child idx

climateWinWriteUpdateAck:
  rcall climateWinWriteEeprom          ; (R16, R18, R20, R21)
  mov r16, r17
  rcall climateWinUpdateWidget
  ldi r23, NETMSG_CMD_VALUE_SET_ACK
  sec
  ret
; @end



; ---------------------------------------------------------------------------
; @routine climateWinUpdateWidget
;
; @param Y pointer to widget
; @param r16 idx of child widget

climateWinUpdateWidget:
  ldd r17, Y+OBJECT_OFFS_FLAGS
  sbrs r17, WIDGET_FLAGS_VISIBLE_BIT
    rjmp climateWinUpdateWidget_ret
  push r16
    bigcall MainWindow_GetFirstChildOfContentWidget
  pop r16
  brcc climateWinUpdateWidget_ret
  push yl
    push yh
      mov yl, r18
      mov yh, r19
      bigcall OBJ_GetChildAt
    pop yh
  pop yl
  brcc climateWinUpdateWidget_ret
  push yl
    push yh
      mov yl, r18
      mov yh, r19
      bigcall SensorWatch_fromEeprom
    pop yh
  pop yl
climateWinUpdateWidget_ret:
  ret
; @end



; ---------------------------------------------------------------------------
; @routine climateWinSendValue
;
; @param Y pointer to widget
; @param r16 idx of child widget
; @param r19:r18 value

climateWinSendValue:
  ldd r17, Y+OBJECT_OFFS_FLAGS
  sbrs r17, WIDGET_FLAGS_VISIBLE_BIT
    rjmp climateWinSendValue_ret
  ; visible
  mov xl, r18
  mov xh, r19
  push r16
    bigcall MainWindow_GetFirstChildOfContentWidget  ; (r16)
  pop r16
  brcc climateWinSendValue_ret
  push yl
    push yh
      mov yl, r18
      mov yh, r19
      bigcall OBJ_GetChildAt    ; (r16)
    pop yh
  pop yl
  brcc climateWinSendValue_ret
  push yl
    push yh
      mov yl, r18
      mov yh, r19
      bigcall Widget_SetCurrentValue
    pop yh
  pop yl
climateWinSendValue_ret:
  ret
; @end




  




; ***************************************************************************
; data in FLASH

ClimateWin_MsgTable:
  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_CO2_SOURCE,  LOW(ClimateWin_OnMsgSetCo2Source),    HIGH(ClimateWin_OnMsgSetCo2Source)
  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_CO2_LIMWARN, LOW(ClimateWin_OnMsgSetCo2LimWarn),   HIGH(ClimateWin_OnMsgSetCo2LimWarn)
  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_CO2_LIMWARN, LOW(ClimateWin_OnMsgSetCo2LimCrit),   HIGH(ClimateWin_OnMsgSetCo2LimCrit)

  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_TEMP_SOURCE,  LOW(ClimateWin_OnMsgSetTempSource),  HIGH(ClimateWin_OnMsgSetTempSource)
  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_TEMP_LIMWARN, LOW(ClimateWin_OnMsgSetTempLimWarn), HIGH(ClimateWin_OnMsgSetTempLimWarn)
  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_TEMP_LIMWARN, LOW(ClimateWin_OnMsgSetTempLimCrit), HIGH(ClimateWin_OnMsgSetTempLimCrit)

  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_HUM_SOURCE,  LOW(ClimateWin_OnMsgSetHumSource),    HIGH(ClimateWin_OnMsgSetHumSource)
  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_HUM_LIMWARN, LOW(ClimateWin_OnMsgSetHumLimWarn),   HIGH(ClimateWin_OnMsgSetHumLimWarn)
  .db NETMSG_CMD_VALUE_SET, VALUE_ID_SENSOR_HUM_LIMWARN, LOW(ClimateWin_OnMsgSetHumLimCrit),   HIGH(ClimateWin_OnMsgSetHumLimCrit)

  .db 0, 0, 0, 0


ClimateWin_HLayoutStyle:
  .dw DISPLAY_COLOR_BLACK        ; frontCol_norm
  .dw DISPLAY_COLOR_LIGHTGREY    ; backCol_norm
  .dw DISPLAY_COLOR_BLACK        ; borderCol_norm
  .dw DISPLAY_COLOR_WHITE        ; shadowCol_norm
  
  .dw DISPLAY_COLOR_WHITE        ; frontCol_activated
  .dw DISPLAY_COLOR_NAVY         ; backCol_activated
  .dw DISPLAY_COLOR_BLACK        ; borderCol_activated
  .dw DISPLAY_COLOR_WHITE        ; shadowCol_activated
  
  .db 0, 1                       ; outerBorderSize, innerBorderSize
  .dw ili9341Font12x16_1*2       ; font
  .db 12, 16                     ; charWidth, charHeight



ClimateWin_DefaultSignalmap:
  ; header
  .dw Dialog_DefaultSignalmap*2  ; next table to use
  ; entries
  .db NETMSG_CMD_VALUE_REPORT, OBJECT_SIGNAL_RECVMSG,   LOW(ClimateWin_OnRecvReport),  HIGH(ClimateWin_OnRecvReport)
  .db NETMSG_CMD_VALUE_SET,    OBJECT_SIGNAL_RECVMSG,   LOW(ClimateWin_OnRecvSet),     HIGH(ClimateWin_OnRecvSet)
  .db 0,                       DIALOG_SIGNAL_MKCONTENT, LOW(ClimateWin_OnMkContent),   HIGH(ClimateWin_OnMkContent)
  ; end of table
  .db 0, 0, 0, 0



#endif

