src/SequoiaWiFiStartUpManager.cpp
//Can't use local variables here....
Can't use local variables here
Can ' t use local variables here
bool SequoiaWiFiStartUpManager::ConnectToNetworkSetByUser()
{
    Serial.println("Connecting to ");
    Serial.printf("Struct set values are! Values are: SSID: %s PASSWORD %s \n", _userSettings.m_network_ssid.c_str(), _userSettings.m_network_password.c_str());
    WiFi.begin(_userSettings.m_network_ssid.c_str(), _userSettings.m_network_password.c_str());
    unsigned long startTime = millis();
    uint32_t millisecondsToWait = 1000*WIFI_CONNECT_ATTEMPT_TIME_S;
    while (WiFi.status() != WL_CONNECTED && (millis() - startTime) <= millisecondsToWait) 
    {
        delay(500);
        Serial.print(".");
    }
    if (WiFi.status() != WL_CONNECTED)
    {
        WiFi.disconnect(true);
        Serial.printf("WiFi connection failed. Tried for %d seconds. SSID: %s Password: %s \n", 
        WIFI_CONNECT_ATTEMPT_TIME_S, 
        _userSettings.m_network_ssid.c_str(),
        _userSettings.m_network_password.c_str());
        return false;
    }
    Serial.println("");
    Serial.println("WiFi connected.");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
    if (m_devicePtr != NULL)
    {
        m_devicePtr->SetNetworkCredentials(NetworkCredentials(
            WiFi.localIP(),
            _userSettings.m_network_ssid, 
            _userSettings.m_network_password));
    }
    return true;
}
bool SequoiaWiFiStartUpManager :: ConnectToNetworkSetByUser ( ) { Serial . println ( " " ) ; Serial . printf ( " \n " , _userSettings . m_network_ssid . c_str ( ) , _userSettings . m_network_password . c_str ( ) ) ; WiFi . begin ( _userSettings . m_network_ssid . c_str ( ) , _userSettings . m_network_password . c_str ( ) ) ; unsigned long startTime = millis ( ) ; uint32_t millisecondsToWait = 1000 * WIFI_CONNECT_ATTEMPT_TIME_S ; while ( WiFi . status ( ) != WL_CONNECTED && ( millis ( ) - startTime ) <= millisecondsToWait ) { delay ( 500 ) ; Serial . print ( " " ) ; } if ( WiFi . status ( ) != WL_CONNECTED ) { WiFi . disconnect ( true ) ; Serial . printf ( " \n " , WIFI_CONNECT_ATTEMPT_TIME_S , _userSettings . m_network_ssid . c_str ( ) , _userSettings . m_network_password . c_str ( ) ) ; return false ; } Serial . println ( " " ) ; Serial . println ( " " ) ; Serial . println ( " " ) ; Serial . println ( WiFi . localIP ( ) ) ; if ( m_devicePtr != NULL ) { m_devicePtr -> SetNetworkCredentials ( NetworkCredentials ( WiFi . localIP ( ) , _userSettings . m_network_ssid , _userSettings . m_network_password ) ) ; } return true ; }
Can't use local variables here....
Can ' t use local variables here ....
//UserSettings newVal = _userSettings; //Serial.printf("Check line! %s", _testString.c_str()); // Print local IP address and start web server //Save this IP HERE!