Skip to content

Commit

Permalink
v6.1.0b - WPS optional
Browse files Browse the repository at this point in the history
6.1.0b
 * Add user selection of WPS as define USE_WPS in user_config.h in preparation for core v2.4.2 (arendst#3221)
 * Change default Wifi config option from WPS to Wifi Manager if WPS is disabled (or Wifi Smartconfig if webserver is disabled)
 * Remove WPS from sonoff-minimal saving 33k code space
 * Revert wifi changes implemented in v6.0.0a due to possible bad initial wifi connections
  • Loading branch information
arendst committed Jul 14, 2018
1 parent 0d37d7e commit a411a10
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -15,7 +15,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
### Development
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)

Current version is **6.1.0a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
Current version is **6.1.0b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.

### Disclaimer
:warning: **DANGER OF ELECTROCUTION** :warning:
Expand Down
8 changes: 7 additions & 1 deletion sonoff/_releasenotes.ino
@@ -1,4 +1,10 @@
/* 6.1.0a
/* 6.1.0b
* Add user selection of WPS as define USE_WPS in user_config.h in preparation for core v2.4.2 (#3221)
* Change default Wifi config option from WPS to Wifi Manager if WPS is disabled (or Wifi Smartconfig if webserver is disabled)
* Remove WPS from sonoff-minimal saving 33k code space
* Revert wifi changes implemented in v6.0.0a due to possible bad initial wifi connections
*
* 6.1.0a
* Fix TM1638 compile error (#3212)
* Add TM1638 switch support (#2226)
* Fix invalid response using more than 4 switches and domoticz
Expand Down
2 changes: 2 additions & 0 deletions sonoff/sonoff.h
Expand Up @@ -111,6 +111,8 @@ typedef unsigned long power_t; // Power (Relay) type
#define SERIAL_POLLING 100 // Serial receive polling in ms
#define MAX_STATUS 11 // Max number of status lines

#define NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions)

/*
// Removed from esp8266 core since 20171105
#define min(a,b) ((a)<(b)?(a):(b))
Expand Down
2 changes: 1 addition & 1 deletion sonoff/sonoff.ino
Expand Up @@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/

#define VERSION 0x06010001 // 6.1.0a
#define VERSION 0x06010002 // 6.1.0b

// Location specific includes
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
Expand Down
5 changes: 5 additions & 0 deletions sonoff/sonoff_post.h
Expand Up @@ -167,6 +167,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);

#undef USE_ENERGY_SENSOR // Disable energy sensors
#undef USE_ARDUINO_OTA // Disable support for Arduino OTA
#undef USE_WPS // Disable support for WPS as initial wifi configuration tool
#undef USE_DOMOTICZ // Disable Domoticz
#undef USE_HOME_ASSISTANT // Disable Home Assistant
#undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set
Expand Down Expand Up @@ -207,6 +208,10 @@ void KNX_CB_Action(message_t const &msg, void *arg);
* Mandatory defines satisfying possible disabled defines
\*********************************************************************************************/

#ifndef USE_WPS // See https://github.com/esp8266/Arduino/pull/4889
#undef NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions)
#endif

#ifndef SWITCH_MODE
#define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state)
#endif
Expand Down
27 changes: 25 additions & 2 deletions sonoff/support.ino
Expand Up @@ -980,6 +980,16 @@ void WifiConfig(uint8_t type)
#endif // USE_EMULATION
WiFi.disconnect(); // Solve possible Wifi hangs
wifi_config_type = type;
#ifndef USE_WPS
if (WIFI_WPSCONFIG == wifi_config_type) {
wifi_config_type = WIFI_MANAGER;
}
#endif // USE_WPS
#ifndef USE_WEBSERVER
if (WIFI_MANAGER == wifi_config_type) {
wifi_config_type = WIFI_SMARTCONFIG;
}
#endif // USE_WPS
wifi_config_counter = WIFI_CONFIG_SEC; // Allow up to WIFI_CONFIG_SECS seconds for phone to provide ssid/pswd
wifi_counter = wifi_config_counter +5;
blinks = 1999;
Expand All @@ -990,6 +1000,7 @@ void WifiConfig(uint8_t type)
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_1_SMARTCONFIG " " D_ACTIVE_FOR_3_MINUTES));
WiFi.beginSmartConfig();
}
#ifdef USE_WPS
else if (WIFI_WPSCONFIG == wifi_config_type) {
if (WifiWpsConfigBegin()) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG " " D_ACTIVE_FOR_3_MINUTES));
Expand All @@ -998,6 +1009,7 @@ void WifiConfig(uint8_t type)
wifi_config_counter = 3;
}
}
#endif // USE_WPS
#ifdef USE_WEBSERVER
else if (WIFI_MANAGER == wifi_config_type) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES));
Expand Down Expand Up @@ -1142,9 +1154,11 @@ void WifiCheck(uint8_t param)
if ((WIFI_SMARTCONFIG == wifi_config_type) && WiFi.smartConfigDone()) {
wifi_config_counter = 0;
}
#ifdef USE_WPS
if ((WIFI_WPSCONFIG == wifi_config_type) && WifiWpsConfigDone()) {
wifi_config_counter = 0;
}
#endif // USE_WPS
if (!wifi_config_counter) {
if (strlen(WiFi.SSID().c_str())) {
strlcpy(Settings.sta_ssid[0], WiFi.SSID().c_str(), sizeof(Settings.sta_ssid[0]));
Expand All @@ -1161,7 +1175,7 @@ void WifiCheck(uint8_t param)
if (WIFI_SMARTCONFIG == wifi_config_type) {
WiFi.stopSmartConfig();
}
SettingsSdkErase();
// SettingsSdkErase(); // Disabled v6.1.0b due to possible bad wifi connects
restart_flag = 2;
}
} else {
Expand Down Expand Up @@ -1244,6 +1258,8 @@ void WifiConnect()
wifi_counter = 1;
}

/*
// Enable from 6.0.0a until 6.1.0a - disabled due to possible cause of bad wifi connect on core 2.3.0
void WifiDisconnect()
{
// Courtesy of EspEasy
Expand All @@ -1256,10 +1272,17 @@ void WifiDisconnect()
void EspRestart()
{
delay(100); // Allow time for message xfer
// This results in exception 3 on restarts
delay(100); // Allow time for message xfer - disabled v6.1.0b
WifiDisconnect();
ESP.restart();
}
*/

void EspRestart()
{
ESP.restart();
}

#ifdef USE_DISCOVERY
/*********************************************************************************************\
Expand Down
11 changes: 8 additions & 3 deletions sonoff/user_config.h
Expand Up @@ -65,6 +65,7 @@
#define STA_PASS2 "" // [Password2] Optional alternate AP Wifi password
#define WIFI_CONFIG_TOOL WIFI_WPSCONFIG // [WifiConfig] Default tool if wifi fails to connect
// (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT)
// *** NOTE: When WPS is disabled by USE_WPS below, WIFI_WPSCONFIG will execute WIFI_MANAGER ***

// -- Syslog --------------------------------------
#define SYS_LOG_HOST "" // [LogHost] (Linux) syslog host
Expand Down Expand Up @@ -178,8 +179,6 @@
* - Disable a feature by preceding it with //
\*********************************************************************************************/

//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code)

// -- Localization --------------------------------
// If non selected the default en-GB will be used
//#define MY_LANGUAGE bg-BG // Bulgarian in Bulgaria
Expand All @@ -200,6 +199,12 @@
//#define MY_LANGUAGE zh-CN // Chinese (Simplified) in China
//#define MY_LANGUAGE zh-TW // Chinese (Traditional) in Taiwan

// -- WPS -----------------------------------------
//#define USE_WPS // Add support for WPS as initial wifi configuration tool (+33k code, 1k mem (5k mem with core v2.4.2+))

// -- OTA -----------------------------------------
//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code)

/*-------------------------------------------------------------------------------------------*\
* Select ONE of possible three MQTT library types below
\*-------------------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -314,7 +319,7 @@

//#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)

#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB
#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code)

/*********************************************************************************************\
* Debug features are only supported in development branch
Expand Down

0 comments on commit a411a10

Please sign in to comment.