[fix] File listing not working
This commit is contained in:
parent
0bb699ffe5
commit
136f47f318
|
@ -17,12 +17,9 @@ class KlipperLogAnalyzer():
|
||||||
def analyze(self):
|
def analyze(self):
|
||||||
data = self.parse_log(self.log_file, None)
|
data = self.parse_log(self.log_file, None)
|
||||||
if not data:
|
if not data:
|
||||||
result = dict(error= "Couldn't parse \"{}\"".format(self.log_file))
|
result = dict(error= "No relevant data available in \"{}\"".format(self.log_file))
|
||||||
else:
|
else:
|
||||||
result = self.plot_mcu(data, self.MAXBANDWIDTH)
|
result = self.plot_mcu(data, self.MAXBANDWIDTH)
|
||||||
#if options.frequency:
|
|
||||||
# plot_frequency(data, outname, options.mcu)
|
|
||||||
# return
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def parse_log(self, logname, mcu):
|
def parse_log(self, logname, mcu):
|
||||||
|
@ -119,14 +116,13 @@ class KlipperLogAnalyzer():
|
||||||
else:
|
else:
|
||||||
hb = 100. * (self.MAXBUFFER - hb) / self.MAXBUFFER
|
hb = 100. * (self.MAXBUFFER - hb) / self.MAXBUFFER
|
||||||
hostbuffers.append(hb)
|
hostbuffers.append(hb)
|
||||||
#times.append(datetime.datetime.utcfromtimestamp(st))
|
|
||||||
times.append(st)
|
times.append(st)
|
||||||
bwdeltas.append(100. * (bw - lastbw) / (maxbw * timedelta))
|
bwdeltas.append(100. * (bw - lastbw) / (maxbw * timedelta))
|
||||||
loads.append(100. * load / self.TASK_MAX)
|
loads.append(100. * load / self.TASK_MAX)
|
||||||
awake.append(100. * float(d.get('mcu_awake', 0.)) / self.STATS_INTERVAL)
|
awake.append(100. * float(d.get('mcu_awake', 0.)) / self.STATS_INTERVAL)
|
||||||
lasttime = st
|
lasttime = st
|
||||||
lastbw = bw
|
lastbw = bw
|
||||||
|
|
||||||
result = dict(
|
result = dict(
|
||||||
times= times,
|
times= times,
|
||||||
bwdeltas= bwdeltas,
|
bwdeltas= bwdeltas,
|
||||||
|
@ -151,4 +147,6 @@ class KlipperLogAnalyzer():
|
||||||
val = d.get(key)
|
val = d.get(key)
|
||||||
if val not in (None, '0', '1'):
|
if val not in (None, '0', '1'):
|
||||||
times.append(st)
|
times.append(st)
|
||||||
values.append(float(val))
|
values.append(float(val)/1000000.0)
|
||||||
|
|
||||||
|
return values
|
||||||
|
|
|
@ -5,17 +5,19 @@ $(function() {
|
||||||
self.settings = parameters[0];
|
self.settings = parameters[0];
|
||||||
self.loginState = parameters[1];
|
self.loginState = parameters[1];
|
||||||
self.connectionState = parameters[2];
|
self.connectionState = parameters[2];
|
||||||
|
self.levelingViewModel = parameters[3];
|
||||||
|
|
||||||
self.shortStatus = ko.observable();
|
self.shortStatus = ko.observable();
|
||||||
self.logMessages = ko.observableArray();
|
self.logMessages = ko.observableArray();
|
||||||
|
|
||||||
self.showLevelingDialog = function() {
|
self.showLevelingDialog = function() {
|
||||||
var dialog = $("#klipper_leveling_dialog");
|
var dialog = $("#klipper_leveling_dialog");
|
||||||
dialog.modal({
|
dialog.modal({
|
||||||
show: 'true',
|
show: 'true',
|
||||||
backdrop: 'static',
|
backdrop: 'static',
|
||||||
keyboard: false
|
keyboard: false
|
||||||
});
|
});
|
||||||
|
self.levelingViewModel.initView();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.showPidTuningDialog = function() {
|
self.showPidTuningDialog = function() {
|
||||||
|
@ -89,7 +91,7 @@ $(function() {
|
||||||
|
|
||||||
OCTOPRINT_VIEWMODELS.push({
|
OCTOPRINT_VIEWMODELS.push({
|
||||||
construct: KlipperViewModel,
|
construct: KlipperViewModel,
|
||||||
dependencies: ["settingsViewModel", "loginStateViewModel", "connectionViewModel"],
|
dependencies: ["settingsViewModel", "loginStateViewModel", "connectionViewModel", "klipperLevelingViewModel"],
|
||||||
elements: ["#tab_plugin_klipper_main", "#sidebar_plugin_klipper", "#navbar_plugin_klipper"]
|
elements: ["#tab_plugin_klipper_main", "#sidebar_plugin_klipper", "#navbar_plugin_klipper"]
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -2,11 +2,13 @@ $(function() {
|
||||||
|
|
||||||
function KlipperGraphViewModel(parameters) {
|
function KlipperGraphViewModel(parameters) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
self.loginState = parameters[0];
|
||||||
|
|
||||||
self.header = OctoPrint.getRequestHeaders({
|
self.header = OctoPrint.getRequestHeaders({
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
"cache-control": "no-cache"
|
"cache-control": "no-cache"
|
||||||
});
|
});
|
||||||
|
|
||||||
self.apiUrl = OctoPrint.getSimpleApiUrl("klipper");
|
self.apiUrl = OctoPrint.getSimpleApiUrl("klipper");
|
||||||
|
|
||||||
self.availableLogFiles = ko.observableArray();
|
self.availableLogFiles = ko.observableArray();
|
||||||
|
@ -18,7 +20,7 @@ function KlipperGraphViewModel(parameters) {
|
||||||
self.canvasContext;
|
self.canvasContext;
|
||||||
self.chart;
|
self.chart;
|
||||||
self.spinnerDialog;
|
self.spinnerDialog;
|
||||||
|
|
||||||
self.onStartup = function() {
|
self.onStartup = function() {
|
||||||
self.canvas = $("#klipper_graph_canvas")[0]
|
self.canvas = $("#klipper_graph_canvas")[0]
|
||||||
self.canvasContext = self.canvas.getContext("2d");
|
self.canvasContext = self.canvas.getContext("2d");
|
||||||
|
@ -31,6 +33,13 @@ function KlipperGraphViewModel(parameters) {
|
||||||
var myChart = new Chart(self.canvas, {
|
var myChart = new Chart(self.canvas, {
|
||||||
type: "line"
|
type: "line"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(self.loginState.loggedIn()) {
|
||||||
|
self.listLogFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.onUserLoggedIn = function(user) {
|
||||||
self.listLogFiles();
|
self.listLogFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,15 +156,6 @@ function KlipperGraphViewModel(parameters) {
|
||||||
data: response.awake
|
data: response.awake
|
||||||
});
|
});
|
||||||
|
|
||||||
// self.datasets.push(
|
|
||||||
// {
|
|
||||||
// label: "Frequency",
|
|
||||||
// backgroundColor: "rgba(33, 64, 95, 0.5)",
|
|
||||||
// borderColor: "rgb(33, 64, 95)",
|
|
||||||
// yAxisID: 'y-axis-2',
|
|
||||||
// data: response.frequency
|
|
||||||
// });
|
|
||||||
|
|
||||||
self.chart = new Chart(self.canvas, {
|
self.chart = new Chart(self.canvas, {
|
||||||
type: "line",
|
type: "line",
|
||||||
data: {
|
data: {
|
||||||
|
@ -193,14 +193,6 @@ function KlipperGraphViewModel(parameters) {
|
||||||
position: 'left',
|
position: 'left',
|
||||||
id: 'y-axis-1'
|
id: 'y-axis-1'
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// scaleLabel: {
|
|
||||||
// display: true,
|
|
||||||
// labelString: 'MHz'
|
|
||||||
// },
|
|
||||||
// position: 'right',
|
|
||||||
// id: 'y-axis-2'
|
|
||||||
// }
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
@ -215,7 +207,7 @@ function KlipperGraphViewModel(parameters) {
|
||||||
|
|
||||||
OCTOPRINT_VIEWMODELS.push({
|
OCTOPRINT_VIEWMODELS.push({
|
||||||
construct: KlipperGraphViewModel,
|
construct: KlipperGraphViewModel,
|
||||||
dependencies: [],
|
dependencies: ["loginStateViewModel"],
|
||||||
elements: ["#klipper_graph_dialog"]
|
elements: ["#klipper_graph_dialog"]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,14 +3,18 @@ $(function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.settings = parameters[0];
|
self.settings = parameters[0];
|
||||||
self.loginState = parameters[1];
|
self.loginState = parameters[1];
|
||||||
self.connectionState = parameters[2];
|
|
||||||
|
|
||||||
self.activePoint = ko.observable();
|
self.activePoint = ko.observable(-1);
|
||||||
|
self.pointCount = ko.observable();
|
||||||
|
self.points = ko.observableArray();
|
||||||
|
|
||||||
self.onStartup = function() {
|
self.initView = function() {
|
||||||
self.activePoint(-1);
|
self.points(self.settings.settings.plugins.klipper.probe.points());
|
||||||
|
self.pointCount(
|
||||||
|
self.points().length
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.startLeveling = function() {
|
self.startLeveling = function() {
|
||||||
OctoPrint.control.sendGcode("G28")
|
OctoPrint.control.sendGcode("G28")
|
||||||
self.moveToPoint(0);
|
self.moveToPoint(0);
|
||||||
|
@ -39,14 +43,14 @@ $(function() {
|
||||||
|
|
||||||
self.jumpToPoint = function(item) {
|
self.jumpToPoint = function(item) {
|
||||||
self.moveToPoint(
|
self.moveToPoint(
|
||||||
self.settings.settings.plugins.klipper.probe.points().indexOf(item)
|
self.points().indexOf(item)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
self.pointCount = function() {
|
self.pointCount = function() {
|
||||||
return self.settings.settings.plugins.klipper.probe.points().length;
|
return self.settings.settings.plugins.klipper.probe.points().length;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
self.moveToPosition = function(x, y) {
|
self.moveToPosition = function(x, y) {
|
||||||
OctoPrint.control.sendGcode(
|
OctoPrint.control.sendGcode(
|
||||||
"G1 Z" + (self.settings.settings.plugins.klipper.probe.height() * 1 +
|
"G1 Z" + (self.settings.settings.plugins.klipper.probe.height() * 1 +
|
||||||
|
@ -64,7 +68,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.moveToPoint = function(index) {
|
self.moveToPoint = function(index) {
|
||||||
var point = self.settings.settings.plugins.klipper.probe.points()[index];
|
var point = self.points()[index];
|
||||||
|
|
||||||
self.moveToPosition(point.x(), point.y());
|
self.moveToPosition(point.x(), point.y());
|
||||||
self.activePoint(index);
|
self.activePoint(index);
|
||||||
|
@ -73,7 +77,7 @@ $(function() {
|
||||||
|
|
||||||
OCTOPRINT_VIEWMODELS.push({
|
OCTOPRINT_VIEWMODELS.push({
|
||||||
construct: KlipperLevelingViewModel,
|
construct: KlipperLevelingViewModel,
|
||||||
dependencies: ["settingsViewModel", "loginStateViewModel", "connectionViewModel"],
|
dependencies: ["settingsViewModel", "loginStateViewModel"],
|
||||||
elements: ["#klipper_leveling_dialog"]
|
elements: ["#klipper_leveling_dialog"]
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -9,15 +9,15 @@
|
||||||
<canvas id="klipper_graph_canvas"></canvas>
|
<canvas id="klipper_graph_canvas"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<span class="help-inline" style="display:block; position: absolute"><em>Click labels to hide/show dataset</em></span>
|
<span class="help-inline" style="display:block; position: absolute"><em>Click labels to hide/show dataset</em></span>
|
||||||
|
<label class="checkbox fill-checkbox">
|
||||||
|
<input type="checkbox" data-bind="checked: datasetFill, click: toggleDatasetFill" />{{ _('Fill Datasets') }}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<form class="form-inline">
|
<form class="form-inline">
|
||||||
<label class="checkbox">
|
<span text-align="left" data-bind="text: status" class="status-label"></span>
|
||||||
<input type="checkbox" data-bind="checked: datasetFill, click: toggleDatasetFill" />{{ _('filled datasets') }}
|
|
||||||
</label>
|
|
||||||
<span class="help-inline" text-align="left" data-bind="text: status"></span>
|
|
||||||
<label class="control-label">
|
<label class="control-label">
|
||||||
{{ _('Select Log') }}
|
{{ _('Select') }}
|
||||||
<select data-bind="options: availableLogFiles, optionsText: 'name', optionsValue: 'file', value: logFile"></select>
|
<select data-bind="options: availableLogFiles, optionsText: 'name', optionsValue: 'file', value: logFile"></select>
|
||||||
</label>
|
</label>
|
||||||
<button class="btn" data-bind="click: listLogFiles" title="Reload file list"><i class="icon-refresh"></i></button>
|
<button class="btn" data-bind="click: listLogFiles" title="Reload file list"><i class="icon-refresh"></i></button>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="span7"> </div>
|
<div class="span7"> </div>
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="foreach: settings.settings.plugins.klipper.probe.points">
|
<div data-bind="foreach: points">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span1">
|
<div class="span1">
|
||||||
<i class="fa fa-arrow-right pull-right" data-bind="visible: ($index()==$parent.activePoint())"></i>
|
<i class="fa fa-arrow-right pull-right" data-bind="visible: ($index()==$parent.activePoint())"></i>
|
||||||
|
@ -41,11 +41,12 @@
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn" data-bind="click: startLeveling"><i class="icon-play"></i> {{ _('Start') }}</button>
|
<button class="btn" data-bind="click: startLeveling"><i class="icon-play"></i> {{ _('Start') }}</button>
|
||||||
<button class="btn" data-bind="click: previousPoint, enable: (activePoint() > 0)"><i class="icon-chevron-left"></i> {{ _('Previous') }}</button>
|
<button class="btn" data-bind="click: previousPoint, enable: (activePoint() > 0)"><i class="icon-chevron-left"></i> {{ _('Previous') }}</button>
|
||||||
<button class="btn" data-bind="click: nextPoint, enable: (activePoint() < pointCount()-1)">{{ _('Next') }} <i class="icon-chevron-right"></i></button>
|
<button class="btn" data-bind="click: nextPoint, enable: (activePoint() < (pointCount()-1))">{{ _('Next') }} <i class="icon-chevron-right"></i></button>
|
||||||
<button class="btn" data-bind="click: stopLeveling" data-dismiss="modal"><i class="icon-stop"></i> {{ _('Stop') }}</button>
|
<button class="btn" data-bind="click: stopLeveling" data-dismiss="modal"><i class="icon-stop"></i> {{ _('Stop') }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span2"></div>
|
<div class="span2"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span data-bind="text: pointCount"></span>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue