-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Add configurable action command to send when printer is killed #7217
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
Conversation
USER_SPECIFIED_ACTION_AT_KILL leaves very little doubt about what is being specified and when it will be invoked. For something as important as this... It doesn't bother me to have a slightly longish name. |
But I do see how having all ACTION_* strings in a common location useful, and prefixing with "USER_SPECIFIED_ACTION" doesn't really lend itself well toward finding if someone is looking for "ACTION" items (which is what other host software like Repeteir and Octoprint lump them into). I do like ACTION_AT_KILL (since ACTION_AT_SUICIDE as per some existing internal values seems a bit melodramatic ;) |
Yes. You are correct... I don't really care what the name is. But I want it very obvious what it means when it shows up in the code some where. Let's not skimp on characters for the name just to make it short. I prefer something like this is very very obvious! And if the user presses the Kill button on the LCD Panel, it isn't a 'Suicide'. The firmware didn't kill itself. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor changes needed…
Marlin/Configuration_adv.h
Outdated
* Will be sent in the form '//action:KILL_ACTION', e.g. '//action:poweroff'. | ||
* The host must be configured to handle the action command. | ||
*/ | ||
//#define KILL_ACTION "poweroff" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clone these lines to the same position in all Configuration_adv.h
files in example_configurations. The easiest way is to globally replace the unique lines that precede this addition with those same lines, plus this addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do - wanted to have the conversation about the parameter name before I went and edited a bunch of files. ACTION_ON_KILL seems good to me. Do you have a preference?
Marlin/Marlin_main.cpp
Outdated
@@ -12836,6 +12836,10 @@ void kill(const char* lcd_msg) { | |||
_delay_ms(250); //Wait to ensure all interrupts routines stopped | |||
thermalManager.disable_all_heaters(); //turn off heaters again | |||
|
|||
#if defined(KILL_ACTION) | |||
SERIAL_ECHOLNPAIR("//action:", KILL_ACTION); | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use this instead to save on SRAM:
SERIAL_ECHOLNPGM("//action:" KILL_ACTION);
Not to be pedantic, but |
Agreed. But it looks like Scott doesn't want to change the string name throughout ? Maybe make the change as he describes for now, and if the action commands take off, we can revisit renaming so all actions are prefixed with "ACTION_" at a later time ? EDIT: I see that Scott's comments were only to omit the comma operator from the SERIAL_ECHOLNPAIR to save SRAM, so I think you're good to go for ACTION_ON_KILL. |
To @Roxy-3D 's point, the ACTION is a host feature class that probably deserves some form of simple documentation on the wiki. @benlye - do you have an idea on where you could inject this info ? Also, your new Mcode probably needs an entry ? ps- I don't think others realize the possibilites this opens up. Nice work 🥇 |
Sends pre-defined string as action command when printer is kill.
I've changed the serial out method to |
This is a great contribution, simple as it is. Thanks! Perhaps we ought to also add " If it seems like " |
Sends user-defined string as action command when printer is killed.
Spawned from conversation in #7137, where a couple of people thought that informing a connected host that the printer has been killed in a user-configurable, language agnostic, way would be useful.
I'm sure there are other action commands which it would be useful for the printer to send, but a 'kill' action is the one which seems most useful to me. With that in mind, I couldn't decide if the variable should be
KILL_ACTION
, which groks easier, orACTION_KILL
, which lends itself to being in a list of other action definitions. I don't feel strongly either way.