Skip to content

Commit

Permalink
Removed (not working) APSTA wifi mode
Browse files Browse the repository at this point in the history
-> ESP-IDF has a bug, which renderes the webserver unuseable, if connected to an access-point at the same time
  • Loading branch information
simonmicro committed Aug 18, 2024
1 parent d5b058f commit 09856f6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
1 change: 0 additions & 1 deletion docs/firmware/flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ The table below list all currently available features of the OSW-OS. These featu
| ---------------------------- | ------------------------------------------------------------------------------------ | ---------------------------------- |
| `OSW_FEATURE_STATS_STEPS` | Enable step history (displayed on the watchfaces) | - |
| `OSW_FEATURE_WIFI` | Enable all wifi related functions (services, webinterface) | - |
| `OSW_FEATURE_WIFI_APST` | Allow the watch to enable wifi client and station simultaneously | `OSW_FEATURE_WIFI` |
| `OSW_FEATURE_WIFI_ONBOOT` | Allow the user to enable the wifi on boot | `OSW_FEATURE_WIFI` |
| `OSW_FEATURE_BLE_MEDIA_CTRL` | Enables media control via BLE | - |
| `OSW_FEATURE_LUA` | Enable LUA scripting support for apps | `LUA_C89_NUMBERS` |
Expand Down
7 changes: 0 additions & 7 deletions include/services/OswServiceTaskWiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ class OswServiceTaskWiFi : public OswServiceTask {
~OswServiceTaskWiFi() {};

private:
//The ESP32 has some problems broadcasting its SSID while using client & station
#ifdef OSW_FEATURE_WIFI_APST
const bool onlyOneModeSimultaneously = false;
#else
const bool onlyOneModeSimultaneously = true;
#endif

bool m_bootDone = false; // This triggers the async setup inside the loop
bool m_enableWiFi = false;
bool m_enableClient = false;
Expand Down
3 changes: 0 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ build_flags =
-D OSW_FEATURE_STATS_STEPS
-D OSW_SERVICE_CONSOLE
-D OSW_FEATURE_WIFI
-D OSW_FEATURE_WIFI_APST
-D OSW_FEATURE_WIFI_ONBOOT
build_type = debug

Expand All @@ -116,7 +115,6 @@ build_flags =
-D OSW_FEATURE_STATS_STEPS
-D OSW_SERVICE_CONSOLE
-D OSW_FEATURE_WIFI
-D OSW_FEATURE_WIFI_APST
-D OSW_FEATURE_WIFI_ONBOOT
build_type = debug

Expand All @@ -127,6 +125,5 @@ build_flags =
-D OSW_TARGET_PLATFORM_HEADER='"platform/FLOW3R_C3CAMP_2023.h"'
-D OSW_SERVICE_CONSOLE
-D OSW_FEATURE_WIFI
-D OSW_FEATURE_WIFI_APST
-D OSW_FEATURE_WIFI_ONBOOT
build_type = debug
20 changes: 5 additions & 15 deletions src/services/OswServiceTaskWiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,9 @@ void OswServiceTaskWiFi::loop() {
this->m_connectFailureCount = 0;
} else if(!this->m_connectTimeout and WiFi.status() != WL_CONNECTED) {
// Wifi is either disconnected or unavailable...
if(this->onlyOneModeSimultaneously and this->m_enableStation) {
// This watch does not support connecting to networks with an active AutoAP.
// It would therefore be not helpful to activate the timeout to try an other
// action, while the AutoAP is active as this will shutdown the AutoAP as the
// timeout expires!
} else {
// -> start timeout
this->m_connectTimeout = time(nullptr);
OSW_LOG_D("[Connection] Timeout activated: 10 seconds");
}
// -> start timeout
this->m_connectTimeout = time(nullptr);
OSW_LOG_D("[Connection] Timeout activated: 10 seconds");
}

// Handling in case of 10 seconds without a successful connect
Expand Down Expand Up @@ -307,11 +300,8 @@ void OswServiceTaskWiFi::updateWiFiConfig() {
}
#endif

if(!this->onlyOneModeSimultaneously and this->m_enableWiFi and this->m_enableClient and this->m_enableStation) {
WiFi.mode(WIFI_MODE_APSTA);
OSW_LOG_D("[Mode] Station & client");
} else if(this->m_enableWiFi and this->m_enableStation) {
//Check this BEFORE the client, so in case of onlyOneModeSimultaneously we prefer the station, when enabled!
// How about "WiFi.mode(WIFI_MODE_APSTA)"? Well, so far every ESP was unable to work with this properly. So we removed it.
if(this->m_enableWiFi and this->m_enableStation) {
WiFi.mode(WIFI_MODE_AP);
OSW_LOG_D("[Mode] Station");
} else if(this->m_enableWiFi and this->m_enableClient) {
Expand Down

0 comments on commit 09856f6

Please sign in to comment.