home
/
code
/
khatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b1c097d
)
Remove debug prints and add TODOs
author
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 19 Aug 2018 02:19:48 +0000
(22:19 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 19 Aug 2018 02:19:48 +0000
(22:19 -0400)
bin/khatus_monitor_energy
patch
|
blob
|
blame
|
history
diff --git
a/bin/khatus_monitor_energy
b/bin/khatus_monitor_energy
index
f0f9f85
..
24a4b74
100755
(executable)
--- a/
bin/khatus_monitor_energy
+++ b/
bin/khatus_monitor_energy
@@
-5,6
+5,7
@@
BEGIN {
OFS = msg_fs ? msg_fs : "|"
Kfs = key_fs ? key_fs : ":"
OFS = msg_fs ? msg_fs : "|"
Kfs = key_fs ? key_fs : ":"
+ # TODO: Read spec from a file
bat_alert_spec[100] = "low|Energy_Bellow_Full|Must have perfection!"
bat_alert_spec[50] = "low|Energy_Bellow_Half|Where is the charger?"
bat_alert_spec[20] = "med|Energy_Low|Get the charger."
bat_alert_spec[100] = "low|Energy_Bellow_Full|Must have perfection!"
bat_alert_spec[50] = "low|Energy_Bellow_Half|Where is the charger?"
bat_alert_spec[20] = "med|Energy_Low|Get the charger."
@@
-28,14
+29,13
@@
$2 == "khatus_sensor_energy" && \
$3 == "battery_state" {
battery_state_prev = battery_state_curr
battery_state_curr = $4
$3 == "battery_state" {
battery_state_prev = battery_state_curr
battery_state_curr = $4
- printf("BATTERY_STATE prev:%s curr:%s\n", battery_state_prev, battery_state_curr)
}
$1 == "OK" && \
$2 == "khatus_sensor_energy" && \
$3 == "battery_percentage" {
}
$1 == "OK" && \
$2 == "khatus_sensor_energy" && \
$3 == "battery_percentage" {
+ # TODO: Re-think the spec - can't rely on order of keys
battery_percentage = ensure_numeric($4)
battery_percentage = ensure_numeric($4)
- printf("BATTERY_PERCENTAGE %s\n", battery_percentage)
if (battery_state_curr == "discharging") {
for (threshold in bat_alert_spec) {
threshold = ensure_numeric(threshold)
if (battery_state_curr == "discharging") {
for (threshold in bat_alert_spec) {
threshold = ensure_numeric(threshold)
This page took
0.027641 seconds
and
4
git commands to generate.