-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Helios64 UPS. System shutdown when battery reach 7.0V. (#2599)
* Helios64 UPS. System shutdown when battery reach 7.0V.
- Loading branch information
Showing
4 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
#7.0V 916 Recommended threshold to force shutdown system | ||
TH=916 | ||
|
||
val=$(cat '/sys/bus/iio/devices/iio:device0/in_voltage2_raw') | ||
sca=$(cat '/sys/bus/iio/devices/iio:device0/in_voltage_scale') | ||
adc=$(echo "$val * $sca / 1" | bc) | ||
|
||
if [ "$adc" -le $TH ]; then | ||
/usr/sbin/poweroff | ||
fi |
This file contains 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 characters