Skip to content

Commit 8b3083a

Browse files
author
Luc
committed
Fix deadloop if no FW settings and has autopolling enabled
1 parent 8c9bcbd commit 8b3083a

File tree

12 files changed

+52
-14
lines changed

12 files changed

+52
-14
lines changed

dist/grbl/debug/index.html.gz

11 Bytes
Binary file not shown.

dist/grbl/production/index.html.gz

0 Bytes
Binary file not shown.

dist/printer/debug/index.html.gz

56 Bytes
Binary file not shown.
41 Bytes
Binary file not shown.

src/components/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
initApp,
3232
preferences,
3333
stopPolling,
34+
startPolling,
3435
startWizard,
3536
} from "./settings"
3637
import { Header, ExtraPages } from "./header"
@@ -218,6 +219,7 @@ export {
218219
beepError,
219220
beep,
220221
stopPolling,
222+
startPolling,
221223
finishSetup,
222224
disconnectPage,
223225
disconnectWsServer,

src/components/printer/files.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@ import {
3838
SendPostHttp,
3939
cancelCurrentQuery,
4040
lastError,
41+
clearCommandList,
4142
} from "../http"
4243
import { useStoreon } from "storeon/preact"
4344
import { showDialog, updateProgress } from "../dialog"
44-
import { esp3dSettings, prefs, getPanelIndex } from "../app"
45+
import {
46+
esp3dSettings,
47+
prefs,
48+
getPanelIndex,
49+
stopPolling,
50+
startPolling,
51+
} from "../app"
4552
/*
4653
* Local constants
4754
*
@@ -207,6 +214,7 @@ function sdSerialListSuccess(responseText) {}
207214
*/
208215
function sdSerialListError(errorCode, responseText) {
209216
isSDListRequested = false
217+
startPolling()
210218
fileSystemLoaded[currentFilesType] = false
211219
showDialog({ type: "error", numError: errorCode, message: T("S103") })
212220
}
@@ -218,8 +226,10 @@ function ListSDSerialFiles() {
218226
let cmd = listSDSerialFilesCmd()
219227
if (cmd) {
220228
console.log(cmd[0])
221-
SendCommand(cmd[0], sdCheckSuccess, sdCheckError, null, "sdlist", 1)
222229
isSDListRequested = true
230+
stopPolling()
231+
clearCommandList()
232+
SendCommand(cmd[0], sdCheckSuccess, sdCheckError, null, "sdlist", 1)
223233
listDataSize = 0
224234
}
225235
}
@@ -389,6 +399,7 @@ function processFiles(rawdata) {
389399
if (response) {
390400
if (data.indexOf(response[2]) != -1) {
391401
isSDListRequested = false
402+
startPolling()
392403
isSDListDetected = false
393404
fileSystemCache[currentFilesType] = []
394405
fileSystemCache[currentFilesType].files = generateSDList(
@@ -405,6 +416,7 @@ function processFiles(rawdata) {
405416
data.status = T("S111")
406417
buildStatus(data)
407418
isSDListRequested = false
419+
startPolling()
408420
isSDListDetected = false
409421
//revert path to allow refresh
410422
let pos = currentPath[currentFilesType].lastIndexOf("/")
@@ -720,7 +732,7 @@ function processCreateDir() {
720732

721733
function startJobFile(source, filename) {
722734
console.log("print " + filename + " from " + source)
723-
let cmd =""
735+
let cmd = ""
724736
const { dispatch } = useStoreon()
725737
dispatch("status/print", T("P63"))
726738
switch (source) {
@@ -731,8 +743,11 @@ function startJobFile(source, filename) {
731743
case "repetier":
732744
case "marlin":
733745
case "marlinkimbra":
734-
if((esp3dSettings.serialprotocol == "MKS") && ((source=="TFTSD") || (source=="TFTUSB"))) {
735-
if (source=="TFTSD") cmd = "M998 1\n"
746+
if (
747+
esp3dSettings.serialprotocol == "MKS" &&
748+
(source == "TFTSD" || source == "TFTUSB")
749+
) {
750+
if (source == "TFTSD") cmd = "M998 1\n"
736751
else cmd = "M998 0\n"
737752
}
738753
cmd += "M23 " + filename + "\nM24"

src/components/printer/index.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@
1919
*/
2020

2121
import { h, Fragment } from "preact"
22-
import { Setting, esp3dSettings, prefs, beep } from "../app"
22+
import {
23+
Setting,
24+
esp3dSettings,
25+
prefs,
26+
beep,
27+
startPolling,
28+
stopPolling,
29+
} from "../app"
2330
import { useEffect } from "preact/hooks"
2431
import { T } from "../translations"
25-
import { SendCommand } from "../http"
32+
import { SendCommand, clearCommandList } from "../http"
2633
import { JogPanel, processPositions } from "./jog"
2734
import { TemperaturesPanel, processTemperatures } from "./temperatures"
2835
import { FeedratePanel, processFeedRate } from "./feedrate"
@@ -688,6 +695,7 @@ function processWSData(buffer) {
688695
}
689696
isConfigData = false
690697
isConfigRequested = false
698+
startPolling()
691699
if (
692700
buffer.startsWith(configurationCmd(isoverloadedconfig)[2])
693701
) {
@@ -802,6 +810,8 @@ function processConfigData() {
802810
*/
803811
function timeoutError() {
804812
stopTimeout()
813+
startPolling()
814+
isConfigRequested = false
805815
showDialog({ type: "error", numError: 404, message: T("P17") })
806816
}
807817

@@ -820,16 +830,18 @@ function stopTimeout() {
820830
if (timeoutLoader != null) {
821831
clearInterval(timeoutLoader)
822832
}
823-
timeoutLoader = null
824833
}
825834

826835
/*
827836
* Load Firmware settings
828837
*/
829838
function loadConfig() {
830839
const cmd = configurationCmd(isoverloadedconfig)[0]
840+
stopPolling()
841+
console.log("***************************************");
831842
isloaded = true
832843
isConfigRequested = true
844+
clearCommandList()
833845
isConfigData = false
834846
configDataSize = 0
835847
listrawSettings = []
@@ -845,6 +857,7 @@ function loadConfig() {
845857
function loadConfigError(errorCode, responseText) {
846858
isConfigRequested = false
847859
isConfigData = false
860+
startPolling()
848861
showDialog({ type: "error", numError: errorCode, message: T("S5") })
849862
}
850863

src/components/printer/status.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,12 @@ function processStatus(buffer) {
121121
//M994 filename;size
122122
let status = buffer.split(" ")
123123
printFileName = status[1].split(";")[0]
124-
if (printFileName.startsWith("0:") || printFileName.startsWith("1:")){
125-
let f = printFileName.replace("0:", "USB:")
126-
printFileName = f.replace("1:", "SD:")
124+
if (
125+
printFileName.startsWith("0:") ||
126+
printFileName.startsWith("1:")
127+
) {
128+
let f = printFileName.replace("0:", "USB:")
129+
printFileName = f.replace("1:", "SD:")
127130
}
128131
dispatch("status/print", printFileName + lastStatus)
129132
lastStatusReset = 0

src/components/settings/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
setcurrentprefs,
3333
initApp,
3434
stopPolling,
35+
startPolling,
3536
} from "./webui"
3637
import { Esp3DSettings } from "./esp3d"
3738
import { useStoreon } from "storeon/preact"
@@ -69,5 +70,6 @@ export {
6970
setcurrentprefs,
7071
initApp,
7172
stopPolling,
73+
startPolling,
7274
startWizard,
7375
}

src/components/settings/webui.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
cancelCurrentQuery,
3939
SendGetHttp,
4040
SendPostHttp,
41+
clearCommandList,
4142
} from "../http"
4243
import { useStoreon } from "storeon/preact"
4344
import { useEffect } from "preact/hooks"
@@ -127,6 +128,7 @@ function stopPolling() {
127128
clearInterval(pollingInterval)
128129
}
129130
pollingInterval = null
131+
console.log("Stop polling")
130132
}
131133

132134
/*
@@ -1984,6 +1986,7 @@ export {
19841986
prefs,
19851987
WebUISettings,
19861988
stopPolling,
1989+
startPolling,
19871990
macros,
19881991
LanguageSelection,
19891992
}

0 commit comments

Comments
 (0)