; ***************************************************************************
; 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.   *
; ***************************************************************************



; ---------------------------------------------------------------------------
; @routine MultiFan_ReportSpeed1
;
; @param R17     value id
; @param R19:R18 speed (RPM)
; @clobbers R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, X

MultiFan_ReportSpeed1:
  push yl
    push yh
      ldi yl, LOW(multiFanObjects)
      ldi yh, HIGH(multiFanObjects)
      ldi r17, VALUE_ID_FAN1_SPEED
      ldd r18, Y+MULTIFAN_FAN_OFFS_CURR_FREQUENCY_LO
      ldd r19, Y+MULTIFAN_FAN_OFFS_CURR_FREQUENCY_HI
      rcall multiFanReportSpeed
    pop yh
  pop yl
  ret
; @end



; ---------------------------------------------------------------------------
; @routine MultiFan_ReportSpeed2
;
; @param R17     value id
; @param R19:R18 speed (RPM)
; @clobbers R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, X

MultiFan_ReportSpeed2:
  push yl
    push yh
      ldi yl, LOW(multiFanObjects+MULTIFAN_FAN_SIZE)
      ldi yh, HIGH(multiFanObjects+MULTIFAN_FAN_SIZE)
      ldi r17, VALUE_ID_FAN2_SPEED
      ldd r18, Y+MULTIFAN_FAN_OFFS_CURR_FREQUENCY_LO
      ldd r19, Y+MULTIFAN_FAN_OFFS_CURR_FREQUENCY_HI
      rcall multiFanReportSpeed
    pop yh
  pop yl
  ret
; @end



; ---------------------------------------------------------------------------
; @routine MultiFan_ReportSpeed2
;
; @param R17     value id
; @param R19:R18 speed (RPM)
; @clobbers R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, X

MultiFan_ReportSpeed3:
  push yl
    push yh
      ldi yl, LOW(multiFanObjects+(MULTIFAN_FAN_SIZE*2))
      ldi yh, HIGH(multiFanObjects+(MULTIFAN_FAN_SIZE*2))
      ldi r17, VALUE_ID_FAN3_SPEED
      ldd r18, Y+MULTIFAN_FAN_OFFS_CURR_FREQUENCY_LO
      ldd r19, Y+MULTIFAN_FAN_OFFS_CURR_FREQUENCY_HI
      rcall multiFanReportSpeed
    pop yh
  pop yl
  ret
; @end



; ---------------------------------------------------------------------------
; @routine multiFanReportSpeed
;
; @param R17     value id
; @param R19:R18 speed (RPM)
; @clobbers R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, X, Y

multiFanReportSpeed:
  ldi r20, 1
  clr r21
  ldi r22, AQHOME_VALUETYPE_RPM
  rcall Main_SendValueReport       ; (R16, R17, R18, R19, R20, R21, R23, R24, R25, X)
  ret
; @end


