Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi auto connect + reboot counter #47

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

giulcioffi
Copy link
Contributor

The current version of nina-fw does not allow to retrieve the credentials of a working connection. This can be done by storing a backup of the credentials of the last working network into the flash.
2 new options are available:

  • NO network selection (SSID field empty): the fw immediately tries to connect to the last working network by restoring its credentials saved in a backup;
  • wrong SSID: while the first time the fw tries to connect to this network and fails, the second time it restores the credentials of the last working network and connects to it. In order to allow this, the WiFi.begin() function must not be called just once, otherwise the connection will fail anyway. It is suggested to use a loop such as
while (status != WL_CONNECTED) {
    status = WiFi.begin(ssid, pass);
  }

This patch allows to save the credentials of only one network: whenever the WiFi module connects to a new working network, the backup of this "safe" credentials are overwritten. Then, obviously, if the WiFi to which we are trying to connect is different from the one saved in the backup, the only way to connect to the new WiFi is to provide the right SSID and password.

The second proposed feature introduces a counter for the number of times a reboot is performed. This counter is saved in the flash in a file called "bootcounter.bin". This information can be used to trigger a reset or enable a way to step out from a blocking condition.
The file is created (if it does not already exist) by the ESP. It just contains a number which is read, incremented and written back whenever a reboot is triggered.

@aentinger
Copy link
Contributor

Hi @giulcioffi and @facchinm 👋
I'm seeing that this PR contains commits of PR #32. I'm wondering why is that?
Cheers, Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants