From 36a5af164e93d96c354c64cf5037ada1f33ff490 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Mon, 2 Oct 2023 18:02:17 +0700 Subject: [PATCH] add AC State change callback --- src/espmega_iot_core.cpp | 5 +++-- src/user_code.cpp | 4 ++++ src/user_code.hpp | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index 7e9a142..df30835 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.cpp @@ -289,8 +289,8 @@ void ota_begin() { lcd_send_stop_bit(); uint32_t totalsize_kb = upload.totalSize / 1000; - uint32_t upload_pct = 100 * upload.totalSize/1000000; - String otafiletxt = "Downloading File : " + upload.filename + " ("+String(totalsize_kb) + "KB)"; + uint32_t upload_pct = 100 * upload.totalSize / 1000000; + String otafiletxt = "Downloading File : " + upload.filename + " (" + String(totalsize_kb) + "KB)"; panel.writeNum("prog.val", upload_pct); panel.writeStr("otatxt.txt", otafiletxt); } @@ -726,6 +726,7 @@ void ac_set_state(int mode, int temperature, int fan_speed) IrSender.sendRaw(ir_code_fan[fan_speed], sizeof(ir_code_fan[fan_speed]) / sizeof(ir_code_fan[fan_speed][0]), NEC_KHZ); break; } + ac_changed_user_callback(mode, temperature, fan_speed); } void publish_env_state() diff --git a/src/user_code.cpp b/src/user_code.cpp index 039e421..0c19dc2 100644 --- a/src/user_code.cpp +++ b/src/user_code.cpp @@ -80,4 +80,8 @@ void timer1_callback() { pwm_set_state(i, 1); } +} + +void ac_changed_user_callback(int mode, int temperature, int fan_speed) { + } \ No newline at end of file diff --git a/src/user_code.hpp b/src/user_code.hpp index d8383cb..7ef0623 100644 --- a/src/user_code.hpp +++ b/src/user_code.hpp @@ -21,6 +21,7 @@ void user_init(); void user_loop(); void virtual_interrupt_user_callback(int pin, int state); void pwm_changed_user_callback(int pin); +void ac_changed_user_callback(int mode, int temperature, int fan_speed); void timer_tick_callback(); void timer1_callback(); void bt0PopCallback(void *ptr);