Commit 301e0b67 authored by Matthieu Cattin's avatar Matthieu Cattin

test22: Add temperature print on the screen every second.

parent 83620d71
......@@ -38,7 +38,7 @@ test13: Test FMC temperature stability
"""
TEMP_THRES = 50.0
TEMP_THRES = 45.0
TEMP_RIPPLE = 0.5
FIFO_SIZE = 20
MEAS_SLEEP = 1
......@@ -99,6 +99,36 @@ def acq_channels(fmc, carrier):
carrier.set_irq_en_mask(0x0)
return 0
def print_temp(temp):
# Standard in/out temporary redirection
tmp_stdout = sys.stdout;
sys.stdout = sys.__stdout__;
tmp_stdin = sys.stdin;
sys.stdin = sys.__stdin__;
# Print temperature at the same position on the screen
sys.stdout.write("FMC temperature: %3.3f°C \r" % temp)
sys.stdout.flush()
# Restore standard in/out
sys.stdout = tmp_stdout;
sys.stdin = tmp_stdin;
def newline():
# Standard in/out temporary redirection
tmp_stdout = sys.stdout;
sys.stdout = sys.__stdout__;
tmp_stdin = sys.stdin;
sys.stdin = sys.__stdin__;
# Print temperature at the same position on the screen
sys.stdout.write("\n")
sys.stdout.flush()
# Restore standard in/out
sys.stdout = tmp_stdout;
sys.stdin = tmp_stdin;
def main (default_directory='.'):
......@@ -196,6 +226,7 @@ def main (default_directory='.'):
while fmc_temp[-1] < TEMP_THRES:
fmc_temp.append(fmc.get_temp())
# print "FMC temperature: %3.3f°C" % fmc_temp[-1]
print_temp(fmc_temp[-1])
fmc_temp.pop(0)
acq_channels(fmc, carrier)
time.sleep(MEAS_SLEEP)
......@@ -206,12 +237,14 @@ def main (default_directory='.'):
fmc_temp_cnt = 0
while True:
fmc_temp.append(fmc.get_temp())
print_temp(fmc_temp[-1])
if fmc_temp_cnt >= FIFO_SIZE:
temp_diff = (max(fmc_temp) - min(fmc_temp))
fmc_temp.pop(0)
print "[%4d] fmc temp: %3.3f°C, temp diff: %3.3f°C"%(fmc_temp_cnt, fmc_temp[-1], temp_diff)
if temp_diff < TEMP_RIPPLE:
print "\nTemperature difference in the last %d measurements is less than %2.1f°C"%(FIFO_SIZE, TEMP_RIPPLE)
newline()
break
else:
print "%4d fmc temp:%3.3f°C"%(fmc_temp_cnt, fmc_temp[-1])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment