work out bugs
parent
a44447d9e4
commit
d6ec9ee7e9
|
|
@ -61,7 +61,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 [ "$(isBatteryAvailable)" -eq "1" ] ; then
|
if [ "$?" -eq "1" ] ; then
|
||||||
local voltage=$(getBatteryVoltage)
|
local voltage=$(getBatteryVoltage)
|
||||||
local chargeCurrent=$(getChargeCurrent)
|
local chargeCurrent=$(getChargeCurrent)
|
||||||
echo "Voltage: $voltage"
|
echo "Voltage: $voltage"
|
||||||
|
|
@ -88,9 +88,6 @@ function setLed() {
|
||||||
# @return ... true if button pressed else false as return value
|
# @return ... true if button pressed else false as return value
|
||||||
function isButtonPressed() {
|
function isButtonPressed() {
|
||||||
local value=$(cat ${POWER_BUTTON_GPIO}/value)
|
local value=$(cat ${POWER_BUTTON_GPIO}/value)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$value" -eq "0" ] ; then
|
if [ "$value" -eq "0" ] ; then
|
||||||
shutdownCommand "shutdown on button pressed"
|
shutdownCommand "shutdown on button pressed"
|
||||||
fi
|
fi
|
||||||
|
|
@ -104,16 +101,16 @@ function verifyButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
setupGpioInputButton
|
# setupGpioInputButton
|
||||||
|
echo "hello"
|
||||||
while true ; do
|
while true ; do
|
||||||
setLed 1
|
# setLed 1
|
||||||
verifyBatteryVoltage
|
verifyBatteryVoltage
|
||||||
setLed 0
|
# setLed 0
|
||||||
sleep 3
|
sleep 3
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# start monitoring in subshell and nonblocking
|
# start monitoring in subshell and nonblocking
|
||||||
$(main)
|
main
|
||||||
#exit 0
|
#exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue