Add a 50ms delay after switching relays, so we avoid RF spikes from inductive loads triggering capacitive touch sensors

This commit is contained in:
Pim van Pelt
2018-10-31 13:51:02 +01:00
parent 818c27c7ce
commit 64fc98dcf7

View File

@ -155,6 +155,9 @@ void channel_set(int idx, bool state) {
s_channels[idx].relay_state = state;
if (s_channels[idx].relay_gpio != GPIO_INVALID) {
mgos_gpio_write(s_channels[idx].relay_gpio, state);
// We sleep for 50ms because inductive loads cause an RF spike which trips
// capacitive sensors
mgos_msleep(50);
}
if (s_channels[idx].led_gpio != GPIO_INVALID) {
mgos_gpio_write(s_channels[idx].led_gpio, state);