display errors
This commit is contained in:
parent
31f352ed49
commit
b0307f2e07
@ -269,7 +269,6 @@ class Oven(threading.Thread):
|
||||
self.start_time = datetime.datetime.now() - datetime.timedelta(milliseconds = self.runtime * 1000)
|
||||
|
||||
def update_runtime(self):
|
||||
|
||||
runtime_delta = datetime.datetime.now() - self.start_time
|
||||
if runtime_delta.total_seconds() < 0:
|
||||
runtime_delta = datetime.timedelta(0)
|
||||
@ -578,6 +577,8 @@ class Profile():
|
||||
return (prev_point, next_point)
|
||||
|
||||
def get_target_temperature(self, time):
|
||||
#log.info("time = " + str(time))
|
||||
#log.info("duration = " + str(self.get_duration()))
|
||||
if time > self.get_duration():
|
||||
return 0
|
||||
|
||||
@ -620,12 +621,15 @@ class PID():
|
||||
output = 0
|
||||
out4logs = 0
|
||||
dErr = 0
|
||||
status = ''
|
||||
if error < (-1 * config.pid_control_window):
|
||||
status = "kiln outside pid control window, max cooling"
|
||||
log.info("kiln outside pid control window, max cooling")
|
||||
output = 0
|
||||
# it is possible to set self.iterm=0 here and also below
|
||||
# but I dont think its needed
|
||||
elif error > (1 * config.pid_control_window):
|
||||
status = "kiln outside pid control window, max heating"
|
||||
log.info("kiln outside pid control window, max heating")
|
||||
output = 1
|
||||
else:
|
||||
@ -659,6 +663,7 @@ class PID():
|
||||
'kd': self.kd,
|
||||
'pid': out4logs,
|
||||
'out': output,
|
||||
'status': status,
|
||||
}
|
||||
|
||||
return output
|
||||
|
||||
@ -106,16 +106,20 @@ class OvenDisplay(threading.Thread):
|
||||
displayhatmini.set_led(1.0, 0.0, 0.0)
|
||||
else:
|
||||
displayhatmini.set_led(0.0, 0.0, 1.0)
|
||||
message = ''
|
||||
if (oven_state['totaltime'] is not None and oven_state['runtime'] is not None):
|
||||
total_time = oven_state['totaltime']
|
||||
run_time = oven_state['runtime']
|
||||
time_left = total_time - run_time
|
||||
time_left_str = str(datetime.timedelta(seconds=round(time_left)))
|
||||
self.text('Remaining: ' + time_left_str, (10, 195), fnt25, (255, 255, 255))
|
||||
message = 'Remaining: ' + time_left_str;
|
||||
if (oven_state['pidstats'] is not None and oven_state['pidstats']['status'] is not None):
|
||||
message = 'ERROR: ' + oven_state['pidstats']['status']
|
||||
self.text(message, (10, 195), fnt25, (255, 255, 255))
|
||||
displayhatmini.display()
|
||||
|
||||
def send(self,oven_state_json):
|
||||
log.info(oven_state_json)
|
||||
#log.info(oven_state_json)
|
||||
oven_state = json.loads(oven_state_json)
|
||||
self.update_display(oven_state)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user