Closed DJDevon3 closed 1 year ago
This looks good to me, did you test these as well?
@tekktrik Only tested the TFT featherwing example and can confirm it works well. The other 2 I did just because I was in there. Should I not submit things I cannot explicitly test? It seemed like a shame to leave the other 2 examples alone without umount. I probably should have specified that in the original commit sorry.
No, totally fine to PR things you haven't tested! Just wanted to check, definitely always makes me more confident when it is tested is all :)
I'm out today but will look tomorrow!
Take screenshot is False by default. Set to true to take a screenshot.
A good real world example is at the very end of my feather weather project. That's my old "YOLO version" as Anecdata puts it where I race a 120 second timer to remove the SD card, upload it to the PC, and put it back. Still have to update my own scripts.
I included the if statement because I believe its in everyone's best interest to become accustomed to using it in that way, especially beginners.
Technically it doesn't need to be there... but then neither does umount. It adds safety measures so you don't
Stopping an SD write mid-stream won't just corrupt the file you're trying to write, it will create gibberish files that cannot be deleted and/or corrupt your entire SD card.
Between the if statement and umount the risk of data corruption and infinite screenshot taking loop is virtually eliminated. For advanced users with never ending scripts at some point you'll likely want to remount but that is unnecessary in the simpletest examples. umount however is definitely necessary.
They're features I wish would have been included in the examples from the beginning. I've used this library more than anyone else I know. I've used it on the NRF52840, M0's, M4's, and ESP32-S2 & S3. Beginners in particular will run into data corruption issues if those 2 features are not included. I learned the hard way, these features are necessary.
@FoamyGuy that's a great point and points out a flaw in the way I've been using it. Will take another shot at improving it. Thank you for the excellent guidance.
Moved SD Card initialization into take screenshot if statement. Works well. Tested the bitmapsaver_screenshot_simpletest.py & bitmapsaver_screenshot_tft_featherwing.py. example successfully
was unable to successfully test the bitmapsaver_simpletest.py example on my tft featherwing because sck in use. if a reviewer could test/confirm that works then push it. it just won't work by default on a 3.5" tft featherwing which is why we have a separate example for the tft featherwing. :) I'm not sure what hardware it's designed for so I don't want to mess with that one too much since I can't successfully test for it.
Help avoid data corruption by unmounting SD card after use