Skip to content

Commit

Permalink
P1 Series with .gcode file fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfwithSword committed Sep 15, 2023
1 parent da50b1b commit c46ea33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion files/nodered/advanced_ftp_db_flow_group.json
Original file line number Diff line number Diff line change
Expand Up @@ -3958,7 +3958,7 @@
"z": "fbda6ab16491b918",
"g": "615e0a4a63e8487d",
"name": "Check Print File",
"func": "if(msg.old_payload != undefined) {\n msg.payload = msg.old_payload;\n}\nvar found = false;\n/*if(msg.filename.includes(\"plate_\")) {\n msg.filename = msg.filename.replace(/_plate_[0-9]/,\"\");\n}*/\nmsg.filename = msg.filename.replace(\".gcode.3mf\", \"\");\nfor (var obj of msg.files) {\n if (!obj.endsWith(\".3mf\")) {\n continue;\n }\n if (msg.filename == obj || msg.filename + \".3mf\" == obj\n || msg.filename + \".gcode.3mf\" == obj ) {\n msg.filename = \"/\" + obj;\n msg.payload = msg.filename;\n node.send(msg)\n let msgText = \"Found - \" + msg.payload;\n node.status({ fill: \"blue\", shape: \"ring\", text: msgText });\n found = true;\n break;\n }\n else if (\"/cache/\" + msg.filename == obj || \"/cache/\" +msg.filename + \".3mf\" == obj\n || \"/cache/\" +msg.filename + \".gcode.3mf\" == obj\n || \"/\" + msg.filename == obj || \"/\"+msg.filename + \".3mf\" == obj\n || \"/\"+msg.filename + \".gcode.3mf\" == obj) {\n\n msg.filename = obj;\n msg.payload = msg.filename;\n node.send(msg)\n let msgText = \"Found - \" + msg.payload;\n node.status({ fill: \"blue\", shape: \"ring\", text: msgText});\n found = true;\n break;\n }\n}\nif (!found) {\n // msg.filename = \"/local_print.gcode.3mf\"\n // msg.payload = msg.filename;\n let msgText = \"Not Found - \" + msg.payload;\n msg.filename = \"\";\n msg.payload = msg.filename;\n if(msg.retried != undefined && !msg.retried) {\n msg.retried = true;\n }\n else {\n msg.retried = false;\n }\n node.send(msg)\n node.status({ fill: \"red\", shape: \"ring\", text: msgText });\n}",
"func": "if(msg.old_payload != undefined) {\n msg.payload = msg.old_payload;\n}\nvar found = false;\n/*if(msg.filename.includes(\"plate_\")) {\n msg.filename = msg.filename.replace(/_plate_[0-9]/,\"\");\n}*/\nlet is_gcode = false\nmsg.filename = msg.filename.replace(\".gcode.3mf\", \"\");\nif(msg.filename.endsWith(\".gcode\")) {\n msg.filename.replace(\".gcode\", \"\");\n let f = msg.filename;\n msg.filename = msg.filename.replace(/_plate_[0-9]/, \"\");\n is_gcode = true\n let plate = f.match(/_(plate_[0-9])/)[1];\n flow.set(\"current_platename\", plate);\n}\nfor (var obj of msg.files) {\n if (!obj.endsWith(\".3mf\")) {\n continue;\n }\n if (msg.filename == obj || msg.filename + \".3mf\" == obj\n || msg.filename + \".gcode.3mf\" == obj ) {\n msg.filename = \"/\" + obj;\n msg.payload = msg.filename;\n node.send(msg)\n let msgText = \"Found - \" + msg.payload;\n node.status({ fill: \"blue\", shape: \"ring\", text: msgText });\n found = true;\n break;\n }\n else if (\"/cache/\" + msg.filename == obj || \"/cache/\" +msg.filename + \".3mf\" == obj\n || \"/cache/\" +msg.filename + \".gcode.3mf\" == obj\n || \"/\" + msg.filename == obj || \"/\"+msg.filename + \".3mf\" == obj\n || \"/\"+msg.filename + \".gcode.3mf\" == obj) {\n\n msg.filename = obj;\n msg.payload = msg.filename;\n node.send(msg)\n let msgText = \"Found - \" + msg.payload;\n node.status({ fill: \"blue\", shape: \"ring\", text: msgText});\n found = true;\n break;\n }\n}\nif (!found) {\n // msg.filename = \"/local_print.gcode.3mf\"\n // msg.payload = msg.filename;\n let msgText = \"Not Found - \" + msg.payload;\n msg.filename = \"\";\n msg.payload = msg.filename;\n if(msg.retried != undefined && !msg.retried) {\n msg.retried = true;\n }\n else {\n msg.retried = false;\n }\n node.send(msg)\n node.status({ fill: \"red\", shape: \"ring\", text: msgText });\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
Expand Down

0 comments on commit c46ea33

Please sign in to comment.