; ***************************************************************************
; 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_APPS_FAN_CONTROL_SEND_ASM
#define AQH_AVR_APPS_FAN_CONTROL_SEND_ASM

.cseg


; ---------------------------------------------------------------------------
; @routine AppFanControl_ReportState
;
; @clobbers R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, X

AppFanControl_ReportState:
  push yl
    push yh
      push zl
        push zh
          ldi zl, LOW(appFanControlObjectFlash*2)
          ldi zh, HIGH(appFanControlObjectFlash*2)
          lpm yl, Z+
          lpm yh, Z
          sbiw zh:zl, 1
        
          ldd r16, Y+HTIM_RAM_OFFS_FLAGS
          clr r18
          sbrc r16, HTIM_FLAGBIT_STATE
            inc r18
          ldi r17, VALUE_ID_FANCTRL_STATE
          clr r19
          ldi r20, 1
          clr r21
          ldi r22, AQHOME_VALUETYPE_ONOFF
          rcall Main_SendValueReport       ; (R16, R17, R18, R19, R20, R21, R23, R24, R25, X)
        pop zh
      pop zl
    pop yh
  pop yl
  ret
; @end




#endif

