I can't really say I understand your logic in displaying battery condition after the device is turned off, but no big deal.
You need to test the battery condition under load...I.e., when you have the LEDs illuminated or when you're running the transmitter. After the load is removed, the battery voltage will rise, leading to erroneous results.
What I would do is set up a flag, a Boolean variable called BatteryDead. Check the state of battery each time through the program loop, just as I did in the code I posted. If the HVLD indicates the battery is low, set BatteryDead to true. Then, at whatever time you want to illuminate the low battery LED, test if BatteryDead is true.
Set BatteryDead to false only when the program initializers (I.e., before the main program loop) so that any low measurement results in a low indication.
You need to test the battery condition under load...I.e., when you have the LEDs illuminated or when you're running the transmitter. After the load is removed, the battery voltage will rise, leading to erroneous results.
What I would do is set up a flag, a Boolean variable called BatteryDead. Check the state of battery each time through the program loop, just as I did in the code I posted. If the HVLD indicates the battery is low, set BatteryDead to true. Then, at whatever time you want to illuminate the low battery LED, test if BatteryDead is true.
Set BatteryDead to false only when the program initializers (I.e., before the main program loop) so that any low measurement results in a low indication.