Skip to content

Commit

Permalink
gpio: Fix #29
Browse files Browse the repository at this point in the history
  • Loading branch information
ljalves committed Apr 8, 2022
1 parent 27a06a8 commit ae1b59f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,15 @@ static void USER_FUNC switch_state_page(char *url, char *rsp)

if (state->func_state & FUNC_RELAY) {
ret = httpd_arg_find(url, "sw", val);
if (ret != 1)
if (ret != 1) {
strcpy(val, "none");

/* set relay */
if (atoi(val) > 0)
relay_set(1, RELAY_SRC_HTTP);
else
relay_set(0, RELAY_SRC_HTTP);
} else {
/* set relay */
if (atoi(val) > 0)
relay_set(1, RELAY_SRC_HTTP);
else
relay_set(0, RELAY_SRC_HTTP);
}

leds_ctrl_if(LED_CONFIG_HTTP, "n1f", NULL); /* got data = 1 blink */

Expand Down
2 changes: 1 addition & 1 deletion src/hfeasy.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


#define HFEASY_VERSION_MAJOR 1
#define HFEASY_VERSION_MINOR 2
#define HFEASY_VERSION_MINOR 1


enum {
Expand Down

0 comments on commit ae1b59f

Please sign in to comment.