Validating Wifi details
Closed this issue · 6 comments
Noticed two issues:
- When I enter incorrect Wifi details, the core accepts it and blinks green led. It should validate Wifi details before it flashes green led.
- Once the green LED is flashing I can't interact with the device i.e. re-setup the device.
For (2), simply hold the MODE button for 4 seconds to re-enter Listening mode as documented here: http://docs.spark.io/connect/#connecting-your-core-listening-mode
As for (1), sounds great but the core needs to first store the Wifi credentials and attempt to connect and see if it's successful.
There can be a couple of reasons why connection failed so the reason for flashing green would tell the user that there's some issue connecting to the wifi network.
The more appropriate repo for this issue would be: https://github.com/spark/firmware
Thanks @kennethlimcp I am aware of reseting wifi details but thinking it's not a good practice when you are embedding spark core into a product. Do you know any library which can help me in validating wifi credentials?
Is there any way I can debug the green led issue?
Another issue I am facing is that when I setup Wifi details I can't interact with the device. Is that normal? Here is the error I am getting:
Serial err: Error: Opening \\.\COM6: File not found
Serial problems, please reconnect the core.
Something went wrong Serial problems, please reconnect the core.
Potentially unhandled rejection [2] Serial problems, please reconnect the core. (WARNING: non-Error used)
Potentially unhandled rejection [3] Error: Serialport not open.
at SerialPortFactory.SerialPort.close
I also can't see the Spark core driver in the device list when the device is active. As soon as I reset the device i.e. turn into listening mode then it becomes available.
Hi @moazam1 ,
In these cases, the default tinker firmware on your core has stopped listening for connection credentials while it's trying to connect to your network. You can overcome this with custom firmware, or using different setup methods. Best practices for integrating the core and wifi setup into your product will be outlined in our product creator guides that we'll be launching soon, and will also become easier with the Photon. If you want, please email hello@spark.io for more details on those guides in the meantime. :)
Thanks!
David
Hi @dmiddlecamp
Thanks for the message. Can you please enlighten more how custom firmware can solve this problem and how to get started with it? I am also interested if there are any other alternate setup methods available. Can you please tell me more about it?
Do you think your product creator guide will work with current version of Spark core. We are close to in launching our product so probably we can't wait for Photon release.
Thanks,
Moazam
Hi @moazam1,
The only way to validate the credentials is to attempt to connect to the network. You can write code to set a timeout so that if you have been attempting to connect for long enough, you go into listening mode.
Once you enter listening mode, your loop stops being called until after credentials have been added. If you also want a timeout for listening mode, to drop back into trying to connect, then you need to write code in main.cpp and/or spark_wlan.cpp to handle this.
The product creator workflow will mostly apply to the Spark Core as well, yes. However, there will be some elements of it that are more applicable to the Photon.