diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index a02007d8..58cdbd14 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -135,17 +135,22 @@ HASP_ATTRIBUTE_FAST_MEM void hasp_update_sleep_state() // return (hasp_sleep_state != HASP_SLEEP_OFF); } +void hasp_set_sleep_offset(uint32_t offset) +{ + sleepTimeOffset = offset; +} + void hasp_set_sleep_state(uint8_t state) { switch(state) { case HASP_SLEEP_LONG: - sleepTimeOffset = (sleepTimeShort + sleepTimeLong); + hasp_set_sleep_offset(sleepTimeShort + sleepTimeLong); break; case HASP_SLEEP_SHORT: - sleepTimeOffset = sleepTimeShort; + hasp_set_sleep_offset(sleepTimeShort); break; case HASP_SLEEP_OFF: - sleepTimeOffset = 0; + hasp_set_sleep_offset(0); break; default: return; diff --git a/src/hasp/hasp.h b/src/hasp/hasp.h index acdb07ba..bc77db18 100644 --- a/src/hasp/hasp.h +++ b/src/hasp/hasp.h @@ -69,8 +69,9 @@ void hasp_get_sleep_state(char* payload); void hasp_set_sleep_state(uint8_t state); 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_offset(uint32_t offset); void hasp_set_wakeup_touch(bool en); -void hasp_set_antiburn(int32_t repeat_count,uint32_t period); +void hasp_set_antiburn(int32_t repeat_count, uint32_t period); hasp_event_t hasp_get_antiburn(); void hasp_init(void);