get free flash space
-
On the esp8266, I use a function to get the free file space:
def df(): s = os.statvfs('//') return ('{0} MB'.format((s[0]*s[3])/1048576))However on the wipy, os.statvfs is not available and os.stat() does not appear to return the block data to be able to calculate the free space:
>>> os.stat('/flash') (16384, 0, 0, 0, 0, 0, 0, 959558400, 959558400, 959558400) >>>So how can I create a similar function that returns the free space in MB ?
-
@crankshaft For exactly that purpose statvfs() was introduced.
There was an attempt (by @deshipu?) using a tree search with adding up file sizes, but that is slow and error prone. If you look up that discussion in the micropython's board, you may find that code.
No, that code was never written. The discussion is here:
https://forum.micropython.org/viewtopic.php?f=16&t=2361&hilit=statvfs -
@robert-hh - Yes, thanks, I am using that on the esp8266 ( see my first code snippet df() ) and it works just fine, what I am asking is how can I get the freespace on the pycom port as statvfs() is not available ?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login