in an application for the p1 i am using WiFi.listen() if there are no wifi credentials. it runs with SYSTEM_MODE(SEMI_AUTOMATIC) before and after the WiFi.listen() i use Log (and SerialLogHandler logHandler(LOG_LEVEL_ALL))
when the device is blinking blue (and unclaimed) and i use the particle app to “add” it works fine but i am missing some of the logging after the Wifi.listen()
although annoying, this is not the problem but might be a clue:
when i add code using the SPI interface (and A2 as select) i can no longer configure the device with the particle app: i get a “X” before “Configuring Wi-Fi credentials” followed by “Error! Setup process couldn’t configure the Wi-Fi credentials …” (and the blue led keeps blinking)
in case the P1 is already setup the code runs fine. anyone any idea?
thanks so much!
frank
ps:
browsing through the device-os code on github: why do i not see the log messages? like LOG(INFO, “Entering listening mode”);
how do i enable those? (i was hoping “LOG_LEVEL_ALL” whould do that)
You can try adding SYSTEM_THREAD(ENABLED) to ensure your application code is running while in LM.
I haven't looked into the implementaion of the LOG() macro in the device OS repo, but
these may be deactivated for release device OS and only do something when building with the debug flag.
okay, more detail: although the call to “mm_firmware_update” is not used it does cause the problem. my guess now is that linking in that call and associated code causes the problem with wifi.listen. it is code to flash a micro-controller over spi (and uses many times in other projects)
investigating further…
maybe turn the question around: what can cause wifi.listen to behave like this? (seems normal till you try to add the device with particle app)
i now belief it is a stack problem or something. a large array is used in the code that gets linked in there. when eliminate the use of that array it does work. will use a different/better implementation…
so i guess this question turns into a warning! weird behavior with wifi.listen --> check memory usage
For the sake of clarity - which device are you using (Photon or P1) and which device OS?
Are these your functions mm_needs_upgrade(version) and mm_firmware_update(version)?
From what you have shared it is unclear what you are using SPI for and what this need_upgrade is doing. You refer to an array but not where it is defined and used.