Skip to content

Commit

Permalink
Added logic to not try to connect to an AP when the default credentia…
Browse files Browse the repository at this point in the history
…ls have not been changed by the user at compile time.
  • Loading branch information
MartinMueller2003 committed Mar 7, 2024
1 parent 85982f3 commit ade0ea3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions ESPixelStick/src/network/WiFiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#endif // __has_include("secrets.h")

#if !defined(SECRETS_SSID)
# define SECRETS_SSID "DEFAULT_SSID_NOT_SET"
# define SECRETS_SSID DEFAULT_SSID_NOT_SET
#endif // SECRETS_SSID
#if !defined(SECRETS_PASS)
# define SECRETS_PASS "DEFAULT_PASSPHRASE_NOT_SET"
Expand Down Expand Up @@ -753,11 +753,19 @@ void fsm_WiFi_state_ConnectingUsingDefaults::Init ()
// DEBUG_START;

// DEBUG_V (String ("this: ") + String (uint32_t (this), HEX));
pWiFiDriver->SetFsmState (this);
pWiFiDriver->AnnounceState ();
pWiFiDriver->GetFsmTimer().StartTimer(1000 * pWiFiDriver->Get_sta_timeout ());

pWiFiDriver->connectWifi (default_ssid, default_passphrase);
if(!default_ssid.equals(DEFAULT_SSID_NOT_SET))
{
pWiFiDriver->SetFsmState (this);
pWiFiDriver->AnnounceState ();
pWiFiDriver->GetFsmTimer().StartTimer(1000 * pWiFiDriver->Get_sta_timeout ());
pWiFiDriver->connectWifi (default_ssid, default_passphrase);
}
else
{
// no defauult ssid was set at compile time. Just move on to AP mode
fsm_WiFi_state_ConnectingAsAP_imp.Init ();
}
// pWiFiDriver->displayFsmState ();

// DEBUG_END;
Expand Down
2 changes: 1 addition & 1 deletion ESPixelStick/src/network/WiFiDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class c_WiFiDriver
void Enable ();

private:

#define DEFAULT_SSID_NOT_SET "DEFAULT_SSID_NOT_SET"
int ValidateConfig ();

#ifdef ARDUINO_ARCH_ESP8266
Expand Down

0 comments on commit ade0ea3

Please sign in to comment.