from my understanding the connection to the button is just an example of what you can do in semiautomatic mode. You can use any other pin by adapting the code ( attachInterrupt(D0, connect, FALLING) or do not use a button at all and call Spark.Connect() in some other place in your code.
Has anyone had a problem with SYSTEM_MODE(MANUAL) and OTA updates? If I set MANUAL and I try to do OTA uptade then core led is solid magenta and then resets it. In loop function I have this:
I can take a look at this the next day or two - from what I know of how this works, this could likely be a bug, since MANUAL mode is expecting user code to call Spark.process() but that is of course not possible during a OTA update.
Until a fix is available, can you use SEMI_AUTOMATIC mode?
Try dropping the Wifi calls - they shouldnāt be needed and could be interfering. (I agree this code should work as is, and that the extra calls to Wifi should have no effect if not needed.)
I have used all three modes and found some minor issues that appear to have been resolved. I initially used the MANUAL mode and called āSpark.process()ā every second or so in my main loop. However, when I tried to Spark.connect() I had the breathing cyan led but no connection. It was fine for working on a local network but to synchronise the time I had to download a Unix timestamp over the local TCP IP connection as I couldnāt use Spark.syncTime();
Next, I started using SEMI_AUTOMATIC mode and this was perfect for my code, allowing it to work on a local network and then calling Spark.connect() when required to download new firmware or to use Spark cloud functionality such as Spark.variable and Spark.syncTime. However, I had to call Spark.process() regularly in my main loop - this is not made clear in the documentation.
AUTOMATIC mode took care of everything but I prefer the above SEMI_AUTOMATIC to minimise any critical timing issues.
Overall I would say this functionality is a great step forward for those of us who want to dip in and out of the Cloud.
Thanks @kennethlimcp! Please submit a pull request to core-firmware. In order to avoid calling Spark.process() in MANUAL mode without the userās consent, I think youāll need to wrap the call to Spark.process() in if (SPARK_FLASH_UPDATE). See these two functions which set and reset it to indicate that OTA is in progress.
We might probably need to review the SYSTEM_MODE code as i tried to force the error using AUTOMATIC with the same condition as how MANUAL behaves and OTA flash still worked fine!
In the long run, imagine static IP support will be baked into the firmware as part of the wifi setup, since the call to netapp_dhcp() is persisted in the cc3000 eeprom. (This same fix also overlaps with enabling the 11-13 channels, since that is also persisted data and set as part of wifi setup.)
run my Spark on a local network (i.e. connecting it to a local Access Point, without connecting it to the Cloud because it will be used in a place where no connection to the internet is available)
provide the SSID of my local Access Point directly in the code
By reading all the topics on the subject from last March, Iāve understood that the use of #include spark_disable_wlan.h, #include "spark_disable_cloud.h and #undef SPARK_WLAN_ENABLE have been more or less deprecated. So Iām trying to do it with the WiFi and Spark classes,
Iāve tried to do this by putting SYSTEM_MODE(SEMI_AUTOMATIC); at the top of my code, then this in the setup() function :
if (WiFi.hasCredentials()) {
WiFi.clearCredentials();
}
WiFi.setCredentials(MY_AP_SSID, MY_AP_PASSWORD, WPA2);
WiFi.on();
if (!WiFi.ready()) {
WiFi.connect();
}
Udp.begin(8888);
but it doesnāt work⦠I canāt manage to get the LED breathing cyan, informing me that the connection has been successfull.
Can anybody explain me why my code doesnāt allow my Spark to connect to my local Access Point ?
Thanks !
(PS : Iām compiling my code with the latest firmware and gcc by using the DFU mode)
In my understanding SYSTEM_MODE(SEMI_AUTOMATIC) is all off the automatic mode stuff, except for the Spark.connect() call. After obtaining a working Wifi connection, your led should breath green, not cyan.
I can imagine that for setting the credentials manually, MANUAL mode would be more suitable, requiring you to setup the connection yourself. Have you tried that to see how that works out for you?