olsr.lua 631 B

123456789101112131415161718192021222324252627282930313233
  1. -- Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
  2. -- Licensed to the public under the Apache License 2.0.
  3. module("luci.tools.olsr", package.seeall)
  4. function etx_color(etx)
  5. local color = "#bb3333"
  6. if etx == 0 then
  7. color = "#bb3333"
  8. elseif etx < 2 then
  9. color = "#00cc00"
  10. elseif etx < 4 then
  11. color = "#ffcb05"
  12. elseif etx < 10 then
  13. color = "#ff6600"
  14. end
  15. return color
  16. end
  17. function snr_color(snr)
  18. local color = "#bb3333"
  19. if snr == 0 then
  20. color = "#bb3333"
  21. elseif snr > 30 then
  22. color = "#00cc00"
  23. elseif snr > 20 then
  24. color = "#ffcb05"
  25. elseif snr > 5 then
  26. color = "#ff6600"
  27. end
  28. return color
  29. end