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