diff --git a/config/model_menu.conf b/config/model_menu.conf index aca36403..1de5b6dc 100644 --- a/config/model_menu.conf +++ b/config/model_menu.conf @@ -1,6 +1,20 @@ -CreatBot_F430NX -CreatBot_D600Pro2 -CreatBot_D600Pro2_V0 -CreatBot_D1000 -CreatBot_D1000_V0 -CreatBot_P800 + +[CreatBot_F430NX] +versions = 1.0 + +[CreatBot_D600Pro2HS] +versions = 1.0, 1.1 +#V1.1 Add door detection + +[CreatBot_D600Pro2HS_KIT] +versions = 1.0 + +[CreatBot_D1000HS] +versions = 1.0, 1.1 +#V1.1 Add door detection + +[CreatBot_D1000HS_KIT] +versions = 1.0 + +[CreatBot_P800] +versions = 1.0 diff --git a/ks_includes/KlippyFactory.py b/ks_includes/KlippyFactory.py index 0995240b..3fe534c0 100644 --- a/ks_includes/KlippyFactory.py +++ b/ks_includes/KlippyFactory.py @@ -49,6 +49,7 @@ class KlippyFactory: "adaptive_meshing": False, "power_loss_recovery": True, "auto_change_nozzle": False, + "door_detect": "Disabled", } for key, val in option_list.items(): script = KlippyGcodes.set_save_variables(key, val) diff --git a/ks_includes/ModelConfig.py b/ks_includes/ModelConfig.py index 0ef3bb5d..f027cae3 100644 --- a/ks_includes/ModelConfig.py +++ b/ks_includes/ModelConfig.py @@ -100,9 +100,17 @@ class ModelConfig: f"Configuration file {self.klipperscreen_config_path} not found." ) - def wirte_printer_config(self, device_name): + def wirte_printer_config(self, device_name, version): + config_dict = { + "CreatBot_F430NX": "CreatBot_F430NX", + "CreatBot_D600Pro2HS": "CreatBot_D600Pro2", + "CreatBot_D600Pro2HS_KIT": "CreatBot_D600Pro2_V0", + "CreatBot_D1000HS": "CreatBot_D1000", + "CreatBot_D1000HS_KIT": "CreatBot_D1000_V0", + "CreatBot_P800": "CreatBot_P800", + } if device_name: - source_path = f"{os.path.expanduser('~')}/klipper/config/{device_name}/" + source_path = f"{os.path.expanduser('~')}/klipper/config/{config_dict.get(device_name)}/" target_path = f"{os.path.expanduser('~')}/printer_data/config/" if not os.path.exists(target_path): os.makedirs(target_path) @@ -120,6 +128,21 @@ class ModelConfig: except Exception as e: logging.error(f"Error creating symlink for{device_name}:{e}") + source_module_path = os.path.join(source_path, os.path.basename(version)) + target_module_path = os.path.join(target_path, os.path.basename("module")) + try: + if os.path.islink(target_module_path) or os.path.exists(target_module_path): + os.remove(target_module_path) + if version != "1.0": + os.symlink(source_module_path, target_module_path) + logging.info(f"Created config version for {device_name}-{version}.") + except FileExistsError: + logging.error(f"Failed to create version symlink for {device_name}.") + except PermissionError: + logging.error(f"No permission to create version symlink for {device_name}.") + except Exception as e: + logging.error(f"Error creating version symlink for{device_name}:{e}") + source_printer_path = os.path.join(source_path, os.path.basename("printer.cfg")) target_printer_path = os.path.join(target_path, os.path.basename("printer.cfg")) command = ['cp','-f', source_printer_path, target_printer_path] @@ -143,13 +166,13 @@ class ModelConfig: except Exception as e: logging.error(f"An unexpected error occurred: {e}") - def generate_config(self, model): + def generate_config(self, model, version): model_name = model model_name = model_name.split("_")[1] device_name = self.generate_machine_name(model_name) self.write_mdns_config(device_name) self.write_device_name_config(device_name) - self.wirte_printer_config(model) + self.wirte_printer_config(model, version) self.wirte_hostname(device_name) os.system("systemctl restart klipper.service") os.system("systemctl restart moonraker.service") diff --git a/ks_includes/locales/KlipperScreen.pot b/ks_includes/locales/KlipperScreen.pot index 4a1a2111..90649464 100644 --- a/ks_includes/locales/KlipperScreen.pot +++ b/ks_includes/locales/KlipperScreen.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-26 11:12+0800\n" +"POT-Creation-Date: 2025-03-29 17:34+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -76,6 +76,9 @@ msgstr "" msgid "Adaptive Bed Leveling" msgstr "" +msgid "Add" +msgstr "" + msgid "Add profile" msgstr "" @@ -292,6 +295,9 @@ msgstr "" msgid "Disable for 12hs with am / pm" msgstr "" +msgid "Disabled" +msgstr "" + msgid "Disconnect" msgstr "" @@ -306,6 +312,9 @@ msgstr "" msgid "Do you want to recover %s?" msgstr "" +msgid "Door Open Protection Mode" +msgstr "" + msgid "Elapsed trial time:" msgstr "" @@ -321,9 +330,6 @@ msgstr "" msgid "Enable screen power management" msgstr "" -msgid "Enabled successfully" -msgstr "" - msgid "Error" msgstr "" @@ -643,6 +649,9 @@ msgstr "" msgid "Minimum:" msgstr "" +msgid "Minus" +msgstr "" + msgid "Modified" msgstr "" @@ -763,6 +772,9 @@ msgstr "" msgid "Pause" msgstr "" +msgid "Pause Print" +msgstr "" + msgid "Paused" msgstr "" @@ -775,6 +787,9 @@ msgstr "" msgid "Pins" msgstr "" +msgid "Please close the door and click Resume to proceed." +msgstr "" + msgid "Please ensure that the Probe Calibrate has been performed" msgstr "" @@ -823,6 +838,12 @@ msgstr "" msgid "Printer Select" msgstr "" +msgid "Printer door is opened. Please close the door and then start printing." +msgstr "" + +msgid "Printer door is opening!" +msgstr "" + msgid "Printing" msgstr "" @@ -877,12 +898,6 @@ msgstr "" msgid "Reprint" msgstr "" -msgid "Reset" -msgstr "" - -msgid "Reset successfully" -msgstr "" - msgid "Restart" msgstr "" @@ -1052,6 +1067,9 @@ msgstr "" msgid "Temperature" msgstr "" +msgid "Test Mode" +msgstr "" + msgid "The last print job was not completed continue printing?" msgstr "" @@ -1067,6 +1085,11 @@ msgstr "" msgid "This device is not activated and is available for trial use only" msgstr "" +msgid "" +"This feature allows you to customize the printer's response when door " +"opening is detected" +msgstr "" + msgid "This operation is about to print the model" msgstr "" diff --git a/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.mo b/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.mo index b36aa86b..6cc1981f 100644 Binary files a/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.mo and b/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.mo differ diff --git a/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.po b/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.po index f27c6d50..7c6c54af 100644 --- a/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.po +++ b/ks_includes/locales/zh_CN/LC_MESSAGES/KlipperScreen.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: KlipperScreen\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-26 11:12+0800\n" +"POT-Creation-Date: 2025-03-29 17:34+0800\n" "PO-Revision-Date: 2024-06-03 19:09+0000\n" "Last-Translator: wsj20050623 <2129426599@qq.com>\n" "Language-Team: Chinese (Simplified) \n" "Language-Team: Chinese (Traditional)