mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 05:36:37 +00:00
Dispatch antiburn on connect #134
This commit is contained in:
parent
884a466ca9
commit
47eb19b9b2
@ -203,9 +203,9 @@ void hasp_set_antiburn(int32_t repeat_count, uint32_t period)
|
|||||||
/**
|
/**
|
||||||
* Check if Anti Burn-in protection is enabled
|
* Check if Anti Burn-in protection is enabled
|
||||||
*/
|
*/
|
||||||
bool hasp_get_antiburn()
|
hasp_event_t hasp_get_antiburn()
|
||||||
{
|
{
|
||||||
return antiburn_task != NULL;
|
return (antiburn_task != NULL) ? HASP_EVENT_ON : HASP_EVENT_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ void hasp_set_sleep_state(uint8_t state);
|
|||||||
void hasp_get_sleep_time(uint16_t& short_time, uint16_t& long_time);
|
void hasp_get_sleep_time(uint16_t& short_time, uint16_t& long_time);
|
||||||
void hasp_set_sleep_time(uint16_t short_time, uint16_t long_time);
|
void hasp_set_sleep_time(uint16_t short_time, uint16_t long_time);
|
||||||
void hasp_set_wakeup_touch(bool en);
|
void hasp_set_wakeup_touch(bool en);
|
||||||
bool hasp_get_antiburn();
|
hasp_event_t hasp_get_antiburn();
|
||||||
void hasp_set_antiburn(int32_t repeat_count,uint32_t period);
|
void hasp_set_antiburn(int32_t repeat_count,uint32_t period);
|
||||||
|
|
||||||
void hasp_init(void);
|
void hasp_init(void);
|
||||||
|
@ -953,8 +953,12 @@ void dispatch_web_update(const char*, const char* espOtaUrl, uint8_t source)
|
|||||||
|
|
||||||
void dispatch_antiburn(const char*, const char* payload, uint8_t source)
|
void dispatch_antiburn(const char*, const char* payload, uint8_t source)
|
||||||
{
|
{
|
||||||
bool state = Parser::is_true(payload); // ON, TRUE, YES or 1
|
if(strlen(payload) > 0) {
|
||||||
hasp_set_antiburn(state ? 30 : 0, 1000); // ON = 25 cycles of 1000 milli seconds (i.e. 25 sec)
|
bool state = Parser::is_true(payload); // ON, TRUE, YES or 1
|
||||||
|
hasp_set_antiburn(state ? 30 : 0, 1000); // ON = 25 cycles of 1000 milli seconds (i.e. 25 sec)
|
||||||
|
} else {
|
||||||
|
dispatch_state_antiburn(hasp_get_antiburn());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// restart the device
|
// restart the device
|
||||||
@ -1167,6 +1171,7 @@ void dispatch_current_state(uint8_t source)
|
|||||||
dispatch_current_page();
|
dispatch_current_page();
|
||||||
dispatch_send_sensordata(NULL, NULL, source);
|
dispatch_send_sensordata(NULL, NULL, source);
|
||||||
dispatch_send_discovery(NULL, NULL, source);
|
dispatch_send_discovery(NULL, NULL, source);
|
||||||
|
dispatch_state_antiburn(hasp_get_antiburn());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format filesystem and erase EEPROM
|
// Format filesystem and erase EEPROM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user