Browse Source

Mbps for human

rorist 9 months ago
parent
commit
64fec8f7aa
3 changed files with 5 additions and 4 deletions
  1. 2 2
      node.lua
  2. 1 0
      requirements.txt
  3. 2 2
      screend.py

+ 2 - 2
node.lua

@@ -89,8 +89,8 @@ function node.render()
     fix:draw()
     scroll:draw()
 
-    font:write(900, 40, "DL: " .. network_in .. " Mbps", 80, 1,1,1,1)
-    font:write(900, 110, "UP: " .. network_out .. " Mbps" , 80, 1,1,1,1)
+    font:write(900, 40, "DL: " .. network_in, 80, 1,1,1,1)
+    font:write(900, 110, "UP: " .. network_out, 80, 1,1,1,1)
     font:write(900, 180, "Power: " .. power .. " W", 80, 1,1,1,1)
 
     pos = 360

+ 1 - 0
requirements.txt

@@ -1,3 +1,4 @@
 requests
 icalendar
 arrow
+humanize

+ 2 - 2
screend.py

@@ -108,8 +108,8 @@ def snmp():
 
         # print("input=%d, output=%d" % (input, output))
 
-        in_mbps = round(8 * (input - previous_input) / (INTERVAL * 1024 * 1024), 1)
-        out_mbps = round(8 * (output - previous_output) / (INTERVAL * 1024 * 1024), 1)
+        in_mbps  = humanize.naturalsize(round(8 * (input - previous_input) / INTERVAL, 1))
+        out_mbps = humanize.naturalsize(round(8 * (output - previous_output) / INTERVAL, 1))
 
         if previous_input:
             send_data('screen/network/in/set', str(in_mbps))