diff --git a/dist/CNC/GRBL/index.html.gz b/dist/CNC/GRBL/index.html.gz index c3d608e6..0f5d8ec9 100644 Binary files a/dist/CNC/GRBL/index.html.gz and b/dist/CNC/GRBL/index.html.gz differ diff --git a/dist/CNC/GRBLHal/index.html.gz b/dist/CNC/GRBLHal/index.html.gz index 68b2f5a4..93588eef 100644 Binary files a/dist/CNC/GRBLHal/index.html.gz and b/dist/CNC/GRBLHal/index.html.gz differ diff --git a/dist/Plotter/HP-GL/index.html.gz b/dist/Plotter/HP-GL/index.html.gz index 7120c824..2d12d5b5 100644 Binary files a/dist/Plotter/HP-GL/index.html.gz and b/dist/Plotter/HP-GL/index.html.gz differ diff --git a/dist/Printer3D/Marlin-embedded/index.html.gz b/dist/Printer3D/Marlin-embedded/index.html.gz index b22da38a..67180dbd 100644 Binary files a/dist/Printer3D/Marlin-embedded/index.html.gz and b/dist/Printer3D/Marlin-embedded/index.html.gz differ diff --git a/dist/Printer3D/Marlin/index.html.gz b/dist/Printer3D/Marlin/index.html.gz index c4f8be6c..5343728f 100644 Binary files a/dist/Printer3D/Marlin/index.html.gz and b/dist/Printer3D/Marlin/index.html.gz differ diff --git a/dist/Printer3D/Repetier/index.html.gz b/dist/Printer3D/Repetier/index.html.gz index f0e8ad00..4a8e1e55 100644 Binary files a/dist/Printer3D/Repetier/index.html.gz and b/dist/Printer3D/Repetier/index.html.gz differ diff --git a/dist/Printer3D/Smoothieware/index.html.gz b/dist/Printer3D/Smoothieware/index.html.gz index adf66c28..a7550caf 100644 Binary files a/dist/Printer3D/Smoothieware/index.html.gz and b/dist/Printer3D/Smoothieware/index.html.gz differ diff --git a/dist/SandTable/GRBL/index.html.gz b/dist/SandTable/GRBL/index.html.gz index 287d305e..e4fb4d62 100644 Binary files a/dist/SandTable/GRBL/index.html.gz and b/dist/SandTable/GRBL/index.html.gz differ diff --git a/extensions_samples/API.md b/extensions_samples/API.md index 987646f0..3280eaba 100644 --- a/extensions_samples/API.md +++ b/extensions_samples/API.md @@ -455,10 +455,18 @@ There is no answer for this message, so `id` is not necessary --- ### Send capabilities request -Example: `{type:'capabilities', target:'webui', id:'transpanel'}` +This allow to collect all capabilities for specific topic: +if id is `connection` you will get the json of [ESP800] response jsonified +if id is `features` you will get the [ESP400] response jsonified +if id is `interface` you will get the preferences.json jsonified +if id is `settings` you will get specific settings from target fw + +Be noted this API only collect existing data, so for `features`,`interface` and `settings` you may get empty response if corresponding query has not be done. + +Example: `{type:'capabilities', target:'webui', id:'connection'}` **type** is `capabilities` (mandatory) **target** is `webui` (mandatory) -**id** is `infopanel` (optional) +**id** is `connection` (mandatory) * Answer format: check the `eventMsg.data` @@ -466,18 +474,41 @@ Example: `{type:'capabilities', target:'webui', id:'transpanel'}` { "type": "capabilities", "content": { - "response": "Your session will end soon, do you want to stay connected ?", + "response": "{ + "FWVersion": "3.0.0.a111", + "FWTarget": "marlin", + "FWTargetID": "40", + "Setup": "Enabled", + "Screen": "HMI V3", + "Streaming": "Enabled", + "SDConnection": "direct", + "SerialProtocol": "Raw", + "Authentication": "Disabled", + "WebCommunication": "Asynchronous", + "WebSocketIP": "localhost", + "WebSocketPort": "81", + "Hostname": "esp3d", + "WiFiMode": "STA", + "WebUpdate": "Enabled", + "FlashFileSystem": "LittleFS", + "HostPath": "/", + "Time": "none", + "HostTarget": "files", + "HostUploadPath": "/", + "HostDownloadPath": "/", + "wsID": "0" + }", "initiator": { "type":"capabilities", "target":"webui", - "id":"infopanel" + "id":"connection" } }, - "id": "infopanel" + "id": "connection" } ``` **type** is `capabilities` - **id** is the id set in command message to help to screen + **id** is the id of requested capability **content** has the response it self **response**, in our case a JSON and also the **initiator** is the initial command for reference --- @@ -643,4 +674,4 @@ Note: there no answer as the purpose of this is to send answer **id** is the id set in command message to help to screen **content** has the response it self **response**, in our case `create` because user clicked on button 1, and the text entered is in **inputData**, here `mydir`, and also the **initiator** is the initial command for reference - Note: **inputData** is present for both buttons clicked, so screening must be done according response \ No newline at end of file + Note: **inputData** is present for both buttons clicked, so screening must be done according response diff --git a/extensions_samples/capabilities.html b/extensions_samples/capabilities.html index 61e54e8e..cbb310f8 100644 --- a/extensions_samples/capabilities.html +++ b/extensions_samples/capabilities.html @@ -2,14 +2,23 @@ function sendMessage(msg){ window.parent.postMessage(msg, '*'); } + + function onclickBtn(){ + const selectElement = document.getElementById('request_id'); + id_requested = selectElement.value + sendMessage({type:'capabilities', target:'webui', id:document.getElementById('request_id').value,}); + } function processMessage(eventMsg){ - if (eventMsg.data.type && (!eventMsg.data.id||eventMsg.data.id=="infopanel")){ + if (eventMsg.data.type && (!eventMsg.data.id||eventMsg.data.id==document.getElementById('request_id').value)){ if (eventMsg.data.type=="capabilities"){ const line = eventMsg.data.content const resultPanel = document.getElementById("output"); - - resultPanel.innerHTML = resultPanel.innerHTML + "
"+ JSON.stringify(line.response, " ", "
")+"

"; + let res = JSON.stringify(line.response," ","\n") + while (res.includes("\n\n")) { + res = res.replace("\n\n", "\n"); + } + resultPanel.innerHTML = res; } } @@ -23,8 +32,14 @@
- -
-
+ + +
+    
diff --git a/server/CNC/GRBL/Flash/preferences.json b/server/CNC/GRBL/Flash/preferences.json index 582c047a..98306ee9 100644 --- a/server/CNC/GRBL/Flash/preferences.json +++ b/server/CNC/GRBL/Flash/preferences.json @@ -222,11 +222,30 @@ "opennotificationsonstart": false, "notifautoscroll": true, "showmacrospanel": true, - "openmacrosonstart": false, + "openmacrosonstart": true, "macros": [], - "showextracontents": false, - "openextrapanelsonstart": false, - "extracontents": [], + "showextracontents": true, + "openextrapanelsonstart": true, + "extracontents": [ + { + "id": "xjxkqpm5o", + "name": "Panel xjxkqpm5o", + "icon": "Meh", + "target": "panel", + "source": "capabilities.html", + "type": "extension", + "refreshtime": "0" + }, + { + "id": "ooyeeka4e", + "name": "Kiri", + "icon": "Box", + "target": "page", + "source": "https://grid.space/kiri/", + "type": "content", + "refreshtime": "0" + } + ], "showstatuspanel": true, "openstatusonstart": true, "showprobepanel": true, diff --git a/src/areas/index.js b/src/areas/index.js index 1562b091..c4230859 100644 --- a/src/areas/index.js +++ b/src/areas/index.js @@ -19,7 +19,7 @@ */ import { h, Fragment } from "preact" import { Menu } from "./menu" -import { Informations } from "./informations" +import { machineSettings} from "../targets" import { ConnectionContainer } from "./connection" import { MainContainer } from "./main" import { useUiContext, useUiContextFn } from "../contexts/UiContext" @@ -63,7 +63,7 @@ const ViewContainer = () => { const ContentContainer = () => { const { getConnectionSettings, getInterfaceSettings } = useSettings() - const { connectionSettings } = useSettingsContext() + const { connectionSettings, interfaceSettings, featuresSettings } = useSettingsContext() const { createNewRequest } = useHttpQueue() const { toasts, modals } = useUiContext() @@ -377,12 +377,40 @@ const ContentContainer = () => { } break case "capabilities": + let response = {} + switch (eventMsg.data.id) { + case "connection": + console.log(connectionSettings.current) + response = JSON.parse( + JSON.stringify(connectionSettings.current) + ) + break + case "settings": + console.log(machineSettings) + response = JSON.parse( + JSON.stringify(machineSettings) + ) + break + break + case "interface": + console.log(interfaceSettings.current) + response = JSON.parse( + JSON.stringify(interfaceSettings.current) + ) + break + case "features": + console.log(featuresSettings.current) + response = JSON.parse( + JSON.stringify(featuresSettings.current) + ) + break + default: + response = {} + } dispatchToExtensions( "capabilities", { - response: JSON.parse( - JSON.stringify(connectionSettings.current) - ), + response: response, initiator: eventMsg.data, }, eventMsg.data.id diff --git a/src/components/App/version.js b/src/components/App/version.js index 9804226c..f70db065 100644 --- a/src/components/App/version.js +++ b/src/components/App/version.js @@ -17,7 +17,7 @@ */ import { h } from "preact" import { webUIbuild } from "../../targets" -export const webUIversion = "3.0.0-a56" +export const webUIversion = "3.0.0-a57" export const Esp3dVersion = () => ( {webUIversion}.{webUIbuild} diff --git a/src/tabs/features/index.js b/src/tabs/features/index.js index 6a3019dd..bf268f59 100644 --- a/src/tabs/features/index.js +++ b/src/tabs/features/index.js @@ -422,6 +422,7 @@ const FeaturesTab = () => { } }, []) console.log("feature") + console.log(featuresSettings.current) return (
{ const [isLoading, setIsLoading] = useState(false) - const [settings, setSettings] = useState(machineSetting.cache) + const [settings, setSettings] = useState(machineSettings.cache) const [collected, setCollected] = useState("0 B") const { createNewRequest, abortRequest } = useHttpFn const { modals, toasts, uisettings } = useUiContext() @@ -83,7 +83,7 @@ const MachineSettings = () => { type: "error", }) } else if (feedback.command == "eeprom") { - machineSetting.cache = CMD.command( + machineSettings.cache = CMD.command( "formatEeprom", feedback.content ) @@ -99,7 +99,7 @@ const MachineSettings = () => { type: "error", }) processor.stopCatchResponse() - machineSetting.cache = [] + machineSettings.cache = [] setIsLoading(false) } @@ -158,7 +158,7 @@ const MachineSettings = () => { return validation } useEffect(() => { - if (uisettings.getValue("autoload") && machineSetting.cache == "") { + if (uisettings.getValue("autoload") && machineSettings.cache == "") { setIsLoading(true) //do not call onRefresh directly as WebSocket may still be connecting or just connected // and we may have a race issue, the command go but does not have answer catched @@ -189,10 +189,10 @@ const MachineSettings = () => { )} {!isLoading && (
- {machineSetting.cache.length > 0 && ( + {machineSettings.cache.length > 0 && (
- {machineSetting.cache.map((element) => { + {machineSettings.cache.map((element) => { if (element.type == "comment") return (
@@ -261,4 +261,4 @@ const MachineSettings = () => { ) } -export { MachineSettings } +export { MachineSettings, machineSettings} diff --git a/src/targets/CNC/GRBL/index.js b/src/targets/CNC/GRBL/index.js index a3854d0c..c1b9864b 100644 --- a/src/targets/CNC/GRBL/index.js +++ b/src/targets/CNC/GRBL/index.js @@ -23,7 +23,7 @@ import { files } from "./files" import { processor } from "./processor" import { gcode_parser_modes } from "./gcode_parser_modes" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings, machineSettings } from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -78,6 +78,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/CNC/grblHAL/MachineSettings.js b/src/targets/CNC/grblHAL/MachineSettings.js index 944e1d3b..9a373720 100644 --- a/src/targets/CNC/grblHAL/MachineSettings.js +++ b/src/targets/CNC/grblHAL/MachineSettings.js @@ -39,12 +39,12 @@ import { import { RefreshCcw, XCircle, Send, Flag } from "preact-feather" import { CMD } from "./CMD-source" -const machineSetting = {} -machineSetting.cache = [] +const machineSettings = {} +machineSettings.cache = [] const MachineSettings = () => { const [isLoading, setIsLoading] = useState(false) - const [settings, setSettings] = useState(machineSetting.cache) + const [settings, setSettings] = useState(machineSettings.cache) const [collected, setCollected] = useState("0 B") const { createNewRequest, abortRequest } = useHttpFn const { modals, toasts, uisettings } = useUiContext() @@ -83,7 +83,7 @@ const MachineSettings = () => { type: "error", }) } else if (feedback.command == "eeprom") { - machineSetting.cache = CMD.command( + machineSettings.cache = CMD.command( "formatEeprom", feedback.content ) @@ -99,7 +99,7 @@ const MachineSettings = () => { type: "error", }) processor.stopCatchResponse() - machineSetting.cache = [] + machineSettings.cache = [] setIsLoading(false) } @@ -158,7 +158,7 @@ const MachineSettings = () => { return validation } useEffect(() => { - if (uisettings.getValue("autoload") && machineSetting.cache == "") { + if (uisettings.getValue("autoload") && machineSettings.cache == "") { setIsLoading(true) //do not call onRefresh directly as WebSocket may still be connecting or just connected // and we may have a race issue, the command go but does not have answer catched @@ -189,10 +189,10 @@ const MachineSettings = () => { )} {!isLoading && (
- {machineSetting.cache.length > 0 && ( + {machineSettings.cache.length > 0 && (
- {machineSetting.cache.map((element) => { + {machineSettings.cache.map((element) => { if (element.type == "comment") return (
@@ -261,4 +261,4 @@ const MachineSettings = () => { ) } -export { MachineSettings } +export { MachineSettings, machineSettings } diff --git a/src/targets/CNC/grblHAL/index.js b/src/targets/CNC/grblHAL/index.js index 9ea7ce4d..fcb776af 100644 --- a/src/targets/CNC/grblHAL/index.js +++ b/src/targets/CNC/grblHAL/index.js @@ -23,7 +23,7 @@ import { files } from "./files" import { processor } from "./processor" import { gcode_parser_modes } from "./gcode_parser_modes" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings, machineSettings } from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -80,6 +80,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/Plotter/HP-GL/MachineSettings.js b/src/targets/Plotter/HP-GL/MachineSettings.js index a06c6944..c4b9a1cd 100644 --- a/src/targets/Plotter/HP-GL/MachineSettings.js +++ b/src/targets/Plotter/HP-GL/MachineSettings.js @@ -20,5 +20,7 @@ import { h } from "preact" const MachineSettings = () => {} +const machineSettings = {} +machineSettings.cache=[] -export { MachineSettings } +export { MachineSettings, machineSettings } diff --git a/src/targets/Plotter/HP-GL/index.js b/src/targets/Plotter/HP-GL/index.js index 2a8d5cb4..51d7eb75 100644 --- a/src/targets/Plotter/HP-GL/index.js +++ b/src/targets/Plotter/HP-GL/index.js @@ -22,7 +22,7 @@ import { iconsTarget } from "./icons" import { files } from "./files" import { processor } from "./processor" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings, machineSettings } from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -86,6 +86,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/Printer3D/Marlin-embedded/MachineSettings.js b/src/targets/Printer3D/Marlin-embedded/MachineSettings.js index 969a9f3f..83d31612 100644 --- a/src/targets/Printer3D/Marlin-embedded/MachineSettings.js +++ b/src/targets/Printer3D/Marlin-embedded/MachineSettings.js @@ -43,10 +43,10 @@ import { showProgressModal, } from "../../../components/Modal" -const machineSetting = {} -machineSetting.cache = [] -machineSetting.toSave = [] -machineSetting.totalToSave = 0 +const machineSettings = {} +machineSettings.cache = [] +machineSettings.toSave = [] +machineSettings.totalToSave = 0 const MachineSettings = () => { const [isLoading, setIsLoading] = useState(false) @@ -122,12 +122,12 @@ const MachineSettings = () => { } const processSaving = () => { - if (machineSetting.toSave.length > 0) { - const index = machineSetting.toSave.pop() + if (machineSettings.toSave.length > 0) { + const index = machineSettings.toSave.pop() saveEntry( - machineSetting.cache[index], - machineSetting.totalToSave - machineSetting.toSave.length - 1, - machineSetting.totalToSave + machineSettings.cache[index], + machineSettings.totalToSave - machineSettings.toSave.length - 1, + machineSettings.totalToSave ) } else { endProgression() @@ -135,13 +135,13 @@ const MachineSettings = () => { } const saveSettings = () => { - machineSetting.totalToSave = 0 - machineSetting.toSave = [] - machineSetting.cache.map((entry, index) => { + machineSettings.totalToSave = 0 + machineSettings.toSave = [] + machineSettings.cache.map((entry, index) => { if (entry.type != "comment") { if (entry.initial.trim() != entry.value.trim()) { - machineSetting.totalToSave++ - machineSetting.toSave.push(index) + machineSettings.totalToSave++ + machineSettings.toSave.push(index) } } }) @@ -153,7 +153,7 @@ const MachineSettings = () => { content: ( ), }) @@ -161,7 +161,7 @@ const MachineSettings = () => { } function checkSaveStatus() { - let stringified = JSON.stringify(machineSetting.cache) + let stringified = JSON.stringify(machineSettings.cache) let hasmodified = stringified.indexOf('"hasmodified":true') == -1 ? false : true let haserrors = @@ -185,7 +185,7 @@ const MachineSettings = () => { type: "error", }) } else if (feedback.command == "eeprom") { - machineSetting.cache = CMD.command( + machineSettings.cache = CMD.command( "formatEeprom", feedback.content ) @@ -201,7 +201,7 @@ const MachineSettings = () => { type: "error", }) processor.stopCatchResponse() - machineSetting.cache = [] + machineSettings.cache = [] setIsLoading(false) } @@ -262,7 +262,7 @@ const MachineSettings = () => { return validation } useEffect(() => { - if (uisettings.getValue("autoload") && machineSetting.cache == "") { + if (uisettings.getValue("autoload") && machineSettings.cache == "") { setIsLoading(true) //do not call onRefresh directly as WebSocket may still be connecting or just connected // and we may have a race issue, the command go but does not have answer catched @@ -294,10 +294,10 @@ const MachineSettings = () => { )} {!isLoading && (
- {machineSetting.cache.length > 0 && ( + {machineSettings.cache.length > 0 && (
- {machineSetting.cache.map((element) => { + {machineSettings.cache.map((element) => { if (element.type == "comment") return (
@@ -367,4 +367,4 @@ const MachineSettings = () => { ) } -export { MachineSettings } +export { MachineSettings, machineSettings} diff --git a/src/targets/Printer3D/Marlin-embedded/index.js b/src/targets/Printer3D/Marlin-embedded/index.js index c77ef11d..bca345d4 100644 --- a/src/targets/Printer3D/Marlin-embedded/index.js +++ b/src/targets/Printer3D/Marlin-embedded/index.js @@ -22,7 +22,7 @@ import { iconsTarget } from "./icons" import { files } from "./files" import { processor } from "./processor" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings, machineSettings } from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -76,6 +76,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/Printer3D/Marlin/MachineSettings.js b/src/targets/Printer3D/Marlin/MachineSettings.js index 969a9f3f..83d31612 100644 --- a/src/targets/Printer3D/Marlin/MachineSettings.js +++ b/src/targets/Printer3D/Marlin/MachineSettings.js @@ -43,10 +43,10 @@ import { showProgressModal, } from "../../../components/Modal" -const machineSetting = {} -machineSetting.cache = [] -machineSetting.toSave = [] -machineSetting.totalToSave = 0 +const machineSettings = {} +machineSettings.cache = [] +machineSettings.toSave = [] +machineSettings.totalToSave = 0 const MachineSettings = () => { const [isLoading, setIsLoading] = useState(false) @@ -122,12 +122,12 @@ const MachineSettings = () => { } const processSaving = () => { - if (machineSetting.toSave.length > 0) { - const index = machineSetting.toSave.pop() + if (machineSettings.toSave.length > 0) { + const index = machineSettings.toSave.pop() saveEntry( - machineSetting.cache[index], - machineSetting.totalToSave - machineSetting.toSave.length - 1, - machineSetting.totalToSave + machineSettings.cache[index], + machineSettings.totalToSave - machineSettings.toSave.length - 1, + machineSettings.totalToSave ) } else { endProgression() @@ -135,13 +135,13 @@ const MachineSettings = () => { } const saveSettings = () => { - machineSetting.totalToSave = 0 - machineSetting.toSave = [] - machineSetting.cache.map((entry, index) => { + machineSettings.totalToSave = 0 + machineSettings.toSave = [] + machineSettings.cache.map((entry, index) => { if (entry.type != "comment") { if (entry.initial.trim() != entry.value.trim()) { - machineSetting.totalToSave++ - machineSetting.toSave.push(index) + machineSettings.totalToSave++ + machineSettings.toSave.push(index) } } }) @@ -153,7 +153,7 @@ const MachineSettings = () => { content: ( ), }) @@ -161,7 +161,7 @@ const MachineSettings = () => { } function checkSaveStatus() { - let stringified = JSON.stringify(machineSetting.cache) + let stringified = JSON.stringify(machineSettings.cache) let hasmodified = stringified.indexOf('"hasmodified":true') == -1 ? false : true let haserrors = @@ -185,7 +185,7 @@ const MachineSettings = () => { type: "error", }) } else if (feedback.command == "eeprom") { - machineSetting.cache = CMD.command( + machineSettings.cache = CMD.command( "formatEeprom", feedback.content ) @@ -201,7 +201,7 @@ const MachineSettings = () => { type: "error", }) processor.stopCatchResponse() - machineSetting.cache = [] + machineSettings.cache = [] setIsLoading(false) } @@ -262,7 +262,7 @@ const MachineSettings = () => { return validation } useEffect(() => { - if (uisettings.getValue("autoload") && machineSetting.cache == "") { + if (uisettings.getValue("autoload") && machineSettings.cache == "") { setIsLoading(true) //do not call onRefresh directly as WebSocket may still be connecting or just connected // and we may have a race issue, the command go but does not have answer catched @@ -294,10 +294,10 @@ const MachineSettings = () => { )} {!isLoading && (
- {machineSetting.cache.length > 0 && ( + {machineSettings.cache.length > 0 && (
- {machineSetting.cache.map((element) => { + {machineSettings.cache.map((element) => { if (element.type == "comment") return (
@@ -367,4 +367,4 @@ const MachineSettings = () => { ) } -export { MachineSettings } +export { MachineSettings, machineSettings} diff --git a/src/targets/Printer3D/Marlin/index.js b/src/targets/Printer3D/Marlin/index.js index 8fb0b18f..eacb7a90 100644 --- a/src/targets/Printer3D/Marlin/index.js +++ b/src/targets/Printer3D/Marlin/index.js @@ -22,7 +22,7 @@ import { iconsTarget } from "./icons" import { files } from "./files" import { processor } from "./processor" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings, machineSettings } from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -76,6 +76,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/Printer3D/Repetier/MachineSettings.js b/src/targets/Printer3D/Repetier/MachineSettings.js index 3b211d97..338c5bd4 100644 --- a/src/targets/Printer3D/Repetier/MachineSettings.js +++ b/src/targets/Printer3D/Repetier/MachineSettings.js @@ -43,10 +43,10 @@ import { showProgressModal, } from "../../../components/Modal" -const machineSetting = {} -machineSetting.cache = [] -machineSetting.toSave = [] -machineSetting.totalToSave = 0 +const machineSettings = {} +machineSettings.cache = [] +machineSettings.toSave = [] +machineSettings.totalToSave = 0 const MachineSettings = () => { const [isLoading, setIsLoading] = useState(false) @@ -122,12 +122,12 @@ const MachineSettings = () => { } const processSaving = () => { - if (machineSetting.toSave.length > 0) { - const index = machineSetting.toSave.pop() + if (machineSettings.toSave.length > 0) { + const index = machineSettings.toSave.pop() saveEntry( - machineSetting.cache[index], - machineSetting.totalToSave - machineSetting.toSave.length - 1, - machineSetting.totalToSave + machineSettings.cache[index], + machineSettings.totalToSave - machineSettings.toSave.length - 1, + machineSettings.totalToSave ) } else { endProgression() @@ -135,13 +135,13 @@ const MachineSettings = () => { } const saveSettings = () => { - machineSetting.totalToSave = 0 - machineSetting.toSave = [] - machineSetting.cache.map((entry, index) => { + machineSettings.totalToSave = 0 + machineSettings.toSave = [] + machineSettings.cache.map((entry, index) => { if (entry.type != "comment") { if (entry.initial.trim() != entry.value.trim()) { - machineSetting.totalToSave++ - machineSetting.toSave.push(index) + machineSettings.totalToSave++ + machineSettings.toSave.push(index) } } }) @@ -153,7 +153,7 @@ const MachineSettings = () => { content: ( ), }) @@ -161,7 +161,7 @@ const MachineSettings = () => { } function checkSaveStatus() { - let stringified = JSON.stringify(machineSetting.cache) + let stringified = JSON.stringify(machineSettings.cache) let hasmodified = stringified.indexOf('"hasmodified":true') == -1 ? false : true let haserrors = @@ -185,7 +185,7 @@ const MachineSettings = () => { type: "error", }) } else if (feedback.command == "eeprom") { - machineSetting.cache = CMD.command( + machineSettings.cache = CMD.command( "formatEeprom", feedback.content ) @@ -201,7 +201,7 @@ const MachineSettings = () => { type: "error", }) processor.stopCatchResponse() - machineSetting.cache = [] + machineSettings.cache = [] setIsLoading(false) } @@ -259,7 +259,7 @@ const MachineSettings = () => { return validation } useEffect(() => { - if (uisettings.getValue("autoload") && machineSetting.cache == "") { + if (uisettings.getValue("autoload") && machineSettings.cache == "") { setIsLoading(true) //do not call onRefresh directly as WebSocket may still be connecting or just connected // and we may have a race issue, the command go but does not have answer catched @@ -291,10 +291,10 @@ const MachineSettings = () => { )} {!isLoading && (
- {machineSetting.cache.length > 0 && ( + {machineSettings.cache.length > 0 && (
- {machineSetting.cache.map((element) => { + {machineSettings.cache.map((element) => { if (element.type == "comment") return (
@@ -364,4 +364,4 @@ const MachineSettings = () => { ) } -export { MachineSettings } +export { MachineSettings, machineSettings} diff --git a/src/targets/Printer3D/Repetier/index.js b/src/targets/Printer3D/Repetier/index.js index 0250df00..9810bd75 100644 --- a/src/targets/Printer3D/Repetier/index.js +++ b/src/targets/Printer3D/Repetier/index.js @@ -22,7 +22,7 @@ import { iconsTarget } from "./icons" import { files } from "./files" import { processor } from "./processor" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings, machineSettings} from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -76,6 +76,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/Printer3D/Smoothieware/MachineSettings.js b/src/targets/Printer3D/Smoothieware/MachineSettings.js index d658af20..981d8634 100644 --- a/src/targets/Printer3D/Smoothieware/MachineSettings.js +++ b/src/targets/Printer3D/Smoothieware/MachineSettings.js @@ -606,4 +606,4 @@ const MachineSettings = () => { ) } -export { MachineSettings } +export { MachineSettings, machineSettings } diff --git a/src/targets/Printer3D/Smoothieware/index.js b/src/targets/Printer3D/Smoothieware/index.js index 60a3c419..16eac846 100644 --- a/src/targets/Printer3D/Smoothieware/index.js +++ b/src/targets/Printer3D/Smoothieware/index.js @@ -22,7 +22,7 @@ import { iconsTarget } from "./icons" import { files } from "./files" import { processor } from "./processor" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings,machineSettings } from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -76,6 +76,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/SandTable/GRBL/MachineSettings.js b/src/targets/SandTable/GRBL/MachineSettings.js index 944e1d3b..9a373720 100644 --- a/src/targets/SandTable/GRBL/MachineSettings.js +++ b/src/targets/SandTable/GRBL/MachineSettings.js @@ -39,12 +39,12 @@ import { import { RefreshCcw, XCircle, Send, Flag } from "preact-feather" import { CMD } from "./CMD-source" -const machineSetting = {} -machineSetting.cache = [] +const machineSettings = {} +machineSettings.cache = [] const MachineSettings = () => { const [isLoading, setIsLoading] = useState(false) - const [settings, setSettings] = useState(machineSetting.cache) + const [settings, setSettings] = useState(machineSettings.cache) const [collected, setCollected] = useState("0 B") const { createNewRequest, abortRequest } = useHttpFn const { modals, toasts, uisettings } = useUiContext() @@ -83,7 +83,7 @@ const MachineSettings = () => { type: "error", }) } else if (feedback.command == "eeprom") { - machineSetting.cache = CMD.command( + machineSettings.cache = CMD.command( "formatEeprom", feedback.content ) @@ -99,7 +99,7 @@ const MachineSettings = () => { type: "error", }) processor.stopCatchResponse() - machineSetting.cache = [] + machineSettings.cache = [] setIsLoading(false) } @@ -158,7 +158,7 @@ const MachineSettings = () => { return validation } useEffect(() => { - if (uisettings.getValue("autoload") && machineSetting.cache == "") { + if (uisettings.getValue("autoload") && machineSettings.cache == "") { setIsLoading(true) //do not call onRefresh directly as WebSocket may still be connecting or just connected // and we may have a race issue, the command go but does not have answer catched @@ -189,10 +189,10 @@ const MachineSettings = () => { )} {!isLoading && (
- {machineSetting.cache.length > 0 && ( + {machineSettings.cache.length > 0 && (
- {machineSetting.cache.map((element) => { + {machineSettings.cache.map((element) => { if (element.type == "comment") return (
@@ -261,4 +261,4 @@ const MachineSettings = () => { ) } -export { MachineSettings } +export { MachineSettings, machineSettings } diff --git a/src/targets/SandTable/GRBL/index.js b/src/targets/SandTable/GRBL/index.js index e1769d14..11f47404 100644 --- a/src/targets/SandTable/GRBL/index.js +++ b/src/targets/SandTable/GRBL/index.js @@ -23,7 +23,7 @@ import { files } from "./files" import { processor } from "./processor" import { gcode_parser_modes } from "./gcode_parser_modes" import { defaultPanelsList } from "./panels" -import { MachineSettings } from "./MachineSettings" +import { MachineSettings, machineSettings } from "./MachineSettings" import { InformationsControls, QuickButtonsBar, @@ -78,6 +78,7 @@ const eventsList = { export { MachineSettings, + machineSettings, Target, fwUrl, Name, diff --git a/src/targets/index.js b/src/targets/index.js index c4ff7931..589c3840 100644 --- a/src/targets/index.js +++ b/src/targets/index.js @@ -20,6 +20,7 @@ import { h } from "preact" import { MachineSettings, + machineSettings, defaultPanelsList, Target, files, @@ -39,6 +40,7 @@ import { WebUILogo, QuickButtonsBar, BackgroundContainer, + } from "SubTargetDir" import defaultPreferencesSubTarget from "SubTargetDir/preferences.json" @@ -59,6 +61,7 @@ const webUiUrl = "https://github.com/luc-github/ESP3D-WEBUI/tree/3.0" export { MachineSettings, + machineSettings, Target, defaultPreferences, files,