From 8231eda68470153d6599fe4685dda79077cb12bf Mon Sep 17 00:00:00 2001 From: Tomas Vybiral Date: Fri, 9 Aug 2024 09:42:48 +0200 Subject: [PATCH 1/6] buddy: Add missing titles for bootloader errors The bootloader only shows "Error #XXXX" as a title. But other bootloader errors were assigned a title, so I took "artistic liberties" to assign something to them BFW-5773 --- yaml/buddy-error-codes.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yaml/buddy-error-codes.yaml b/yaml/buddy-error-codes.yaml index e5eb822..6c87f5a 100644 --- a/yaml/buddy-error-codes.yaml +++ b/yaml/buddy-error-codes.yaml @@ -697,7 +697,7 @@ Errors: approved: false - code: "XX601" - title: "" + title: "UNKNOWN ERROR" text: "This error code is not found\nin our database.\nContact the support." id: "UNKNOWN_ERROR_CODE" approved: true @@ -746,14 +746,14 @@ Errors: - code: "XX609" printers: [MINI] - title: "" + title: "FIRMWARExPRINTER MISMATCH" text: "Firmware and hardware\nversions do not\nmatch. Make sure\nyou have the right\nfirmware file for\nyour printer." id: "HW_VERSION_ERR" approved: true - code: "XX609" printers: [MK4, iX, XL, MK3.5] - title: "" + title: "FIRMWARExPRINTER MISMATCH" text: "Firmware and hardware versions do\nnot match. Make sure you have\nthe right firmware file for\nyour printer." id: "HW_VERSION_ERR" approved: true From 1679f2f27200bad6d1160c85cedf90a64d246b6a Mon Sep 17 00:00:00 2001 From: Tomas Vybiral Date: Fri, 9 Aug 2024 10:45:28 +0200 Subject: [PATCH 2/6] buddy: Add "Warning" title to all warnings Technically the printer doesn't show any title when showing warnings (the title that is shown is the title of the screen that was rendered before the warning was shown). Similar to error `XX806` we can set every warning title to "Warning". BFW-5773 --- yaml/buddy-error-codes.yaml | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/yaml/buddy-error-codes.yaml b/yaml/buddy-error-codes.yaml index 6c87f5a..5b522c8 100644 --- a/yaml/buddy-error-codes.yaml +++ b/yaml/buddy-error-codes.yaml @@ -876,7 +876,7 @@ Errors: type: "CONNECT" - code: "XX808" - title: "" + title: "Warning" text: "The heatbed cooled down during the power outage, printed object might have detached. Inspect it before continuing." id: "POWER_PANIC_COLD_BED" type: "CONNECT" @@ -927,82 +927,82 @@ Errors: type: "CONNECT" - code: "XX816" - title: "" + title: "Warning" text: "Print fan not spinning. Check it for possible debris, then inspect the wiring." id: "PRINT_FAN_ERROR" type: "CONNECT" - code: "XX817" - title: "" + title: "Warning" text: "Heating disabled due to 30 minutes of inactivity." id: "HEATERS_TIMEOUT" type: "CONNECT" - code: "XX818" - title: "" + title: "Warning" text: "Measured temperature is not matching expected value. Check the thermistor is in contact with hotend. In case of damage, replace it." id: "HOTEND_TEMP_DISCREPANCY" type: "CONNECT" - code: "XX819" - title: "" + title: "Warning" text: "Heating disabled due to 30 minutes of inactivity." id: "NOZZLE_TIMEOUT" type: "CONNECT" - code: "XX820" - title: "" + title: "Warning" text: "Steppers disabled due to inactivity." id: "STEPPERS_TIMEOUT" type: "CONNECT" - code: "XX821" - title: "" + title: "Warning" text: "USB drive or file error, the print is now paused. Reconnect the drive." id: "USB_FLASH_DISK_ERROR" type: "CONNECT" - code: "XX822" - title: "" + title: "Warning" text: "Heatbreak thermistor is disconnected. Inspect the wiring." id: "HEATBREAK_THERMISTOR_FAIL" type: "CONNECT" - code: "XX823" printers: [XL, MK3.5] - title: "" + title: "Warning" text: "Nozzle doesn't seem to have round cross section. Make sure it is clean and perpendicular to the bed." id: "NOZZLE_DOES_NOT_HAVE_ROUND_SECTION" type: "CONNECT" - code: "XX824" - title: "" + title: "Warning" text: "G-Code transfer running too slow. Check your network for issues or use different USB drive. Press Continue to resume printing." id: "NOT_DOWNLOADED" type: "CONNECT" - code: "XX825" - title: "" + title: "Warning" text: "MCU in Buddy is overheated, likely due to exceeding the printer's operating temperature. Prevent overheating for optimal performance." id: "BUDDY_MCU_MAX_TEMP" type: "CONNECT" - code: "XX826" printers: [XL] - title: "" + title: "Warning" text: "MCU in Dwarf is overheated, likely due to exceeding the printer's operating temperature. Prevent overheating for optimal performance." id: "DWARF_MCU_MAX_TEMP" type: "CONNECT" - code: "XX827" printers: [iX, XL] - title: "" + title: "Warning" text: "MCU in Modular Bed is overheated, likely due to exceeding the printer's operating temperature. Prevent overheating for optimal performance." id: "MOD_BED_MCU_MAX_TEMP" type: "CONNECT" - code: "XX828" - title: "" + title: "Warning" text: "Hotend fan not spinning. Check it for possible debris, then inspect the wiring." id: "HOTEND_FAN_ERROR" type: "CONNECT" @@ -1015,35 +1015,35 @@ Errors: - code: "XX830" printers: [XL] - title: "" + title: "Warning" text: "Enclosure fan not spinning. Check it for possible debris, then inspect the wiring." id: "ENCLOSURE_FAN_ERROR" type: "CONNECT" - code: "XX831" printers: [XL] - title: "" + title: "Warning" text: "The HEPA filter is nearing the end of its life span (100 hours of printing time remaining). We recommend purchasing a new one. Visit prusa.io/xl-filter for more information." id: "ENCLOSURE_FILTER_EXPIRATION_WARNING" type: "CONNECT" - code: "XX832" printers: [XL] - title: "" + title: "Warning" text: "The HEPA filter has expired. Change the HEPA filter before your next print. Visit prusa.io/xl-filter for more information." id: "ENCLOSURE_FILTER_EXPIRATION" type: "CONNECT" - code: "XX833" printers: [iX, MK4, MK3.5, MINI, XL] - title: "" + title: "Warning" text: "Bed leveling failed. Try again?" id: "PROBING_FAILED" type: "CONNECT" - code: "XX834" printers: [iX, MK4, XL] - title: "" + title: "Warning" text: "Nozzle cleaning failed." id: "NOZZLE_CLEANING_FAILED" type: "CONNECT" From 95f44bc9f288912f045ff1567c440523ce5c3500 Mon Sep 17 00:00:00 2001 From: Tomas Vybiral Date: Fri, 9 Aug 2024 10:49:08 +0200 Subject: [PATCH 3/6] buddy: Add title to crash detection errors These errors are shown during crash recovery and the screen sets common title for all of them. BFW-5773 --- yaml/buddy-error-codes.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yaml/buddy-error-codes.yaml b/yaml/buddy-error-codes.yaml index 5b522c8..ba4e868 100644 --- a/yaml/buddy-error-codes.yaml +++ b/yaml/buddy-error-codes.yaml @@ -882,32 +882,32 @@ Errors: type: "CONNECT" - code: "XX809" - title: "" + title: "CRASH DETECTED" text: "Length of an axis is too long.\nMotor current is too low, probably.\nRetry check, pause or resume the print?" id: "CRASH_RECOVERY_AXIS_LONG" type: "CONNECT" - code: "XX810" - title: "" + title: "CRASH DETECTED" text: "Length of an axis is too short.\nThere's an obstacle or bearing issue.\nRetry check, pause or resume the print?" id: "CRASH_RECOVERY_AXIS_SHORT" type: "CONNECT" - code: "XX811" - title: "" + title: "CRASH DETECTED" text: "Repeated collision has been detected.\nDo you want to resume or pause the print?" id: "CRASH_RECOVERY_REPEATED_CRASH" type: "CONNECT" - code: "XX812" - title: "" + title: "CRASH DETECTED" text: "Unable to home the printer.\nDo you want to try again?" id: "CRASH_RECOVERY_HOME_FAIL" type: "CONNECT" - code: "XX813" printers: [XL] - title: "" + title: "CRASH DETECTED" text: "Toolchanger problem has been detected.\nPark all tools to docks\nand leave the carriage free." id: "CRASH_RECOVERY_TOOL_PICKUP" type: "CONNECT" From 671a547ae670aa5395a47e50b8d23fbe7d4b422a Mon Sep 17 00:00:00 2001 From: Tomas Vybiral Date: Fri, 9 Aug 2024 10:51:57 +0200 Subject: [PATCH 4/6] buddy: Add title to remaining dialogs The only remaining dialog was Quick Pause dialog. Again since it is a dialog it doesn't have any title in the code, but we can assign its name after the feature, similar to warnings. BFW-5773 --- yaml/buddy-error-codes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yaml/buddy-error-codes.yaml b/yaml/buddy-error-codes.yaml index ba4e868..bfcaf7e 100644 --- a/yaml/buddy-error-codes.yaml +++ b/yaml/buddy-error-codes.yaml @@ -1050,7 +1050,7 @@ Errors: - code: "XX835" printers: [iX, MK4, MK3.5, MINI, XL] - title: "" + title: "Quick Pause" text: "Waiting for the user. Press \"Resume\" once the printer is ready." id: "QUICK_PAUSE" type: "CONNECT" From 76ef8346388c64b05e2ebc5c70b1674a35a2e367 Mon Sep 17 00:00:00 2001 From: Tomas Vybiral Date: Fri, 9 Aug 2024 10:54:26 +0200 Subject: [PATCH 5/6] buddy: Add title to MMU error This is a generic error that happens in Load/Unload with MMU. There is large number of errors that can happen during the MMU Loading/Unloading so we use a generic title here. BFW-5773 --- yaml/buddy-error-codes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yaml/buddy-error-codes.yaml b/yaml/buddy-error-codes.yaml index bfcaf7e..ae6e1ab 100644 --- a/yaml/buddy-error-codes.yaml +++ b/yaml/buddy-error-codes.yaml @@ -921,7 +921,7 @@ Errors: - code: "XX815" printers: [MK4, MK3.5] - title: "" + title: "MMU Error" # This is a generic error for any MMU error, so we use generic title, until we send mmu errors directly text: "Waiting for user input" id: "MMU_LOAD_UNLOAD_ERROR" type: "CONNECT" From c7e4712205d41bb4e9acf87ba6778ea42c0615c4 Mon Sep 17 00:00:00 2001 From: Tomas Vybiral Date: Fri, 9 Aug 2024 09:42:14 +0200 Subject: [PATCH 6/6] test: Add a unit test to verify buddy error codes BFW-5773 --- tests/test_verify_buddy_errors_content.py | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/test_verify_buddy_errors_content.py diff --git a/tests/test_verify_buddy_errors_content.py b/tests/test_verify_buddy_errors_content.py new file mode 100644 index 0000000..ac1fdfb --- /dev/null +++ b/tests/test_verify_buddy_errors_content.py @@ -0,0 +1,43 @@ +import unittest +import yaml +from typing import List, Dict + +class TestVerifyPruseErrorContentsForBuddy(unittest.TestCase): + def verify_item_in_error(self, error: Dict, item_name: str, can_be_empty:bool = False): + assert item_name in error, f"Missing item {item_name} in error code {error['code']}" + if not can_be_empty: + assert len(error[item_name]) > 0, f"Item {item_name} in error code {error['code']} is empty" + + def verify_non_empty_array_item(self, error: Dict, item_name: str, is_optional: bool = False): + assert item_name in error or is_optional, f"Missing item {item_name} in error code {error['code']}" + if (is_optional and item_name in error) or not is_optional: + assert len(error[item_name]) > 0, f"Empty array item {item_name} defined in error code {error['code']}" + + def test_buddy_errors(self): + errors = [] + with open("./yaml/buddy-error-codes.yaml", "r") as buddy_errors: + errors = yaml.load(buddy_errors, Loader=yaml.Loader)["Errors"] + for error in errors: + assert "code" in error, f"Missing error code code in definition: {error}" + assert error["code"].startswith("XX"), f"Code {error['code']} is missing XX prefix" + self.verify_item_in_error(error, "id") + self.verify_item_in_error(error, "title") + self.verify_item_in_error(error, "text") + self.verify_non_empty_array_item(error, "printers", True) + + + def test_mmu_errors(self): + errors = [] + with open("./yaml/mmu-error-codes.yaml", "r") as mmu_errors: + errors = yaml.load(mmu_errors, Loader=yaml.Loader)["Errors"] + for error in errors: + assert "code" in error, f"Missing error code code in definition: {error}" + assert error["code"].startswith("04"), f"Code {error['code']} is missing 04 prefix" + self.verify_item_in_error(error, "id") + self.verify_item_in_error(error, "title") + self.verify_item_in_error(error, "text") + self.verify_item_in_error(error, "type") + self.verify_non_empty_array_item(error, "action") + +if __name__ == "__main__": + unittest.main()