-
-
Save TeaPackCZ/436fd02e919e5a140ed1fb5575f40dc1 to your computer and use it in GitHub Desktop.
Revisions
-
TeaPackCZ revised this gist
Apr 18, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,9 +22,9 @@ if [ "$BATT_PRESENT" = "1" ]; then echo -e "${PURPLE}Pine64${NORMAL} reports ${GREEN}battery detected!${NORMAL}" echo -e "${YELLOW}Status:${NORMAL}" $BATT_STATUS echo -e "${YELLOW}Voltage:${NORMAL}" $BATT_VOLTAGE" V" echo -e "${YELLOW}Current:${NORMAL}" $BATT_CURRENT" mA" echo -e "${YELLOW}Capacity:${NORMAL}" $BATT_CAPACITY" %" echo -e "${YELLOW}Health:${NORMAL}" $BATT_HEALTH else echo -e "${PURPLE}Pine64${NORMAL} reports ${RED}no battery connected!${NORMAL}" -
pfeerick created this gist
Aug 2, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/bin/bash SWITCH="\033[" NORMAL="${SWITCH}0m" RED="${SWITCH}1;31m" GREEN="${SWITCH}1;32m" YELLOW="${SWITCH}1;33m" PURPLE="${SWITCH}1;35m" BLUE="${SWITCH}1;34m" CYAN="${SWITCH}1;36m" BATT_PRESENT=$(</sys/class/power_supply/battery/present) if [ "$BATT_PRESENT" = "1" ]; then BATT_STATUS=$(</sys/class/power_supply/battery/status) BATT_VOLTAGE=$(</sys/class/power_supply/battery/voltage_now) BATT_VOLTAGE=$(echo " (($BATT_VOLTAGE/10000)*0.01 ) "|bc) BATT_CURRENT=$(</sys/class/power_supply/battery/current_now) ((BATT_CURRENT = BATT_CURRENT / 1000)) BATT_CAPACITY=$(</sys/class/power_supply/battery/capacity) BATT_HEALTH=$(</sys/class/power_supply/battery/health) echo -e "${PURPLE}Pine64${NORMAL} reports ${GREEN}battery detected!${NORMAL}" echo -e "${YELLOW}Status:${NORMAL}" $BATT_STATUS echo -e "${YELLOW}Voltage:${NORMAL}" $BATT_VOLTAGE"v" echo -e "${YELLOW}Current:${NORMAL}" $BATT_CURRENT"ma" echo -e "${YELLOW}Capacity:${NORMAL}" $BATT_CAPACITY"%" echo -e "${YELLOW}Health:${NORMAL}" $BATT_HEALTH else echo -e "${PURPLE}Pine64${NORMAL} reports ${RED}no battery connected!${NORMAL}" fi