Skip to content

Commit

Permalink
Add enable shortcut as setting
Browse files Browse the repository at this point in the history
Allow 3 digits for probe thickness
Use probe thickness setting step for probe panel probe thickness step
Improve real modulo issue workaround
  • Loading branch information
luc-github committed Jan 18, 2024
1 parent 82b6355 commit 958d468
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 8 deletions.
Binary file modified dist/CNC/GRBL/index.html.gz
Binary file not shown.
Binary file modified dist/CNC/GRBLHal/index.html.gz
Binary file not shown.
Binary file modified dist/Plotter/HP-GL/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Marlin-embedded/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Marlin/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Repetier/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Smoothieware/index.html.gz
Binary file not shown.
Binary file modified dist/SandTable/GRBL/index.html.gz
Binary file not shown.
1 change: 1 addition & 0 deletions server/CNC/GRBL/Flash/preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"showinformationpage": true,
"showmachinesettings": true,
"enableautorepeat": false,
"enableshortcuts": true,
"autorepeatdelay": "500",
"emergencystop": "#SAFETYDOOR#",
"fixedpanels": false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/App/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
import { h } from 'preact'
import { webUIbuild } from '../../targets'
export const webUIversion = '3.0.0-a49'
export const webUIversion = '3.0.0-a50'
export const Esp3dVersion = () => (
<span>
{webUIversion}.{webUIbuild}
Expand Down
10 changes: 6 additions & 4 deletions src/components/Panels/ProbeCNC.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ const ProbePanel = () => {
label: 'CN94',
tooltip: 'CN94',
min: 0,
step: "0.1",
step: useUiContextFn.getElement('probethickness').step,
value: probethickness,
append: 'CN96',
variableName: '#probe_thickness#',
Expand Down Expand Up @@ -488,9 +488,11 @@ const ProbePanel = () => {
}
if (typeof element.step!=="undefined") {
//hack to avoid float precision issue
const mult=1/element.step
console.log(element.value.current,element.step,mult, (element.value.current * mult ) % (element.step* mult))
if ((element.value.current * mult ) % (element.step* mult) != 0) {
const mult=(1/element.step).toFixed(0)
const valueMult = Math.round(element.value.current * mult )
const stepMult = Math.round(element.step* mult)
console.log("Element:",element.value.current, "Step:",element.step,"Mult",mult, "Modal:", "Value mult", valueMult, "Step mult", stepMult, "Modulo", valueMult % stepMult)
if (valueMult % stepMult != 0) {
console.log("not valid", )
validation.valid = false
}
Expand Down
14 changes: 14 additions & 0 deletions src/pages/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const keyboardEventHandlerDown = (e) => {
document.getElementById(cmdMatch).click()
}
}
let intialisationDone = false

const Dashboard = () => {
console.log("Dashboard")
Expand Down Expand Up @@ -182,6 +183,19 @@ const Dashboard = () => {
}
}


useEffect(() => {
if (!intialisationDone) {
console.log("Init")
intialisationDone = true
console.log(uisettings.getValue("enableshortcuts"))
setIsKeyboardEnabled(uisettings.getValue("enableshortcuts"))
shortcuts.enable(uisettings.getValue("enableshortcuts"))
} else {
console.log("Init Done")
}
}, [])

useEffect(() => {
if (shortcuts.enabled) {
AddKeyboardListener()
Expand Down
7 changes: 5 additions & 2 deletions src/tabs/interface/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ const InterfaceTab = () => {
} else {
if (typeof fieldData.step!=="undefined") {
//hack to avoid float precision issue
const mult=1/fieldData.step
if ((fieldData.value * mult ) % (fieldData.step* mult) != 0) {
const mult=(1/fieldData.step).toFixed(0)
const valueMult = Math.round(fieldData * mult )
const stepMult = Math.round(fieldData.step* mult)

if ((valueMult % stepMult ) != 0) {
validation.message = <Flag size="1rem" color="red" />
validation.valid = false
}
Expand Down
2 changes: 1 addition & 1 deletion src/targets/CNC/preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"type": "number",
"label": "CN94",
"value": "1",
"step": "0.1",
"step": "0.001",
"append": "CN96",
"min": 0
},
Expand Down
6 changes: 6 additions & 0 deletions src/targets/preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
"label": "S217",
"value": false
},
{
"id": "enableshortcuts",
"type": "boolean",
"label": "S215",
"value": false
},
{
"id": "autorepeatdelay",
"type": "number",
Expand Down

0 comments on commit 958d468

Please sign in to comment.