rework
parent
b1e9306221
commit
5a5706fcda
|
|
@ -41,8 +41,10 @@ function isBatteryAvailable() {
|
|||
local flags=$(i2cget -f -y 0 0x34 0x01)
|
||||
if (((( $flags&0x20 ) >>5 ) == $TRUE )); then
|
||||
echo "1"
|
||||
return 1
|
||||
else
|
||||
echo "0"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +67,7 @@ function getChargeCurrent() {
|
|||
# shuts the system down if too less voltage
|
||||
function verifyBatteryVoltage() {
|
||||
echo "$(isBatteryAvailable)"
|
||||
if [ "$?" -eq "1" ] ; then
|
||||
if [ "$(isBatteryAvailable)" -eq "1" ] ; then
|
||||
local voltage=$(getBatteryVoltage)
|
||||
local chargeCurrent=$(getChargeCurrent)
|
||||
echo "Voltage: $voltage"
|
||||
|
|
@ -108,9 +110,9 @@ function main() {
|
|||
# setupGpioInputButton
|
||||
echo "hello"
|
||||
while true ; do
|
||||
# setLed 1
|
||||
setLed 1
|
||||
verifyBatteryVoltage
|
||||
# setLed 0
|
||||
setLed 0
|
||||
sleep 3
|
||||
done
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue