ref: 964f71e5a6bac78cf5f9eccef3d7cd78c80595cd
parent: 97d4770b49d386a1cd9493f95d880d16d5c5ad55
author: qwx <qwx@sciops.net>
date: Fri Aug 19 00:16:17 EDT 2022
nopedog: readjust power drain assumptions and realign flux phase arrays
--- a/bin/nopedog
+++ b/bin/nopedog
@@ -5,16 +5,24 @@
mount '#s'/acpi /mnt/pm || exit
if(! test -f /mnt/pm/battery)
exit no battery to hand
-awk '
-{
- if($1 > bat)
- bat = $1
+awk -v 'sys='^$sysname '
+NR == 1{ bat = $1; chg = $12 ~ /charging/ }
+NR > 1 { bat0 = bat; bat = $1; chg = chg || $12 ~ /charging/ }
}END{
- if(bat == 0)
+ if(bat == 0 || chg)
exit
- if(bat < 5)
+ if(sys ~ /x250/){ # internal battery is scratched as fuck
+ bat = bat0
+ low = 50
+ crit = 30
+ }else{
+ bat = bat0 > bat ? bat0 : bat;
+ low = 10
+ crit = 5
+ }
+ if(bat < crit)
system("fshalt")
- else if(bat < 10)
+ else if(bat < low)
system("window -dx 120 -dy 200 -minx 0 -miny 0 \''label alert; echo FAILURE IS IMMINENT; play /lib/m/mamb/pripyat.evacuation.audio.opus; rc\''")
}
' /mnt/pm/battery