From ee2519070f9f5fae3b116c65e2edcc04e7a1bf54 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 15 Oct 2019 16:23:37 +0200 Subject: [PATCH] Add rule support after every command execution * Add incremental beeps to Ifan03 remote control fan speed buttons (#6636) * Add rule support after every command execution like Fanspeed#Data=2 (#6636) --- sonoff/_changelog.ino | 2 ++ sonoff/support_command.ino | 2 -- sonoff/xdrv_22_sonoff_ifan.ino | 4 ++-- sonoff/xdrv_24_buzzer.ino | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 2f1525827..e12f18640 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -5,6 +5,8 @@ * Fix Rules were not triggered with IR unknown protocol or in sonoff-it (#6629) * Add define USE_DEEPSLEEP and command DeepSleepTime 0 or 10..86400 (seconds) to enter deepsleep mode (#6638) * Add define USE_SONOFF_RF to enable/disable Sonoff Rf support (#6648) + * Add incremental beeps to Ifan03 remote control fan speed buttons (#6636) + * Add rule support after every command execution like Fanspeed#Data=2 (#6636) * * 6.6.0.17 20191009 * Add command SetOption34 0..255 to set backlog delay. Default value is 200 (mSeconds) (#6562) diff --git a/sonoff/support_command.ino b/sonoff/support_command.ino index f9ebd855a..a3cf45f69 100644 --- a/sonoff/support_command.ino +++ b/sonoff/support_command.ino @@ -225,9 +225,7 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) if (mqtt_data[0] != '\0') { MqttPublishPrefixTopic_P(RESULT_OR_STAT, type); -#ifdef USE_SCRIPT XdrvRulesProcess(); -#endif } fallback_topic_flag = false; } diff --git a/sonoff/xdrv_22_sonoff_ifan.ino b/sonoff/xdrv_22_sonoff_ifan.ino index 929924b48..490eb9c72 100644 --- a/sonoff/xdrv_22_sonoff_ifan.ino +++ b/sonoff/xdrv_22_sonoff_ifan.ino @@ -125,7 +125,7 @@ void SonoffIfanReceived(void) snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_FANSPEED " %d"), action); ExecuteCommand(svalue, SRC_REMOTE); #ifdef USE_BUZZER - BuzzerEnabledBeep(action); // Beep action times + BuzzerEnabledBeep((action) ? action : 1, (action) ? 1 : 4); // Beep action times #endif } } else { @@ -140,7 +140,7 @@ void SonoffIfanReceived(void) if (7 == mode) { // AA 55 01 07 00 01 01 0A - Rf long press - forget RF codes #ifdef USE_BUZZER - BuzzerEnabledBeep(4); // Beep four times + BuzzerEnabledBeep(4, 1); // Beep four times #endif } diff --git a/sonoff/xdrv_24_buzzer.ino b/sonoff/xdrv_24_buzzer.ino index 9e2742d0a..d6cf24683 100644 --- a/sonoff/xdrv_24_buzzer.ino +++ b/sonoff/xdrv_24_buzzer.ino @@ -45,8 +45,8 @@ void BuzzerOff(void) //void BuzzerBeep(uint32_t count = 1, uint32_t on = 1, uint32_t off = 1, uint32_t tune = 0); void BuzzerBeep(uint32_t count, uint32_t on, uint32_t off, uint32_t tune) { - Buzzer.set[0] = off; - Buzzer.set[1] = on; + Buzzer.set[0] = off; // off duration in 100 mSec steps + Buzzer.set[1] = on; // on duration in 100 mSec steps Buzzer.duration = 1; // Start buzzer on first step Buzzer.tune = 0; if (tune) { @@ -78,10 +78,10 @@ void BuzzerBeep(uint32_t count) { BuzzerBeep(count, 1, 1, 0); } -void BuzzerEnabledBeep(uint32_t count) +void BuzzerEnabledBeep(uint32_t count, uint32_t duration) { if (Settings.flag3.buzzer_enable) { // SetOption67 - BuzzerBeep(count); + BuzzerBeep(count, duration, 1, 0); } }