Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: a.sintes on October 19, 2023, 04:50:25 PM

Title: SD/CF dual slots free space display (5D3)
Post by: a.sintes on October 19, 2023, 04:50:25 PM
[UPDATED 2023-10-23]
Hello,

Following a request on our Discord channel, I've implemented a very small feature to replace the legacy "free space" display in the ML top bar (top-right corner) with a new one including:
- a proper refresh (e.g.: after recording a video) of the top bar (previously only set once at camera startup, or after taking a picture)
- an indication of the card concerned by the display (CF or SD prefix)
- a potential display of the two card slots in case of SD+CF usage (e.g.: 5D3)

Note:
- to reduce a little the size the unit was removed, which is implicitly GB
- in case of dual slots usage with sound recording activated, the temperature indication may disappear to leave some space

2023-10-23 update:
The refresh of the values is now working well (no need to reboot the camera): current ML code (fio-ml.c) is based over property callbacks that are triggered only with specific camera events (e.g.: taking a picture, removing a file using Canon menus...), so to avoid taking a picture (shutter consumption) I've finally managed to compute the remaining free space the "hard way", using a custom computation:
- the first time, ask ML about the remaining free space on card slots (using get_free_space_32k) then compute the cumulated size of the files within the DCIM/ folder, it allows then to deduce a close approximation of each card volume size
- each time we need to refresh the UI (happens quite rarely, but typically OK after recording something due to the UI reconfiguration), compute the current cumulated size of the files inside the DCIM folder then use a simple subtraction to deduce the remaining free space
For those worrying about the file size cumulation routine, it took approximatively less than 10ms (depending of the number of pictures/movies present on the cards), which is completely sustainable as the top-bar refresh happens really occasionally.

It look like this:
(http://silentbreed.com/ML/ML_cards_free_space2.jpg)

And it was pushed in my GitHub repository (https://github.com/arnaud-sintes/magiclantern_asintes), which is basically an up-to-date fork of Danne's BitBucket one (https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/src/master/), including also the ultrafast framed preview feature (https://www.magiclantern.fm/forum/index.php?topic=26998).

You can download and install 5D3 (1.1.3 & 1.2.3) builds (including modules etc.) using these packages (https://github.com/arnaud-sintes/magiclantern_asintes/releases/tag/crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_fsq_2023Oct19).

Hope it may help someone else!

Note: it may potentially solve this old ML thread (https://www.magiclantern.fm/forum/index.php?topic=10548.msg102511).

Thanks to @WalterSchulz and @names_are_hard
Title: Re: SD/CF dual slots free space display (5D3)
Post by: Danne on October 20, 2023, 10:20:24 PM
Great man! Sorry for not having the time to check into your stuff lately. My 5D III is buried in a box atm :(.
Title: Re: SD/CF dual slots free space display (5D3)
Post by: a.sintes on October 21, 2023, 07:26:01 AM
We all have a family and a "real" job, so no need to apology ;-)

Note anyway this feature is not totally completed: the display is ok but it seems the "free remaining" value itself is not yet properly refreshed, the update event being triggered by the camera only in very specific situations (e.g.: taking a picture, removing a picture from the Canon menus...) so I need to find a workaround to force it so we may have a proper information refreshed after a video recording.
Title: Re: SD/CF dual slots free space display (5D3)
Post by: Mattia on October 21, 2023, 09:48:39 AM
You could make the camera take a picture after every recording, it would be useful also to identify the content of mlv files, just like a thumbnail
Title: Re: SD/CF dual slots free space display (5D3)
Post by: a.sintes on October 21, 2023, 10:15:34 AM
Seems to be the most obvious yes, note anyway MLVFS already provides an HTML page with details about the shots and a gif-based preview, so the image is maybe too much (and shutter consuming for nothing), will check if I can figure out something else before using this fallback
Title: Re: SD/CF dual slots free space display (5D3)
Post by: 70MM13 on October 21, 2023, 03:09:58 PM
Please,  if you decide to waste shutter actuations, add an option to disable it. Otherwise,  people who care about such things will not use your function.
Title: Re: SD/CF dual slots free space display (5D3)
Post by: a.sintes on October 23, 2023, 01:30:52 PM
UPDATED: refresh is working well now, without the need of wasting shutter actuations ;-)
Title: Re: SD/CF dual slots free space display (5D3)
Post by: Mattia on October 23, 2023, 02:30:30 PM
Great! It works well! But I've noticed how without the SD Overclock enabled it only updates the CF card. It is supposed to work like that? Or maybe tge amount of data written on the SD Card without the overclock is not that much, I need to test further..
Title: Re: SD/CF dual slots free space display (5D3)
Post by: a.sintes on October 23, 2023, 02:52:47 PM
must be totally independent of SD-overclock / Card Spanning / preferred card options, so yes, my guess is you don't exceed 1GB of write
(tell me otherwise)
Title: Re: SD/CF dual slots free space display (5D3)
Post by: Skinny on October 24, 2023, 07:36:44 PM
Very, very nice option! I hope it will be ported to other cameras at some point. Great job!
Title: Re: SD/CF dual slots free space display (5D3)
Post by: a.sintes on October 25, 2023, 06:01:52 AM
an easy one to port, small non-5D3-specific code addition and a minor change of menu priority, all done in the same single file (lens.c)