Guest User

Untitled

a guest
Jan 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. local sizeX, sizeY = term.getSize()
  2. os.unloadAPI("sensorsUI")
  3. os.loadAPI("/rom/apis/sensorsUI")
  4. os.unloadAPI("sensors")
  5. os.loadAPI("/rom/apis/sensors")
  6. os.unloadAPI("sensorsData")
  7. os.loadAPI("/rom/apis/sensorsData")
  8.  
  9. local arg = {...};
  10.  
  11.  
  12.  
  13. --[[
  14. Dashboard Parameters
  15. ]]--
  16. -- sensor name
  17. local sensor= "Blake";
  18. -- dashboard title
  19. local title="WHEEE";
  20.  
  21. -- refresh timer
  22. local refresh=2
  23. -- probe name
  24. --local probe="EUStorage";
  25.  
  26.  
  27. local side = sensors.getController()
  28. local monside="none",mon ; --= sensorsUI.getMonitor();
  29. local targets = sensors.getAvailableTargetsforProbe(side,sensor,"Reactor");
  30. local target = targets[1]
  31. local targets_mfsu = sensors.getAvailableTargetsforProbe(side,sensor,"EUStorage");
  32. --[[
  33. if #targets_mfsu>0 then
  34. sensorsUI.printPaged ("[Probe:"..p.. "] [Available Targets:"..#targets_mfsu.."]");
  35. for i,v in ipairs(targets_mfsu) do
  36. sensorsUI.printPaged (" "..v)
  37. end
  38. end
  39. ]]--
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. -- main program
  48.  
  49. if monside~="none" then
  50. sensorsUI.writeAt(1,sizeY,"Press Spacebar to exit")
  51. mon.setTextScale(1);
  52. term.redirect(mon);
  53. end
  54.  
  55. local done=false;
  56. local eus =sensorsData.getProbe("ic2","eustorage");
  57. --for i,v in pairs(content) do
  58. -- print(v)
  59. --end
  60.  
  61.  
  62. local mfsu={};
  63.  
  64. for ind,tg in ipairs(targets_mfsu) do
  65. mfsu[ind] = sensors.getSensorReadingAsDict(side,sensor,targets_mfsu[ind],"EUStorage")
  66. end
  67. --local mfsu1 = sensors.getSensorReadingAsDict(side,sensor,targets_mfsu[1],"EUStorage")
  68.  
  69.  
  70.  
  71. local timer1=os.startTimer(refresh)
  72. local count=1;
  73. local progress={"-","\\","|","/"};
  74. term.clear()
  75. sensorsUI.writeAt(1,1,title)
  76. if monside=="none" then
  77. sensorsUI.writeAt(1,sizeY,"Press Spacebar to exit")
  78. end
  79. local rate1=0;
  80. local rate2=0;
  81.  
  82.  
  83. while not done do
  84. sensorsUI.hr(2)
  85.  
  86. sensorsUI.writeAt(1,14,"EU Storage")
  87. for ind,tg in ipairs(targets_mfsu) do
  88. sensorsUI.hBar(1,14+ind,10,"MFSU-"..ind,mfsu[ind][eus.storage.val],mfsu[ind][eus.storage.maxval]);
  89. end
  90.  
  91.  
  92. evt,k = os.pullEvent()
  93.  
  94. sensorsUI.writeAt(string.len(title)+2,1,progress[count])
  95. count = count+1;
  96. if count>3 then count=1 end
  97.  
  98. end
  99. term.restore();
  100. term.setCursorPos(1,sizeY)
Add Comment
Please, Sign In to add comment