From a6f1eb34e3682f42d752fded2536c0a6ecda2947 Mon Sep 17 00:00:00 2001 From: reaw55 <58457329+reaw55@users.noreply.github.com> Date: Mon, 8 Jan 2024 22:07:39 +0700 Subject: [PATCH] try to fix toggle --- src/user_code.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/user_code.cpp b/src/user_code.cpp index a50675b..d9c70a3 100644 --- a/src/user_code.cpp +++ b/src/user_code.cpp @@ -139,15 +139,15 @@ void fan_pop_callback(void *ptr) void mode_pop_callback(void *ptr) { - // uint8_t current_mode = ac_get_mode(); - user_acmode = ac_get_mode(); + uint8_t current_mode = ac_get_mode(); + //user_acmode = ac_get_mode(); // uint8_t new_mode = (current_mode + 1) % 3; // Loop back to 1 when reaching 2 - if (user_acmode == 1) + if (current_mode == 1) { user_acmode = 2; ac_set_state(2, ac_get_temperature(), ac_get_fan_speed()); } - else if (user_acmode == 2) + else if (current_mode == 2) { user_acmode = 1; ac_set_state(1, ac_get_temperature(), ac_get_fan_speed()); @@ -453,7 +453,7 @@ void update_lcd_ac() } // update the mode cool is 22, fan mode is 24, for off the toggle button act as indicator // Mode 0: Off, 1: Cool, 2: Fan - uint8_t mode_state = ac_get_mode(); + uint8_t mode_state = user_acmode; // mode.Set_background_image_pic(mode_state==1?22:24); elcd_send_stop_bit(); if (mode_state == 1)