mirror of https://github.com/arendst/Tasmota.git
6.4.1.9 Fix mDNS addService
6.4.1.9 20190115 * Add support for Mi LED Desk Lamp with rotary switch (#4887) * Fix mDNS addService (#4938)
This commit is contained in:
parent
6b7becb30a
commit
e5fd45c9c8
|
@ -1,4 +1,8 @@
|
|||
/* 6.4.1.8 20190107
|
||||
/* 6.4.1.9 20190115
|
||||
* Add support for Mi LED Desk Lamp with rotary switch (#4887)
|
||||
* Fix mDNS addService (#4938)
|
||||
*
|
||||
* 6.4.1.8 20190107
|
||||
* Change sonoff_template.h layout regarding optional module flags like ADC0
|
||||
* Add command SetOption62 1 to force no Button/Switch pullup on dedicated modules. Currently only supported on Shelly2 (#4841)
|
||||
* Fix Display exception 28 when JSON value is NULL received
|
||||
|
@ -11,9 +15,7 @@
|
|||
* Add support for Luminea ZX2820 Smart Socket with Energy monitoring (#4921)
|
||||
* Add define MDNS_ENABLE to control initial mDNS state (#4923)
|
||||
* Add split interlock part 1 (#4910)
|
||||
* Add support for rotary switch
|
||||
* Add support for Mi Desk Lamp
|
||||
*
|
||||
*
|
||||
* 6.4.1.7 20190106
|
||||
* Fix HLW8012, HJL01 and BL0937 based energy sensors low Power (below 10W) measurement regression from 6.4.1.6
|
||||
* Add Power status functionality to LED2 when configured leaving LED1 for Link status indication
|
||||
|
|
|
@ -167,7 +167,6 @@ byte syslog_level; // Current copy of Settings.syslog_l
|
|||
//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
|
||||
myio my_module; // Active copy of Module GPIOs (17 x 8 bits)
|
||||
gpio_flag my_module_flag; // Active copy of Module GPIO flags
|
||||
StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits)
|
||||
|
|
|
@ -1759,8 +1759,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
GPIO_REL1, // GPIO14 Relay
|
||||
0, 0, 0
|
||||
},
|
||||
{ "Mi Desk Lamp", // Mi LED Desk Lamp
|
||||
// https://www.mi.com/global/smartlamp/
|
||||
{ "Mi Desk Lamp", // Mi LED Desk Lamp - https://www.mi.com/global/smartlamp/
|
||||
0, 0,
|
||||
GPIO_KEY1, // GPIO02 Button
|
||||
0,
|
||||
|
@ -1769,11 +1768,11 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
// GPIO06 (SD_CLK Flash)
|
||||
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
|
||||
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
|
||||
0,
|
||||
0,
|
||||
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
|
||||
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
|
||||
// GPIO11 (SD_CMD Flash)
|
||||
GPIO_ROT_A, // GPIO12 Rotary switch A pin
|
||||
GPIO_ROT_B, // GPIO13 Rotary switch B pin
|
||||
GPIO_ROT_A, // GPIO12 Rotary switch A pin
|
||||
GPIO_ROT_B, // GPIO13 Rotary switch B pin
|
||||
0, 0, 0, 0
|
||||
}
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _SONOFF_VERSION_H_
|
||||
#define _SONOFF_VERSION_H_
|
||||
|
||||
#define VERSION 0x06040108
|
||||
#define VERSION 0x06040109
|
||||
|
||||
#define D_PROGRAMNAME "Sonoff-Tasmota"
|
||||
#define D_AUTHOR "Theo Arends"
|
||||
|
|
|
@ -204,18 +204,18 @@ void ButtonHandler(void)
|
|||
}
|
||||
}
|
||||
if ((MI_DESK_LAMP == Settings.module) && (button_index == 0) && (rotary_changed) && (light_power)) {
|
||||
rotary_changed = 0; // Color temp changed, no need to turn of the light
|
||||
rotary_changed = 0; // Color temp changed, no need to turn of the light
|
||||
} else {
|
||||
if (single_press && SendKey(0, button_index + multipress[button_index], POWER_TOGGLE)) { // Execute Toggle command via MQTT if ButtonTopic is set
|
||||
// Success
|
||||
} else {
|
||||
if (multipress[button_index] < 3) { // Single or Double press
|
||||
if (WifiState() > WIFI_RESTART) { // WPSconfig, Smartconfig or Wifimanager active
|
||||
if (single_press && SendKey(0, button_index + multipress[button_index], POWER_TOGGLE)) { // Execute Toggle command via MQTT if ButtonTopic is set
|
||||
// Success
|
||||
} else {
|
||||
if (multipress[button_index] < 3) { // Single or Double press
|
||||
if (WifiState() > WIFI_RESTART) { // WPSconfig, Smartconfig or Wifimanager active
|
||||
restart_flag = 1;
|
||||
} else {
|
||||
ExecuteCommandPower(button_index + multipress[button_index], POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally
|
||||
}
|
||||
} else { // 3 - 7 press
|
||||
} else { // 3 - 7 press
|
||||
if (!Settings.flag.button_restrict) {
|
||||
snprintf_P(scmnd, sizeof(scmnd), kCommands[multipress[button_index] -3]);
|
||||
ExecuteCommand(scmnd, SRC_BUTTON);
|
||||
|
|
|
@ -33,7 +33,8 @@ uint8_t rotary_changed = 0;
|
|||
|
||||
/********************************************************************************************/
|
||||
|
||||
void update_position(void) {
|
||||
void update_position(void)
|
||||
{
|
||||
uint8_t s;
|
||||
|
||||
/*
|
||||
|
@ -58,7 +59,8 @@ void update_position(void) {
|
|||
rotary_state = (s >> 2);
|
||||
}
|
||||
|
||||
void update_rotary(void) {
|
||||
void update_rotary(void)
|
||||
{
|
||||
if (MI_DESK_LAMP == Settings.module){
|
||||
if (light_power) {
|
||||
update_position();
|
||||
|
@ -132,7 +134,7 @@ void RotaryHandler(void)
|
|||
Settings.light_dimmer = d;
|
||||
}
|
||||
}
|
||||
rotary_last_position = 128;
|
||||
rotary_last_position = 128;
|
||||
rotary_position = 128;
|
||||
}
|
||||
interrupts();
|
||||
|
|
|
@ -41,6 +41,7 @@ uint8_t wifi_status;
|
|||
uint8_t wps_result;
|
||||
uint8_t wifi_config_type = 0;
|
||||
uint8_t wifi_config_counter = 0;
|
||||
uint8_t mdns_begun = 0; // mDNS active
|
||||
|
||||
uint8_t wifi_scan_state;
|
||||
uint8_t wifi_bssid[6];
|
||||
|
@ -492,7 +493,7 @@ void WifiCheck(uint8_t param)
|
|||
// mdns_delayed_start--;
|
||||
// } else {
|
||||
// mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START];
|
||||
mdns_begun = MDNS.begin(my_hostname);
|
||||
mdns_begun = (uint8_t)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);
|
||||
// }
|
||||
|
@ -505,7 +506,8 @@ void WifiCheck(uint8_t param)
|
|||
StartWebserver(Settings.webserver, WiFi.localIP());
|
||||
#ifdef USE_DISCOVERY
|
||||
#ifdef WEBSERVER_ADVERTISE
|
||||
if (mdns_begun) {
|
||||
if (1 == mdns_begun) {
|
||||
mdns_begun = 2;
|
||||
MDNS.addService("http", "tcp", WEB_PORT);
|
||||
}
|
||||
#endif // WEBSERVER_ADVERTISE
|
||||
|
@ -530,7 +532,7 @@ void WifiCheck(uint8_t param)
|
|||
#if defined(USE_WEBSERVER) && defined(USE_EMULATION)
|
||||
UdpDisconnect();
|
||||
#endif // USE_EMULATION
|
||||
mdns_begun = false;
|
||||
mdns_begun = 0;
|
||||
#ifdef USE_KNX
|
||||
knx_started = false;
|
||||
#endif // USE_KNX
|
||||
|
|
Loading…
Reference in New Issue