-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
New error_mcu module; report sensor on "ADC out of range" #6620
Conversation
That’s great! |
I've been waiting for this function in klipper for a long time! Thank you very much! it will make troubleshooting a lot easier. I can only agree with @rogerlz . The last read value would also be helpful. this way, you can also determine whether it is a cable break (or not/incorrectly connected cable) or a short circuit (damaged sensor). |
@KevinOConnor is it possible that you are not using multiline strings for these messages? background: we can only delete/ignore all |
0a987cb
to
1d58721
Compare
Thanks. I reworked this PR a bit and the error will now report the last temperature along with the valid range (if it is able to detect which sensor is having an issue).
-Kevin |
I'm not sure what you are reporting or requesting. The error messages should have embedded newlines in them ( I'm open to a new scheme if you have a proposal. Cheers, |
@KevinOConnor here an example from the current/old error message. The first screenshot is with an optimal screen size: And here a screenshot with a "bad" screen size: The word "the" is here in the next line and the paragraph looks "strange". if you don't use 60 characters per line for long sentences, it would be nice if the GUIs could make the line breaks themselves depending on the available space. you can still use line breaks to separate paragraphs to structure the error message, just not in the middle of a sentences. |
Thanks. I've also seen that in Mainsail. But, I'm not sure what you are proposing. The code on this PR will produce:
in the Can you provide a snippet of the raw text that you would prefer to see? -Kevin |
Here is an example with "cleaned" newlines:
and here is a possible Python code: message_shutdown = "Once the underlying issue is corrected, use the 'FIRMWARE_RESTART' command " \
"to reset the firmware, reload the config, and restart the host software. \n" \
"Printer is shutdown"
message_protocol_error1 = "This is frequently caused by running an older version of the firmware " \
"on the MCU(s). Fix by recompiling and flashing the firmware."
message_protocol_error2 = "Once the underlying issue is corrected, use the 'RESTART' command to " \
"reload the config and restart the host software."
message_mcu_connect_error = "Once the underlying issue is corrected, use the 'FIRMWARE_RESTART' " \
"command to reset the firmware, reload the config, and restart the " \
"host software. Error configuring printer"
Common_MCU_errors = {
("Timer too close",): "This often indicates the host computer is overloaded. Check for other "
"processes consuming excessive CPU time, high swap usage, disk errors, "
"overheating, unstable voltage, or similar system problems on the host "
"computer.",
("Missed scheduling of next ",): "This is generally indicative of an intermittent communication "
"failure between micro-controller and host.",
("ADC out of range",): "This generally occurs when a heater temperature exceeds its configured "
"min_temp or max_temp.",
("Rescheduled timer in the past",
"Stepper too far in past"): "This generally occurs when the micro-controller has been "
"requested to step at a rate higher than it is capable of "
"obtaining.",
("Command request",): "This generally occurs in response to an M112 G-Code command or in "
"response to an internal error in the host software.",
} (Python is not my area of expertise) EDIT: It should also be possible with multiline strings and just escape the linebreaks: message_shutdown = """
Once the underlying issue is corrected, use the \
"FIRMWARE_RESTART" command to reset the firmware, reload the \
config, and restart the host software.
Printer is shutdown
"""
message_protocol_error1 = """
This is frequently caused by running an older version of the \
firmware on the MCU(s). Fix by recompiling and flashing the \
firmware.
"""
message_protocol_error2 = """
Once the underlying issue is corrected, use the "RESTART" \
command to reload the config and restart the host software.
"""
message_mcu_connect_error = """
Once the underlying issue is corrected, use the \
"FIRMWARE_RESTART" command to reset the firmware, reload the \
config, and restart the host software.
Error configuring printer
"""
Common_MCU_errors = {
("Timer too close",): """
This often indicates the host computer is overloaded. Check \
for other processes consuming excessive CPU time, high swap \
usage, disk errors, overheating, unstable voltage, or \
similar system problems on the host computer.""",
("Missed scheduling of next ",): """
This is generally indicative of an intermittent \
communication failure between micro-controller and host.""",
("ADC out of range",): """
This generally occurs when a heater temperature exceeds \
its configured min_temp or max_temp.""",
("Rescheduled timer in the past", "Stepper too far in past"): """
This generally occurs when the micro-controller has been \
requested to step at a rate higher than it is capable of \
obtaining.""",
("Command request",): """
This generally occurs in response to an M112 G-Code command \
or in response to an internal error in the host software.""",
} FYI: Both are not tested! I only edited it in the editor and copy&paste it. |
Thanks. I think I understand. Basically, use newlines as an end of paragraph marker. I'm fine with making that change. I think a change like that should be separate from this PR though. I am also not sure if the traditional g-code clients (those using the "pseudo-tty" like OctoPrint) can handle really long lines (eg, 300+ characters per line) - it may be necessary for Klipper to reformat the error message content when sending it on the pseudo-tty. Cheers, |
… module Create a new module to help format verbose mcu error messages. Move the shutdown message formatting to this module. This moves the error formatting out of the background thread and out of the critical shutdown code path. Signed-off-by: Kevin O'Connor <[email protected]>
Signed-off-by: Kevin O'Connor <[email protected]>
Signed-off-by: Kevin O'Connor <[email protected]>
Signed-off-by: Kevin O'Connor <[email protected]>
Rename this method so that it is more distinct from the the common temperature setup_minmax() method. Signed-off-by: Kevin O'Connor <[email protected]>
Try to report which ADC is reporting out of range. Signed-off-by: Kevin O'Connor <[email protected]>
Try to report which ADC is reporting out of range. Signed-off-by: Kevin O'Connor <[email protected]>
1d58721
to
6d70050
Compare
This PR adds a new error_mcu host module to facilitate error formatting. It also attempts to report which ADC sensor is out of range on an "ADC out of range" mcu error.
Handling micro-controller errors is challenging because we really want the heaters to be disabled if an unexpected error occurs. That means we don't want a lot of code complexity to analyze the source of the error in the code that needs to immediately handle that error. This can lead to crytpic mcu error reports.
This PR creates a new error_mcu host module that can analyze the low-level error reports after the main shutdown processing has completed. Thus, the error_mcu code is no longer on the "critical shutdown path" and can take more time and resources to format a more user friendly error message.
With this PR, the low-level MCU_adc code can identify if recent adc values were out of range, and then communicate that to the new error_mcu module. This is then used in an "ADC out of range" error report. For example:
This ADC check should work in most cases, but it is possible that an out-of-range error may occur while the host is unable to identify which module was out of range.
-Kevin
EDIT: The new module was renamed to "error_mcu.py"