6.4.1.5 Add mDns user control

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)
This commit is contained in:
Theo Arends 2019-01-03 17:30:54 +01:00
parent edc245e5c6
commit 67cf1dbbcf
6 changed files with 32 additions and 21 deletions

View File

@ -1,8 +1,12 @@
/* 6.4.1.4 20190101 /* 6.4.1.5 20190103
* Update Copyright (C) 2019 * 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) * Fix epaper driver (#4785)
* Add support for Near Field Communication (NFC) controller PN532 using I2C (#4791) * Add support for Near Field Communication (NFC) controller PN532 using I2C (#4791)
* *
* 6.4.1.3 20181229 * 6.4.1.3 20181229
* Change sonoff_template.h module lay-out by removing non-configurable GPIOs * Change sonoff_template.h module lay-out by removing non-configurable GPIOs
* Add support for MAX31855 K-Type thermocouple sensor using softSPI (#4764) * Add support for MAX31855 K-Type thermocouple sensor using softSPI (#4764)

View File

@ -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 time_append_timezone : 1; // bit 2 (v6.2.1.2)
uint32_t gui_hostname_ip : 1; // bit 3 (v6.2.1.20) 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 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_scan : 1; // bit 6 (v6.3.0.10)
uint32_t use_wifi_rescan : 1; // bit 7 (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) uint32_t receive_raw : 1; // bit 8 (v6.3.0.11)

View File

@ -866,6 +866,10 @@ void SettingsDelta(void)
Settings.sleep = 50; // Default to 50 for sleep, for now 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; Settings.version = VERSION;
SettingsSave(1); SettingsSave(1);

View File

@ -171,7 +171,7 @@ byte reset_web_log_flag = 0; // Reset web console log
byte devices_present = 0; // Max number of devices supported byte devices_present = 0; // Max number of devices supported
byte seriallog_level; // Current copy of Settings.seriallog_level byte seriallog_level; // Current copy of Settings.seriallog_level
byte syslog_level; // Current copy of Settings.syslog_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 latest_uptime_flag = true; // Signal latest uptime
boolean pwm_present = false; // Any PWM channel configured with SetOption15 0 boolean pwm_present = false; // Any PWM channel configured with SetOption15 0
boolean mdns_begun = false; // mDNS active 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 else if (1 == ptype) { // SetOption50 .. 81
if (payload <= 1) { if (payload <= 1) {
bitWrite(Settings.flag3.data, pindex, payload); bitWrite(Settings.flag3.data, pindex, payload);
if (60 == ptype) { // SetOption60 enable or disable traditional sleep if (5 == pindex) { // SetOption55
if (payload == 0) { // Dynamic Sleep if (0 == payload) {
WiFiSetSleepMode(); // Update WiFi sleep mode accordingly restart_flag = 2; // Disable mDNS needs restart
} else { // Traditional Sleep //AT
WiFiSetSleepMode(); // Update WiFi sleep mode accordingly
} }
} }
if (10 == pindex) { // SetOption60 enable or disable traditional sleep
WiFiSetSleepMode(); // Update WiFi sleep mode accordingly
}
} }
} }
else { // SetOption32 .. 49 else { // SetOption32 .. 49
@ -2539,7 +2540,7 @@ void setup(void)
} }
baudrate = Settings.baudrate * 1200; 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_level = Settings.seriallog_level;
seriallog_timer = SERIALLOG_TIMER; seriallog_timer = SERIALLOG_TIMER;
syslog_level = Settings.syslog_level; syslog_level = Settings.syslog_level;

View File

@ -20,7 +20,7 @@
#ifndef _SONOFF_VERSION_H_ #ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_
#define VERSION 0x06040104 #define VERSION 0x06040105
#define D_PROGRAMNAME "Sonoff-Tasmota" #define D_PROGRAMNAME "Sonoff-Tasmota"
#define D_AUTHOR "Theo Arends" #define D_AUTHOR "Theo Arends"

View File

@ -485,15 +485,17 @@ void WifiCheck(uint8_t param)
#endif // BE_MINIMAL #endif // BE_MINIMAL
#ifdef USE_DISCOVERY #ifdef USE_DISCOVERY
if (!mdns_begun) { if (Settings.flag3.mdns_enabled) {
if (mdns_delayed_start) { if (!mdns_begun) {
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_ATTEMPTING_CONNECTION)); // if (mdns_delayed_start) {
mdns_delayed_start--; // AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_ATTEMPTING_CONNECTION));
} else { // mdns_delayed_start--;
mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; // } else {
mdns_begun = MDNS.begin(my_hostname); // mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START];
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MDNS "%s"), (mdns_begun) ? D_INITIALIZED : D_FAILED); mdns_begun = MDNS.begin(my_hostname);
AddLog(LOG_LEVEL_INFO); 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 #endif // USE_DISCOVERY