X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=bin%2Fkhatus_bar;h=d62f5d50573def1adbcae6c1d0c1814e5cb516ba;hb=9c10bd399c93b58d5b7f8d5eda380b27cdb6e81b;hp=0db3e0b7398862419748c76cc558a5a64bea27ec;hpb=b1e3fbd91cbfeea163285acd781d18c4b8af4595;p=khatus.git diff --git a/bin/khatus_bar b/bin/khatus_bar index 0db3e0b..d62f5d5 100755 --- a/bin/khatus_bar +++ b/bin/khatus_bar @@ -47,11 +47,12 @@ function Data_update( src, key, val, len_line, len_head, len_val, time) { } } -function Data_get(src, key, age_max, time, age, is_expired) { +function Data_get(src, key, ttl, time, age, is_expired) { time = Data_get_time() A_time[src, key] = time age = time - M_time[src, key] - is_expired = age_max && age > age_max + # ttl = 0 => forever + is_expired = ttl && age > ttl return is_expired ? "" : Data[src, key] } @@ -114,8 +115,8 @@ function make_status_bar( position, bar, sep, i, j) { } function make_status_energy( state, charge, direction_of_change) { - state = Data_get("khatus_sensor_energy", "battery_state") - charge = Data_get("khatus_sensor_energy", "battery_percentage") + state = Data_get("khatus_sensor_energy", "battery_state" , 0) + charge = Data_get("khatus_sensor_energy", "battery_percentage", 0) if (state == "discharging") { direction_of_change = "<"