kizniche / ttgo-tbeam-ttn-tracker

TTGO T-Beam Tracker for TTN Mapper and TTN Tracker using US (915 MHz) and EU (868 MHz) frequencies
https://kylegabriel.com/projects/2019/04/lorawan-tracker-and-mapper.html
GNU General Public License v3.0
262 stars 139 forks source link

No more booting when battery dies or is removed #57

Open NoFloXx opened 10 months ago

NoFloXx commented 10 months ago

As soon as you remove the battery and put it back in, the TBeam no longer boots. The same also happens if the battery is empty and you don't charge it during operation. You then have to flash the entire TBeam again, since it no longer boots. Then it runs perfectly again.

Bobkatze commented 10 months ago

I cant seem to make it run again no matter what I try. I tried disconnecting the battery, reflashing, erasing the flash and reflashing, both with and without battery. I still get this error: [ 5532][E][Preferences.cpp:50] begin(): nvs_open failed: NOT_FOUND

I have managed to track it down to this function causing the error, But I dont know if its the actual cause for being stuck. The code responsible is located in ttn.ino at line 228. (line might differ since I added a few debug messages to narrow down the error) // If the value for LORA packet counts is unknown, restore from flash static void initCount() { if(count == 0) { Preferences p; if(p.begin("lora", true)) { count = p.getUInt("count", 0); p.end(); } } }

Help would be appreciated.