diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 6f68d76f4fac..b5bb0e5a2d6f 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,8 +1,12 @@ -/* 6.4.1.4 20190101 - * Update Copyright (C) 2019 +/* 6.4.1.5 20190103 + * Remove command SetOption35 0-255 for mDNS start-up delay (#4793) + * Add command SetOption55 0/1 to disable/enable mDNS (#4793) + * + * 6.4.1.4 20190101 + * Update Copyright (C) 2019 * Fix epaper driver (#4785) * Add support for Near Field Communication (NFC) controller PN532 using I2C (#4791) - * + * * 6.4.1.3 20181229 * Change sonoff_template.h module lay-out by removing non-configurable GPIOs * Add support for MAX31855 K-Type thermocouple sensor using softSPI (#4764) diff --git a/sonoff/settings.h b/sonoff/settings.h index 6397d2d13b2c..66ab6645ce85 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -68,7 +68,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t time_append_timezone : 1; // bit 2 (v6.2.1.2) uint32_t gui_hostname_ip : 1; // bit 3 (v6.2.1.20) uint32_t tuya_apply_o20 : 1; // bit 4 (v6.3.0.4) - uint32_t spare5 : 1; + uint32_t mdns_enabled : 1; // bit 5 (v6.4.1.4) - SetOption55 uint32_t use_wifi_scan : 1; // bit 6 (v6.3.0.10) uint32_t use_wifi_rescan : 1; // bit 7 (v6.3.0.10) uint32_t receive_raw : 1; // bit 8 (v6.3.0.11) diff --git a/sonoff/settings.ino b/sonoff/settings.ino index 03d7ef08ec53..2624167c1a1f 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -866,6 +866,10 @@ void SettingsDelta(void) Settings.sleep = 50; // Default to 50 for sleep, for now } } + if (Settings.version < 0x06040105) { + Settings.flag3.mdns_enabled = 0; + Settings.param[P_MDNS_DELAYED_START] = 0; + } Settings.version = VERSION; SettingsSave(1); diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index c05c11626da2..a281ee97f5e7 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -171,7 +171,7 @@ byte reset_web_log_flag = 0; // Reset web console log byte devices_present = 0; // Max number of devices supported byte seriallog_level; // Current copy of Settings.seriallog_level byte syslog_level; // Current copy of Settings.syslog_level -byte mdns_delayed_start = 0; // mDNS delayed start +//byte mdns_delayed_start = 0; // mDNS delayed start boolean latest_uptime_flag = true; // Signal latest uptime boolean pwm_present = false; // Any PWM channel configured with SetOption15 0 boolean mdns_begun = false; // mDNS active @@ -761,13 +761,14 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) else if (1 == ptype) { // SetOption50 .. 81 if (payload <= 1) { bitWrite(Settings.flag3.data, pindex, payload); - if (60 == ptype) { // SetOption60 enable or disable traditional sleep - if (payload == 0) { // Dynamic Sleep - WiFiSetSleepMode(); // Update WiFi sleep mode accordingly - } else { // Traditional Sleep //AT - WiFiSetSleepMode(); // Update WiFi sleep mode accordingly + if (5 == pindex) { // SetOption55 + if (0 == payload) { + restart_flag = 2; // Disable mDNS needs restart } } + if (10 == pindex) { // SetOption60 enable or disable traditional sleep + WiFiSetSleepMode(); // Update WiFi sleep mode accordingly + } } } else { // SetOption32 .. 49 @@ -2539,7 +2540,7 @@ void setup(void) } baudrate = Settings.baudrate * 1200; - mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; +// mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; seriallog_level = Settings.seriallog_level; seriallog_timer = SERIALLOG_TIMER; syslog_level = Settings.syslog_level; diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index af8d59cd7f4c..242eb5fbd9aa 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,7 +20,7 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x06040104 +#define VERSION 0x06040105 #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/support_wifi.ino b/sonoff/support_wifi.ino index 6b60417642ac..817577900fc3 100644 --- a/sonoff/support_wifi.ino +++ b/sonoff/support_wifi.ino @@ -485,15 +485,17 @@ void WifiCheck(uint8_t param) #endif // BE_MINIMAL #ifdef USE_DISCOVERY - if (!mdns_begun) { - if (mdns_delayed_start) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_ATTEMPTING_CONNECTION)); - mdns_delayed_start--; - } else { - mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; - mdns_begun = MDNS.begin(my_hostname); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MDNS "%s"), (mdns_begun) ? D_INITIALIZED : D_FAILED); - AddLog(LOG_LEVEL_INFO); + if (Settings.flag3.mdns_enabled) { + if (!mdns_begun) { +// if (mdns_delayed_start) { +// AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_ATTEMPTING_CONNECTION)); +// mdns_delayed_start--; +// } else { +// mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; + mdns_begun = MDNS.begin(my_hostname); + snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MDNS "%s"), (mdns_begun) ? D_INITIALIZED : D_FAILED); + AddLog(LOG_LEVEL_INFO); +// } } } #endif // USE_DISCOVERY