[Tutorial] Kite's Circuit board RetroPie menu item for the battery indicator

Post Reply
User avatar
diko_d
Posts: 33
Joined: Mon May 08, 2017 5:18 pm
Has thanked: 27 times
Been thanked: 18 times

[Tutorial] Kite's Circuit board RetroPie menu item for the battery indicator

Post by diko_d » Fri Mar 15, 2019 11:28 am

In addition to the previous tutorial focusing on Kite's update script for his boards (viewtopic.php?f=51&t=7613), I am adding this tutorial for a menu item to turn ON/OFF the battery indicator. One major benefit with this menu item, it does not require a reboot of the device as indicated in Kite's wiki pages. This tutorial is also compatible with all the Circuit boards without the need to modify the script!
IMG_3638.jpeg
IMG_3638.jpeg (2.44 MiB) Viewed 3406 times
Here is a quick link to download a short video to see how it operates:
battery-indicator.mov
(4.98 MiB) Downloaded 316 times
You two options for installation:
- You can run the automated install using info in this repo: https://github.com/dikodahan/cs-hud-shortcuts. This will take care of everything listed below and you do not need to continue with this tutorial.
- You can follow the manual process listed here if you wish so.

You will need to SSH into your Circuit Gem/Sword to get this set up once. In my specific example, this is a Circuit Gem, but aside from some minor variations I will note below, the process is the same.
  1. First off, you will need to copy this image file here to your PC. Make sure it is saved as battery.png
    battery.png
    battery.png (101.18 KiB) Viewed 3420 times
  2. SSH to your Kite board.
  3. Go into the retromenu directory. Any sh file in this directory will automatically show up in RetroPie configuration menu.

    Code: Select all

    cd RetroPie/retropiemenu/
  4. Create a new shell script file to launch the script.

    Code: Select all

    nano battery.sh
  5. Paste the following lines in the file.

    Code: Select all

    #! /bin/sh
    
    sudo systemctl stop cs-hud.service
    
    if [[ -d "${HOME}/Circuit-Gem" ]]; then
      if grep -q "ExecStart=/home/pi/Circuit-Gem/cs-hud/cs-hud -s" "/lib/systemd/system/cs-hud.service"; then
        sudo sed -i 's/ExecStart=\/home\/pi\/Circuit-Gem\/cs-hud\/cs-hud -s/ExecStart=\/home\/pi\/Circuit-Gem\/cs-hud\/cs-hud/g' /lib/systemd/system/cs-hud.service
      else
        sudo sed -i 's/ExecStart=\/home\/pi\/Circuit-Gem\/cs-hud\/cs-hud/ExecStart=\/home\/pi\/Circuit-Gem\/cs-hud\/cs-hud -s/g' /lib/systemd/system/cs-hud.service
      fi
    elif [[ -d "${HOME}/Circuit-Sword" ]]; then
      if grep -q "ExecStart=/home/pi/Circuit-Sword/cs-hud/cs-hud -s" "/lib/systemd/system/cs-hud.service"; then
        sudo sed -i 's/ExecStart=\/home\/pi\/Circuit-Sword\/cs-hud\/cs-hud -s/ExecStart=\/home\/pi\/Circuit-Sword\/cs-hud\/cs-hud/g' /lib/systemd/system/cs-hud.service
      else
        sudo sed -i 's/ExecStart=\/home\/pi\/Circuit-Sword\/cs-hud\/cs-hud/ExecStart=\/home\/pi\/Circuit-Sword\/cs-hud\/cs-hud -s/g' /lib/systemd/system/cs-hud.service
      fi
    elif [[ -d "${HOME}/Circuit-Sword-Lite" ]]; then
      if grep -q "ExecStart=/home/pi/Circuit-Sword-Lite/cs-hud/cs-hud -s" "/lib/systemd/system/cs-hud.service"; then
        sudo sed -i 's/ExecStart=\/home\/pi\/Circuit-Sword-Lite\/cs-hud\/cs-hud -s/ExecStart=\/home\/pi\/Circuit-Sword-Lite\/cs-hud\/cs-hud/g' /lib/systemd/system/cs-hud.service
      else
        sudo sed -i 's/ExecStart=\/home\/pi\/Circuit-Sword-Lite\/cs-hud\/cs-hud/ExecStart=\/home\/pi\/Circuit-Sword-Lite\/cs-hud\/cs-hud -s/g' /lib/systemd/system/cs-hud.service
      fi
    else
      echo "It seems like Kite's CS-HUD software is not installed on your device :("
      echo "Please follow Kite's guides and images to make sure it is installed: https://github.com/kiteretro"
      sleep 10s
    fi
    
    sudo systemctl daemon-reload
    sudo systemctl start cs-hud.service
  6. To save the file press Ctrl+x, Then y and then press Enter.
  7. Make the shell script executable:

    Code: Select all

    chmod +x battery.sh
  8. Now we need to update the RetroPie configuration menu to add this item properly.

    Code: Select all

    sudo nano /opt/retropie/configs/all/emulationstation/gamelists/retropie/gamelist.xml
  9. Scroll all the way down to the end of the file and just above the last line </gameList> add the following lines.

    Code: Select all

    <game>
    	<path>./battery.sh</path>
    	<name>Battery Indicator</name>
    	<desc>Turns ON and OFF the battery indicator in Kite's HUD software.</desc>
    	<image>./icons/battery.png</image>
    </game>
  10. To save the file press Ctrl+x, Then y and then press Enter.
  11. Close the SSH connection.
  12. Now you need to copy the battery.png file over to the following directory on your Circuit board: /home/pi/RetroPie/retropiemenu/icons
    I will not cover how to copy a file over to RetroPie from a PC or a Mac in this tutorial. You can easily google this part.
  13. From your HUD software perform a proper shutdown and turn your hand-held back on. You now have the battery indicator toggle easily accessible from RetroPie menu!!!
Last edited by diko_d on Mon Apr 08, 2019 8:39 am, edited 1 time in total.

pbutters
Posts: 5
Joined: Tue Mar 05, 2019 5:00 pm
Has thanked: 1 time

Re: [Tutorial] Kite's Circuit board RetroPie menu item for the battery indicator

Post by pbutters » Wed Apr 03, 2019 1:03 pm

Very cool idea and great tutorial to getting it working.

Idea/suggestion: Would it be possible to integrate this feature into the "mode" button found on the circuit sword? I have the circuit sword lite and being able to quickly turn off/on wifi and the virtual keyboard I find to be a super neat feature. Adding this battery display toggle would make a great addition.

User avatar
kite
Posts: 972
Joined: Thu May 12, 2016 4:30 am
Location: UK
Has thanked: 246 times
Been thanked: 361 times
Contact:

Post by kite » Thu Apr 04, 2019 4:28 am

pbutters wrote:
Wed Apr 03, 2019 1:03 pm
Very cool idea and great tutorial to getting it working.

Idea/suggestion: Would it be possible to integrate this feature into the "mode" button found on the circuit sword? I have the circuit sword lite and being able to quickly turn off/on wifi and the virtual keyboard I find to be a super neat feature. Adding this battery display toggle would make a great addition.
Add a request here: https://github.com/kiteretro/Circuit-Sword-Lite/issues
Stock clearance - CLOSED: viewtopic.php?f=38&t=12064
Kite's Mailing List: https://goo.gl/forms/e97uUvPOfUxPWdz82
Kite's FAQ: https://kiteretro.com/faq/


ImageImageImageImageImage

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest