Hi, I’m developing a firmware for argon where the device should connect to an Wi-fi AP which is not necessarily connected to internet (for security reasons, I think).
It seems that the Argon device first connects to an internet, so I made it to connect to an Wi-fi AP (say A) which is connected to internet, then disconnect, and connect to the target Wi-fi AP (say B).
I found it extremely cumbersome when the Argon device, when booted up, connects to B and tries to connect to the cloud (in this case, I had to set Wi-fi credentials as ‘A’ using Particle App).
So, here’s my question:
- Is there any methods to skip cloud connection and to start with ‘setup()’?
- Or, can I set a ‘default’ Wi-fi credential to be used at the first stage?
I tried as shown below, but failed to go into ‘setup()’ (the device is just blinking blue).
// in \.particle\toolchains\deviceOS\3.2.0-rc.1\system\src\system_task.cpp
void Network_Setup(bool threaded)
{
network_setup(0, 0, 0);
network_clear_credentials(0, 0, NULL, NULL);
NetworkCredentials init_credential;
memset(&init_credential, 0, sizeof(init_credential));
init_credential.size = sizeof(init_credential);
init_credential.ssid = "TARGET_AP";
init_credential.ssid_len = strlen(init_credential.ssid);
init_credential.password = "PW_OF_TARGET_AP";
init_credential.password_len = strlen(init_credential.password);
init_credential.security = WLAN_SEC_WPA2;
init_credential.cipher = WLAN_CIPHER_AES;
network_set_credentials(0, 0, &init_credential, NULL);
// don't automatically connect when threaded since we want the thread to start asap
if ((!threaded && system_mode() == AUTOMATIC) || system_mode()==SAFE_MODE)
{
network_connect(0, 0, 0, 0);
}
...