Page 1 of 1

wipy environment

Posted: Mon Nov 09, 2015 12:35 am
by cliechti
I wanted to have some configuration code run at startup and the option to put a main.py file on the SD card, so i coded something to do that. Thought that may be useful to others too.

https://github.com/zsquareplusc/wipy-environment
  • activate REPL on serial port
  • try to connect to home network (in STA mode), fall back to AP mode if that fails.
  • mount the SD card to /sd and add /sd/lib to sys.path (if present)
  • execute /sd/main.py on SD card (if present)
i've also added a tool to sync files from the PC with the WiPy (via FTP / Pythons libftp) and one to download the latest firmware.

Re: wipy environment

Posted: Mon Nov 09, 2015 8:18 am
by pythoncoder
That looks awesome, especially for first time setup of a WiPy :D

Re: wipy environment

Posted: Mon Nov 09, 2015 11:04 am
by platforma
That's a good collection of very useful quick set-ups. Handy to have it as scripts for first time setup. Good work!

Re: wipy environment

Posted: Tue Nov 10, 2015 2:50 am
by iandouglas
This is a great start, thanks for sharing the code. I'm going to need to fork the code and adapt it since I won't have an expansion board connecting to all of my units. :)

I just got my WiPy units last week and am just starting to dig into how to set them up etc., and I have much to learn, but ideally I'd like to get their wifi MAC addresses hard-coded on my router at home such that even with DHCP they'll always get the same IP addresses.

And of course, I have to think of a project for all of them. :)

Re: wipy environment

Posted: Tue Nov 10, 2015 4:25 am
by iandouglas
(apologies for the double post, I was waiting for moderation)

Hi @cliechti,

I can't leave you a PM here, but I've submitted an untested pull request on github to see if you'd be open to trying this out for us and possibly adding it to your code base. I don't have my wipy operational yet, so I have tons of print() statements in there to ensure the order of my ftp commands is correct.

https://github.com/zsquareplusc/wipy-environment/pull/1

It's basically a means (hopefully) to upload module folders into /lib/ not just modules packaged into single .py files inside /lib/. From what I've read, micropython should support this just fine.

I've also added a flag (which I have commented out) for a --noexp option for your script to operate by filtering out any commands which would use SD storage, etc..

Cheers,
Ian

Re: wipy environment

Posted: Tue Nov 10, 2015 10:12 pm
by cliechti
@iandouglas
well the code does not verify if there is an expansion board and handles a non existent SD card gracefully. so it should be fine without any connections. however it will initialize the pins (SD, button, led, UART), which may or may not conflict with your setup