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

amended wifi connection for compatibility with list format wifi.json #64

Open
wants to merge 3 commits into
base: tilda-master
Choose a base branch
from

Conversation

prehensile
Copy link

@prehensile prehensile commented Aug 10, 2016

Corresponds to a PR on emfcamp/Mk3-Firmware to support wifi.json files containing more than one network.

@drrk
Copy link

drrk commented Aug 11, 2016

@marekventur Can you review this one please.

n.connect(w["ssid"], w["pw"], timeout=10)
else:
n.connect(w["ssid"], timeout=10)
except Exception as e:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you be more specific with the kind of exception your catching here?

@marekventur
Copy link

If we change this here, we also need to change bootstrap.py and the files baked into the firmware (wifi.json and bootstrap.json), otherwise it will be very confusing to users.

@Jonty
Copy link
Member

Jonty commented Aug 11, 2016

And it also needs to update the changefi app so it doesn't break.

@drrk
Copy link

drrk commented Aug 11, 2016

On that note the changefi app needs to read the json to populate the entries, not just assume it's set to emfcamp-insecure.

@prehensile
Copy link
Author

prehensile commented Aug 12, 2016

I've made a bunch of improvements in the PR on emfcamp/Mk3-Firmware, copied bootstrap.py back here, and amended stmhal/main.c to write the list format wifi.json.

Unfortunately, it doesn't build / deploy cleanly for me - bootstrap.py never seems to make it to the board. I don't know enough about the build process to debug this. It works as far as I can test it - flashing the current firmware, then replacing bootstrap.py & wifi.json on the board and resetting behaves as expected.

It'll be a while before I can get to amending changefi.

Apologies for these loose ends - I'm limited by skillset & available time.

@drrk
Copy link

drrk commented Aug 12, 2016

To get the badge to rewrite the bootstrap.json you need follow the factory reset procedure: See the box on https://badge.emfcamp.org/wiki/TiLDA_MK3

@prehensile
Copy link
Author

Aha, thanks @drrk! In that case, I can confirm that performing a factory reset writes the correct bootstrap.py & wifi.json and behaves as expected.

known_ssids = [ ap['ssid'] for ap in w ]

if len(set(known_ssids).intersection(visible_ssids)) < 1:
label.text("Couldn't find any networks listed in wifi.json :(" + wifi_info)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: could you add a \n before the wifi_info?

@marekventur
Copy link

looks good to me

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.

4 participants