- refactored

git-svn-id: http://moon:8086/svn/projects/HendiControl@380 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2020-04-20 15:50:25 +00:00
parent ec85ab3c73
commit 16b77f0a17
9 changed files with 38 additions and 25 deletions
+8 -4
View File
@@ -5,9 +5,10 @@ import numpy as np
from matplotlib.pyplot import figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show, subplot
import signal
import threading
import logging
#from tempSensorSim import TempSensorSim
from max31865 import Max31865
from tempSensorSim import TempSensorSim as TempSensor
#from tempSensor_max31865 import TempSensor_max31865 as TempSensor
class TempLogger():
def __init__(self, sensor, filename="temp.log"):
@@ -81,11 +82,14 @@ if __name__ == '__main__':
if signum == signal.SIGHUP:
tempPlot(logger.result())
logging.getLogger().setLevel(logging.INFO)
FORMAT = '%(asctime)-15s %(user)-8s %(message)s'
logging.basicConfig(format=FORMAT)
signal.signal(signal.SIGINT, handler)
signal.signal(signal.SIGHUP, handler)
sensor = Max31865()
# sensor = TempSensorSim("FakeTemp")
sensor = TempSensor()
logger = TempLogger(sensor)
logger.start(1.0, 30*60)
logger.wait()