mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-26 20:38:25 +00:00
fixes
This commit is contained in:
1 parent
ed2d4c1c2b
commit
560561c5b7
2 files changed
+4
-4
No files matched your search
@@ -13,13 +13,13 @@ static void signal_handler(int signo) {
|
|||||||
static bool s_pins[100];
|
static bool s_pins[100];
|
||||||
|
|
||||||
void hal_gpio_write(int pin, bool status) {
|
void hal_gpio_write(int pin, bool status) {
|
||||||
if (pin >= 0 && pin <= (int) (sizeof(s_pins) / sizeof(s_pins[0]))) {
|
if (pin >= 0 && pin < (int) (sizeof(s_pins) / sizeof(s_pins[0]))) {
|
||||||
s_pins[pin] = status;
|
s_pins[pin] = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hal_gpio_read(int pin) {
|
bool hal_gpio_read(int pin) {
|
||||||
return (pin >= 0 && pin <= (int) (sizeof(s_pins) / sizeof(s_pins[0])))
|
return (pin >= 0 && pin < (int) (sizeof(s_pins) / sizeof(s_pins[0])))
|
||||||
? s_pins[pin]
|
? s_pins[pin]
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,9 +111,9 @@ static void rpc_config_set(struct mg_rpc_req *r) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmp_pin = (int8_t) mg_json_get_long(r->frame, "$.params.led_pin", -1);
|
tmp_pin = (int8_t) mg_json_get_long(r->frame, "$.params.led_pin", -1);
|
||||||
if (tmp_pin > 0) s_device_config.led_pin = tmp_pin;
|
if (tmp_pin >= 0) s_device_config.led_pin = tmp_pin;
|
||||||
|
|
||||||
if (tmp_pin > 0 && ok) {
|
if (tmp_pin >= 0 && ok) {
|
||||||
hal_gpio_write(s_device_config.led_pin, s_device_config.led_status);
|
hal_gpio_write(s_device_config.led_pin, s_device_config.led_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user