Cause of potential brownout and loss of logs?

Recently I had a flight where all logs were lost after about 1000s of log time. I’ve done some investigating and I am currently trying to reproduce the issue. I am running a modified version of Plane V4.1.0 on a Pixhawk1 board. The modified branch can be found here:

Based on the documentation here, I believe the issue was a brownout. Reviewing the log shows a sudden drop in voltage just before the loss of logs:

voltage_current

Other things I noticed:

  1. Many log variables have a new column labeled “I” that is full of zeros. I am not sure if this is an issue I caused by modifying the code. It could be, as I added a new log variable that I now realize I didn’t need to add.

  2. There is no “ERR” message in the dataflash log

  3. The board voltage varies but generally looks ok, based on the ±0.15 Volts variation that is mentioned as normal in the doc.

board_voltage

I also have run into a similar issue with this same aircraft, where the entire dataflash log was corrupted. This was running stock firmware, but I am not sure what version. The date of this was 3/19/2021.

Lastly, it has a pretty cheap SD card in it (it came with the Pixhawk and is unbranded). I am going to replace this with a nicer one just to be safe. Could this have an effect on this issue?

The dataflash logs from this flight (00000013) and from the 3/19 flight (00000028) are in this google drive folder:

https://drive.google.com/drive/folders/1-67-NRFrZq3c5cRTg-tlJa04i-MZ18xA?usp=sharing

Thanks in advance for any help