-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Octoprint support + configurable gcode file comment parsing + bugfixes + cleanup #2241
Conversation
While you're at it please set |
@kisslorand done |
@digant73 Maybe something like: |
@kisslorand added the comment on variable definition. I don't see any reference to update = true/false (it is already 0/1). |
Sorry, I was checking the current master. Alles ist in Ordnung! |
Hello @digant73 , *Configurable Gcode file comment parsing feature: This previously hidden feature can now be enabled/disabled in config.ini (with param name "file_comment_parsing") and also in Feature menu. This gives visibility/control of the feature so it can be used according to the used slicer (e.g. Cura) and/or user preference. |
@savenn |
@digant73 |
@digant73 If the OctoPrint part a default setting in OctoPrint, or do you have to add the functions somehow? |
You can likely add them in Octoprint Settings -> GCode Scripts... |
68f73e6
to
a7dd034
Compare
@Guilouz Strange you needed to provide P0. P0 should be the default value in case Pn is omitted. However, I edited the commands above providing also the "P0" option. |
Hi guys. Fantastic upgrade. I've also gotten almost the same functionality from Octoprint that locally from SD. |
@inigoml you should see the Printing menu is open |
Hi @digant73, what do you want to say with "printing menu is open"? |
PR for cura plugin already created. Will be in next version or not! :) |
@inigoml I meant that sending "M118 A1 P0 action:print_start" should trigger the TFT to open the Printing menu. But as I see in your picture, the Printing menu is now properly open. |
Hi @digant73. The problem is that after print has started, no ETA is displayed on screen because message box for notifications is not available. M118 A1 P0 action:notification Time Left 1h2m3s has no way to be displayed. ;) |
Just try, I have elapsed time, time remaining, percentage, layer height in their respective case but not number of layers (just show ---) @inigoml You use 'M118 A1 P0 action:notification Data Left' in your script as percentage right ? It's not supposed to be used for number of layers ? Another little issue, percentage are not the same on octoprint and on the screen (example : 35% on screen, 37.6% on octoprint) |
@inigoml the Time Left notification is displayed directly in the Printing menu (you will see the time elapsed and below the time remaining). The notification is not saved in the Notification box |
It depends. You can modify behavior in config.ini. Options: [Percentage & Elapsed time: 0, Percentage & Remaining time: 1, Elapsed time & Remaining time: 2]Basically, I'm emulating M73 command via M118.
Octoprint has it's own calculation algorithm while Cura has another. In this case, since the script is for Cura, it's normal to have minor discrepancies. If an Octoprint plugin manages this instead of Cura, both could be equal. But no plugin is yet available for Octoprint (if I find myself strong, I could take a look about how to create an Octoprint plugin). |
Thank you @digant73. I will check config again. I'm almost sure I have prog_disp_type:2 set, but behavior is like if I had prog_disp_type:0. Perhaps it's not being properly parsed due to some error at script level. |
At Gcode level I think it's everthing OK...
|
@inigoml yes you can switch time info (percentage, time remaining, elapsed time) by clicking on the time box, no problem for that I have all info. What I mean is that normally 'M118 A1 P0 action:notification Data Left' must be used to display number of layers (example : layer 127/528) and not and not a percentage out of 100, no ? |
OMG.... You are right! :-) Everything working properly. Since I've reused same calculation at plugin level that was used for M73 command, I applied the same percentage. Just that. |
@inigoml To summarize, we have all the info except the number of layers (displayed as '---'), and all without notifications, all info are in boxes. Click on layer box you will see that. |
For layer, we need a parser at TFT level in order to process specific message via M118. @digant73 could add it and we can include it at Cura script level or eventually at script level. |
the layer number is already supported by the TFT. You must enable "File comment parsing" in Feature menu. Maybe you must enable something on Cura/Prusa slicer to provide that info as comment in the gcode file |
@digant73, would this file comment parsing work also from Octoprint? |
@digant73 yes working when printing from TFT ports but not in remote printing. |
Understood. |
yes, Octoprint should provide the info (the notification you reported should be ok) and then I would add a support to that new notification in a similar way as the File comment parsing feature already implemented on TFT (used when printing from TFT). |
Adapting octoprint_detailedprogress plugin for TFT BTREETECH should be easy.... Will take a look. |
I added these lines to Octoprint GCODES and it works great. |
Python script is only for Cura. I was testing with Prusa Slicer but
eventually you would need a new script. Although Slicer can execute python
code, I didn't find proper programing variable suitable in order to do the
same from Prusa Slicer.
El vie., 25 feb. 2022 19:24, Eddiiie ***@***.***> escribió:
… I added these lines to Octoprint GCODES and it works great.
I can't find where to put the time remaining and filedata GCODEs; I use
Prusa Slicer... ? @inigoml <https://github.com/inigoml> can your Python
script be run from slicer post processor?
—
Reply to this email directly, view it on GitHub
<#2241 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABZDZ5BPK6ABLVEESX4UHH3U47CMLANCNFSM5H2MWCTQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Thank you. |
IMPROVEMENTS:
*Configurable Gcode file comment parsing feature: This previously hidden feature can now be enabled/disabled in config.ini (with param name "file_comment_parsing") and also in Feature menu. This gives visibility/control of the feature so it can be used according to the used slicer (e.g. Cura) and/or user preference.
If enabled, the current implementation parses and processes print time and print layer information from the G-code file (nothing else).
If disabled, the "layer_disp_type" setting provided in "UI Settings" section in config.ini becomes redundant.
*Optimized loopPrintFromTFT function in Printing.c API: The parsing of each line in the gcode file is now split in order to speed up both the gcode parsing and the comment (if any) parsing
*Added error handling and error notification in loopPrintFromTFT function in Printing.c API: The error handling function handleDiskError currently implemented forces a device re-initialization for a maximum number of retry attempts. If maximum number of retry is reached a print abort is forced. Previously, in case of error the file position (infoPrinting.cur) was never updated causing an infinite print loop (the print could never reach the end due to a permanent error reading from file)
*Unified name for Controller Fan Active: Id for Active PWD in config.ini (CtL) was not matching the Id displayed in the menus (CtS) and its meaning (Active). The name was unified to CtA on both config.ini and menus
*Implemented Octoprint support: It resolves #2180 and #438
*Some cleanup
BUG FIXES:
*Fixed wrong stringify expansion for icon names: In boot.c a double macro expansion was used causing a macro value expansion (in case of an existing macro definition) instead of macro name. The fix will avoid further issues such as happened with #2237. Previous definitions (LANGUAGE and ONBOARD_SD) have been restored
*Fixed TFT freeze due to permanent read/write error printing from SD slot: functions disk_read / disk_write in diskio.c performed a loop invoking SD_Init function. The loop was never terminated in case of a persistent error. That bug could be the main reason for the freeze reported in #2231
*Fixed MinX/MinY Leveling Distance: The origin of the bed is never less than 0. A negative minX/minY indicates the distance of the bed from endstops and must not be considered to determine the four leveling edges in Manual Leveling menu and Leveling Corner menu. It fixes #2246
INTEGRATION WITH OCTOPRINT / OCTOPRINT TRIGGERING COMMANDS:
Octoprint can optionally trigger some actions to the TFT sending specific gcodes. The following actions and the related triggering gcodes are currently supported by the TFT fw:
start:
M118 A1 P0 action:print_start
end:
M118 A1 P0 action:print_end
cancel:
M118 A1 P0 action:cancel
pause:
M118 A1 P0 action:pause
resume:
M118 A1 P0 action:resume
time remaining progress:
M118 A1 P0 action:notification Time Left <XX>h<YY>m<ZZ>s (e.g. 02h04m06s)
or
M117 Time Left <XX>h<YY>m<ZZ>s
file data progress:
M118 A1 P0 action:notification Data Left <XXXX>/<YYYY> (e.g. 123/12345)
or
M117 Data Left <XXXX>/<YYYY>
When the trigger "print_start" is received, the TFT switches to Printing menu.
Once on Printing menu, the "pause", "resume" and "stop" buttons on the menu will be disabled.
That means only Octoprint will control the print.
Only on print end or cancel the TFT Printing menu is finalized (statistics available etc...) and unlocked (it can be closed).
NOTE: A new plugin on Octoprint implementing the above protocol should be the preferable way (available to everyone)
resolves #2180
resolves #438
fixes #2246
could fix (#2231) (to be confirmed)
fixes #2255
fixes #2216
PR STATE: Ready to merge. It adds 560 bytes to program size