mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-25 02:27:56 +01:00
58b3a12c6b
---------------------------------------------------------------------- Merge branch 'new_layouting_approach' into feature/printerdriver * new_layouting_approach: (22 commits) changed chmod adjustments to make preview be initialized and updated better (when resizing) updates css styles changes to how the draw and preview canvasses are positioned and initted many updates CSS and LESS files and generally a responsive scaling overhaul of the settings page new LESS simple js lib for managing the folded in/out state of the sidebars on the minimal interface arrow file used in the minimal doodle3d interface the resulting css files which LESS outputs removed this because it's being rolled into the styles.css by LESS moved logos to their own dir + removed a few redundant ones copy normalize.css to the LESS dir since it's a source file smallest size of the doodle3d logo started using LESS for stylesheeting commit of current state of this branch. It's a work-in-progress (comitting because I need to change to other branch) a lot of changes -> almost there but the drawing is not consistent yet across devices. Drawing on the draw canvas is going OK but the preview is not drawing well now. Giving up for now. changes (sry) intermediary progress commented out part of the css (not final solution) added todo for future ...
108 lines
3.8 KiB
JavaScript
108 lines
3.8 KiB
JavaScript
var debugMode = false; // debug mode
|
|
var sendPrintCommands = true; // if Doodle3d should send print commands to the 3d printer
|
|
var communicateWithWifibox = true; // if Doodle3d should try interfacing with the wifibox (in case one is not connected)
|
|
var wifiboxIsRemote = false; // when you want to run the client on a computer and have it remotely connect to the wifibox
|
|
var autoUpdate = true; // auto retrieve updates about temperature and progress from printer
|
|
|
|
var printer = new Printer();
|
|
var thermometer = new Thermometer();
|
|
var settingsWindow = new SettingsWindow();
|
|
|
|
var firstTimeSettingsLoaded = true;
|
|
|
|
|
|
var $drawAreaContainer, $doodleCanvas, doodleCanvas, doodleCanvasContext, $previewContainer;
|
|
|
|
$(function() {
|
|
console.log("ready");
|
|
|
|
|
|
//TODO give this a more logical place in code
|
|
|
|
if (getURLParameter("d") != "null") debugMode = (getURLParameter("d") == "1");
|
|
if (getURLParameter("p") != "null") sendPrintCommands = (getURLParameter("p") == "1");
|
|
if (getURLParameter("c") != "null") communicateWithWifibox = (getURLParameter("c") == "1");
|
|
if (getURLParameter("r") != "null") wifiboxIsRemote = (getURLParameter("r") == "1");
|
|
if (getURLParameter("u") != "null") autoUpdate = (getURLParameter("u") == "1");
|
|
|
|
if (wifiboxIsRemote) {
|
|
wifiboxURL = "http://192.168.5.1/cgi-bin/d3dapi";
|
|
} else {
|
|
wifiboxURL = "http://" + window.location.host + "/d3dapi";
|
|
}
|
|
|
|
if (!communicateWithWifibox) {
|
|
sendPrintCommands = false; // 'communicateWithWifibox = false' implies this
|
|
}
|
|
console.log("debugMode: " + debugMode);
|
|
console.log("sendPrintCommands: " + sendPrintCommands);
|
|
console.log("communicateWithWifibox: " + communicateWithWifibox);
|
|
console.log("wifiboxIsRemote: " + wifiboxIsRemote);
|
|
console.log("wifibox URL: " + wifiboxURL);
|
|
|
|
initDoodleDrawing();
|
|
initPreviewRendering();
|
|
initLayouting();
|
|
initSidebars();
|
|
initButtonBehavior();
|
|
initVerticalShapes();
|
|
|
|
thermometer.init($("#thermometerCanvas"), $("#thermometerContainer"));
|
|
|
|
printer.init();
|
|
$(document).on(Printer.UPDATE,update);
|
|
|
|
settingsWindow.init(wifiboxURL);
|
|
$(document).on(SettingsWindow.SETTINGS_LOADED, settingsLoaded);
|
|
|
|
if(debugMode) {
|
|
console.log("debug mode is true");
|
|
$("body").css("overflow", "auto");
|
|
$("#debug_textArea").css("display", "block");
|
|
$("#preview_tmp").css("display", "block");
|
|
|
|
$("#debug_display").css("display", "block");
|
|
|
|
// $("#debugContainer").css("display", "block");
|
|
|
|
/* TEMP CODE!! -> artificially populates the startgcode and endgcode textareas in the settings window */
|
|
// todo remove this temporary code...
|
|
/*
|
|
setTimeout(function() {
|
|
$("#startgcode").text("");
|
|
$("#startgcode").append("G21 (mm) \n");
|
|
$("#startgcode").append("G91 (relative) \n");
|
|
$("#startgcode").append("G28 X0 Y0 Z0 (physical home) \n");
|
|
$("#startgcode").append("M104 S230 (temperature) \n");
|
|
$("#startgcode").append("G1 E10 F250 (flow) \n");
|
|
$("#startgcode").append("G92 X-100 Y-100 Z0 E10 \n");
|
|
$("#startgcode").append("G1 Z3 F5000 (prevent diagonal line) \n");
|
|
$("#startgcode").append("G90 (absolute) \n");
|
|
$("#startgcode").append("M106 (fan on)");
|
|
console.log("$('#startgcode'): " + $("#startgcode").val());
|
|
|
|
$("#endgcode").text("");
|
|
$("#endgcode").append("G1 X-100 Y-100 F15000 (fast homing) \n");
|
|
$("#endgcode").append("M107 \n");
|
|
$("#endgcode").append("M84 (disable axes) \n");
|
|
console.log("$('#endgcode'): " + $("#endgcode").val());
|
|
}, 1000);
|
|
//*/
|
|
}
|
|
|
|
})
|
|
function settingsLoaded() {
|
|
console.log("settingsLoaded");
|
|
console.log("autoHeatup: ",settings["printer.heatup.enabled"]);
|
|
if(settings["printer.heatup.enabled"]) {
|
|
if(firstTimeSettingsLoaded) {
|
|
printer.preheat();
|
|
firstTimeSettingsLoaded = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
function setDebugText(text) {
|
|
$("#debug_display").text(text);
|
|
}
|