Add link count and handle screen resize in fake Lakeshores
This commit is contained in:
@@ -52,7 +52,7 @@ class MYDEV(MYBASE):
|
|||||||
print MYDEV.__name__, "ctor"
|
print MYDEV.__name__, "ctor"
|
||||||
|
|
||||||
def device_display():
|
def device_display():
|
||||||
global stdscr, myDev, myOpts, myPort
|
global screen, myDev, myOpts, myPort, myFactory
|
||||||
try:
|
try:
|
||||||
myDev.doIteration();
|
myDev.doIteration();
|
||||||
except:
|
except:
|
||||||
@@ -62,33 +62,45 @@ def device_display():
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
stdscr.addstr(0, 0, "Random :%8.3f" % myDev.RANDOM)
|
rows, cols = screen.stdscr.getmaxyx()
|
||||||
stdscr.addstr(0, 25, "Identity : %s (%d)" % (myDev.IDN, myPort))
|
screen.stdscr.addstr(0, 0, "Lnks:%2d" % myFactory.numProtocols)
|
||||||
stdscr.addstr(1, 0, "Sensor :")
|
screen.stdscr.addstr(0, 10, "Rnd:%6.3f" % myDev.RANDOM)
|
||||||
|
screen.stdscr.addstr(0, 22, "Identity : %s (%d)" % (myDev.IDN, myPort))
|
||||||
|
screen.stdscr.addstr(1, 0, "Sensor :")
|
||||||
for idx in myDev.CONFIG_SNSRS:
|
for idx in myDev.CONFIG_SNSRS:
|
||||||
stdscr.addstr(1, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[idx])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(2, 0, "PV :")
|
break
|
||||||
stdscr.addstr(3, 0, "Setpoint :")
|
screen.stdscr.addstr(1, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[idx])
|
||||||
stdscr.addstr(4, 0, "Diff :")
|
screen.stdscr.addstr(2, 0, "PV :")
|
||||||
|
screen.stdscr.addstr(3, 0, "Setpoint :")
|
||||||
|
screen.stdscr.addstr(4, 0, "Diff :")
|
||||||
for idx in myDev.CONFIG_LOOPS:
|
for idx in myDev.CONFIG_LOOPS:
|
||||||
stdscr.addstr(2, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[myDev.LOOPINPUT[idx]])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(3, 12 + (idx - 1) * 12, "%8.3f" % myDev.SETP[idx])
|
break
|
||||||
stdscr.addstr(4, 12 + (idx - 1) * 12, "%8.3f" % (myDev.KRDG[myDev.LOOPINPUT[idx]] - myDev.SETP[idx]))
|
screen.stdscr.addstr(2, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[myDev.LOOPINPUT[idx]])
|
||||||
stdscr.addstr(5, 0, "Target :")
|
screen.stdscr.addstr(3, 12 + (idx - 1) * 12, "%8.3f" % myDev.SETP[idx])
|
||||||
stdscr.addstr(6, 0, "Ramp Rate:")
|
screen.stdscr.addstr(4, 12 + (idx - 1) * 12, "%8.3f" % (myDev.KRDG[myDev.LOOPINPUT[idx]] - myDev.SETP[idx]))
|
||||||
stdscr.addstr(7, 0, "Ramp On :")
|
screen.stdscr.addstr(5, 0, "Target :")
|
||||||
stdscr.addstr(8, 0, "Ramping :")
|
screen.stdscr.addstr(6, 0, "Ramp Rate:")
|
||||||
|
screen.stdscr.addstr(7, 0, "Ramp On :")
|
||||||
|
screen.stdscr.addstr(8, 0, "Ramping :")
|
||||||
for idx in myDev.CONFIG_RAMPS:
|
for idx in myDev.CONFIG_RAMPS:
|
||||||
stdscr.addstr(5, 12 + (idx - 1) * 12, "%8.3f" % myDev.TARGET[idx])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(6, 12 + (idx - 1) * 12, "%8.3f" % myDev.RAMP_RATE[idx])
|
break
|
||||||
stdscr.addstr(7, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ON[idx]])
|
screen.stdscr.addstr(5, 12 + (idx - 1) * 12, "%8.3f" % myDev.TARGET[idx])
|
||||||
stdscr.addstr(8, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ST[idx]])
|
screen.stdscr.addstr(6, 12 + (idx - 1) * 12, "%8.3f" % myDev.RAMP_RATE[idx])
|
||||||
stdscr.refresh()
|
screen.stdscr.addstr(7, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ON[idx]])
|
||||||
|
screen.stdscr.addstr(8, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ST[idx]])
|
||||||
except:
|
except:
|
||||||
raise
|
pass
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
screen.stdscr.refresh()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
global stdscr, myDev, myOpts, myPort
|
global screen, myDev, myOpts, myPort, myFactory
|
||||||
|
|
||||||
myOpts = MyOptions()
|
myOpts = MyOptions()
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class MYDEV(MYBASE):
|
|||||||
print MYDEV.__name__, "ctor"
|
print MYDEV.__name__, "ctor"
|
||||||
|
|
||||||
def device_display():
|
def device_display():
|
||||||
global stdscr, myDev, myOpts, myPort
|
global screen, myDev, myOpts, myPort, myFactory
|
||||||
try:
|
try:
|
||||||
myDev.doIteration();
|
myDev.doIteration();
|
||||||
except:
|
except:
|
||||||
@@ -62,33 +62,45 @@ def device_display():
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
stdscr.addstr(0, 0, "Random :%8.3f" % myDev.RANDOM)
|
rows, cols = screen.stdscr.getmaxyx()
|
||||||
stdscr.addstr(0, 25, "Identity : %s (%d)" % (myDev.IDN, myPort))
|
screen.stdscr.addstr(0, 0, "Lnks:%2d" % myFactory.numProtocols)
|
||||||
stdscr.addstr(1, 0, "Sensor :")
|
screen.stdscr.addstr(0, 10, "Rnd:%6.3f" % myDev.RANDOM)
|
||||||
|
screen.stdscr.addstr(0, 22, "Identity : %s (%d)" % (myDev.IDN, myPort))
|
||||||
|
screen.stdscr.addstr(1, 0, "Sensor :")
|
||||||
for idx in myDev.CONFIG_SNSRS:
|
for idx in myDev.CONFIG_SNSRS:
|
||||||
stdscr.addstr(1, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[idx])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(2, 0, "PV :")
|
break
|
||||||
stdscr.addstr(3, 0, "Setpoint :")
|
screen.stdscr.addstr(1, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[idx])
|
||||||
stdscr.addstr(4, 0, "Diff :")
|
screen.stdscr.addstr(2, 0, "PV :")
|
||||||
|
screen.stdscr.addstr(3, 0, "Setpoint :")
|
||||||
|
screen.stdscr.addstr(4, 0, "Diff :")
|
||||||
for idx in myDev.CONFIG_LOOPS:
|
for idx in myDev.CONFIG_LOOPS:
|
||||||
stdscr.addstr(2, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[myDev.LOOPINPUT[idx]])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(3, 12 + (idx - 1) * 12, "%8.3f" % myDev.SETP[idx])
|
break
|
||||||
stdscr.addstr(4, 12 + (idx - 1) * 12, "%8.3f" % (myDev.KRDG[myDev.LOOPINPUT[idx]] - myDev.SETP[idx]))
|
screen.stdscr.addstr(2, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[myDev.LOOPINPUT[idx]])
|
||||||
stdscr.addstr(5, 0, "Target :")
|
screen.stdscr.addstr(3, 12 + (idx - 1) * 12, "%8.3f" % myDev.SETP[idx])
|
||||||
stdscr.addstr(6, 0, "Ramp Rate:")
|
screen.stdscr.addstr(4, 12 + (idx - 1) * 12, "%8.3f" % (myDev.KRDG[myDev.LOOPINPUT[idx]] - myDev.SETP[idx]))
|
||||||
stdscr.addstr(7, 0, "Ramp On :")
|
screen.stdscr.addstr(5, 0, "Target :")
|
||||||
stdscr.addstr(8, 0, "Ramping :")
|
screen.stdscr.addstr(6, 0, "Ramp Rate:")
|
||||||
|
screen.stdscr.addstr(7, 0, "Ramp On :")
|
||||||
|
screen.stdscr.addstr(8, 0, "Ramping :")
|
||||||
for idx in myDev.CONFIG_RAMPS:
|
for idx in myDev.CONFIG_RAMPS:
|
||||||
stdscr.addstr(5, 12 + (idx - 1) * 12, "%8.3f" % myDev.TARGET[idx])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(6, 12 + (idx - 1) * 12, "%8.3f" % myDev.RAMP_RATE[idx])
|
break
|
||||||
stdscr.addstr(7, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ON[idx]])
|
screen.stdscr.addstr(5, 12 + (idx - 1) * 12, "%8.3f" % myDev.TARGET[idx])
|
||||||
stdscr.addstr(8, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ST[idx]])
|
screen.stdscr.addstr(6, 12 + (idx - 1) * 12, "%8.3f" % myDev.RAMP_RATE[idx])
|
||||||
stdscr.refresh()
|
screen.stdscr.addstr(7, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ON[idx]])
|
||||||
|
screen.stdscr.addstr(8, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ST[idx]])
|
||||||
except:
|
except:
|
||||||
raise
|
pass
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
screen.stdscr.refresh()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
global stdscr, myDev, myOpts, myPort
|
global screen, myDev, myOpts, myPort, myFactory
|
||||||
|
|
||||||
myOpts = MyOptions()
|
myOpts = MyOptions()
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class MYDEV(MYBASE):
|
|||||||
print MYDEV.__name__, "ctor"
|
print MYDEV.__name__, "ctor"
|
||||||
|
|
||||||
def device_display():
|
def device_display():
|
||||||
global stdscr, myDev, myOpts, myPort
|
global screen, myDev, myOpts, myPort, myFactory
|
||||||
try:
|
try:
|
||||||
myDev.doIteration();
|
myDev.doIteration();
|
||||||
except:
|
except:
|
||||||
@@ -62,35 +62,45 @@ def device_display():
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
stdscr.addstr(0, 0, "Random :%8.3f" % myDev.RANDOM)
|
rows, cols = screen.stdscr.getmaxyx()
|
||||||
stdscr.addstr(0, 25, "Identity : %s (%d)" % (myDev.IDN, myPort))
|
screen.stdscr.addstr(0, 0, "Lnks:%2d" % myFactory.numProtocols)
|
||||||
stdscr.addstr(1, 0, "Sensor :")
|
screen.stdscr.addstr(0, 10, "Rnd:%6.3f" % myDev.RANDOM)
|
||||||
|
screen.stdscr.addstr(0, 22, "Identity : %s (%d)" % (myDev.IDN, myPort))
|
||||||
|
screen.stdscr.addstr(1, 0, "Sensor :")
|
||||||
for idx in myDev.CONFIG_SNSRS:
|
for idx in myDev.CONFIG_SNSRS:
|
||||||
if idx > 4:
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
continue
|
break
|
||||||
stdscr.addstr(1, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[idx])
|
screen.stdscr.addstr(1, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[idx])
|
||||||
stdscr.addstr(2, 0, "PV :")
|
screen.stdscr.addstr(2, 0, "PV :")
|
||||||
stdscr.addstr(3, 0, "Setpoint :")
|
screen.stdscr.addstr(3, 0, "Setpoint :")
|
||||||
stdscr.addstr(4, 0, "Diff :")
|
screen.stdscr.addstr(4, 0, "Diff :")
|
||||||
for idx in myDev.CONFIG_LOOPS:
|
for idx in myDev.CONFIG_LOOPS:
|
||||||
stdscr.addstr(2, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[myDev.LOOPINPUT[idx]])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(3, 12 + (idx - 1) * 12, "%8.3f" % myDev.SETP[idx])
|
break
|
||||||
stdscr.addstr(4, 12 + (idx - 1) * 12, "%8.3f" % (myDev.KRDG[myDev.LOOPINPUT[idx]] - myDev.SETP[idx]))
|
screen.stdscr.addstr(2, 12 + (idx - 1) * 12, "%8.3f" % myDev.KRDG[myDev.LOOPINPUT[idx]])
|
||||||
stdscr.addstr(5, 0, "Target :")
|
screen.stdscr.addstr(3, 12 + (idx - 1) * 12, "%8.3f" % myDev.SETP[idx])
|
||||||
stdscr.addstr(6, 0, "Ramp Rate:")
|
screen.stdscr.addstr(4, 12 + (idx - 1) * 12, "%8.3f" % (myDev.KRDG[myDev.LOOPINPUT[idx]] - myDev.SETP[idx]))
|
||||||
stdscr.addstr(7, 0, "Ramp On :")
|
screen.stdscr.addstr(5, 0, "Target :")
|
||||||
stdscr.addstr(8, 0, "Ramping :")
|
screen.stdscr.addstr(6, 0, "Ramp Rate:")
|
||||||
|
screen.stdscr.addstr(7, 0, "Ramp On :")
|
||||||
|
screen.stdscr.addstr(8, 0, "Ramping :")
|
||||||
for idx in myDev.CONFIG_RAMPS:
|
for idx in myDev.CONFIG_RAMPS:
|
||||||
stdscr.addstr(5, 12 + (idx - 1) * 12, "%8.3f" % myDev.TARGET[idx])
|
if 12 + (idx - 1) * 12 > cols - 1:
|
||||||
stdscr.addstr(6, 12 + (idx - 1) * 12, "%8.3f" % myDev.RAMP_RATE[idx])
|
break
|
||||||
stdscr.addstr(7, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ON[idx]])
|
screen.stdscr.addstr(5, 12 + (idx - 1) * 12, "%8.3f" % myDev.TARGET[idx])
|
||||||
stdscr.addstr(8, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ST[idx]])
|
screen.stdscr.addstr(6, 12 + (idx - 1) * 12, "%8.3f" % myDev.RAMP_RATE[idx])
|
||||||
stdscr.refresh()
|
screen.stdscr.addstr(7, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ON[idx]])
|
||||||
|
screen.stdscr.addstr(8, 12 + (idx - 1) * 12, "%8s" % ["No", "Yes"][myDev.RAMP_ST[idx]])
|
||||||
except:
|
except:
|
||||||
raise
|
pass
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
screen.stdscr.refresh()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
global stdscr, myDev, myOpts, myPort
|
global screen, myDev, myOpts, myPort, myFactory
|
||||||
|
|
||||||
myOpts = MyOptions()
|
myOpts = MyOptions()
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user