diff --git a/kiln-controller.py b/kiln-controller.py
index cf01d943..ed52c16d 100755
--- a/kiln-controller.py
+++ b/kiln-controller.py
@@ -258,6 +258,14 @@ def handle_status():
log.info("websocket (status) closed")
+@app.get('/log')
+def handle_log():
+ log.info("/log command received")
+ if hasattr(oven,'pid'):
+ if hasattr(oven.pid,'pidstats'):
+ return json.dumps(ovenWatcher.lastlog())
+
+
def get_profiles():
try:
profile_files = os.listdir(profile_path)
diff --git a/lib/ovenWatcher.py b/lib/ovenWatcher.py
index 681fa545..744740e6 100644
--- a/lib/ovenWatcher.py
+++ b/lib/ovenWatcher.py
@@ -34,6 +34,9 @@ def run(self):
self.notify_all(oven_state)
time.sleep(self.oven.time_step)
+ def lastlog(self):
+ return self.last_log
+
def lastlog_subset(self,maxpts=50):
'''send about maxpts from lastlog by skipping unwanted data'''
totalpts = len(self.last_log)
diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js
index 82cefc5e..0efc1dbc 100644
--- a/public/assets/js/picoreflow.js
+++ b/public/assets/js/picoreflow.js
@@ -108,8 +108,9 @@ function updateProfileTable()
var slope = "";
var color = "";
- var html = '
Schedule Points
';
- html += '| # | Target Time in ' + time_scale_long+ ' | Target Temperature in °'+temp_scale_display+' | Slope in °'+temp_scale_display+'/'+time_scale_slope+' | |
';
+ var html = 'Schedule Points
'
+ html +='
';
+ html += '| # | Step Duration in ' + time_scale_long+ ' | Step Time in ' + time_scale_long+ ' | Target Temperature in °'+temp_scale_display+' | Slope in °'+temp_scale_display+'/'+time_scale_slope+' | |
';
for(var i=0; i' + (i+1) + ' | ';
- html += ' | ';
- html += ' | ';
- html += '
| ';
+ html += ' | ';
+ html += ' | ';
+ html += ' | ';
+ html += '
| ';
html += ' | ';
}
@@ -136,21 +138,24 @@ function updateProfileTable()
var id = $(this)[0].id; //e.currentTarget.attributes.id
var value = parseInt($(this)[0].value);
var fields = id.split("-");
- var col = parseInt(fields[1]);
var row = parseInt(fields[2]);
- if (graph.profile.data.length > 0) {
- if (col == 0) {
- graph.profile.data[row][col] = timeProfileFormatter(value,false);
- }
- else {
- graph.profile.data[row][col] = value;
+ if (fields[1] === 'time') {
+ if (graph.profile.data.length > 0) {
+ graph.profile.data[row][0] = timeProfileFormatter(value, false);
+ }
+ } else if (fields[1] === 'temperature') {
+ graph.profile.data[row][1] = value;
+ } else if (fields[1] === 'duration') {
+ graph.profile.data[row][0] = graph.profile.data[row-1][0] + timeProfileFormatter(value, false);
+ } else if (fields[1] === 'slope') {
+ console.log({value, formatted: formatDPS(value, true), start_temp: graph.profile.data[row-1][1], end_temp: graph.profile.data[row][1], start_time: graph.profile.data[row-1][0]})
+ graph.profile.data[row][0] = (graph.profile.data[row][1] - graph.profile.data[row-1][1]) / formatDPS(value, true) + graph.profile.data[row-1][0]
}
graph.plot = $.plot("#graph_container", [ graph.profile, graph.live ], getOptions());
- }
- updateProfileTable();
+ updateProfileTable();
});
}
@@ -158,24 +163,27 @@ function timeProfileFormatter(val, down) {
var rval = val
switch(time_scale_profile){
case "m":
- if (down) {rval = val / 60;} else {rval = val * 60;}
+ rval = down ? val / 60 : val * 60;
break;
case "h":
- if (down) {rval = val / 3600;} else {rval = val * 3600;}
+ rval = down ? val / 3600 : val * 3600;
break;
}
return Math.round(rval);
}
-function formatDPS(val) {
+function formatDPS(val, down = false) {
var tval = val;
- if (time_scale_slope == "m") {
- tval = val * 60;
- }
- if (time_scale_slope == "h") {
- tval = (val * 60) * 60;
+ switch(time_scale_slope){
+ case "m":
+ tval = down ? val / 60 : val * 60;
+ break;
+ case "h":
+ tval = down ? val / 60 / 60 : (val * 60) * 60;
+ break;
}
- return Math.round(tval);
+
+ return down ? tval : Math.round(tval);
}
function hazardTemp(){