Skip to content

Commit

Permalink
Disarm countdown timer on press/release
Browse files Browse the repository at this point in the history
  • Loading branch information
przemyslawzygmunt committed Jul 8, 2020
1 parent 1e5e202 commit 62282f7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/user/supla_esp_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,15 +762,17 @@ supla_esp_gpio_on_input_active(supla_input_cfg_t *input_cfg) {

} else if ( input_cfg->type == INPUT_TYPE_BTN_BISTABLE ) {

#ifndef COUNTDOWN_TIMER_DISABLED
supla_esp_countdown_timer_disarm(input_cfg->channel);
#endif /*COUNTDOWN_TIMER_DISABLED*/

//supla_log(LOG_DEBUG, "RELAY");
supla_esp_gpio_relay_switch(input_cfg, 255);


} else if ( input_cfg->type == INPUT_TYPE_SENSOR
&& input_cfg->channel != 255 ) {

supla_esp_channel_value_changed(input_cfg->channel, 1);

}

input_cfg->last_state = 1;
Expand All @@ -797,13 +799,16 @@ supla_esp_gpio_on_input_inactive(supla_input_cfg_t *input_cfg) {
} else if ( input_cfg->type == INPUT_TYPE_BTN_MONOSTABLE
|| input_cfg->type == INPUT_TYPE_BTN_BISTABLE ) {

#ifndef COUNTDOWN_TIMER_DISABLED
supla_esp_countdown_timer_disarm(input_cfg->channel);
#endif /*COUNTDOWN_TIMER_DISABLED*/

supla_esp_gpio_relay_switch(input_cfg, 255);

} else if ( input_cfg->type == INPUT_TYPE_SENSOR
&& input_cfg->channel != 255 ) {
supla_esp_channel_value_changed(input_cfg->channel, 0);

supla_esp_channel_value_changed(input_cfg->channel, 0);
}

input_cfg->last_state = 0;
Expand Down

0 comments on commit 62282f7

Please sign in to comment.