This is a step-through which writes the actual state of the battery level and the acutal date and time to a specified file on the sdcard.

1. Make up a new profile, context: Power: Battery changed, priority normal -> done.
3. Add task Alert: Flash: Text "%BATT % %MEMF", If checked "%BATT !~ %BATTPREV" -> done
4. Add task File: Write File: File "Batterlog.txt", Text "%DATE %TIME %BATT", Append checked, If checked "%BATT !~ %BATTPREV" -> done
5. Add task Variable: Variable Set: Name "%BATTPREV", To: "%BATT"

What it does
On any battery change (this *does* include change of the voltage - so not solely the battery level) the battery level %BATT is compared to the user variable %BATTPREV (which on the first run does not exist) and if they do not match both the actual Battery Level and Free Memory are flashed and the date, time and battery level are written to the file "Batterylog.txt" in the sdcard's root. At last, %BATTPREV is stored so that we can compare it to %BATT the next time anything changes.

For information:

  • If %BATTPREV would not be used, there would be dozens of entries in the log file with the same battery level (as any change in battery states is recognized - also the voltage).
  • If the file Batterylog.txt does not exist, it will be created automatically
  • If a user variable is not yet set, but some comparison is done on it, !~ will always yield true.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License