Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for SLA support for v1 API #428

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.m1.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = (env, args) => {

WITH_STORAGES: ["local", "usb"],
WITH_FILES: true,
WITH_SETTINGS: false,
WITH_SETTINGS: true,
WITH_CONTROLS: false,
WITH_REMOTE_UPLOAD: true,
WITH_START_PRINT_AFTER_UPLOAD: true,
Expand Down
3 changes: 2 additions & 1 deletion config.sl1.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ module.exports = (env, args) => {

WITH_STORAGES: ["local", "usb"],
WITH_FILES: true,
WITH_SETTINGS: false,
WITH_SETTINGS: true,
WITH_CONTROLS: false,
WITH_REMOTE_UPLOAD: true,
WITH_START_PRINT_AFTER_UPLOAD: true,
WITH_LOGS: false,
WITH_FONT: false,
WITH_V1_API: true,
...env,
};
return webpackConfig(config, args);
Expand Down
4 changes: 4 additions & 0 deletions src/locales/c.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@
"msg.sysupgrade.remark": "",
"msg.sysupgrade.title": "",
"msg.sysupgrade.wait-for-printer": "",
"ntf.calibration-error": "",
"ntf.camera-config-success": "",
"ntf.camera-suc": "",
"ntf.error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": "",
"ntf.n-calibrated": "",
"ntf.settings-suc": "",
"ntf.success": "",
"ntf.upld-start": "",
Expand Down
5 changes: 4 additions & 1 deletion src/locales/source/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,8 @@
"btn.upgrade": "Aktualizovat",
"conn.error_status": "Chyba",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
}
5 changes: 4 additions & 1 deletion src/locales/source/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,8 @@
"msg.file-exists.overwrite-it": "Möchten Sie sie überschreiben?",
"msg.file-exists.title": "Datei existiert bereits",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "Die Protokolldatei hat eine unbekannte Größe und ist daher nur zum Herunterladen verfügbar",
"ntf.calibration-error": "Kalibrierungsfehler",
"ntf.low-resin.message": "Die gemessene Harzmenge ist zu gering. Der Druck kann fortgesetzt werden, es kann jedoch ein Nachfüllen erforderlich sein.",
"ntf.low-resin.title": "Harz niedrig"
}
3 changes: 3 additions & 0 deletions src/locales/source/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@
"ntf.camera-config-success": "Camera configuration has been updated",
"ntf.e-307": "Resin measuring failed!",
"ntf.error": "Error",
"ntf.calibration-error": "Calibration Error",
"ntf.n-calibrated": "Printer is not calibrated!",
"ntf.low-resin.title": "Resin low",
"ntf.low-resin.message": "Measured resin volume is too low. The print can continue, however, a refill might be required.",
"ntf.not-idle": "Printer is not idle!",
"ntf.settings-suc": "Settings was changed successfully.",
"ntf.start-print": "The printer is getting ready.",
Expand Down
9 changes: 6 additions & 3 deletions src/locales/source/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ntf.actn-pending": "La acción se realizará al terminar la capa.",
"ntf.e-307": "Falló la medición de resina.",
"ntf.error": "Error",
"ntf.n-calibrated": "¡La impresora no está calibrada!",
"ntf.n-calibrated": "¡Impresora no calibrada!",
"ntf.not-idle": "¡La impresora no está inactiva!",
"ntf.start-print": "La impresora se está preparando.",
"ntf.success": "Éxito",
Expand Down Expand Up @@ -249,7 +249,7 @@
"btn.connect.unlink": "Desenlazar",
"conn.connect.not-linked": "No enlazado",
"msg.drop-zone.label": "Arrastra archivo aquí para subirlo",
"btn.check-updates": "Comprobar actualizaciones",
"btn.check-updates": "Comprobar Actualizaciones",
"btn.upgrade": "Actualización",
"upgrade.success.message": "La página se recargará en 5 segundos",
"upgrade.success.title": "Actualización con Éxito",
Expand All @@ -267,5 +267,8 @@
"msg.file-exists.overwrite-it": "¿Quieres sobrescribirlo?",
"msg.file-exists.title": "El archivo ya existe",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "El archivo de registro es de tamaño desconocido y, por lo tanto, solo está disponible para su descarga.",
"ntf.calibration-error": "Error de calibración",
"ntf.low-resin.message": "El volumen de resina medido es demasiado bajo. La impresión puede continuar, sin embargo, es posible que se requiera una recarga.",
"ntf.low-resin.title": "Poca resina"
}
7 changes: 5 additions & 2 deletions src/locales/source/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"ntf.actn-pending": "L'action sera exécutée une fois la couche terminée.",
"ntf.e-307": "La mesure de la résine a échoué",
"ntf.error": "Erreur",
"ntf.n-calibrated": "L'imprimante n'est pas calibrée !",
"ntf.n-calibrated": "L'imprimante n'est pas calibrée !",
"ntf.not-idle": "L'imprimante n'est pas au repos !",
"ntf.settings-suc": "Paramètres modifiés avec succès.",
"ntf.start-print": "Préparation de l'imprimante.",
Expand Down Expand Up @@ -278,5 +278,8 @@
"msg.file-exists.title": "Le fichier existe déjà",
"conn.error_status": "Erreur",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "Le fichier de journal est d'une taille inconnue et n'est donc disponible que pour le téléchargement",
"ntf.calibration-error": "Erreur de Calibration",
"ntf.low-resin.message": "Le volume de résine mesuré est trop bas. L'impression peut continuer, mais un remplissage pourra être nécessaire.",
"ntf.low-resin.title": "Niveau de résine bas"
}
7 changes: 5 additions & 2 deletions src/locales/source/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ntf.actn-pending": "L'azione verrà eseguita dopo il completamento del layer.",
"ntf.e-307": "Misurazione resina non riuscita!",
"ntf.error": "Errore",
"ntf.n-calibrated": "La stampante adesso è calibrata!",
"ntf.n-calibrated": "La stampante non è calibrata!",
"ntf.not-idle": "La stampante non è inattiva!",
"ntf.start-print": "Preparazione della stampante.",
"ntf.success": "Successo",
Expand Down Expand Up @@ -267,5 +267,8 @@
"msg.file-exists.overwrite-it": "Vuoi sovrascriverlo?",
"msg.file-exists.title": "File già esistente",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "Il file di log è di dimensioni sconosciute e quindi è disponibile solo per il download.",
"ntf.calibration-error": "Errore di calibrazione",
"ntf.low-resin.message": "Il volume di resina misurato è troppo basso. La stampa può continuare, ma potrebbe essere necessaria una ricarica.",
"ntf.low-resin.title": "Resina bassa"
}
7 changes: 5 additions & 2 deletions src/locales/source/kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,8 @@
"msg.file-exists.overwrite-it": "덮어쓰시겠습니까?",
"msg.file-exists.title": "파일이 이미 존재합니다.",
"conn.printer.not-supported": "지원하지 않는 프린터입니다.",
"logs.file-size-unknown": "로그파일의 크기를 알 수 없으므로 다운로드만 가능합니다."
}
"logs.file-size-unknown": "로그파일의 크기를 알 수 없으므로 다운로드만 가능합니다.",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
}
5 changes: 4 additions & 1 deletion src/locales/source/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,8 @@
"msg.file-exists.overwrite-it": "",
"msg.file-exists.title": "",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
}
5 changes: 4 additions & 1 deletion src/locales/source/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,8 @@
"msg.file-exists.overwrite-it": "",
"msg.file-exists.title": "",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
}
5 changes: 4 additions & 1 deletion src/locales/source/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,8 @@
"msg.file-exists.overwrite-it": "Czy chcesz go nadpisać?",
"msg.file-exists.title": "Plik już istnieje",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "Plik logu ma nieznany rozmiar i dlatego jest dostępny tylko do pobrania",
"ntf.calibration-error": "Błąd kalibracji",
"ntf.low-resin.message": "Zmierzona ilość żywicy jest zbyt niska. Drukowanie można kontynuować, jednak konieczne może być uzupełnienie w trakcie.",
"ntf.low-resin.title": "Niski poziom żywicy"
}
5 changes: 4 additions & 1 deletion src/locales/source/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,8 @@
"msg.file-exists.overwrite-it": "",
"msg.file-exists.title": "",
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
}
7 changes: 4 additions & 3 deletions src/printer/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { LinkState, translateState } from "../state";

const SEPARATOR = " - ";

export const getPrinterLabel = (context) => {
return buildTitle([context.printer?.location, context.printer?.name]);
};
export const getPrinterLabel = (context) => buildTitle([
context.printer?.location || context.printer?.hostname,
context.printer?.name
]);

export const buildTitle = (titleItems) => {
return [...titleItems]
Expand Down
1 change: 0 additions & 1 deletion src/printer/components/cameras.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ const createCameraSettingsModal = (cameraId, resolve) => {
inputTriggerScheme.value = translateTriggerScheme(data.trigger_scheme);

setVisible(inputFocus.parentNode, hasFocus);
console.log(`DEBUG: has focus (${hasFocus})`, data)
if (hasFocus) {
inputFocus.value = Math.round(data.focus * 100);
}
Expand Down
1 change: 0 additions & 1 deletion src/printer/components/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import updateProperties from "./updateProperties";
import { disableSteppers, extrude, homePrinthead, movePrinthead, retract, setBedTemperature, setFlowRate, setNozzleTemperature, setSpeed } from "./controlActions";
import { handleError } from "./errors";
import { LinkState } from "../../state";
import { context } from "../fdm";

let moveStep = 1;
let extrudeRetractStep = 1;
Expand Down
70 changes: 10 additions & 60 deletions src/printer/components/dataFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ const str_GB = translate("unit.gb");
const str_true = translate("prop.true");
const str_false = translate("prop.false");

/**
* Format the value data with format specificated.
* @param {string} format - one of ["int", "number", "layer", "temp", "fan", "resin", "cover", "date", "progress", "timeEst", "time", "expo", "boolean"]
* @param {any} value
*/
const formatData = (format, value) => {
if (process.env.PRINTER_TYPE === "sla") {
return slaFormatData(format, value);
} else {
return fdmFormatData(format, value);
}
};

/**
* It formats a number using fixed-point notation with one digit after the decimal point.
* ex: 123.456 => 123.4
Expand Down Expand Up @@ -193,75 +180,38 @@ function formatBoolean(value) {
}

/**
* Format the value data with format specificated for sla type.
* @param {string} format - one of ["int", "number", "layer", "temp", "fan", "resin", "cover", "date", "progress", "timeEst", "time", "expo", "boolean"]
* Format the value data with format specificated.
* @param {string} format - one of ["number", "temp", "fan", "pos", "date", "progress", "timeEst", "time"]
* @param {any} value
*/
const slaFormatData = (format, value) => {
const formatData = (format, value) => {
if (value === undefined || (value === null && format !== "progress")) {
return translate("prop.na");
}

switch (format) {
case "int":
return parseInt(value);
case "number":
return numberFormat(value);
case "layer":
return numberFormat(value, false) + " mm";
case "temp":
return numberFormat(value) + " °C";
case "fan":
return numberFormat(value) + ` ${str_rpm}`;
case "resin":
return numberFormat(value) + ` ${str_ml}`;
case "cover":
return value
? translate("prop.cover-closed")
: translate("prop.cover-opened");
case "date":
return dateFormat(value);
case "progress":
return numberFormat((value || 0) * 100, true, 0) + "%";
case "timeEst":
return formatEstimatedTime(value);
case "time":
return formatTime(value);
case "est-time":
return "~ " + formatTime(value);
case "expo":
return formatExposure(value);
case "totalLayer":
return totalLayers(value);
case "material":
return value || translate("prop.na");
case "size":
return formatSize(value);
case "boolean":
return formatBoolean(value);
default:
return value;
}
};

/**
* Format the value data with format specificated for fdm type.
* @param {string} format - one of ["number", "temp", "fan", "pos", "date", "progress", "timeEst", "time"]
* @param {any} value
*/
const fdmFormatData = (format, value) => {
if (value === undefined || (value === null && format !== "progress")) {
return translate("prop.na");
}

switch (format) {
case "number":
return numberFormat(value);
case "temp":
return numberFormat(value) + " °C";
case "temp_int":
return numberFormat(value, 0) + "°C";
case "fan":
return numberFormat(value) + ` ${str_rpm}`;
case "resin":
return numberFormat(value) + ` ${str_ml}`;
case "cover":
return value
? translate("prop.cover-closed")
: translate("prop.cover-opened");
case "print":
return numberFormat(value || 0, true, 0) + "%";
case "pos":
Expand Down
4 changes: 2 additions & 2 deletions src/printer/components/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export function handleError(result, options) {
let message = result?.data?.message
|| options?.fallbackMessage?.message
|| "Action can not be performed";
let isWarning = false;
let isWarning = options?.isWarning ?? false;

if (result?.data) {
const data = result.data;
if (data.code) {
title += `- ${data.code}`;
title += ` - ${data.code}`;
if (`${data.code}`[3] == "7")
isWarning = true;
}
Expand Down
5 changes: 4 additions & 1 deletion src/printer/components/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function getCurrentApiPath(fileName) {
return getApiPath(storage.path, path, fileName);
}

function getApiPath(origin, path, file) {
export function getApiPath(origin, path, file) {
const apiPath = ["/api/v1/files", origin, path, file].filter((e) => !!e)
.join("/");

Expand Down Expand Up @@ -202,6 +202,9 @@ const updateFiles = (opts = {}) => {
headers: { "If-None-Match": lastETag },
})
.then((result) => {
if (result.code === 304) {
return
}
if (url !== getCurrentApiPath()) {
// user navigated to other folder
return;
Expand Down
Loading
Loading