diff --git a/config_loader.py b/config_loader.py index 459942e..2682928 100644 --- a/config_loader.py +++ b/config_loader.py @@ -62,6 +62,7 @@ CONFIG_ENV_MAPPING = { "DEFAULT_AMS_SLOT": (CONFIG_SECTION_PRINT, "default_ams_slot"), "AUTO_LEVELING": (CONFIG_SECTION_PRINT, "auto_leveling"), "VIBRATION_COMPENSATION": (CONFIG_SECTION_PRINT, "vibration_compensation"), + "FLOW_CALIBRATION": (CONFIG_SECTION_PRINT, "flow_calibration"), "CAMERA_ON_PRINT": (CONFIG_SECTION_PRINT, "camera_on_print"), "WEB_UPLOAD_WARNING": (CONFIG_SECTION_PRINT, "web_upload_warning"), "PRINT_START_DIALOG": (CONFIG_SECTION_PRINT, "print_start_dialog"), @@ -126,6 +127,7 @@ def migrate_env_to_config(env_path: pathlib.Path, config_path: pathlib.Path): "default_ams_slot": env_vals.get("DEFAULT_AMS_SLOT", "auto"), "auto_leveling": env_vals.get("AUTO_LEVELING", "1"), "vibration_compensation": env_vals.get("VIBRATION_COMPENSATION", "0"), + "flow_calibration": env_vals.get("FLOW_CALIBRATION", "0"), "camera_on_print": env_vals.get("CAMERA_ON_PRINT", "0"), "web_upload_warning": env_vals.get("WEB_UPLOAD_WARNING", "1"), } @@ -451,6 +453,7 @@ DEVICE_ID = get("DEVICE_ID", "") DEFAULT_AMS_SLOT = get("DEFAULT_AMS_SLOT", "auto") AUTO_LEVELING = int(get("AUTO_LEVELING", "1")) VIBRATION_COMPENSATION = int(get("VIBRATION_COMPENSATION", "0")) +FLOW_CALIBRATION = int(get("FLOW_CALIBRATION", "0")) CAMERA_ON_PRINT = int(get("CAMERA_ON_PRINT", "0")) WEB_UPLOAD_WARNING = int(get("WEB_UPLOAD_WARNING", "1")) PRINT_START_DIALOG = int(get("PRINT_START_DIALOG", get("FILE_READY_DIALOG", "1"))) diff --git a/env_loader.py b/env_loader.py index 97f37af..95df569 100644 --- a/env_loader.py +++ b/env_loader.py @@ -49,6 +49,7 @@ DEVICE_ID = get("DEVICE_ID", "") DEFAULT_AMS_SLOT = get("DEFAULT_AMS_SLOT", "auto") AUTO_LEVELING = int(get("AUTO_LEVELING", "1")) VIBRATION_COMPENSATION = int(get("VIBRATION_COMPENSATION", "0")) +FLOW_CALIBRATION = int(get("FLOW_CALIBRATION", "0")) CAMERA_ON_PRINT = int(get("CAMERA_ON_PRINT", "0")) WEB_UPLOAD_WARNING = int(get("WEB_UPLOAD_WARNING", "1")) PRINT_START_DIALOG = int(get("PRINT_START_DIALOG", get("FILE_READY_DIALOG", "1"))) diff --git a/kobrax_moonraker_bridge.py b/kobrax_moonraker_bridge.py index f2ca7ff..3e6d6a4 100644 --- a/kobrax_moonraker_bridge.py +++ b/kobrax_moonraker_bridge.py @@ -3514,7 +3514,7 @@ class KobraXBridge: "task_settings": { "auto_leveling": auto_leveling, "vibration_compensation": getattr(self._args, "vibration_compensation", 0), - "flow_calibration": 0, + "flow_calibration": getattr(self._args, "flow_calibration", 0), "dry_mode": 0, "ai_settings": {"status": 0, "count": 0, "type": ai_type}, "timelapse": {"status": 0, "count": 0, "type": timelapse_type}, @@ -4343,6 +4343,7 @@ class KobraXBridge: "print_speed_mode": s["print_speed_mode"], "auto_leveling": getattr(self._args, "auto_leveling", 1), "vibration_compensation": getattr(self._args, "vibration_compensation", 0), + "flow_calibration": getattr(self._args, "flow_calibration", 0), "camera_on_print": getattr(self._args, "camera_on_print", 0), "web_upload_warning": getattr(self._args, "web_upload_warning", 1), "light_on": s["light_on"], @@ -4495,6 +4496,7 @@ class KobraXBridge: "default_ams_slot": getattr(self._args, "default_ams_slot", "auto"), "auto_leveling": getattr(self._args, "auto_leveling", 1), "vibration_compensation": getattr(self._args, "vibration_compensation", 0), + "flow_calibration": getattr(self._args, "flow_calibration", 0), "camera_on_print": getattr(self._args, "camera_on_print", 0), "web_upload_warning": getattr(self._args, "web_upload_warning", 1), "print_start_dialog": getattr(self._args, "print_start_dialog", 1), @@ -4533,6 +4535,7 @@ class KobraXBridge: cfg.set("print", "default_ams_slot", str(data.get("default_ams_slot", getattr(self._args, "default_ams_slot", "auto")))) cfg.set("print", "auto_leveling", str(data.get("auto_leveling", getattr(self._args, "auto_leveling", 1)))) cfg.set("print", "vibration_compensation", str(int(bool(data.get("vibration_compensation", getattr(self._args, "vibration_compensation", 0)))))) + cfg.set("print", "flow_calibration", str(int(bool(data.get("flow_calibration", getattr(self._args, "flow_calibration", 0)))))) cfg.set("print", "camera_on_print", str(int(bool(data.get("camera_on_print", getattr(self._args, "camera_on_print", 0)))))) cfg.set("print", "web_upload_warning", str(int(bool(data.get("web_upload_warning", getattr(self._args, "web_upload_warning", 1)))))) cfg.set("print", "print_start_dialog", str(int(bool(data.get("print_start_dialog", getattr(self._args, "print_start_dialog", 1)))))) @@ -5677,6 +5680,7 @@ def main(): parser.add_argument("--default-ams-slot",default=env_loader.DEFAULT_AMS_SLOT) parser.add_argument("--auto-leveling", type=int, default=env_loader.AUTO_LEVELING) parser.add_argument("--vibration-compensation", type=int, default=env_loader.VIBRATION_COMPENSATION) + parser.add_argument("--flow-calibration", type=int, default=env_loader.FLOW_CALIBRATION) parser.add_argument("--camera-on-print", type=int, default=env_loader.CAMERA_ON_PRINT) parser.add_argument("--web-upload-warning", type=int, default=env_loader.WEB_UPLOAD_WARNING) parser.add_argument("--print-start-dialog", dest="print_start_dialog", type=int, default=env_loader.PRINT_START_DIALOG) diff --git a/web/themes/default/app.js b/web/themes/default/app.js index e127321..3eaf936 100644 --- a/web/themes/default/app.js +++ b/web/themes/default/app.js @@ -446,6 +446,7 @@ function applyLang(){ setText('opt-slot-auto',T.settings_slot_auto); setText('lbl-auto-leveling',T.settings_auto_leveling); setText('lbl-vibration-compensation',T.settings_vibration_compensation); + setText('lbl-flow-calibration',T.settings_flow_calibration); setText('lbl-file-ready-mode',T.settings_file_ready_mode); setText('opt-file-ready-dialog',T.settings_file_ready_dialog); setText('opt-file-ready-banner',T.settings_file_ready_banner); @@ -1100,6 +1101,7 @@ function openSettings(){ document.getElementById('s-default-slot').value=d.default_ams_slot||'auto'; document.getElementById('s-auto-leveling').checked=(d.auto_leveling===undefined?true:!!d.auto_leveling); var vc=document.getElementById('s-vibration-compensation');if(vc)vc.checked=!!d.vibration_compensation; + var vc=document.getElementById('s-flow-calibration');if(vc)vc.checked=!!d.flow_calibration; var cop=document.getElementById('s-camera-on-print');if(cop)cop.checked=!!d.camera_on_print; var frm=document.getElementById('s-file-ready-mode');if(frm)frm.value=(d.print_start_dialog===undefined?'1':String(d.print_start_dialog?1:0)); var wuw=document.getElementById('s-web-upload-warning');if(wuw)wuw.checked=(d.web_upload_warning===undefined?true:!!d.web_upload_warning); @@ -1868,6 +1870,7 @@ function saveSettings(){ default_ams_slot: document.getElementById('s-default-slot').value, auto_leveling: document.getElementById('s-auto-leveling').checked?1:0, vibration_compensation: (document.getElementById('s-vibration-compensation')||{}).checked?1:0, + flow_calibration: (document.getElementById('s-flow-calibration')||{}).checked?1:0, camera_on_print: (document.getElementById('s-camera-on-print')||{}).checked?1:0, print_start_dialog: parseInt((document.getElementById('s-file-ready-mode')||{}).value||'1',10), web_upload_warning:webUploadWarning, diff --git a/web/themes/default/index.html b/web/themes/default/index.html index 4f7b82d..39f50c1 100644 --- a/web/themes/default/index.html +++ b/web/themes/default/index.html @@ -526,6 +526,10 @@ +