mirror of
https://github.com/luc-github/ESP3D-WEBUI.git
synced 2026-02-20 01:11:21 +01:00
Fix #372 Thanks @DivingDuck for pointing this out
This commit is contained in:
BIN
dist/Printer3D/Smoothieware/index.html.gz
vendored
BIN
dist/Printer3D/Smoothieware/index.html.gz
vendored
Binary file not shown.
@@ -17,14 +17,14 @@
|
||||
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"
|
||||
import { h } from 'preact'
|
||||
import { useSettingsContextFn } from '../../../contexts'
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ok acknowledge
|
||||
const isOk = (str) => {
|
||||
if (str.startsWith("ok")) {
|
||||
if (str == 'ok') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -70,7 +70,7 @@ const getTemperatures = (str) => {
|
||||
//result[4] = target
|
||||
//Note :on multiple extruders T is the active one, it will be erased by the next T0
|
||||
while ((result = regex_search.exec(str)) !== null) {
|
||||
response[result[1]][result[2] == "" ? 0 : result[2]] = {
|
||||
response[result[1]][result[2] == '' ? 0 : result[2]] = {
|
||||
value: result[3],
|
||||
target: result[4],
|
||||
}
|
||||
@@ -130,12 +130,12 @@ const getPrintStatus = (str) => {
|
||||
}
|
||||
if ((result = reg_search2.exec(str)) !== null) {
|
||||
return {
|
||||
status: "Printing",
|
||||
status: 'Printing',
|
||||
printing: true,
|
||||
progress: result[1],
|
||||
}
|
||||
}
|
||||
return { status: "Unknown", printing: false, progress: 0 }
|
||||
return { status: 'Unknown', printing: false, progress: 0 }
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
@@ -157,7 +157,7 @@ const getPrintFileName = (str) => {
|
||||
if ((result = reg_search1.exec(str)) !== null) {
|
||||
return result[1]
|
||||
}
|
||||
return "Unknown"
|
||||
return 'Unknown'
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
@@ -186,7 +186,7 @@ const getStatus = (str) => {
|
||||
if ((result = reg_search2.exec(str)) !== null) {
|
||||
return result[1]
|
||||
}
|
||||
return "Unknown"
|
||||
return 'Unknown'
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
@@ -242,7 +242,7 @@ const getFeedRate = (str) => {
|
||||
//...
|
||||
const isPrinterCapability = (str) => {
|
||||
const reg_search1 = /^Cap:([^:]+):[0-1]$/
|
||||
if (str.startsWith("FIRMWARE_NAME:") || reg_search1.test(str)) {
|
||||
if (str.startsWith('FIRMWARE_NAME:') || reg_search1.test(str)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -250,9 +250,9 @@ const isPrinterCapability = (str) => {
|
||||
|
||||
const getPrinterCapability = (str) => {
|
||||
let result = null
|
||||
const res = str.split(",").reduce((acc, cur) => {
|
||||
const sp = cur.split(":")
|
||||
acc.push({ name: sp[0], value: sp.slice(1).join(":") })
|
||||
const res = str.split(',').reduce((acc, cur) => {
|
||||
const sp = cur.split(':')
|
||||
acc.push({ name: sp[0], value: sp.slice(1).join(':') })
|
||||
return acc
|
||||
}, [])
|
||||
|
||||
@@ -263,12 +263,12 @@ const getPrinterCapability = (str) => {
|
||||
//
|
||||
//Sensor
|
||||
const isSensor = (str) => {
|
||||
return str.startsWith("SENSOR:")
|
||||
return str.startsWith('SENSOR:')
|
||||
}
|
||||
|
||||
const getSensor = (str) => {
|
||||
const result = []
|
||||
const data = " " + str.substring(7)
|
||||
const data = ' ' + str.substring(7)
|
||||
let res = null
|
||||
const reg_search = /\s(?<value>[^\[]+)\[(?<unit>[^\]]+)\]/g
|
||||
while ((res = reg_search.exec(data))) {
|
||||
|
||||
@@ -17,59 +17,59 @@
|
||||
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 } from "./MachineSettings"
|
||||
import { h } from 'preact'
|
||||
import { iconsTarget } from './icons'
|
||||
import { files } from './files'
|
||||
import { processor } from './processor'
|
||||
import { defaultPanelsList } from './panels'
|
||||
import { MachineSettings } from './MachineSettings'
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
MixedExtrudersControl,
|
||||
BackgroundContainer,
|
||||
} from "./Controls"
|
||||
} from './Controls'
|
||||
import {
|
||||
TargetContextProvider,
|
||||
useTargetContext,
|
||||
useTargetContextFn,
|
||||
} from "./TargetContext"
|
||||
import variablesTable from "./variablesTable"
|
||||
import { AppLogo } from "../../../components/Images/logo"
|
||||
import { Eye as WebUILogo } from "preact-feather"
|
||||
import { addObjectItem, removeObjectItem } from "../../../components/Helpers"
|
||||
} from './TargetContext'
|
||||
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 = "Smoothieware"
|
||||
const webUIbuild = "S2"
|
||||
const Name = "ESP3D"
|
||||
const Target = 'Smoothieware'
|
||||
const webUIbuild = 'S3'
|
||||
const Name = 'ESP3D'
|
||||
const fwUrl = [
|
||||
"https://github.com/luc-github/ESP3D/tree/3.0",
|
||||
"https://github.com/luc-github/ESP3D-TFT",
|
||||
'https://github.com/luc-github/ESP3D/tree/3.0',
|
||||
'https://github.com/luc-github/ESP3D-TFT',
|
||||
]
|
||||
|
||||
const restartdelay = 30
|
||||
const variablesList = {
|
||||
commands: [...variablesTable],
|
||||
addCommand: (variable) =>
|
||||
addObjectItem(variablesList.commands, "name", variable),
|
||||
addObjectItem(variablesList.commands, 'name', variable),
|
||||
removeCommand: (name) =>
|
||||
removeObjectItem(variablesList.commands, "name", name),
|
||||
removeObjectItem(variablesList.commands, 'name', name),
|
||||
}
|
||||
const eventsList = {
|
||||
evts: [],
|
||||
on: (event, fn) => {
|
||||
if (typeof eventsList.evts[event] === "undefined") {
|
||||
if (typeof eventsList.evts[event] === 'undefined') {
|
||||
eventsList.evts[event] = []
|
||||
}
|
||||
addObjectItem(eventsList.evts[event], "fn", { fn: fn })
|
||||
addObjectItem(eventsList.evts[event], 'fn', { fn: fn })
|
||||
},
|
||||
off: (event, fn) => {
|
||||
removeObjectItem(variablesList.evts[event], "fn", 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)
|
||||
if (typeof element.fn === 'function') element.fn(data)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user