-
Notifications
You must be signed in to change notification settings - Fork 14
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
How about OTA updater? :) #55
Comments
I like the idea, but I'm not sure I can envision how this should ideally work for MicroHydra. Most people are running the compiled firmware, I think. That means that there would need to be a totally separate solution for OTA updates on the firmware, vs running it on normal MicroPython firmware. Maybe if there was a built-in app that made it easy to download files from GitHub, that could be a good solution? That way, people could fetch new apps from the app repo without needing a computer, and people who want the newest MH updates could download from this repo. I'm not sure! I'd love to hear your input on this :) |
So, my perfect setup looks like this:
As for OTA, I see three use cases:
Sidenote for perfectionists: to do OTA sustainably, proper release process is needed for MicroHydra repo (but that's another story once OTA will work at least somehow) |
That's a good point; Now that M5Launcher supports MicroHydra, (and that they're adding OTA to it), it basically handles all of the 'OTA' functionality for the compiled version for us.
I think this happens because MicroPythons virtual filesystem is just not being overwritten by the other firmwares. You can actually encounter some issues if you, just as an example, install UIFlow, and then install MicroHydra (without erasing the flash first) because the old UIFlow filesystem will be there instead of MH's filesystem. |
Would you be willing to share what line of code in your first attempt is running out of memory? I haven't had the chance to try it out myself, but I have encountered a lot of memory issues throughout this project, so I'm curious to know if this will be a familiar issue for me :) |
Are they adding OTA?.. Where?
Btw, do you know by chance if there's an 'empty' firmware available? Just to make a clean install? (or that should be a feature request to M5 launcher?)
Sure! |
Interesting. So, it looks like it's not failing to fetch the content from the internet, but instead failing to read the content/create the file, right? If that's the case, you might be able to solve it by doing something similar to what the Files app does. Here's a snippet from the 'paste' function in the files app: with open(source,"rb") as old_file:
with open(dest, "wb") as new_file:
while True:
l = old_file.read(512)
if not l: break
new_file.write(l) It's not actually reading/writing the file all at once, but scanning through in small chunks, in order to not use too much memory. I still haven't actually gotten the chance to run your code myself, so I could be totally off with this. But I think it might just be failing because it's trying to fully open/decode the entire file all at once, before writing it to a new file. |
Thanks!
I'll give it a try!
…On Wed, 24 Apr 2024, 02:08 Ethan, ***@***.***> wrote:
Sure! This is the line (+-1)
https://github.com/h-david-a/Cardputer-MicroHydra/blob/67de65a3552fd6d01d7c3c7a6865b7f9deff9506/MicroHydra/apps/ota.py#L105
Interesting. So, it looks like it's not failing to fetch the content from
the internet, but instead failing to read the content/create the file,
right?
If that's the case, you might be able to solve it by doing something
similar to what the Files app does. Here's a snippet from the 'paste'
function in the files app:
with open(source,"rb") as old_file:
with open(dest, "wb") as new_file:
while True:
l = old_file.read(512)
if not l: break
new_file.write(l)
It's not actually reading/writing the file all at once, but scanning
through in small chunks, in order to not use too much memory.
I still haven't actually gotten the chance to run your code myself, so I
could be totally off with this. But I think it might just be failing
because it's trying to fully open/decode the entire file all at once,
before writing it to a new file.
—
Reply to this email directly, view it on GitHub
<#55 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAY6QCUIG6LC75ZGGASNV3Y63ZZLAVCNFSM6AAAAABGRVILGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZTGY4DONJUGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
So, the issue is with the urequests module. |
After messing around got to the No free space on device. Wiping firmware doesn't really help. Also, s3 stamp specs mention 8MB flash (http://docs.m5stack.com/en/core/StampS3) Checking partitions with esp32 method shows also strange results:
[<Partition type=0, subtype=32, address=65536, size=851968, label=app0, encrypted=0>, So, app0 is 832KB and app1 - 5MB. And that doesn't match any schema described by m5 launcher OTA appears to be a more complicated think :) |
FYI, newest version of MicroHydra now has a built-in way to download apps from the github repo. This isn't an OTA updater at all because it can't download/overwrite MicroHydra's files, but I could imagine a future OTA update functionality reusing some of the same logic 😁 |
There are new features almost every day!
I'd like to get them directly to the device :)
I've tried to adapt micropython_ota: https://github.com/mattjackets/micropython_ota/blob/main/micropython_ota.py
But it fails to download 'big' files: in my case it was failing on memory alocation for 44kb
Googled a bit, and it appears that there's a mrequests lib providing chunked downloads (https://github.com/SpotlightKid/mrequests/tree/master)
Looking into it. Any inputs are welcome!
The text was updated successfully, but these errors were encountered: