Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const {
configURI,
getLastconnection,
hasEnabledAuthentication,
marlinBftURI,
} = require(
path.normalize(
__dirname + "/targets/" + target + "/" + subtarget + "/index.js"
Expand Down Expand Up @@ -118,6 +119,12 @@ app.get("/command", function (req, res) {
}
})

if (marlinBftURI) {
app.all("/printer-sd-transfer", function (req, res) {
marlinBftURI(req, res, SendWS)
})
}

/*app.get("/sdfiles", function (req, res) {
res.status(200);
res.send(
Expand Down
60 changes: 59 additions & 1 deletion config/targets/Printer3D/Marlin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ let logindone = false
const sessiontTime = 60000
const isTFT = false
const roomTemperature = 20
let binaryTransfer = {
status: "idle",
active: false,
progress: 0,
error: "",
}
const temperatures = {
T: [
{
Expand Down Expand Up @@ -464,7 +470,7 @@ const commandsQuery = (req, res, SendWS, context) => {
SendWS(
"FIRMWARE_NAME:Marlin 2.0.9.1 (Sep 8 2021 17:07:06) SOURCE_CODE_URL:github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:MRR ESPA EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff\n" +
"Cap:SERIAL_XON_XOFF:0\n" +
"Cap:BINARY_FILE_TRANSFER:0\n" +
"Cap:BINARY_FILE_TRANSFER:1\n" +
"Cap:EEPROM:0\n" +
"Cap:VOLUMETRIC:1\n" +
"Cap:AUTOREPORT_POS:0\n" +
Expand Down Expand Up @@ -1126,10 +1132,62 @@ const configURI = (req, res) => {
)
}

const marlinBftURI = (req, res, SendWS) => {
const action = req.query.action || "status"
if (action == "start") {
if (binaryTransfer.active) {
res.status(409).json(binaryTransfer)
return
}
binaryTransfer = {
status: "checking_capabilities",
active: true,
progress: 0,
source: req.query.source || "",
destination: req.query.destination || "",
error: "",
startedAt: Date.now(),
}
SendWS("printerLink:captured:binary-transfer", false, false)
res.status(202).json(binaryTransfer)
return
}
if (action == "cancel") {
binaryTransfer.status = "cancelled"
binaryTransfer.active = false
SendWS("printerLink:released", false, false)
res.status(202).json(binaryTransfer)
return
}
if (action != "status") {
res.status(400).json({
status: "failed",
active: false,
error: "Unknown action",
})
return
}
if (binaryTransfer.active) {
binaryTransfer.progress = Math.min(
100,
Math.floor((Date.now() - binaryTransfer.startedAt) / 50)
)
binaryTransfer.status =
binaryTransfer.progress < 10 ? "checking_capabilities" : "writing"
if (binaryTransfer.progress == 100) {
binaryTransfer.status = "completed"
binaryTransfer.active = false
SendWS("printerLink:released", false, false)
}
}
res.json(binaryTransfer)
}

module.exports = {
commandsQuery,
configURI,
loginURI,
getLastconnection,
hasEnabledAuthentication,
marlinBftURI,
}
Binary file modified dist/CNC/GRBL/index.html.br
Binary file not shown.
Binary file modified dist/CNC/GRBL/index.html.gz
Binary file not shown.
Binary file modified dist/CNC/GRBLHal/index.html.br
Binary file not shown.
Binary file modified dist/CNC/GRBLHal/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Marlin-embedded/index.html.br
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.br
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.br
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.br
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.br
Binary file not shown.
Binary file modified dist/SandTable/GRBL/index.html.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/Helpers/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const filterResultFiles = (files, path) => {
//it is file or subfile ?
if (newpath.indexOf("/") == -1 && newpath.length > 0) {
//file
acc.push({ name: newpath, size: element.size })
acc.push({ ...element, name: newpath })
} else {
//subdir
const foldername = newpath.substring(
Expand Down
Loading