diff --git a/src/main.c b/src/main.c index 7baaf40..31abad9 100755 --- a/src/main.c +++ b/src/main.c @@ -156,240 +156,17 @@ void update_temp() { target_temp = (int)target_temp; pass_temp_mode_values(target_temp, target_state, target_fan); - // HEAT TARGET STATE 1 - if (target_state == 1) { - - switch ((int) target_temp) { - - case 18: - - // printf("New Heating Temp: %d\n", 18 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 19: - - // printf("New Heating Temp: %d\n", 19 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 20: - - // printf("New Heating Temp: %d\n", 20 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 21: - - // printf("New Heating Temp: %d\n", 21 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - - break; - - case 22: - - // printf("New Heating Temp: %d\n", 22 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 23: - - // printf("New Heating Temp: %d\n", 23 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 24: - - // printf("New Heating Temp: %d\n", 24 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 25: - - // printf("New Heating Temp: %d\n", 25 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 26: - - // printf("New Heating Temp: %d\n", 26 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 27: - - // printf("New Heating Temp: %d\n", 27 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 28: - - // printf("New Heating Temp: %d\n", 28 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 29: - - // printf("New Heating Temp: %d\n", 29 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 30: - - // printf("New Heating Temp: %d\n", 30 ); - ac_button_temp(); - led_code(led_gpio, FUNCTION_B); - switch_temp_update = 1; - update_state(); - break; - - default: - - printf("No action \n"); - - } - } - - // COOL TARGET STATE 2 - if (target_state == 2) { - - switch ((int) target_temp) { - - case 18: - - // printf("New Cooling Temp: %d\n", 18 ); - ac_button_temp(); - led_code(led_gpio, FUNCTION_B); - switch_temp_update = 1; - update_state(); - break; - - case 19: - - // printf("New Cooling Temp: %d\n", 19 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 20: - - // printf("New Cooling Temp: %d\n", 20 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 21: - - // printf("New Cooling Temp: %d\n", 21 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 22: - - // printf("New Cooling Temp: %d\n", 22 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 23: - - // printf("New Cooling Temp: %d\n", 23 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 24: - - // printf("New Cooling Temp: %d\n", 24 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 25: - - // printf("New Cooling Temp: %d\n", 25 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 26: - - // printf("New Cooling Temp: %d\n", 26 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 27: - - // printf("New Cooling Temp: %d\n", 27 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 28: - - // printf("New Cooling Temp: %d\n", 28 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 29: - - // printf("New Cooling Temp: %d\n", 29 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - case 30: - - // printf("New Cooling Temp: %d\n", 30 ); - ac_button_temp(); - switch_temp_update = 1; - update_state(); - break; - - default: - - printf("No action \n"); - - } + ac_button_temp(); + + if (target_state == 1 && target_temp == 30) { + led_code(led_gpio, FUNCTION_B); + }else if (target_state == 2 && target_temp == 18) { + led_code(led_gpio, FUNCTION_B); } + + switch_temp_update = 1; + update_state(); + } // FAN GET VALUE @@ -758,7 +535,7 @@ homekit_characteristic_t manufacturer = HOMEKIT_CHARACTERISTIC_(MANUFACTURER, "C homekit_characteristic_t name = HOMEKIT_CHARACTERISTIC_(NAME, "Air Conditioner"); homekit_characteristic_t serial = HOMEKIT_CHARACTERISTIC_(SERIAL_NUMBER, NULL); homekit_characteristic_t model = HOMEKIT_CHARACTERISTIC_(MODEL, "Fujitsu AC"); -homekit_characteristic_t revision = HOMEKIT_CHARACTERISTIC_(FIRMWARE_REVISION, "2.7.0"); +homekit_characteristic_t revision = HOMEKIT_CHARACTERISTIC_(FIRMWARE_REVISION, "2.7.1"); homekit_characteristic_t identify_function = HOMEKIT_CHARACTERISTIC_(IDENTIFY, identify); homekit_characteristic_t service_name = HOMEKIT_CHARACTERISTIC_(NAME, "Fujitsu AC"); homekit_characteristic_t setup_name = HOMEKIT_CHARACTERISTIC_(NAME, "Setup");