Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/wifi stability #1325

Merged
merged 4 commits into from
Apr 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ platform = espressif8266@1.5.0
[core_2_4_0]
platform = espressif8266@1.6.0

[core_2_4_1]
platform = espressif8266@1.7.0

[core_staged]
platform = https://github.com/platformio/platform-espressif8266.git#feature/stage

Expand All @@ -52,22 +55,23 @@ lib_deps = ESP32WebServer

[common]
build_flags = -D BUILD_GIT='"${env.TRAVIS_TAG}"' ; ${compiler_warnings.build_flags}
-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
lib_deps = ""
lib_ignore = ESP32_ping, ESP32WebServer
lib_ldf_mode = chain
upload_speed = 460800
framework = arduino
board = esp12e
platform = ${core_2_3_0.platform}
platform = ${core_2_4_1.platform}

[normal]
platform = ${common.platform}

[testing]
platform = ${core_2_3_0.platform}
platform = ${core_2_4_1.platform}

[dev]
platform = ${core_2_3_0.platform}
platform = ${core_2_4_1.platform}


[esp8266_1M]
Expand All @@ -83,13 +87,13 @@ build_flags = ${esp8266_1M.build_flags} -DESP8285
board = esp01_1m
board_flash_mode = ${esp8266_1M.board_flash_mode}
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.1m128.ld
platform = ${core_2_3_0.platform}
platform = ${core_2_4_1.platform}

[Sonoff_8285]
board_flash_mode = ${esp8285_1M.board_flash_mode}
board = ${esp8285_1M.board}
build_flags = ${esp8285_1M.build_flags}
platform = ${core_2_3_0.platform}
platform = ${core_2_4_1.platform}

[espWroom2M]
board_flash_mode = dout
Expand Down
20 changes: 10 additions & 10 deletions src/Command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ void ExecuteCommand(byte source, const char *Line)
}
break;
}

case cmd_TimerPause:
{
if (Par1>=1 && Par1<=RULES_TIMER_MAX)
Expand All @@ -500,7 +500,7 @@ void ExecuteCommand(byte source, const char *Line)
{
String event = F("Rules#TimerPause=");
event += Par1;
rulesProcessing(event);
rulesProcessing(event);
RulesTimer[Par1 - 1].paused = true;
RulesTimer[Par1 - 1].interval = -delta; // set remaind time
}
Expand All @@ -514,9 +514,9 @@ void ExecuteCommand(byte source, const char *Line)
{
addLog(LOG_LEVEL_ERROR, F("TIMER: invalid timer number"));
}
break;
break;
}

case cmd_TimerResume:
{
if (Par1>=1 && Par1<=RULES_TIMER_MAX)
Expand All @@ -528,9 +528,9 @@ void ExecuteCommand(byte source, const char *Line)
{
String event = F("Rules#TimerResume=");
event += Par1;
rulesProcessing(event);
rulesProcessing(event);
RulesTimer[Par1 - 1].timestamp = millis() + (RulesTimer[Par1 - 1].interval);
RulesTimer[Par1 - 1].paused = false;
RulesTimer[Par1 - 1].paused = false;
}
}
else
Expand All @@ -542,9 +542,9 @@ void ExecuteCommand(byte source, const char *Line)
{
addLog(LOG_LEVEL_ERROR, F("TIMER: invalid timer number"));
}
break;
break;
}

case cmd_Delay:
{
success = true;
Expand Down Expand Up @@ -748,7 +748,7 @@ void ExecuteCommand(byte source, const char *Line)
case cmd_WifiConnect:
{
success = true;
setWifiState(WifiTryConnect);
WiFiConnectRelaxed();
break;
}

Expand All @@ -761,7 +761,7 @@ void ExecuteCommand(byte source, const char *Line)

case cmd_WifiAPMode:
{
setWifiState(WifiEnableAP);
setAP(true);
success = true;
break;
}
Expand Down
18 changes: 1 addition & 17 deletions src/ESPEasy-Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ struct ControllerSettingsStruct
if (!UseDNS) {
return true;
}
if (WiFi.status() != WL_CONNECTED) return false;
IPAddress tmpIP;
if (WiFi.hostByName(HostName, tmpIP)) {
for (byte x = 0; x < 4; x++) {
Expand Down Expand Up @@ -1193,23 +1194,7 @@ enum WiFiDisconnectReason
};
#endif

enum WifiState {
WifiOff,
WifiStart,
WifiTryConnect,
WifiConnectionFailed,
WifiClientConnectAP,
WifiClientDisconnectAP,
WifiCredentialsChanged,
WifiConnectSuccess,
WifiDisableAP,
WifiEnableAP,
WifiStartScan,
};

WifiState currentWifiState = WifiStart;

void setWifiState(WifiState state);
bool useStaticIP();

// WiFi related data
Expand Down Expand Up @@ -1244,7 +1229,6 @@ bool processedGetIP = true;
bool processedConnectAPmode = true;
bool processedDisconnectAPmode = true;
bool processedScanDone = true;
bool processedTryConnect = true;

bool webserver_state = false;
bool webserver_init = false;
Expand Down
4 changes: 2 additions & 2 deletions src/ESPEasy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void setup()
WifiScanAsync();
}
*/
setWifiState(WifiTryConnect);
WiFiConnectRelaxed();

#ifdef FEATURE_REPORTING
ReportStatus();
Expand Down Expand Up @@ -382,7 +382,7 @@ void loop()
if (wifiSetupConnect)
{
// try to connect for setup wizard
setWifiState(WifiCredentialsChanged);
WiFiConnectRelaxed();
wifiSetupConnect = false;
}
if (wifiStatus != ESPEASY_WIFI_SERVICES_INITIALIZED) {
Expand Down
Loading