X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/6ea6c53480d7812ce5c3c44f89e6c079aa200b8a..3cde6e4128c98b6b9c35f52fff560e4f20e2d4d8:/bin/weather-lcd diff --git a/bin/weather-lcd b/bin/weather-lcd index 779bc49..17436ef 100755 --- a/bin/weather-lcd +++ b/bin/weather-lcd @@ -160,9 +160,6 @@ function setup_pages(conn) for k = 3,height-1 do write_command(conn,"widget_add "..pageid.." "..pageid..".place"..trim(tostring(k)).." string") end - for k=1,width do - write_command(conn,"widget_add "..pageid.." "..pageid..".bar"..trim(tostring(k)).." vbar") - end write_command(conn,"widget_set "..pageid.." "..pageid..".title \"".. pagetitle.."\"") end end @@ -201,7 +198,7 @@ function process_graphs() local minval = 99999999 for k=width,1,-1 do if row then - val = row["val"] + val = row["val"] * def["scale"] row = cur:fetch ({}, "a") else val = nil @@ -217,10 +214,13 @@ function process_graphs() local len = math.max(string.len(minvalstr),string.len(maxvalstr)) write_command(conn,"widget_set "..pageid.." "..pageid..".max "..trim(tostring(width-string.len(maxvalstr)+1)).." 2 "..maxvalstr) for k = 3,height-1 do - write_command(conn,"widget_set "..pageid.." "..pageid..".place"..trim(tostring(k)).." "..trim(tostring(width-len+1)).." "..k.." \""..string.rep("-",len).."\"") + write_command(conn,"widget_set "..pageid.." "..pageid..".place"..trim(tostring(k)).." "..trim(tostring(width-len+1)).." "..k.." \" "..string.rep("-",len-1).."\"") end write_command(conn,"widget_set "..pageid.." "..pageid..".min "..trim(tostring(width-string.len(minvalstr)+1)).." "..height.." "..minvalstr) local m = width + for k=1,width do + write_command(conn,"widget_del "..pageid.." "..pageid..".bar"..trim(tostring(k))) + end for k = width-len,1,-1 do val = vals[m] if val then @@ -228,12 +228,10 @@ function process_graphs() else h = 0 end + write_command(conn,"widget_add "..pageid.." "..pageid..".bar"..trim(tostring(k)).." vbar") write_command(conn,"widget_set "..pageid.." "..pageid..".bar"..trim(tostring(k)).." "..k.." "..height.." "..h) m = m - 1 end - for k= m,1,-1 do - write_command(conn,"widget_set "..pageid.." "..pageid..".bar"..trim(tostring(k)).." 0 0 0") - end end end end