Make MX state multiple instead of unique

Add M6 for Tool change
Bump version
Build package
Update grbl test server to have changing $G report
This commit is contained in:
Luc
2024-12-03 08:16:41 +08:00
parent 29daa79c7c
commit dae9c6d5b5
20 changed files with 91 additions and 53 deletions

View File

@@ -27,6 +27,7 @@ let lastconnection = Date.now()
let logindone = false
const sessiontTime = 60000
let countStatus = 0
let change = false
function getLastconnection() {
return lastconnection
@@ -201,7 +202,13 @@ const commandsQuery = (req, res, SendWS) => {
}
if (url.indexOf("$G") != -1) {
SendWS("[GC:G0 G54 G17 G21 G90 G94 M5 M9 T0 F0.0 S0]\n")
change = !change
if (change) {
SendWS("[GC:G0 G54 G17 G21 G90 G94 M4 M5 M6 M7 M8 T0 F0.0 S0]\n")
} else {
SendWS("[GC:G0 G54 G17 G21 G90 G94 M5 M9 T0 F0.0 S0]\n")
}
res.send("")
return
}

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -1,3 +1,3 @@
{
"version": "3.0.0-a79"
"version": "3.0.0-a81"
}

View File

@@ -10,7 +10,7 @@
"showinformationpage": true,
"showmachinesettings": true,
"enableautorepeat": false,
"enableshortcuts": true,
"enableshortcuts": false,
"autorepeatdelay": "500",
"emergencystop": "#SAFETYDOOR#",
"fixedpanels": false,
@@ -74,15 +74,15 @@
"openterminalonstart": true,
"verbose": true,
"autoscroll": true,
"showfilespanel": true,
"showfilespanel": false,
"openfilesonstart": true,
"filesfilter": "g;G;gco;GCO;gcode;GCODE;nc;txt",
"filesfilter": "g;G;gco;GCO;gcode;GCODE;nc;txt;cnc;ngc",
"flashfs": true,
"sort_flashfs_files": true,
"directsd": true,
"sort_sd_files": true,
"default_filesystem": "DIRECTSD",
"showjogpanel": true,
"sort_directsd_files": true,
"default_filesystem": "FLASH",
"showjogpanel": false,
"openjogonstart": true,
"homesingleaxis": false,
"homecmd": "$H#",
@@ -193,12 +193,12 @@
{
"id": "btnaxisSel+",
"name": "btnaxisSel+",
"key": "Shift+)"
"key": "Control+0"
},
{
"id": "btnaxisSel-",
"name": "btnaxisSel-",
"key": "Shift+("
"key": "Control+9"
},
{
"id": "btndistSel+",
@@ -221,43 +221,24 @@
"key": "Delete"
}
],
"shownotificationspanel": true,
"shownotificationspanel": false,
"opennotificationsonstart": false,
"notifautoscroll": true,
"showmacrospanel": true,
"openmacrosonstart": true,
"showmacrospanel": false,
"openmacrosonstart": false,
"macros": [],
"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"
}
],
"showextracontents": false,
"openextrapanelsonstart": false,
"extracontents": [],
"showstatuspanel": true,
"openstatusonstart": true,
"showprobepanel": true,
"showprobepanel": false,
"openprobeonstart": true,
"probefeedrate": 20,
"maxprobe": 15,
"probethickness": "1",
"probepostcommand": "G10 L20 P1 #selected_axis##probe_thickness#",
"showlaserpanel": true,
"showlaserpanel": false,
"openlaseronstart": true,
"lasertest": 10,
"lasertestprecent": 20,
@@ -268,8 +249,8 @@
"showM4ctrls": true,
"showCoolantctrls": true,
"showMistctrls": true,
"showM7ctrls": false,
"showoverridespanel": true,
"showM7ctrls": true,
"showoverridespanel": false,
"openoverridesonstart": true
}
}

View File

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

View File

@@ -47,6 +47,7 @@ const spindleSpeedValue = {}
const SpindleControls = () => {
const { states } = useTargetContext()
console.log(states)
const { interfaceSettings, connectionSettings } = useSettingsContext()
//Add callback to reset event
eventsList.on("reset", onReset)
@@ -137,6 +138,12 @@ const SpindlePanel = () => {
command: "M5",
mode: "spindle_mode",
},
{
label: "M6",
tooltip: "CN109",
command: "M6",
mode: "spindle_mode",
},
],
control: {
id: "spindlespeedInput",
@@ -311,8 +318,14 @@ const SpindlePanel = () => {
}
}
if (states && button.mode && states[button.mode]) {
if (states[button.mode].value == button.label) {
classname += " btn-primary"
if (Array.isArray(states[button.mode])){
if(states[button.mode].some(item => item.value==button.label)){
classname += " btn-primary"
}
} else {
if (states[button.mode].value == button.label) {
classname += " btn-primary"
}
}
}
return (

View File

@@ -300,6 +300,29 @@ const StatusPanel = () => {
<div class="states-buttons-container">
{variablesList.modes.map((element) => {
if (states[element.id]) {
if (Array.isArray(states[element.id])) {
return states[element.id].map((item) => {
return(
<Button
m1
tooltip
data-tooltip={T(
item.value
)}
onClick={(e) => {
useUiContextFn.haptic()
e.target.blur()
//TBD if need to change value from here
}}
>
{item.pre
? item.pre
: null}
{item.value}
</Button>
)
})
} else
return (
<Button
m1

View File

@@ -216,7 +216,12 @@ const getStates = (str) => {
} else {
gcode_parser_modes.forEach((mode) => {
if (mode.values && mode.values.includes(cur)) {
acc[mode.id] = { value: cur }
if (mode.multiple) {
if (!acc[mode.id]) acc[mode.id] = []
acc[mode.id].push ({ "value": cur })
} else {
acc[mode.id] = { "value": cur }
}
}
})
}

View File

@@ -47,8 +47,8 @@ const gcode_parser_modes = [
{ id: "cutter_compensation_mode", values: ["G40"], label: "CN52" },
{ id: "tool_length_offset_mode", values: ["G43.1", "G49"], label: "CN53" },
{ id: "control_mode", values: ["M0", "M1", "M2", "M30"], label: "CN54" },
{ id: "spindle_mode", values: ["M3", "M4", "M5"], label: "CN55" },
{ id: "coolant_mode", values: ["M7", "M8", "M9"], label: "CN56" },
{ id: "spindle_mode", values: ["M3", "M4", "M5", "M6"], label: "CN55", multiple: true},
{ id: "coolant_mode", values: ["M7", "M8", "M9"], label: "CN56", multiple: true },
{ id: "override_control", values: ["M56"], label: "CN57" },
{ id: "T", pre: "T", label: "CN58" },
{ id: "S", pre: "S", label: "CN59" },

View File

@@ -229,9 +229,13 @@ const getStates = (str) => {
] = { value: parseFloat(cur.substring(1)) }
} else {
gcode_parser_modes.forEach((mode) => {
const el = cur.split(":")[0]
if (mode.values && mode.values.includes(el)) {
acc[mode.id] = { value: cur }
if (mode.values && mode.values.includes(cur)) {
if (mode.multiple) {
if (!acc[mode.id]) acc[mode.id] = []
acc[mode.id].push ({ "value": cur })
} else {
acc[mode.id] = { "value": cur }
}
}
})
}

View File

@@ -82,9 +82,9 @@ const gcode_parser_modes = [
values: ["M0", "M1", "M2", "M30", "M60"],
label: "CN54",
},
{ id: "spindle_mode", values: ["M3", "M4", "M5"], label: "CN55" },
{ id: "spindle_mode", values: ["M3", "M4", "M5", "M6"], label: "CN55", multiple: true },
{ id: "tool_change", values: ["M6"], label: "CN109" },
{ id: "coolant_mode", values: ["M7", "M8", "M9"], label: "CN56" },
{ id: "coolant_mode", values: ["M7", "M8", "M9"], label: "CN56", multiple: true },
{ id: "ovc_feed_rate_disable", values: ["M50"], label: "CN110" },
{ id: "ovc_rpm_disable", values: ["M51"], label: "CN111" },
{ id: "ovc_hold_disable", values: ["M53"], label: "CN112" },

View File

@@ -217,7 +217,12 @@ const getStates = (str) => {
} else {
gcode_parser_modes.forEach((mode) => {
if (mode.values && mode.values.includes(cur)) {
acc[mode.id] = { value: cur }
if (mode.multiple) {
if (!acc[mode.id]) acc[mode.id] = []
acc[mode.id].push ({ "value": cur })
} else {
acc[mode.id] = { "value": cur }
}
}
})
}

View File

@@ -47,8 +47,8 @@ const gcode_parser_modes = [
{ id: "cutter_compensation_mode", values: ["G40"], label: "CN52" },
{ id: "tool_length_offset_mode", values: ["G43.1", "G49"], label: "CN53" },
{ id: "control_mode", values: ["M0", "M1", "M2", "M30"], label: "CN54" },
{ id: "spindle_mode", values: ["M3", "M4", "M5"], label: "CN55" },
{ id: "coolant_mode", values: ["M7", "M8", "M9"], label: "CN56" },
{ id: "spindle_mode", values: ["M3", "M4", "M5", "M6"], label: "CN55", multiple: true },
{ id: "coolant_mode", values: ["M7", "M8", "M9"], label: "CN56", multiple: true },
{ id: "override_control", values: ["M56"], label: "CN57" },
{ id: "T", pre: "T", label: "CN58" },
{ id: "S", pre: "S", label: "CN59" },