Skip to content

Commit

Permalink
dispatch_run_script already checks if file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
fvanroie committed Aug 26, 2023
1 parent 71237c2 commit c5ce7c6
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/hasp/hasp_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,19 +1357,13 @@ void dispatch_idle(const char*, const char* payload, uint8_t source)
uint8_t state = HASP_SLEEP_LAST;
if(!strcmp_P(payload, "off")) {
hasp_set_sleep_state(HASP_SLEEP_OFF);
if(HASP_FS.exists("L:/idle_off.cmd")) {
dispatch_run_script(NULL, "L:/idle_off.cmd", TAG_HASP);
};
dispatch_run_script(NULL, "L:/idle_off.cmd", source);
} else if(!strcmp_P(payload, "short")) {
hasp_set_sleep_state(HASP_SLEEP_SHORT);
if(HASP_FS.exists("L:/idle_short.cmd")) {
dispatch_run_script(NULL, "L:/idle_short.cmd", TAG_HASP);
};
dispatch_run_script(NULL, "L:/idle_short.cmd", source);
} else if(!strcmp_P(payload, "long")) {
hasp_set_sleep_state(HASP_SLEEP_LONG);
if(HASP_FS.exists("L:/idle_long.cmd")) {
dispatch_run_script(NULL, "L:/idle_long.cmd", TAG_HASP);
};
dispatch_run_script(NULL, "L:/idle_long.cmd", source);
} else {
LOG_WARNING(TAG_MSGR, F("Invalid idle value %s"), payload);
return;
Expand Down

0 comments on commit c5ce7c6

Please sign in to comment.