Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.
-
@foxhound Did you get the connection Successful message when trying to connect?
-
Woohoo!! Thanks so much mate, finally in and have placed my code into the UI Flow Python Editor and have started running it :)
Couple of questions related to my original question regarding wifi.
- How do I permenantly save the code to my device. I can run it, but I when I reboot it doesn't boot into my code again.
- Secondly, how on boot can I edit it so it automatically tries to reconnect if the Wifi isn't found.
Thanks so much for your help, really appreciate it.
-
In the top right hand corner is an icon with 3 horizontal lines, click on that then click on "Download" to permanently save to the M5Go.
I do believe that you use
import wifisetup wifisetup.auto_connect()
at the beginning of the file above the
from m5stack import * from m5ui import *
Alternatively, save the file as main.py and copy it to the M5Stack using ampy.
-
Awesome, thanks, I'll give this a go.
-
@ajb2k3
Okay awesome, thanks mate, have it working well now. Just need to make some modifications.Auto connect seems to only work when called, and looks like it will throw an error if not connecting. I've found the code on the repo, so I'll modify that to continue trying when booting up if no wifi is found, and upon disconnection, call the function again.
Won't get much time to work on it for a little bit but will report back next week with my progress. Thanks very much for your assistance.
Also, download didn't work but ampy working really well now, thankyou!
-
@foxhound Glad to hear that I could help.
-
Quick one, do you know where the source code for m5base is?
ALso, with ampy, have you been able to get into directories past /flash.
WHenever I try and list things inside say lib(/flash/lib), it say it isn't a directory?
-
-
which micropython version are you using? if you did a custom flash not from the official m5stack burner you may have forgotten to flash the .spiffs file which contains all the folders and files you want to put on the filesystem
-
Hey Luke,
thanks for getting back to me. I flashed with the flash.sh (I'm on linux) including all the .spiffs file.However, when I try to get I get the following.
-
Strange, which version of the firmware are you using, could you post the log from flash.sh process or the command you used, maybe the files are not getting written to the correct memory addresses, usually it should look like this
"--chip esp32 --port %port --baud %baud write_flash -z 0x1000 %PATH\bootloader.bin 0xf000 %PATH\phy_init_data.bin 0x10000 %PATH\MicroPython.bin 0x8000 %PATH\partitions_mpy.bin",
"--chip esp32 --port %port --baud %baud --before default_reset --after no_reset write_flash -z --flash_freq 40m 0x170000 %PATH\spiffs_image_0x170000.img" -
Yep sure will, I'll get it for you tonight.
-
esptool.py --chip esp32 --port /dev/${port} --baud 921600 --before default_reset --after no_reset write_flash -z \ --flash_mode dio --flash_freq 80m --flash_size detect \ 0x1000 bootloader.bin \ 0xf000 phy_init_data.bin \ 0x10000 MicroPython.bin \ 0x8000 partitions_mpy.bin \ 0x170000 spiffs_image_0x170000.img
I have a feeling however, I did not do this properly. However everything seems to be working fine besides not being able to get into the system, and not being able to change font..
-
@foxhound Maybe, you need install python2.7 for compiling this firmware. A year ago, I compiled a micropython firmware with python3. And the serial monitor displayed some error which seem like yours.
-
Good idea, thanks mate!
Also, can you tell me how to properly change the font? I'm trying to increase the size.
lcd.font(FONT_DejaVu18)
Doesn't compile
lcd.font("FONT_DejaVu18")
Doesn't do anything?
-
@foxhound said in Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.:
Good idea, thanks mate!
Also, can you tell me how to properly change the font? I'm trying to increase the size.
lcd.font(FONT_DejaVu18)
Doesn't compile
lcd.font("FONT_DejaVu18")
Doesn't do anything?
lcd.font doesn't work. try something like
from m5stack import * from m5ui import * clear_bg(0x222222) btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False) btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False) btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False) label1 = M5TextBox(118, 116, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0) label1.setFont(lcd.FONT_DejaVu24)
Here I am using a label for text.
-
The fonts used on the m5stack are bitmap fonts and therefore are not scalable, they are whatever size they were converted in. A while back on our forums one of our users loboris who is an active developer in the micropython community developed a cool tool to convert any font file in any size you want to a .fon bitmap font format, you cant find it here http://forum.m5stack.com/topic/388/cahnge-font-size-in-python/20
-
Awesome, of course, I needed to call lcd.FONT_DejaVu24.
However, I did manage to get lcd.font(lcd.FONT_DejaVu24) to work fine for me. I just called it at the top of my script and all is well.@lukasmaximus
Thanks, I'll take a look at that, so far DejaVu24 is working well for me. But if i need to make it larger I'll be sure to check that out. -
@foxhound Best wish to you !