diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 97aaa5ea7..67bdbfc8f 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -75,7 +75,9 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add command ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380 - Add command ``SetOption84 1`` to send AWS IoT device shadow updates (alternative to retained) - Add command ``ShutterButton `` to control shutter(s) by to-scho (#7403) -- Add ``SwitchMode 8`` ToggleMulti, ``SwitchMode 9`` FollowMulti and ``SwitchMode 10`` FollowMultiInverted (#7522) +- Add commands ``SwitchMode 8`` ToggleMulti, ``SwitchMode 9`` FollowMulti and ``SwitchMode 10`` FollowMultiInverted (#7522) +- Add commands ``SwitchMode 11`` PushHoldMulti and ``SwitchMode 12`` PushHoldInverted (#7603) +- Add command ``Buzzer -1`` for infinite mode and command ``Buzzer -2`` for following led mode (#7623) - Add SerialConfig to ``Status 1`` - Add WifiPower to ``Status 5`` - Add support for DS1624, DS1621 Temperature sensor by Leonid Myravjev @@ -92,4 +94,3 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add rule trigger on one level deeper using syntax with two ``#`` like ``on zigbeereceived#vibration_sensor#aqaracubeside=0 do ...`` - Add support for sensor DS18x20 on Shelly 1 and Shelly 1PM using Shelly Add-On adapter (#7469) - Add support for sensor DHT family on Shelly 1 and Shelly 1PM using Shelly Add-On adapter (#7469) -- Add switch modes 11 (PUSHHOLDMULTI) and 12 (PUSHHOLDMULTI_INV) (#7603) diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 1ec4c144d..f1706f118 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -5,7 +5,8 @@ - Fix Hass sensor discovery part 1/4 by Federico Leoni (#7582, #7548) - Add support for sensor DS18x20 on Shelly 1 and Shelly 1PM using Shelly Add-On adapter (#7469) - Add support for sensor DHT family on Shelly 1 and Shelly 1PM using Shelly Add-On adapter (#7469) -- Add switch modes 11 (PUSHHOLDMULTI) and 12 (PUSHHOLDMULTI_INV) (#7603) +- Add commands ``SwitchMode 11`` PushHoldMulti and ``SwitchMode 12`` PushHoldInverted (#7603) +- Add command ``Buzzer -1`` for infinite mode and command ``Buzzer -2`` for following led mode (#7623) ### 8.1.0.5 20200126 diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 55672ac87..984d93d1e 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -347,9 +347,11 @@ void SetLedPowerIdx(uint32_t led, uint32_t state) } DigitalWrite(GPIO_LED1 + led, bitRead(led_inverted, led) ? !state : state); } - #ifdef USE_BUZZER - if (led == 0) { BuzzerSetStateToLed(state); } - #endif // USE_BUZZER +#ifdef USE_BUZZER + if (led == 0) { + BuzzerSetStateToLed(state); + } +#endif // USE_BUZZER } void SetLedPower(uint32_t state) @@ -385,9 +387,9 @@ void SetLedLink(uint32_t state) if (state) { state = 1; } digitalWrite(led_pin, (led_inv) ? !state : state); } - #ifdef USE_BUZZER +#ifdef USE_BUZZER BuzzerSetStateToLed(state); - #endif // USE_BUZZER +#endif // USE_BUZZER } void SetPulseTimer(uint32_t index, uint32_t time) diff --git a/tasmota/xdrv_24_buzzer.ino b/tasmota/xdrv_24_buzzer.ino index 40af3128c..5e582d7db 100644 --- a/tasmota/xdrv_24_buzzer.ino +++ b/tasmota/xdrv_24_buzzer.ino @@ -31,7 +31,7 @@ struct BUZZER { bool enable = false; uint8_t inverted = 0; // Buzzer inverted flag (1 = (0 = On, 1 = Off)) uint8_t count = 0; // Number of buzzes - uint8_t mode = 0; // Buzzer mode (0 = (0 = regular, 2 = infinite, 3 = follow LED)) + uint8_t mode = 0; // Buzzer mode (0 = regular, 1 = infinite, 2 = follow LED) uint8_t set[2]; uint8_t duration; uint8_t state = 0; @@ -77,14 +77,16 @@ void BuzzerBeep(uint32_t count, uint32_t on, uint32_t off, uint32_t tune, uint32 } } -void BuzzerSetStateToLed(uint32_t state) { - if ((Buzzer.enable) && (Buzzer.mode==2)) { - Buzzer.state = (state!=0); +void BuzzerSetStateToLed(uint32_t state) +{ + if (Buzzer.enable && (2 == Buzzer.mode)) { + Buzzer.state = (state != 0); DigitalWrite(GPIO_BUZZER, (Buzzer.inverted) ? !Buzzer.state : Buzzer.state); } } -void BuzzerBeep(uint32_t count) { +void BuzzerBeep(uint32_t count) +{ BuzzerBeep(count, 1, 1, 0, 0); } @@ -119,7 +121,7 @@ void BuzzerInit(void) void BuzzerEvery100mSec(void) { - if ((Buzzer.enable) && (Buzzer.mode != 2)) { + if (Buzzer.enable && (Buzzer.mode != 2)) { if (Buzzer.count) { if (Buzzer.duration) { Buzzer.duration--; @@ -129,9 +131,11 @@ void BuzzerEvery100mSec(void) Buzzer.tune >>= 1; } else { Buzzer.tune = Buzzer.tune_reload; - Buzzer.count-= (Buzzer.tune_reload) ? 2 : 1; + Buzzer.count -= (Buzzer.tune_reload) ? 2 : 1; Buzzer.state = Buzzer.count & 1; - if (Buzzer.mode) { Buzzer.count |= 2; } + if (Buzzer.mode) { + Buzzer.count |= 2; + } } Buzzer.duration = Buzzer.set[Buzzer.state]; } @@ -164,14 +168,17 @@ void CmndBuzzer(void) // Buzzer 2,3 = Beep twice with duration 300mS and pause 100mS // Buzzer 2,3,4 = Beep twice with duration 300mS and pause 400mS // Buzzer 2,3,4,0xF54 = Beep a sequence twice indicated by 0xF54 = 1111 0101 01 with duration 300mS and pause 400mS + // Buzzer -1 = Beep infinite + // Buzzer -2 = Beep following link led if (XdrvMailbox.data_len > 0) { if (XdrvMailbox.payload != 0) { - uint32_t parm[4] = { 0 }, mode = 0; + uint32_t parm[4] = { 0 }; + uint32_t mode = 0; ParseParameters(4, parm); if (XdrvMailbox.payload <= 0) { - parm[0] = 1; // Default Count - mode = -XdrvMailbox.payload; + parm[0] = 1; // Default Count + mode = -XdrvMailbox.payload; // 0, 1 or 2 } for (uint32_t i = 1; i < 3; i++) { if (parm[i] < 1) { parm[i] = 1; } // Default On time, Off time