From 8d6f8f505faf03415347967baf39844978fa0585 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 26 Dec 2020 15:12:46 +0100 Subject: [PATCH] Change once tickers --- tasmota/support_udp.ino | 6 +++--- tasmota/tasmota_globals.h | 3 +++ tasmota/xdrv_20_hue.ino | 1 - tasmota/xdrv_21_wemo.ino | 3 +-- tasmota/xdrv_21_wemo_multi.ino | 2 -- tasmota/xlgt_05_sonoff_l1.ino | 3 +-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tasmota/support_udp.ino b/tasmota/support_udp.ino index d430374e5..f83788a59 100644 --- a/tasmota/support_udp.ino +++ b/tasmota/support_udp.ino @@ -158,13 +158,13 @@ void PollUdp(void) #ifdef USE_EMULATION_WEMO if (EMUL_WEMO == Settings.flag2.emulation) { if (strstr_P(packet_buffer, URN_BELKIN_DEVICE) != nullptr) { // type1 echo dot 2g, echo 1g's - TickerMSearch.attach_ms(response_delay, WemoRespondToMSearch, 1); + TickerMSearch.once_ms(response_delay, WemoRespondToMSearch, 1); return; } else if ((strstr_P(packet_buffer, UPNP_ROOTDEVICE) != nullptr) || // type2 Echo 2g (echo & echo plus) (strstr_P(packet_buffer, SSDPSEARCH_ALL) != nullptr) || (strstr_P(packet_buffer, SSDP_ALL) != nullptr)) { - TickerMSearch.attach_ms(response_delay, WemoRespondToMSearch, 2); + TickerMSearch.once_ms(response_delay, WemoRespondToMSearch, 2); return; } } @@ -176,7 +176,7 @@ void PollUdp(void) (strstr_P(packet_buffer, UPNP_ROOTDEVICE) != nullptr) || (strstr_P(packet_buffer, SSDPSEARCH_ALL) != nullptr) || (strstr_P(packet_buffer, SSDP_ALL) != nullptr)) { - TickerMSearch.attach_ms(response_delay, HueRespondToMSearch); + TickerMSearch.once_ms(response_delay, HueRespondToMSearch); return; } } diff --git a/tasmota/tasmota_globals.h b/tasmota/tasmota_globals.h index 8dbdb2073..7ef12bb8d 100644 --- a/tasmota/tasmota_globals.h +++ b/tasmota/tasmota_globals.h @@ -164,6 +164,9 @@ String EthernetMacAddress(void); #endif #ifdef USE_ZIGBEE #define USE_UNISHOX_COMPRESSION // Add support for string compression +#endif +#ifdef USE_EMULATION_HUE +#define USE_UNISHOX_COMPRESSION // Add support for string compression #endif // See https://github.com/esp8266/Arduino/pull/4889 diff --git a/tasmota/xdrv_20_hue.ino b/tasmota/xdrv_20_hue.ino index 87557c997..e7289af7f 100644 --- a/tasmota/xdrv_20_hue.ino +++ b/tasmota/xdrv_20_hue.ino @@ -80,7 +80,6 @@ void HueRespondToMSearch(void) { char message[TOPSZ]; - TickerMSearch.detach(); if (PortUdp.beginPacket(udp_remote_ip, udp_remote_port)) { char response[320]; snprintf_P(response, sizeof(response), HUE_RESPONSE, WiFi.localIP().toString().c_str(), HueBridgeId().c_str()); diff --git a/tasmota/xdrv_21_wemo.ino b/tasmota/xdrv_21_wemo.ino index af5d7f176..b63c89e89 100644 --- a/tasmota/xdrv_21_wemo.ino +++ b/tasmota/xdrv_21_wemo.ino @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#if defined(USE_WEBSERVER) && defined(USE_EMULATION) && defined (USE_EMULATION_WEMO_SINGLE) +#if defined(USE_WEBSERVER) && defined(USE_EMULATION) && defined(USE_EMULATION_WEMO_SINGLE) /*********************************************************************************************\ * Belkin WeMo emulation \*********************************************************************************************/ @@ -58,7 +58,6 @@ void WemoRespondToMSearch(int echo_type) { char message[TOPSZ]; - TickerMSearch.detach(); if (PortUdp.beginPacket(udp_remote_ip, udp_remote_port)) { char type[24]; if (1 == echo_type) { // type1 echo 1g & dot 2g diff --git a/tasmota/xdrv_21_wemo_multi.ino b/tasmota/xdrv_21_wemo_multi.ino index 7806b2999..09c05b718 100644 --- a/tasmota/xdrv_21_wemo_multi.ino +++ b/tasmota/xdrv_21_wemo_multi.ino @@ -419,8 +419,6 @@ WemoSwitch *wemoDevice[MAX_FRIENDLYNAMES] = {}; int numOfWemoSwitch = 0; void WemoRespondToMSearch(int echo_type) { - TickerMSearch.detach(); - for (uint32_t i = 0; i < numOfWemoSwitch; i++) { wemoDevice[i]->WemoRespondToMSearch(echo_type); } diff --git a/tasmota/xlgt_05_sonoff_l1.ino b/tasmota/xlgt_05_sonoff_l1.ino index 38f9a3000..fa13765b2 100644 --- a/tasmota/xlgt_05_sonoff_l1.ino +++ b/tasmota/xlgt_05_sonoff_l1.ino @@ -64,7 +64,6 @@ struct SNFL1 { Ticker SnfL1StartDelay; void SnfL1SendDelayed(void) { - SnfL1StartDelay.detach(); SnfL1Send(); } @@ -276,7 +275,7 @@ bool SnfL1SetChannels(void) static bool first_call = true; if (first_call) { - SnfL1StartDelay.attach_ms(900, SnfL1SendDelayed); // Allow startup time for Nuvotron microcontroller + SnfL1StartDelay.once_ms(900, SnfL1SendDelayed); // Allow startup time for Nuvotron microcontroller first_call = false; } else { SnfL1Send();