Add a 50ms delay after switching relays, so we avoid RF spikes from inductive loads triggering capacitive touch sensors
This commit is contained in:
		@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user