Hi There,
It appears WiFi.hasCredentials() / WiFi.ready() never return true on 0.7.0 on my Photon device, whereas it did on 0.6.3. This is while I’m trying to pass it credentials while it is in softAP mode i.e. after WiFi.listen(true).
Observations :
• On 0.6.3, I start off with 36k of free memory, which drops to 16k of free memory when listening
• On 0.7.0, I start off with 24k of free memory, which drops to 4k of free memory when listening
• On 0.6.3, the memory jumps from 16k to 32k when I pass new credentials, and then stays at 32k
• On 0.7.0, the memory jumps from 4k to 24k briefly when I pass new credentials, but then falls back to 4k (this seems to indicate Photon does see some new credentials / some info being passed to it)
• On 0.6.3, WiFi.ready & WiFi.hasCredentials change to true upon passing credentials
• On 0.7.0, WiFi.ready & WiFi.hasCredentials is always false for some reason
Is softAP / WiFi.ready / WiFi.hasCredentials not working properly on 0.7.0 ?
Or is this a memory issue causing softAP / WiFi.ready / WiFi.hasCredentials to not work properly ?
Here’s the basic skeleton of the code (simplified) :
Thanks ScruffR. I made some copy-paste errors in an attempt to simplify the code snippet put here
• Yes, those macros are outside of setup()
• Good to know
• There’s some code I’ve omitted here - in some cases we hard code the credentials in.
I’m showing the case here where it isn’t hardcoded in. But I suppose that should be within the conditional
• How many seconds would you suggest ? In my testing 4s seemed sufficient, so I set it to 6s.
Either way, seems irrelevant to the problem statement on hand ?
• Again, present in the code snippet that I omitted. Updated code below.
I must’ve missed the answer to my question though - why the inability to pass credentials on 0.7.0 but it was fine on 0.6.3 ?
SYSTEM_MODE(SEMI_AUTOMATIC);
SYSTEM_THREAD(ENABLED);
setup( ) {
WiFi.on( );
WiFi.listen(false); // Not needed per earlier comments
// Conditional where sometimes Credentials are hardcoded in and sometimes not
WiFi.connect(WIFI_CONNECT_SKIP_LISTEN); // Trying to connect with previously saved credentials
waitFor(WiFi.ready, 6000);
debugPrint(System.freeMemory( ));
if (!Particle.connected( )) { Particle.connect(); WiFi.listen(true); }
}
loop( ) {
debugPrint(System.freeMemory( ));
if ( WiFi.ready( ) ) { WiFi.listen(false); } // Never true
else { debugPrint(System.freeMemory( )); debugPrint(WiFi.hasCredentials( )); }
}
I guess my point is - WiFi.hasCredentials() and WiFi.ready() on 0.7.0 are never true, which seems to be the underlying problem. How do I fix that to begin with ?
With this test sketch you can see the state of WiFi.ready() via the D7 LED.
When you hit the SETUP button you can connect and disconnect and see how that affects the LED.
Also, when you look at the serial output you’ll see that WiFi.hasCredentials() actually returns true.
But maybe your device is not actually running 0.7.0 correctly.
when running particle serial inspect on a properly upated device this is what you should see
>particle serial inspect
Platform: 6 - Photon
Modules
Bootloader module #0 - version 101, main location, 16384 bytes max size
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
System module #1 - version 207, main location, 262144 bytes max size
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
System module #2 - version 207, main location, 262144 bytes max size
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
System module #1 - version 207
Bootloader module #0 - version 7
User module #1 - version 5, main location, 131072 bytes max size
UUID: DEE6819EFDB0167F0B4F437501CCE2934A02C01D0FE01971D39BA61B8A58591E
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
System module #2 - version 207
empty - factory location, 131072 bytes max size
Is there convincing evidence that this cannot be a memory issue ? 4592 seems really low … Also - notice how the memory comes back up to ~24k at the moment I enter the Credentials - it stops listening (but hasCredentials is never true)