initial commit
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
#tab_plugin_CalibrationTools .main {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#tab_plugin_CalibrationTools .header {
|
||||
margin-bottom: 13px;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .title {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
padding: 2px;
|
||||
border: 1px solid;
|
||||
border-color: #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .tab-content {
|
||||
border: none;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools ul.nav li:first-child > a {
|
||||
border-radius: 4px 4px 0 0;
|
||||
border-top: 1px solid #ddd !important;
|
||||
}
|
||||
#tab_plugin_CalibrationTools ul.nav li:last-child > a {
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools ul.nav li > a {
|
||||
border: 1px solid #ddd;
|
||||
border-top: 0;
|
||||
background-clip: border-box;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .card {
|
||||
box-shadow: 0 0.125rem 0.25rem rgb(0 0 0 / 8%) !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.125);
|
||||
border-radius: 0.25rem;
|
||||
padding: 1.25rem 0.5rem;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .icon a, #tab_plugin_CalibrationTools .icon a i {
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools input:disabled {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
#tab_plugin_CalibrationTools .container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .container .row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-left: 0px;
|
||||
flex-basis: 40px;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .settings_icon {
|
||||
float: right;
|
||||
}
|
||||
#tab_plugin_CalibrationTools .eSteps_container .title {
|
||||
flex-basis: 30%;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .eSteps_container .val {
|
||||
max-width: 60px;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .numberInputField {
|
||||
width: 60px;
|
||||
} */
|
||||
@@ -0,0 +1,106 @@
|
||||
//Notification
|
||||
// new PNotify({
|
||||
// title: "Success",
|
||||
// text: _.sprintf(text, {
|
||||
// command: _.escape(commandSpec.name)
|
||||
// }),
|
||||
// type: "success"
|
||||
// });
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
function CalibrationToolsViewModel(parameters) {
|
||||
var self = this;
|
||||
self.loginStateViewModel = parameters[0];
|
||||
self.settingsViewModel = parameters[1];
|
||||
self.controlViewModel = parameters[2];
|
||||
self.terminalViewModel = parameters[3];
|
||||
self.access = parameters[4];
|
||||
|
||||
self.is_admin = ko.observable(false);
|
||||
self.steps = ko.observable();
|
||||
self.steps["X"] = ko.observable();
|
||||
self.steps["Y"] = ko.observable();
|
||||
self.steps["Z"] = ko.observable();
|
||||
self.steps["E"] = ko.observable();
|
||||
self.results = {};
|
||||
|
||||
self.results["remainedLength"] = ko.observable(20);
|
||||
self.results["markLength"] = ko.observable(120);
|
||||
self.results["actualExtrusion"] = ko.computed(function () {
|
||||
return (self.results.markLength() - self.results.remainedLength()).toFixed(3);
|
||||
});
|
||||
|
||||
self.results["newSteps"] = ko.computed(function () {
|
||||
return (self.steps.E() / self.results.actualExtrusion() * 100).toFixed(3);
|
||||
});
|
||||
|
||||
self.onBeforeBinding = self.onUserLoggedIn = self.onUserLoggedOut = function () {
|
||||
self.is_admin(self.loginStateViewModel.isAdmin());
|
||||
}
|
||||
|
||||
/**open settings*/
|
||||
self.openCalibrationSettings = function () {
|
||||
$('a#navbar_show_settings').click();
|
||||
$('li#settings_plugin_CalibrationTools_link a').click();
|
||||
$("#settings_plugin_CalibrationTools").click();
|
||||
}
|
||||
|
||||
self.from_json = function (response) {
|
||||
self.steps["X"](response.data.X);
|
||||
self.steps["Y"](response.data.Y);
|
||||
self.steps["Z"](response.data.Z);
|
||||
self.steps["E"](response.data.E);
|
||||
}
|
||||
|
||||
self.calibrateESteps = function () {
|
||||
// OctoPrint.simpleApiCommand("loadSteps")
|
||||
// OctoPrint.control.sendGcodeWithParameters("M92").done(function (responseM92) {
|
||||
// OctoPrint.simpleApiGet("CalibrationTools").done(function (response) {
|
||||
// console.log("CalibrationTools");
|
||||
// self.from_json(response);
|
||||
// });
|
||||
// });
|
||||
console.log("calibrateESteps");
|
||||
console.log(self.steps.E(), self.results.remainedLength(), self.results.newSteps());
|
||||
}
|
||||
|
||||
self.loadStepsFromEPROM = function () {
|
||||
OctoPrint.simpleApiCommand("CalibrationTools","loadSteps").done(function (response) {
|
||||
self.from_json(response);
|
||||
})
|
||||
// OctoPrint.simpleApiGet("CalibrationTools").done(function (response) {
|
||||
// console.log("CalibrationTools");
|
||||
// self.from_json(response);
|
||||
// });
|
||||
}
|
||||
|
||||
self.tempRestart = function () {
|
||||
OctoPrint.system.executeCommand("core", "restart");
|
||||
}
|
||||
self.runCommand = function () {
|
||||
OctoPrint.control.sendGcodeWithParameters("G90");
|
||||
}
|
||||
|
||||
self.onAllBound = self.onEventConnected = function () {
|
||||
OctoPrint.simpleApiGet("CalibrationTools").done(function (response) {
|
||||
console.log("CalibrationTools");
|
||||
self.from_json(response);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// This is how our plugin registers itself with the application, by adding some configuration
|
||||
// information to the global variable OCTOPRINT_VIEWMODELS
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
// This is the constructor to call for instantiating the plugin
|
||||
construct: CalibrationToolsViewModel,
|
||||
// This is a list of dependencies to inject into the plugin, the order which you request
|
||||
// here is the order in which the dependencies will be injected into your view model upon
|
||||
// instantiation via the parameters argument
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel", "controlViewModel", "terminalViewModel", "accessViewModel"],
|
||||
// Finally, this is the list of selectors for all elements we want this view model to be bound to.
|
||||
elements: ["#tab_plugin_CalibrationTools"]
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user