Remove plotter as seems no more sustained

Update SandTable UI
This commit is contained in:
Luc
2024-12-09 10:36:18 +08:00
parent d1c3f23303
commit d7413c62ce
31 changed files with 15 additions and 2312 deletions

View File

@@ -1,592 +0,0 @@
/*
index.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
const chalk = require("chalk")
const wscolor = chalk.cyan
const expresscolor = chalk.green
const commandcolor = chalk.white
const enableAuthentication = false
let lastconnection = Date.now()
let logindone = false
const sessiontTime = 60000
let countStatus = 0
function getLastconnection() {
return lastconnection
}
function hasEnabledAuthentication() {
return enableAuthentication
}
let posx = 0
let posy = 0
let pendown = 0
const commandsQuery = (req, res, SendWS) => {
let url = req.query.cmd ? req.query.cmd : req.originalUrl
if (req.query.cmd)
console.log(commandcolor(`[server]/command params: ${req.query.cmd}`))
else console.log(commandcolor(`[server]/command : ${url}`))
if (url.indexOf("PING") != -1) {
lastconnection = Date.now()
res.status(200)
res.send("ok\n")
console.log(commandcolor(`[server]/command :PING`))
return
}
if (!logindone && enableAuthentication) {
res.status(401)
return
}
lastconnection = Date.now()
if (url.indexOf("SIM:") != -1) {
const response = url.substring(url.indexOf("SIM:") + 4)
SendWS(response + "\n" + "ok\n")
res.send("")
return
}
if (url.indexOf("ESP800") != -1) {
res.json({
cmd: "800",
status: "ok",
data: {
FWVersion: "3.0.0.a111",
FWTarget: "hp_gl",
FWTargetID: "90",
Setup: "Enabled",
SDConnection: "direct",
SerialProtocol: "Socket",
Authentication: "Disabled",
WebCommunication: "Synchronous",
WebSocketIP: "localhost",
WebSocketPort: "81",
Hostname: "esp3d",
WiFiMode: "STA",
WebUpdate: "Enabled",
FlashFileSystem: "LittleFS",
HostPath: "/",
Time: "none",
},
})
return
}
if (url.indexOf("ESP111") != -1) {
res.send("192.168.1.111")
return
}
if (url.indexOf("ESP401") != -1) {
const reg_search1 = /P=(?<pos>[^\s]*)/i
let posres = null
if ((posres = reg_search1.exec(url)) == null) {
console.log("Cannot find P= in url")
}
res.json({
cmd: "401",
status: "ok",
data: posres.groups.pos ? posres.groups.pos : "Unknown position",
})
return
}
if (url.indexOf("ESP420") != -1) {
res.json({
cmd: "420",
status: "ok",
data: [
{ id: "chip id", value: "18569" },
{ id: "CPU Freq", value: "240Mhz" },
{ id: "CPU Temp", value: "54.4C" },
{ id: "free mem", value: "201.86 KB" },
{ id: "SDK", value: "v4.4-beta1-308-gf3e0c8bc41" },
{ id: "flash size", value: "4.00 MB" },
{ id: "size for update", value: "1.25 MB" },
{ id: "FS type", value: "LittleFS" },
{ id: "FS usage", value: "64.00 KB/1.44 MB" },
{ id: "sleep mode", value: "none" },
{ id: "wifi", value: "ON" },
{ id: "hostname", value: "esp3d" },
{ id: "HTTP port", value: "80" },
{ id: "Telnet port", value: "23" },
{ id: "sta", value: "ON" },
{ id: "mac", value: "24:6F:28:4C:89:48" },
{ id: "SSID", value: "luc-ext1" },
{ id: "signal", value: "60%" },
{ id: "phy mode", value: "11n" },
{ id: "channel", value: "3" },
{ id: "ip mode", value: "dhcp" },
{ id: "ip", value: "192.168.2.215" },
{ id: "gw", value: "192.168.2.1" },
{ id: "msk", value: "255.255.255.0" },
{ id: "DNS", value: "192.168.2.1" },
{ id: "ap", value: "OFF" },
{ id: "mac", value: "24:6F:28:4C:89:49" },
{ id: "notification", value: "ON(line)" },
{ id: "targetfw", value: "hp_gl" },
{ id: "FW ver", value: "3.0.0.a111" },
{ id: "FW arch", value: "ESP32" },
],
})
return
}
if (url.indexOf("701") != -1) {
if (url.indexOf("json") != -1) {
res.json({
cmd: "701",
status: "ok",
data: {
status: "processing",
total: "1000",
processed: "100",
type: "SD",
name: "test.gcode",
code: 3,
},
})
/*res.json({
cmd: "701",
status: "ok",
data: "no stream",
})*/
} else {
res.send("no stream\n")
}
return
}
if (url.indexOf("ESP410") != -1) {
res.json({
cmd: "410",
status: "ok",
data: [{ SSID: "luc-ext1", SIGNAL: "52", IS_PROTECTED: "1" }],
})
return
}
if (url.indexOf("OA") != -1) {
SendWS(`${posx},${posy},${pendown}\n`)
res.send("")
return
}
if (url.indexOf("PR") != -1) {
const pos_pattern = /PR(?<xrel>[+|-]?\d+),(?<yrel>[+|-]?\d+)/i
let posres = pos_pattern.exec(url)
posx = posx + parseInt(posres.groups.xrel)
posy = posy + parseInt(posres.groups.yrel)
//SendWS(`${posx},${posy},${pendown}\n`)
res.send("")
return
}
if (url.indexOf("PD") != -1) {
pendown = 1
//SendWS(`${posx},${posy},${pendown}\n`)
res.send("")
return
}
if (url.indexOf("PU") != -1) {
pendown = 0
//SendWS(`${posx},${posy},${pendown}\n`)
res.send("")
return
}
if (url.indexOf(String.fromCharCode(27) + ".") != -1) {
//it is esc command ESC.
//SendWS("EScape command\n")
res.send("")
return
}
if (url.indexOf("ESP600") != -1) {
const text = url.substring(8)
SendWS(text, false)
res.send("")
return
}
if (url.indexOf("ESP400") != -1) {
res.json({
cmd: "400",
status: "ok",
data: [
{
F: "network/network",
P: "130",
T: "S",
V: "esp3d",
H: "hostname",
S: "32",
M: "1",
},
{
F: "network/network",
P: "0",
T: "B",
V: "1",
H: "radio mode",
O: [{ none: "0" }, { sta: "1" }, { ap: "2" }],
R: "1",
},
{
F: "network/sta",
P: "1",
T: "S",
V: "WIFI_OFFICE_B2G",
S: "32",
H: "SSID",
M: "1",
R: "1",
},
{
F: "network/sta",
P: "34",
T: "S",
N: "1",
V: "********",
S: "64",
H: "pwd",
M: "0",
MS: "8",
R: "1",
},
{
F: "network/sta",
P: "99",
T: "B",
V: "1",
H: "ip mode",
O: [{ dhcp: "1" }, { static: "0" }],
R: "1",
},
{
F: "network/sta",
P: "100",
T: "A",
V: "192.168.0.1",
H: "ip",
R: "1",
},
{
F: "network/sta",
P: "108",
T: "A",
V: "192.168.0.1",
H: "gw",
R: "1",
},
{
F: "network/sta",
P: "104",
T: "A",
V: "255.255.255.0",
H: "msk",
R: "1",
},
{
F: "network/ap",
P: "218",
T: "S",
V: "ESP3D",
S: "32",
H: "SSID",
M: "1",
R: "1",
},
{
F: "network/ap",
P: "251",
T: "S",
N: "1",
V: "********",
S: "64",
H: "pwd",
M: "0",
MS: "8",
R: "1",
},
{
F: "network/ap",
P: "316",
T: "A",
V: "192.168.0.1",
H: "ip",
R: "1",
},
{
F: "network/ap",
P: "118",
T: "B",
V: "11",
H: "channel",
O: [
{ 1: "1" },
{ 2: "2" },
{ 3: "3" },
{ 4: "4" },
{ 5: "5" },
{ 6: "6" },
{ 7: "7" },
{ 8: "8" },
{ 9: "9" },
{ 10: "10" },
{ 11: "11" },
{ 12: "12" },
{ 13: "13" },
{ 14: "14" },
],
R: "1",
},
{
F: "service/http",
P: "328",
T: "B",
V: "1",
H: "enable",
O: [{ no: "0" }, { yes: "1" }],
},
{
F: "service/http",
P: "121",
T: "I",
V: "80",
H: "port",
S: "65001",
M: "1",
},
{
F: "service/telnetp",
P: "329",
T: "B",
V: "1",
H: "enable",
O: [{ no: "0" }, { yes: "1" }],
},
{
F: "service/telnetp",
P: "125",
T: "I",
V: "23",
H: "port",
S: "65001",
M: "1",
},
{
F: "service/ftp",
P: "1208",
T: "B",
V: "1",
H: "enable",
O: [{ no: "0" }, { yes: "1" }],
},
{
F: "service/ftp",
P: "1196",
T: "I",
V: "21",
H: "control port",
S: "65001",
M: "1",
},
{
F: "service/ftp",
P: "1200",
T: "I",
V: "20",
H: "active port",
S: "65001",
M: "1",
},
{
F: "service/ftp",
P: "1204",
T: "I",
V: "55600",
H: "passive port",
S: "65001",
M: "1",
},
{
F: "service/notification",
P: "1191",
T: "B",
V: "1",
H: "auto notif",
O: [{ no: "0" }, { yes: "1" }],
},
{
F: "service/notification",
P: "116",
T: "B",
V: "0",
H: "notification",
O: [
{ none: "0" },
{ pushover: "1" },
{ email: "2" },
{ line: "3" },
],
},
{
F: "service/notification",
P: "332",
T: "S",
V: "********",
S: "250",
H: "t1",
M: "0",
},
{
F: "service/notification",
P: "583",
T: "S",
V: "********",
S: "63",
H: "t2",
M: "0",
},
{
F: "service/notification",
P: "1042",
T: "S",
V: " ",
S: "127",
H: "ts",
M: "0",
},
{
F: "system/system",
P: "648",
T: "B",
V: "90",
H: "targetfw",
O: [
{ hp_gl: "90" },
{ repetier: "50" },
{ marlin: "20" },
{ smoothieware: "40" },
{ grbl: "10" },
{ unknown: "0" },
],
},
{
F: "system/system",
P: "112",
T: "I",
V: "115200",
H: "baud",
O: [
{ 9600: "9600" },
{ 19200: "19200" },
{ 38400: "38400" },
{ 57600: "57600" },
{ 74880: "74880" },
{ 115200: "115200" },
{ 230400: "230400" },
{ 250000: "250000" },
{ 500000: "500000" },
{ 921600: "921600" },
],
},
{
F: "system/system",
P: "320",
T: "I",
V: "10000",
H: "bootdelay",
S: "40000",
M: "0",
},
],
})
return
}
SendWS("ok\n")
res.send("")
}
const loginURI = (req, res) => {
if (req.body.DISCONNECT == "YES") {
res.status(401)
logindone = false
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {
logindone = true
lastconnection = Date.now()
} else {
res.status(401)
logindone = false
}
res.send("")
}
const configURI = (req, res) => {
if (!logindone && enableAuthentication) {
res.status(401)
return
}
lastconnection = Date.now()
res.send(
"chip id: 56398\nCPU Freq: 240 Mhz<br/>" +
"CPU Temp: 58.3 C<br/>" +
"free mem: 212.36 KB<br/>" +
"SDK: v3.2.3-14-gd3e562907<br/>" +
"flash size: 4.00 MB<br/>" +
"size for update: 1.87 MB<br/>" +
"FS type: LittleFS<br/>" +
"FS usage: 104.00 KB/192.00 KB<br/>" +
"baud: 115200<br/>" +
"sleep mode: none<br/>" +
"wifi: ON<br/>" +
"hostname: esp3d<br/>" +
"HTTP port: 80<br/>" +
"Telnet port: 23<br/>" +
"WebDav port: 8383<br/>" +
"sta: ON<br/>" +
"mac: 80:7D:3A:C4:4E:DC<br/>" +
"SSID: WIFI_OFFICE_A2G<br/>" +
"signal: 100 %<br/>" +
"phy mode: 11n<br/>" +
"channel: 11<br/>" +
"ip mode: dhcp<br/>" +
"ip: 192.168.1.61<br/>" +
"gw: 192.168.1.1<br/>" +
"msk: 255.255.255.0<br/>" +
"DNS: 192.168.1.1<br/>" +
"ap: OFF<br/>" +
"mac: 80:7D:3A:C4:4E:DD<br/>" +
"serial: ON<br/>" +
"notification: OFF<br/>" +
"Target Fw: grbl<br/>" +
"FW ver: 3.0.0.a91<br/>" +
"FW arch: ESP32 "
)
}
module.exports = {
commandsQuery,
configURI,
loginURI,
getLastconnection,
hasEnabledAuthentication,
}

View File

@@ -1,3 +1,3 @@
{
"version": "3.0.0-a82"
"version": "3.0.0-a83"
}

View File

@@ -7,7 +7,6 @@
"test": "echo \"Error: no test specified\" && exit 1",
"front": "webpack serve --config config/webpack.dev.js ",
"server": "nodemon config/server.js",
"dev-plotter-hp_gl": "cross-env TARGET_ENV=Plotter SUBTARGET_ENV=HP-GL concurrently \"npm run server\" \"npm run front\"",
"dev-cnc-grbl": "cross-env TARGET_ENV=CNC SUBTARGET_ENV=GRBL concurrently \"npm run server\" \"npm run front\"",
"dev-cnc-grblhal": "cross-env TARGET_ENV=CNC SUBTARGET_ENV=grblHAL concurrently \"npm run server\" \"npm run front\"",
"dev-printer-marlin": "cross-env TARGET_ENV=Printer3D SUBTARGET_ENV=Marlin concurrently \"npm run server\" \"npm run front\"",
@@ -20,16 +19,14 @@
"printer-marlin": "cross-env TARGET_ENV=Printer3D SUBTARGET_ENV=Marlin webpack --config config/webpack.prod.js",
"printer-smoothieware": "cross-env TARGET_ENV=Printer3D SUBTARGET_ENV=Smoothieware webpack --config config/webpack.prod.js",
"printer-marlin-embedded": "cross-env TARGET_ENV=Printer3D SUBTARGET_ENV=Marlin-embedded webpack --config config/webpack.prod.js",
"plotter-hp_gl": "cross-env TARGET_ENV=Plotter SUBTARGET_ENV=HP-GL webpack --config config/webpack.prod.js",
"cnc-grbl": "cross-env TARGET_ENV=CNC SUBTARGET_ENV=GRBL webpack --config config/webpack.prod.js",
"cnc-grblhal": "cross-env TARGET_ENV=CNC SUBTARGET_ENV=grblHAL webpack --config config/webpack.prod.js",
"sand-grbl": "cross-env TARGET_ENV=SandTable SUBTARGET_ENV=GRBL webpack --config config/webpack.prod.js",
"build": "webpack --config config/webpack.prod.js",
"buildprinter": "npm run printer-marlin && npm run printer-repetier && npm run printer-smoothieware && npm run printer-marlin-embedded",
"buildplotter": "npm run plotter-hp_gl",
"buildcnc": "npm run cnc-grbl && npm run cnc-grblhal",
"buildsand": "npm run sand-grbl",
"buildall": "npm run buildsand && npm run buildprinter && npm run buildcnc && npm run buildplotter",
"buildall": "npm run buildsand && npm run buildprinter && npm run buildcnc",
"package": "node ./config/pack.js",
"template": "node ./config/buildtemplate.js",
"check": "node ./config/checkpack.js"

View File

@@ -17,7 +17,7 @@
*/
import { h } from "preact"
import { webUIbuild } from "../../targets"
export const webUIversion = "3.0.0-a82"
export const webUIversion = "3.0.0-a83"
export const Esp3dVersion = () => (
<span>
{webUIversion}.{webUIbuild}

View File

@@ -1,43 +0,0 @@
/*
BackgroundContainer.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { Fragment, h } from "preact"
/*import { useEffect } from "preact/hooks"
import { useTargetContext } from "../GRBL/TargetContext"
import { useUiContext } from "../../../contexts"
import { T } from "../../components/Translations"*/
const BackgroundContainer = () => {
/* const { alarmCode, errorCode } = useTargetContext()
const { toasts } = useUiContext()
useEffect(() => {
if (alarmCode != 0 || errorCode != 0) {
toasts.addToast({
type: "error",
content: T(
alarmCode != 0 ? "ALARM:" + alarmCode : "error:" + errorCode
),
})
}
}, [alarmCode, errorCode])*/
return null
}
export { BackgroundContainer }

View File

@@ -1,72 +0,0 @@
/*
QuickStopButton.js - ESP3D WebUI component file
Copyright (c) 2021 Luc LEBOSSE. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { AlertCircle } from "preact-feather"
import { useHttpFn } from "../../../hooks"
import { espHttpURL, replaceVariables } from "../../../components/Helpers"
import { useUiContext, useUiContextFn } from "../../../contexts"
import { T } from "../../../components/Translations"
import { ButtonImg } from "../../../components/Controls"
import { variablesList } from "../../../targets"
const QuickStopButton = () => {
const { toasts } = useUiContext()
const { createNewRequest } = useHttpFn
const SendCommand = (command) => {
createNewRequest(
espHttpURL("command", {
cmd: replaceVariables(variablesList.commands, command),
}),
{
method: "GET",
echo: replaceVariables(variablesList.commands, command, true),
}, //need to see real command as it is not printable
{
onSuccess: (result) => {},
onFail: (error) => {
toasts.addToast({ content: error, type: "error" })
console.log(error)
},
}
)
}
return (
<ButtonImg
m1
rtooltip
label={T("HP16")}
className="emergency-btn"
icon={<AlertCircle />}
data-tooltip={T("HP16")}
id="btnEStop"
onclick={(e) => {
useUiContextFn.haptic()
e.target.blur()
const cmds = useUiContextFn.getValue("emergencystop").split(";")
cmds.forEach((cmd) => {
SendCommand(cmd)
})
}}
/>
)
}
export { QuickStopButton }

View File

@@ -1,24 +0,0 @@
/*
index.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { QuickStopButton } from "./QuickStopButton"
import { BackgroundContainer } from "./BackgroundContainer"
export { QuickStopButton, BackgroundContainer }

View File

@@ -1,90 +0,0 @@
/*
CMD-source.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
const formatCapabilityLine = (acc, line) => {
//TODO:
//isolate description
//sort enabled
//sort disabled
acc.push({ data: line })
return acc
}
const formatEepromLine = (acc, line) => {
//format G20 / G21
//it is comment
if (line.startsWith("$")) {
//it is setting
const data = line.split("=")
acc.push({ type: "comment", value: data[0] })
acc.push({
type: "text",
value: data[1],
initial: data[1],
cmd: data[0],
})
}
return acc
}
const capabilities = {}
const commands = {
eeprom: () => {
return { type: "cmd", cmd: "$$" }
},
formatEeprom: (result) => {
if (!result || result.length == 0) return []
const res = result.reduce((acc, line) => {
return formatEepromLine(acc, line)
}, [])
return res
},
}
const responseSteps = {
eeprom: {
start: (data) => data.startsWith("$"),
end: (data) => data.startsWith("ok"),
error: (data) => {
return data.indexOf("error") != -1
},
},
}
function capability() {
const [cap, ...rest] = arguments
if (capabilities[cap]) return capabilities[cap](...rest)
//console.log("Unknow capability ", cap)
return false
}
function command() {
const [cmd, ...rest] = arguments
if (commands[cmd]) return commands[cmd](...rest)
//console.log("Unknow command ", cmd)
return { type: "error" }
}
const CMD = { capability, command, responseSteps }
export { CMD }

View File

@@ -1,32 +0,0 @@
/*
Informations.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { Fragment, h } from "preact"
import { PositionsControls } from "../../../../components/Panels/JogPlotter"
import { useUiContextFn } from "../../../../contexts"
const InformationsControls = () => {
return (
<Fragment>
{useUiContextFn.getValue("showjogpanel") && <PositionsControls />}
</Fragment>
)
}
export { InformationsControls }

View File

@@ -1,31 +0,0 @@
/*
index.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { QuickStopButton } from "../../Controls"
const QuickButtonsBar = () => {
return (
<div class="quick-buttons-bar">
<QuickStopButton />
</div>
)
}
export { QuickButtonsBar }

View File

@@ -1,24 +0,0 @@
/*
index.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { QuickButtonsBar } from "./QuickButtonsBar"
import { InformationsControls } from "./InformationsControls"
import { BackgroundContainer } from "../../Controls/BackgroundContainer"
export { QuickButtonsBar, InformationsControls, BackgroundContainer }

View File

@@ -1,121 +0,0 @@
/*
DIRECTSD-source.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { sortedFilesList, formatStatus } from "../../../components/Helpers"
import { canProcessFile } from "../../helpers"
import { useUiContextFn } from "../../../contexts"
const capabilities = {
Process: (path, filename) => {
return canProcessFile(filename)
},
UseFilters: () => true,
IsFlatFS: () => false,
Upload: () => {
return true
},
Mount: () => {
return false
},
UploadMultiple: () => {
return true
},
Download: () => {
return true
},
DeleteFile: () => {
return true
},
DeleteDir: () => {
return true
},
CreateDir: () => {
return true
},
}
const commands = {
list: (path, filename) => {
return {
type: "url",
url: "sdfiles",
args: { path, action: "list" },
}
},
upload: (path, filename) => {
return {
type: "url",
url: "sdfiles",
args: { path },
}
},
formatResult: (resultTxT) => {
const res = JSON.parse(resultTxT)
if (useUiContextFn.getValue("sort_directsd_files")){
res.files = sortedFilesList(res.files)
}
res.status = formatStatus(res.status)
return res
},
deletedir: (path, filename) => {
return {
type: "url",
url: "sdfiles",
args: { path, action: "deletedir", filename },
}
},
delete: (path, filename) => {
return {
type: "url",
url: "sdfiles",
args: { path, action: "delete", filename },
}
},
createdir: (path, filename) => {
return {
type: "url",
url: "sdfiles",
args: { path, action: "createdir", filename },
}
},
download: (path, filename) => {
return {
type: "url",
url: "/sd" + path + (path.endsWith("/") ? "" : "/") + filename,
args: {},
}
},
play: (path, filename) => {
return {
type: "cmd",
cmd:
"[ESP700]/SD" +
path +
(path == "/" ? "" : "/") +
filename +
"\n",
}
},
}
const DIRECTSD = { capabilities, commands }
export { DIRECTSD }

View File

@@ -1,26 +0,0 @@
/*
MachineSettings.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
const MachineSettings = () => {}
const machineSettings = {}
machineSettings.cache = []
export { MachineSettings, machineSettings }

View File

@@ -1,192 +0,0 @@
/*
TargetContext.js - ESP3D WebUI context file
Copyright (c) 2021 Alexandre Aussourd. All rights reserved.
Modified by Luc LEBOSSE 2021
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h, createContext } from "preact"
import { useRef, useContext, useState } from "preact/hooks"
import {
limitArr,
dispatchToExtensions,
beautifyJSONString,
} from "../../../components/Helpers"
import { useDatasContext } from "../../../contexts"
import { processor } from "./processor"
import { isVerboseOnly } from "./stream"
import { variablesList } from "."
import {
isPositions,
getPositions,
isStreamingStatus,
getStreamingStatus,
} from "./filters"
/*
* Local const
*
*/
const TargetContext = createContext("TargetContext")
const useTargetContext = () => useContext(TargetContext)
const useTargetContextFn = {}
useTargetContextFn.isStaId = (subsectionId, label, fieldData) => {
if (subsectionId == "sta" && label == "SSID") return true
return false
}
const TargetContextProvider = ({ children }) => {
const [positions, setPositions] = useState({
x: "?",
y: "?",
pen: "?",
})
const [streamStatus, setStreamStatus] = useState({})
const { terminal } = useDatasContext()
const dataBuffer = useRef({
stream: "",
core: "",
response: "",
error: "",
echo: "",
})
const dispatchInternally = (type, data) => {
//files
processor.handle(type, data)
//sensors
//status
if (type === "stream") {
//Posistions
if (isPositions(data)) {
const response = getPositions(data)
setPositions(response)
}
}
if (type === "response") {
//check if the response is a command answer
if (data[0] === "{") {
if (isStreamingStatus(data)) {
const status = getStreamingStatus(data)
setStreamStatus(status)
}
}
}
//etc...
}
const processData = (type, data, noecho = false) => {
if (data.length > 0) {
if (type == "stream") {
//TODO
//need to handle \r \n and even not having some
//this will split by char
data.split("").forEach((element, index) => {
if (element == "\n" || element == "\r") {
if (dataBuffer.current[type].length > 0) {
const isverboseOnly = isVerboseOnly(
type,
dataBuffer.current[type]
)
dispatchInternally(type, dataBuffer.current[type])
//format the output if needed
if (dataBuffer.current[type].startsWith("{")) {
const newbuffer = beautifyJSONString(
dataBuffer.current[type]
)
if (newbuffer == "error")
terminal.add({
type,
content: dataBuffer.current[type],
isverboseOnly,
})
else {
terminal.add({
type,
content: newbuffer,
isverboseOnly,
})
}
} else {
//if not json
terminal.add({
type,
content: dataBuffer.current[type],
isverboseOnly,
})
}
dataBuffer.current[type] = ""
}
} else {
dataBuffer.current[type] += element
}
})
} else if (type == "response") {
//ignore such answer unless need to check response
//this response is to workaround some response lost when no response
if (data.startsWith("ESP3D says:")) return
const isverboseOnly = isVerboseOnly(type, data)
dispatchInternally(type, data)
//format the output if needed
if (data.startsWith("{")) {
const newbuffer = beautifyJSONString(data)
if (newbuffer == "error")
terminal.add({
type,
content: data,
isverboseOnly,
})
else {
if (!noecho)
terminal.add({
type,
content: newbuffer,
isverboseOnly,
})
}
} else {
if (!noecho)
terminal.add({
type,
content: data,
isverboseOnly,
})
}
} else {
if (type != "core") {
const isverboseOnly = isVerboseOnly(type, data)
terminal.add({ type, content: data, isverboseOnly })
}
dispatchInternally(type, data)
}
dispatchToExtensions(type, data)
}
}
useTargetContextFn.processData = processData
const store = {
positions,
streamStatus,
processData,
}
return (
<TargetContext.Provider value={store}>
{children}
</TargetContext.Provider>
)
}
export { TargetContextProvider, useTargetContext, useTargetContextFn }

View File

@@ -1,90 +0,0 @@
/*
files.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { FLASH } from "../../FLASH-source"
import { DIRECTSD } from "./DIRECTSD-source"
import { useSettingsContextFn, useUiContextFn } from "../../../contexts"
//List of supported files systems
const supportedFileSystems = [
{
value: "FLASH",
name: "S137",
depend: () => {
return (
useUiContextFn.getValue("flashfs") &&
useSettingsContextFn.getValue("FlashFileSystem") != "none"
)
},
},
{
value: "DIRECTSD",
name: "S190",
depend: () => {
return (
useUiContextFn.getValue("directsd") &&
useSettingsContextFn.getValue("SDConnection") != "none"
)
},
},
{
value: "TFTSD",
name: "S188",
depend: () => {
return useUiContextFn.getValue("tftsd")
},
}
]
const capabilities = {
FLASH: FLASH.capabilities,
DIRECTSD: DIRECTSD.capabilities,
}
const commands = {
FLASH: FLASH.commands,
DIRECTSD: DIRECTSD.commands,
}
function capability() {
const [filesystem, cap, ...rest] = arguments
if (!filesystem) return false
if (capabilities[filesystem] && capabilities[filesystem][cap])
return capabilities[filesystem][cap](...rest)
//console.log("Unknow capability ", cap, " for ", filesystem)
return false
}
function command() {
const [filesystem, cmd, ...rest] = arguments
if (commands[filesystem] && commands[filesystem][cmd])
return commands[filesystem][cmd](...rest)
//console.log("Unknow command ", cmd, " for ", filesystem)
return { type: "error" }
}
//everything in one object
const files = {
command,
capability,
supported: supportedFileSystems,
}
export { files }

View File

@@ -1,92 +0,0 @@
/*
filters.js - ESP3D WebUI helper file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { useSettingsContextFn } from "../../../contexts"
/*
* Local variables
*/
let pos = []
////////////////////////////////////////////////////////
//
// Status format is : <...>
const isPositions = (str) => {
const positions_patern = /(?<xpos>\d+),(?<ypos>\d+),(?<pen>[0|1]+)/
return positions_patern.test(str)
}
const getPositions = (str) => {
const positions_patern = /(?<xpos>\d+),(?<ypos>\d+),(?<pen>[0|1]+)/
const result = {}
let res = null
//position
if ((res = positions_patern.exec(str)) !== null) {
result.x = parseInt(res.groups.xpos)
result.y = parseInt(res.groups.ypos)
result.pen = parseInt(res.groups.pen)
}
return result
}
////////////////////////////////////////////////////////
//
// Sensor format is : SENSOR:SENSOR_DATA]
const isSensor = (str) => {
return str.startsWith("SENSOR:")
}
const getSensor = (str) => {
const result = []
const data = " " + str.substring(7)
let res = null
const reg_search = /\s(?<value>[^\[]+)\[(?<unit>[^\]]+)\]/g
while ((res = reg_search.exec(data))) {
if (res.groups) result.push(res.groups)
}
return result
}
////////////////////////////////////////////////////////
//
// Streaming status
const isStreamingStatus = (str) => {
try {
const res = JSON.parse(str)
if (res.cmd == "701" && typeof res.data != "undefined") return true
} catch (e) {
return false
}
}
const getStreamingStatus = (str) => {
const res = JSON.parse(str)
if (res.data.status) return res.data
return { status: res.data }
}
export {
isPositions,
getPositions,
isSensor,
getSensor,
isStreamingStatus,
getStreamingStatus,
}

View File

@@ -1,25 +0,0 @@
/*
icon.js - ESP3D WebUI images file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
const iconsTarget = {}
export { iconsTarget }

View File

@@ -1,109 +0,0 @@
/*
index.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { iconsTarget } from "./icons"
import { files } from "./files"
import { processor } from "./processor"
import { defaultPanelsList } from "./panels"
import { MachineSettings, machineSettings } from "./MachineSettings"
import {
InformationsControls,
QuickButtonsBar,
BackgroundContainer,
} from "./Controls"
import {
TargetContextProvider,
useTargetContext,
useTargetContextFn,
} from "./TargetContext"
import realCommandsTable from "./realCommandsTable"
import variablesTable from "./variablesTable"
import { AppLogo } from "../../../components/Images/logo"
import { Eye as WebUILogo } from "preact-feather"
import { addObjectItem, removeObjectItem } from "../../../components/Helpers"
const Target = "HP-GL"
const webUIbuild = "H-1"
const Name = "ESP3D"
const fwUrl = [
"https://github.com/luc-github/ESP3D/tree/3.0",
"https://github.com/luc-github/ESP3D-TFT",
]
const restartdelay = 30
const variablesList = {
commands: [...realCommandsTable, ...variablesTable],
addCommand: (variable) =>
addObjectItem(variablesList.commands, "name", variable),
removeCommand: (name) =>
removeObjectItem(variablesList.commands, "name", name),
formatCommand: (command) => {
if (command.trim().startsWith("[")) {
return command.trim()
} else {
if (command.trim().endsWith(";")) {
return command.trim()
}
return command.trim() + ";"
}
},
}
const eventsList = {
evts: [],
on: (event, fn) => {
if (typeof eventsList.evts[event] === "undefined") {
eventsList.evts[event] = []
}
addObjectItem(eventsList.evts[event], "fn", { fn: fn })
},
off: (event, fn) => {
removeObjectItem(variablesList.evts[event], "fn", fn)
},
emit: (event, data) => {
if (eventsList.evts[event])
eventsList.evts[event].forEach((element) => {
if (typeof element.fn === "function") element.fn(data)
})
},
}
export {
MachineSettings,
machineSettings,
Target,
fwUrl,
Name,
files,
iconsTarget,
processor,
restartdelay,
defaultPanelsList,
TargetContextProvider,
useTargetContext,
useTargetContextFn,
webUIbuild,
InformationsControls,
variablesList,
eventsList,
AppLogo,
WebUILogo,
QuickButtonsBar,
BackgroundContainer,
}

View File

@@ -1,35 +0,0 @@
/*
panels.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { FilesPanelElement } from "../../../components/Panels/Files"
import { MacrosPanelElement } from "../../../components/Panels/Macros"
import { TerminalPanelElement } from "../../../components/Panels/Terminal"
import { JogPanelElement } from "../../../components/Panels/JogPlotter"
import { NotificationsPanelElement } from "../../../components/Panels/Notifications"
const defaultPanelsList = [
FilesPanelElement,
TerminalPanelElement,
MacrosPanelElement,
JogPanelElement,
NotificationsPanelElement,
]
export { defaultPanelsList }

View File

@@ -1,239 +0,0 @@
{
"settings": {
"general": [
{
"id": "emergencystop",
"type": "text",
"label": "HP16",
"value": "#ESC#.K",
"help": "S97"
},
{
"id": "showmachinesettings",
"type": "boolean",
"label": "S197",
"value": false,
"hide": true
}
],
"panels": [
{
"id": "fixedpanels",
"type": "boolean",
"label": "S203",
"value": false
},
{
"id": "panelsorder",
"fixed": true,
"sorted": true,
"depend": [
{
"id": "fixedpanels",
"value": true
}
],
"type": "list",
"label": "S202",
"value": [
{ "id": "Files", "name": "files" },
{ "id": "Terminal", "name": "terminal" },
{ "id": "Jog", "name": "jog", "value": "jog" },
{ "id": "Status", "name": "status" },
{ "id": "Notifications", "name": "notification" },
{ "id": "Macros", "name": "macros" },
{ "id": "Extracontents", "name": "extracontents" }
]
}
],
"polling": [
{
"id": "pollingcmds",
"depend": [
{
"id": "enablepolling",
"value": true
}
],
"type": "list",
"sorted": false,
"label": "S115",
"value": [
{
"id": "samplepolling",
"name": "3s",
"cmds": "OA;[ESP701]json",
"refreshtime": "3000"
}
]
}
],
"files": [
{
"id": "filesfilter",
"type": "text",
"label": "S96",
"value": "g;G;gco;GCO;gcode;GCODE;nc;txt;cnc;ngc",
"help": "S97",
"depend": [{ "id": "showfilespanel", "value": true }]
},
{
"id": "flashfsgroup",
"type": "group",
"label": "S137",
"depend": [
{
"id": "showfilespanel",
"value": true
},
{ "connection_id": "FlashFileSystem", "value": "!='none'" }
],
"value": [
{
"id": "flashfs",
"type": "boolean",
"label": "S63",
"value": true
},
{
"id": "sort_flashfs_files",
"type": "boolean",
"label": "S224",
"value": true,
"depend": [{ "id": "flashfs", "value": true }]
}
]
},
{
"id": "sdfsgroup",
"type": "group",
"label": "S190",
"depend": [
{
"id": "showfilespanel",
"value": true
},
{ "connection_id": "SDConnection", "value": "!='none'" }
],
"value": [
{
"id": "directsd",
"type": "boolean",
"depend": [{ "connection_id": "SDConnection", "value": "!='none'" }],
"label": "S63",
"value": true
},
{
"id": "sort_sd_files",
"type": "boolean",
"label": "S224",
"value": true,
"depend": [{ "id": "directsd", "value": true }]
}
]
},
{
"id": "default_filesystem",
"type": "select",
"label": "S223",
"value": "FLASH",
"depend": [
{
"id": "showfilespanel",
"value": true
},
{
"orGroups": [
[{
"id": "sd",
"value": true
}],
[{
"id": "flashfs",
"value": true
}]
]
}
],
"options": [
{ "value": "FLASH", "label": "S137", "depend": [{ "id": "flashfs", "value": true }] },
{
"value": "DIRECTSD",
"label": "S190",
"depend": [
{ "id": "directsd", "value": true },
{ "connection_id": "SDConnection", "value": "!='none'" }
]
}
]
}
],
"jog": [
{
"id": "keymap",
"sorted": false,
"fixed": true,
"nodelete": true,
"editable": true,
"label": "S212",
"type": "list",
"value": [
{
"id": "btnjogright",
"name": "btnjogright",
"key": "ArrowRight"
},
{
"id": "btnjogleft",
"name": "btnjogleft",
"key": "ArrowLeft"
},
{
"id": "btnjogup",
"name": "btnjogup",
"key": "ArrowUp"
},
{
"id": "btnjogdown",
"name": "btnjogdown",
"key": "ArrowDown"
},
{
"id": "btnpark",
"name": "btnpark",
"key": "Home"
},
{
"id": "btnPen",
"name": "btnPen",
"key": "p"
},
{
"id": "btndistSel+",
"name": "btndistSel+",
"key": "+"
},
{
"id": "btndistSel-",
"name": "btndistSel-",
"key": "-"
},
{
"id": "btnStop",
"name": "btnStop",
"key": "Control+s"
},
{
"id": "btnEStop",
"name": "btnEStop",
"key": "Delete"
}
]
}
]
}
}

View File

@@ -1,138 +0,0 @@
/*
processor.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
import { CMD } from "./CMD-source"
import { disableUI } from "../../../components/Helpers"
//only one query at once
const onGoingQuery = {
source: "",
command: "",
started: false,
content: [],
size: 0,
feedback: null,
startTime: 0,
cb: null,
}
//set parameter for starting a catch in stream
const startCatchResponse = (source, command, feedbackfn, arg, cbfn) => {
if (onGoingQuery.source != "") {
return false
}
disableUI(true)
onGoingQuery.source = source
onGoingQuery.command = command
onGoingQuery.arg = arg
onGoingQuery.startTime = window.performance.now()
onGoingQuery.started = false
onGoingQuery.ended = false
onGoingQuery.content = []
onGoingQuery.feedback = feedbackfn
onGoingQuery.cb = cbfn
onGoingQuery.size = 0
return true
}
//stop the catch in stream
const stopCatchResponse = () => {
onGoingQuery.source = ""
disableUI(false)
}
//steps
const responseSteps = {
CMD: CMD.responseSteps,
}
const processStream = (type = "stream", data = "") => {
if (
onGoingQuery.source != "" &&
onGoingQuery.command != "" &&
type == "stream"
) {
const step = responseSteps[onGoingQuery.source][onGoingQuery.command]
//time out
if (
window.performance.now() - onGoingQuery.startTime >
(onGoingQuery.started ? 60000 : 30000)
) {
stopCatchResponse()
onGoingQuery.feedback({
status: "error",
command: onGoingQuery.command,
arg: onGoingQuery.arg,
content: "timeout",
})
return
}
//started trigger detected set started flag
if (step.start(data)) {
onGoingQuery.started = true
onGoingQuery.startTime = window.performance.now()
}
//Got final trigger on catched stream
//it catch start trigger = start trigger
if (step.end(data) && onGoingQuery.started) {
stopCatchResponse()
onGoingQuery.feedback({
status: "ok",
command: onGoingQuery.command,
arg: onGoingQuery.arg,
content:
onGoingQuery.content.length > 0
? [...onGoingQuery.content]
: [data],
})
return
}
//error or got end without start
if (step.error(data) || (step.end(data) && !onGoingQuery.started)) {
stopCatchResponse()
if (onGoingQuery.feedback)
onGoingQuery.feedback({
status: "error",
command: onGoingQuery.command,
arg: onGoingQuery.arg,
content: data,
})
return
}
//No error and no end detected so save stream data
if (onGoingQuery.started && data.length > 0) {
onGoingQuery.content.push(data)
onGoingQuery.size += data.length
//callback for data stream for update
if (onGoingQuery.cb) onGoingQuery.cb(data, onGoingQuery.size)
}
}
}
const processor = {
startCatchResponse,
stopCatchResponse,
handle: processStream,
}
export { processor }

View File

@@ -1,25 +0,0 @@
/*
realCommandsTable.js - ESP3D WebUI helpers file
Copyright (c) 2021 Luc LEBOSSE. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
const realCommandsTable = [
{ name: "#ESC#", value: "\x1B", notprintable: true },
{ name: "#ETX#", value: "\x03", notprintable: true },
]
export default realCommandsTable

View File

@@ -1,35 +0,0 @@
/*
stream.js - ESP3D WebUI Target file
Copyright (c) 2020 Luc Lebosse. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
const isVerboseOnly = (type, data) => {
const line = data.trim()
if (
line.trim().length == 0 ||
line.startsWith("[") ||
line.startsWith("ok") ||
line.startsWith("<") ||
(line.startsWith("{") && line.endsWith("}"))
)
return true
else return false
}
export { isVerboseOnly }

View File

@@ -1 +0,0 @@
@import "../../style/index";

View File

@@ -1,27 +0,0 @@
{
"HP1": "Velocity",
"HP2": "Steps",
"HP3": "steps/min",
"HP4": "Use keyboard",
"HP5": "Show axis",
"HP6": "Jog up",
"HP7": "Jog Down",
"HP8": "Keyboard keys",
"HP9": "Park command",
"HP10": "Jogging distance",
"HP11": "Stop",
"btnjogright": "Button jog right",
"btnjogleft": "Button jog left",
"btnjogup": "Button jog top",
"btnjogdown": "Button jog bottom",
"btnpark": "Park Pen",
"btnPen": "Toggle Pen",
"btndistSel+": "Next jog distance",
"btndistSel-": "Previous jog distance",
"btnStop": "Stop",
"HP16": "Quick Stop",
"HP17": "Pen",
"HP18": "If 0 use default max value",
"HP19": "Park pen",
"HP20": "Pen down"
}

View File

@@ -1,41 +0,0 @@
/*
variablesTable.js - ESP3D WebUI helpers file
Copyright (c) 2021 Luc LEBOSSE. All rights reserved.
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with This code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
import { h } from "preact"
const variablesTable = [
{ name: "#pos_x#", value: 0 },
{ name: "#pos_y#", value: 0 },
{ name: "#pos_z#", value: 0 },
{ name: "#pos_a#", value: 1 },
{ name: "#pos_b#", value: 1 },
{ name: "#pos_c#", value: 0 },
{ name: "#pos_wx#", value: 0 },
{ name: "#pos_wy#", value: 0 },
{ name: "#pos_wz#", value: 0 },
{ name: "#pos_wa#", value: 0 },
{ name: "#pos_wb#", value: 0 },
{ name: "#pos_wc#", value: 0 },
{ name: "#prb_x#", value: 0 },
{ name: "#prb_y#", value: 0 },
{ name: "#prb_z#", value: 0 },
{ name: "#laser_max#", value: 0 },
{ name: "#selected_axis#", value: "X" },
{ name: "#probe_thickness#", value: 0 },
]
export default variablesTable

View File

@@ -1,101 +0,0 @@
{
"settings": {
"jog": [
{
"id": "axis",
"type": "group",
"label": "HP5",
"value": [
{
"id": "showx",
"type": "boolean",
"label": "X",
"value": true
},
{
"id": "showy",
"type": "boolean",
"label": "Y",
"value": true
},
{
"id": "showpen",
"type": "boolean",
"label": "HP17",
"value": true
}
]
},
{
"id": "invertx",
"type": "boolean",
"label": "S209",
"value": false,
"depend": [
{
"id": "showx",
"value": true
}
]
},
{
"id": "inverty",
"type": "boolean",
"label": "S210",
"value": false,
"depend": [
{
"id": "showy",
"value": true
}
]
},
{
"id": "swapxy",
"type": "boolean",
"label": "S211",
"value": false,
"depend": [
{
"id": "showx",
"value": true
},
{
"id": "showy",
"value": true
}
]
},
{
"id": "velocity",
"type": "number",
"label": "HP1",
"value": 0,
"min": 0,
"help": "HP18"
},
{
"id": "steps",
"type": "number",
"label": "HP2",
"value": "40",
"min": 1,
"append": "HP3"
},
{
"id": "jogparkcmd",
"type": "text",
"label": "HP9",
"value": "PA;PU0,0;",
"help": "S97"
},
{
"id": "jogstopcmd",
"type": "text",
"label": "HP16",
"value": "#ESC#.K",
"help": "S97"
}
]
}
}

View File

@@ -1,95 +0,0 @@
.H-100 {
height: 100%;
}
.W-100 {
width: 100%;
}
.jog-container {
display: flex;
height: 100%;
width: 100%;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}
.jog-positions-ctrls {
display: flex;
width: 100%;
justify-content: space-evenly;
}
.jog-position-ctrl {
min-width: 3rem;
border: 0.05rem solid #dadee4;
border-radius: 5px;
}
.jog-position-sub-header,
.jog-position-header {
border-bottom: 0.05rem solid #dadee4;
color: #5755d9;
background-color: #f1f1fc;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 70%;
}
.jog-position-header {
border-radius: 5px 5px 0px 0px;
}
.jog-position-value {
display: flex;
justify-content: center;
align-items: center;
color: #5755d9;
font-size: 80%;
}
.jog-buttons-container-horizontal,
.jog-buttons-container {
display: flex;
justify-content: space-between;
border: 0.05rem solid #dadee4;
border-radius: 5px;
}
.jog-buttons-container {
flex-direction: column;
}
.jog-buttons-line-container,
.jog-buttons-main-container {
display: flex;
justify-content: space-between;
}
.jog-extra-buttons-container {
display: flex;
width: 100%;
justify-content: center;
align-items: center;
gap: 0.8rem;
}
.jog-buttons-line-top-container,
.jog-buttons-line-bottom-container {
display: flex;
justify-content: center;
}
.jog-distance-selector-container {
display: flex;
flex-direction: column;
justify-content: center;
}
.jog-distance-selector-header {
border: 0.05rem solid #5755d9 !important;
border-radius: 5px 5px 0px 0px;
color: #5755d9;
background-color: #f1f1fc;
}

View File

@@ -1 +0,0 @@
{}

View File

@@ -71,19 +71,20 @@
"type": "text",
"label": "S96",
"value": "g;G;gco;GCO;gcode;GCODE;nc;txt",
"help": "S97"
"help": "S97",
"depend": [{ "id": "showfilespanel", "value": true }]
},
{
"id": "flashfs",
"type": "boolean",
"depend": [{ "connection_id": "FlashFileSystem", "value": "!='none'" }],
"depend": [{ "connection_id": "FlashFileSystem", "value": "!='none'" },{ "id": "showfilespanel", "value": true }],
"label": "S137",
"value": true
},
{
"id": "directsd",
"type": "boolean",
"depend": [{ "connection_id": "SDConnection", "value": "!='none'" }],
"depend": [{ "connection_id": "SDConnection", "value": "!='none'" },{ "id": "showfilespanel", "value": true }],
"label": "S190",
"value": true
}
@@ -97,6 +98,7 @@
"editable": true,
"label": "S212",
"type": "list",
"depend": [{ "id": "showjogpanel", "value": true }],
"value": [
{
"id": "btn+X",

View File

@@ -5,6 +5,7 @@
"id": "axis",
"type": "group",
"label": "CN8",
"depend": [{ "id": "showjogpanel", "value": true }],
"value": [
{
"id": "showx",
@@ -48,6 +49,7 @@
"id": "feedrate",
"type": "group",
"label": "CN9",
"depend": [{ "id": "showjogpanel", "value": true }],
"value": [
{
"id": "xyfeedrate",
@@ -117,6 +119,7 @@
"id": "home",
"type": "group",
"label": "CN17",
"depend": [{ "id": "showjogpanel", "value": true }],
"value": [
{
"id": "homesingleaxis",
@@ -138,14 +141,16 @@
"type": "text",
"label": "CN19",
"value": "G10 L20 P0 #",
"help": "CN11"
"help": "CN11",
"depend": [{ "id": "showjogpanel", "value": true }]
},
{
"id": "jogstopcmd",
"type": "text",
"label": "CN23",
"value": "#SAFETYDOOR#",
"help": "S97"
"help": "S97",
"depend": [{ "id": "showjogpanel", "value": true }]
}
]
}