Off Image Display Order

Discussion around the SwissMicros DM42 calculator
User avatar
Jeff O.
Posts: 19
Joined: Fri Jul 21, 2017 10:40 pm

Off Image Display Order

Post by Jeff O. »

Does anyone know on what the DM42 bases the order in which it cycles through the Off Images? I guess I would have expected alphabetical, but the 36 images I have in my DM42 display in the following order relative to alphabetical: 34, 7, 8, 10, 11, 22, 12, 20, 25, 33... (i.e., the image that would be 34th in an alphabetical listing displays first, the 7th alphabetically displays second, etc.). I thought that it might be the order in which they were added to the Off Image folder, but I deleted the one that displayed first and then added it again, and it still displays first. So I was wondering if it based on something else, and if there is any way to force a display order.
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: Off Image Display Order

Post by Walter »

On my DM42-Beta the order is alphabetical though not starting at the beginning but constantly with a file somewhere near the end. Also no idea why. :?
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
User avatar
ijabbott
Posts: 253
Joined: Fri Dec 15, 2017 2:34 pm
Location: GB-MAN

Re: Off Image Display Order

Post by ijabbott »

They are displayed in raw directory order. If you delete files, it leaves empty spaces in the directory that can be filled by new files. (It's a little more complicated than that, because with VFAT, directory entries are variable length. So when a new file is added to the directory, it needs to find a large enough gap in the directory, or append to the end of the directory.)

I think you can force a particular display order by deleting all the files in the OFFIMG folder and adding them back one at a time in the order you want them to be displayed. To save flash wear, it would be better to rename the OFFIMG folder to OLDIMG, create a new OFFIMG folder, and move (not copy) the images one at a time from OLDIMG to OFFIMG in the desired display order.
User avatar
Jeff O.
Posts: 19
Joined: Fri Jul 21, 2017 10:40 pm

Re: Off Image Display Order

Post by Jeff O. »

ijabbott wrote:
Thu Mar 08, 2018 12:01 am
I think you can force a particular display order by deleting all the files in the OFFIMG folder and adding them back one at a time in the order you want them to be displayed. To save flash wear, it would be better to rename the OFFIMG folder to OLDIMG, create a new OFFIMG folder, and move (not copy) the images one at a time from OLDIMG to OFFIMG in the desired display order.
Thanks, that did it.
Creating folders and moving files doesn't cause any flash wear? So I could leave the OLDIMG folder intact, and move images back and forth without wearing flash? (Please pardon my ignorance which I am sure is on full display.)
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Off Image Display Order

Post by Thomas Okken »

Jeff O. wrote:
Thu Mar 08, 2018 1:54 am
Creating folders and moving files doesn't cause any flash wear? So I could leave the OLDIMG folder intact, and move images back and forth without wearing flash?
Moving files around does cause some flash wear, but not as much as copying files. When you move files, the file data stays put, but the affected directories do have to be updated.

A directory is essentially just another file, containing a list of file names and pointers to the files' contents. When a directory changes, because of files or subdirectories being added, removed, or renamed, it has to be updated on disk, but this is an operation that is typically optimized to write as little data as possible. Copying a file, on the other hand, is the worst-case scenario: all the sectors of the original file have to be copied to new locations.

Having said all that, I wouldn't worry about it too much. Modern flash memory lasts a long time, and offimg files are small... I don't think you'll wear out the DM42 flash chip that way.
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: Off Image Display Order

Post by Walter »

Thanks to ijabott and Thomas for explaining. Reminded me of something learned long ago but forgotten. IIRC file handling on magnetic disks worked a similar way.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
User avatar
Jeff O.
Posts: 19
Joined: Fri Jul 21, 2017 10:40 pm

Re: Off Image Display Order

Post by Jeff O. »

Walter wrote:
Thu Mar 08, 2018 6:08 am
Thanks to ijabott and Thomas for explaining.
Agreed, thanks for the help and information.
Regarding wearing out the flash, you are probably correct, I will never wear it out and should not worry. But then I think, “if I did 10 flash-wearing operations per day, and the flash is good for 100,000 operations, that’s only 10,000 days! That’s only 27 years!”
keithdalby
Posts: 564
Joined: Mon Apr 24, 2017 8:38 pm

Re: Off Image Display Order

Post by keithdalby »

Jeff O. wrote:
Thu Mar 08, 2018 2:49 pm
That’s only 27 years!”
With my diet, that'll see me through until I reroll my next character.
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: Off Image Display Order

Post by Walter »

keithdalby wrote:
Thu Mar 08, 2018 6:30 pm
Jeff O. wrote:
Thu Mar 08, 2018 2:49 pm
That’s only 27 years!”
With my diet, that'll see me through until I reroll my next character.
Are you going to queue for rebirth?
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
mcc
Posts: 277
Joined: Fri Jun 23, 2017 5:10 am

Re: Off Image Display Order

Post by mcc »

Hi,
Jeff O. wrote:
Thu Mar 08, 2018 2:49 pm
Agreed, thanks for the help and information.
Regarding wearing out the flash, you are probably correct, I will never wear it out and should not worry. But then I think, “if I did 10 flash-wearing operations per day, and the flash is good for 100,000 operations, that’s only 10,000 days! That’s only 27 years!”
A colleque of mine said, that the 100000 write cycles were combined with the 20 years of quaranteed data integrity.
After that the flash dont stop working suddenly but you may loose the long term data integrity.

I haven't checked that practically though but searching for according tests with the Atmel mcu for the Arduino project (keyword "flash destroyer") may be worth searching/reading.

HTH!
Cheers Meino
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
Post Reply