Ignore interrupts while sending blinds signal

Makes transmission more reliable.
This commit is contained in:
2023-10-03 16:18:04 +02:00
parent d175005269
commit 487378b71e
2 changed files with 8 additions and 0 deletions
+3
View File
@@ -9,6 +9,9 @@ esphome:
includes: includes:
- somfy.h - somfy.h
libraries:
- SPI
packages: packages:
device_base: !include templates/esp8266.yaml device_base: !include templates/esp8266.yaml
sensor: !include templates/esp8266-vcc.yaml sensor: !include templates/esp8266-vcc.yaml
+5
View File
@@ -1,3 +1,4 @@
#include <SPI.h>
#include "esphome.h" #include "esphome.h"
namespace { namespace {
@@ -104,6 +105,8 @@ class SomfyRTS : public Component, public Cover {
frame[i] ^= frame[i-1]; frame[i] ^= frame[i-1];
} }
noInterrupts();
// Wake-up pulse & silence. // Wake-up pulse & silence.
digitalWrite(rfPin, HIGH); digitalWrite(rfPin, HIGH);
delayMicroseconds(9415); delayMicroseconds(9415);
@@ -150,6 +153,8 @@ class SomfyRTS : public Component, public Cover {
delayMicroseconds(30415); delayMicroseconds(30415);
} }
interrupts();
// Publish the new rolling code at the end to ensure fast reaction time // Publish the new rolling code at the end to ensure fast reaction time
// when the component is called. This method may be synchronous and // when the component is called. This method may be synchronous and
// introduces an unpredictable delay. // introduces an unpredictable delay.