BatMon - Battery Status on emulators for Clockwork OS v0.3

app
#1

Hi guys, sorry for the delay. I moved to another country and I was away for some time, but here it is, the new version of BatMon for those who have not seen my previous release BatMon is a Clockwork Pi app that creates an overlay with the battery percentage on top of emulators or games, because you can only see that information in the main menu, this is my attempt on solving that issue.

splash

What is new?

  • Now supports OS v0.3.
  • Now it only runs once and stays alive, previosly a script called and killed the process which was unefficient.
  • User can set a custom update interval from the caller script, previosly you had to recompile.
  • Can be toggled on and off from menu, previosly once you ran it it stayed until reboot.
  • Now includes a clock feature :smiley:
  • Easier to install.
  • Removed the pseudo transparency and replaced it with black background.

How to install?

You need to go to https://github.com/Mihaylov93/BatMon/releases and get the latest release. (currently its the 0.4)

You can download BatMon.tar.gz to your computer and copy it to your gameshell or download it from the gameshell.

Once you have BatMon.tar.gz on your gameshell, you need to execute the following commands:

sudo apt-get install libqtcore4
sudo apt-get install libqtgui4
tar -zxvf BatMon.tar.gz -C /home/cpi/apps/Menu/

Then you need to reload the launcher and it will appear there :slight_smile: thats all.

How to use?

There are 3 modes, battery only, battery and clock in horizontal layout and battery and clock in vertical layout. The default mode is battery only with 30 seconds interval, if you want to customize that you need to change the launcher script located in /home/cpi/apps/Menu/BatMon
image

The content of the script looks like this:

#!/bin/bash
APP_ID=$(ps -C BatMon --no-header --format 'pid')
if [ -n "${APP_ID}" ]; then
  echo "Stopping instance $APP_ID"
  kill "${APP_ID}"
else
# You can change the refresh time in seconds and/or the mode
./BatMon 30 &
fi
exit

The line you need to change is this: ./BatMon 30 &

Examples:

  • Default mode (Mode 0):
    default_mode

There are 4 ways that the app will enter in default mode:

  1. You call it without arguments, for example: ./BatMon &
  2. You call it with 1 argument setting up the refresh seconds, for exampe: ./BatMon 30 &
  3. You call it with 2 arguments, setting the seconds and the mode 0 (Default) ./BatMon 30 0 &
  4. You enter wrong arguments and the app entered default mode with 30 seconds. For example ./BatMon bla bla &
  • Battery and clock in horizontal (Mode 1):
    screen
    To enter this mode you need to set the second argument to 1, for example: ./BatMon 30 1 &

  • Battery and clock in vertical (Mode 2):
    screen2
    To enter this mode you need to set the second argument to 1, for example: ./BatMon 30 2 &

But I want to compile it myself!

Fair enough, if you want to compile it yourself clone the repository with git clone https://github.com/Mihaylov93/BatMon.git

This was made with Qt4, check your version of Qt with qmake --version if you have Qt5 is not guaranteed to work, plus you will get warnings because of the code differences.

Install qt4 with sudo apt-get install qt4-dev-tools if you have Qt5 in your system select Qt4 with export QT_SELECT=qt4 then for compiling it you need to do the following:

qmake BatmMon.pro
make

If make ran succesfully you don’t need to do anything else, BatMon will be installed in your launcher.

FAQ:

  • It never shows 100%, it shows 95-98% is my battery damaged?
    No, thats fine this program reads /sys/class/power_supply/axp20x-battery/uevent file and gets the percentage, if we take a look at:

POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4200000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=2900000

We see that the maximum by design is 4.2V, our battery is 3.7V so at full charge is normal to be for example POWER_SUPPLY_VOLTAGE_NOW=4186000 which wont give us a 100% in this formula: (voltage_now-voltage_min)/(voltage_max-voltage_min)) * 100 But it is fully charged and in a normal state.

Links:
Source code: https://github.com/Mihaylov93/BatMon
Releases: https://github.com/Mihaylov93/BatMon/releases

5 Likes
[APP] Battery status on emulators
Editable Icons Project - Fixing and expanding the default theme's icons