- changed time step to one sec in config
- added sleep for simulations to accurately reflect a real run
This commit is contained in:
parent
e2ae5eac65
commit
3cc7c4a11b
@ -52,7 +52,7 @@ gpio_sensor_data = 17
|
||||
spi_sensor_chip_id = 0
|
||||
|
||||
### amount of time, in seconds, to wait between reads of the thermocouple
|
||||
sensor_time_wait = .5
|
||||
sensor_time_wait = 1
|
||||
|
||||
|
||||
########################################################################
|
||||
|
||||
@ -74,13 +74,13 @@ def handle_control():
|
||||
ovenWatcher.record(profile)
|
||||
elif msgdict.get("cmd") == "SIMULATE":
|
||||
log.info("SIMULATE command received")
|
||||
profile_obj = msgdict.get('profile')
|
||||
if profile_obj:
|
||||
profile_json = json.dumps(profile_obj)
|
||||
profile = Profile(profile_json)
|
||||
simulated_oven = Oven(simulate=True, time_step=0.05)
|
||||
simulation_watcher = OvenWatcher(simulated_oven)
|
||||
simulation_watcher.add_observer(wsock)
|
||||
#profile_obj = msgdict.get('profile')
|
||||
#if profile_obj:
|
||||
# profile_json = json.dumps(profile_obj)
|
||||
# profile = Profile(profile_json)
|
||||
#simulated_oven = Oven(simulate=True, time_step=0.05)
|
||||
#simulation_watcher = OvenWatcher(simulated_oven)
|
||||
#simulation_watcher.add_observer(wsock)
|
||||
#simulated_oven.run_profile(profile)
|
||||
#simulation_watcher.record(profile)
|
||||
elif msgdict.get("cmd") == "STOP":
|
||||
|
||||
@ -64,7 +64,9 @@ class Oven (threading.Thread):
|
||||
self.time_step = time_step
|
||||
self.reset()
|
||||
if simulate:
|
||||
self.temp_sensor = TempSensorSimulate(self, 0.5, self.time_step)
|
||||
self.temp_sensor = TempSensorSimulate(self,
|
||||
self.time_step,
|
||||
self.time_step)
|
||||
if sensor_available:
|
||||
self.temp_sensor = TempSensorReal(self.time_step)
|
||||
else:
|
||||
@ -161,7 +163,10 @@ class Oven (threading.Thread):
|
||||
else:
|
||||
GPIO.output(config.gpio_heat, GPIO.HIGH)
|
||||
time.sleep(self.time_step * value)
|
||||
GPIO.output(config.gpio_heat, GPIO.LOW)
|
||||
GPIO.output(config.gpio_heat, GPIO.LOW)
|
||||
else:
|
||||
#for runs that are simulations
|
||||
time.sleep(self.time_step * value)
|
||||
else:
|
||||
self.heat = 0.0
|
||||
if gpio_available:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user