From 4f74c702702a510555d1caa2fc83307dce1cde1a Mon Sep 17 00:00:00 2001 From: Hadinger Date: Fri, 3 Jan 2020 17:57:47 +0100 Subject: [PATCH] Add LightPowerIRAM() for rotary interrupt handler --- tasmota/support_rotary.ino | 2 +- tasmota/xdrv_04_light.ino | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tasmota/support_rotary.ino b/tasmota/support_rotary.ino index cb6782da1..071b15b92 100644 --- a/tasmota/support_rotary.ino +++ b/tasmota/support_rotary.ino @@ -43,7 +43,7 @@ void update_rotary(void) ICACHE_RAM_ATTR; void update_rotary(void) { if (MI_DESK_LAMP == my_module_type) { - if (LightPower()) { + if (LightPowerIRAM()) { /* * https://github.com/PaulStoffregen/Encoder/blob/master/Encoder.h */ diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 600642bfe..736d46e5a 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -277,6 +277,16 @@ power_t LightPower(void) return Light.power; // Make external } +// IRAM variant for rotary +#ifndef ARDUINO_ESP8266_RELEASE_2_3_0 // Fix core 2.5.x ISR not in IRAM Exception +power_t LightPowerIRAM(void) ICACHE_RAM_ATTR; +#endif // ARDUINO_ESP8266_RELEASE_2_3_0 + +power_t LightPowerIRAM(void) +{ + return Light.power; // Make external +} + uint8_t LightDevice(void) { return Light.device; // Make external