The local toolchain really is much better, especially when it took minutes to flash each time.
I was thinking to simplify implementation, just remove the initial checking for connectivity with a define if possible? Then Spark.connect() could be called with a condidtion.
Or update the firmware to have limited retries to the cloud on 1st run?
If the reconnect is kept blocking that should be ok as it will ensure that the spark is always connected to wifi if required. If no wifi is required wifi can just be undefined.
I’ve found that while Spark.disconnect() ensures the code on the core doesn’t stop executing, the WiFi connection still stalls after a few hours and requries a reset. I didn’t notice it in my initial tests as I wasn’t using the network.
Hopefully the guys at texas instruments will be able to assist with this problem, as… well I hate to say it, but my ten cores are useless until this is working
Is there any further update on this issue? Has this been fixed?
Yesterday I complied the new code using the WebIDE, but I am still facing the same issue. If the core is not connected to Net, TCPServer/Client within the loop does not work.
Not able to retrieve IP address using Network.localIP(); after including “spark_disable_wlan.h” and “spark_disable_cloud.h”. Though I am able to get the IP if I exclude “spark_disable_wlan.h” and “spark_disable_cloud.h”.
sample code…
#include "application.h"
#include "spark_disable_wlan.h"
#include "spark_disable_cloud.h"
WiFi_Status_TypeDef last_wifi_status;
// variable to store the local IP Address
char myIpString[24];
void setup()
{
last_wifi_status = WiFi.status();
WiFi.on();
Spark.connect();
//Get the local IP address.
myIp = Network.localIP();
sprintf(myIpString, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]);
Spark.variable("localIP", myIpString, STRING);
}
With WiFI.on(); I am enabling the wifi and The spark core is getting connected to the router (Breathing Green --> IP address has been assigned). I am able to ping the Ping the Spark core with that IP but I am not able to get the value using Network.localIP();
Second Scenario:
I am calling both WiFi.on(); and Spark.connect() and I am getting breathing Cyan (Connected to Cloud). When I call the Spark Variable, it is not returning IP address.
If I remove both the Wlan and Clound… .h call and use the same code, IP is getting returned when I call the Spark Variable.
For the 1st case, it’s true you cannot get through Spark.variable since only Wifi.on() and Spark.disconnect();?
The core needs to be connected to the spark cloud to get the IP through the API to read the Spark.Variable
Scenario 2 is more interesting…
It should work in this case. Do you happen to have the Spark-CLI? Would be nice to see what functions and variable is available when you are connected.
Thanks. I tried that and and it is working. But my question is why IP is not getting retrieved in the first call in the setup {} and this is happening when wlan and cloud disable…h files are included. The same code is working without any problem if I exclude these files.
Also, why Network.localIP(); needs to be called repeatedly within a loop to get a value.
I suspect this is the combination of wanting the setup/loop code to run regardless of network / cloud status. Establishing a Wifi / network connection and getting a DHCP lease take some time, so if your code is running immediately, it’ll be a few moments before you have an IP.
I am trying to start up the Spark without connection to the WiFI and Cloud. I have included “spark_disable_wlan.h” and “spark_disable_cloud.h” to the beginning of my firmware, it nicely starts without connecting. Later on in my firmware I connect to WiFi and that works perfectly. After that I tried to connect to the Cloud but that fails, the RGB led start flashing red for a while and the program seems to hang. Here is the code snipped:
WiFi_Status_TypeDef wifiStatus;
bool cloudStatus;
WiFi.on(); // Startup WiFi connection
do {
yellowLed->on();
wifiStatus = WiFi.status();
delay(500);
yellowLed->off();
delay(500);
}
while (wifiStatus != WIFI_ON); // Repeat until WiFi is connected
Spark.connect(); // Connect to the Spark Cloud
do {
yellowLed->on();
cloudStatus = Spark.connected();
delay(500);
yellowLed->off();
delay(500);
}
while (cloudStatus == false); // Repeat until Spark Cloud is connected
The yellowLed->on() and off() are just for me to show where I am in my code and manupulates an external Led.
Any idea what could be wrong?