Check SD status before storing data

Hi All,

We use an SD card along with Ricks great library PublishQueueAsyncRK. We expect to be connected all the time, but this may change in the future and we do see periods of time where connection is lost due to signal. We have seen the SD card stop working after some amount of time in some cases, may be to do with resetting/safemodding/updating device while the SD card is in use. Essentially I am looking for a check before publishing to see if SD card is working and if it’s not change a bool so the system swaps back to publish instead of publishQueue. I was hoping to just check if publishQueue returns false, but this does not seem to be sufficient (see snippet below).

Also if anyone has any suggestions to block updates/resets/safemodes until its safe that would be great. Thanks.

if(!publishQueue.publish("SysReadings", s , PRIVATE , WITH_ACK)){
      sd_available = false;

That’s a missing feature of PublishQueueAsyncRK. The result codes from opening and writing the file are not checked and the publish function will always return true, even if those operations fail.


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.