├── KlipperSettingsPlugin.py ├── LICENSE ├── README.md ├── __init__.py ├── klipper_settings.def.json ├── plugin.json └── resources ├── images ├── Klipper.svg └── examples │ ├── KSP_AllSettings_v1.0.PNG │ ├── KSP_Category_v1.0.PNG │ ├── KSP_Preset-ex1_v1.0.PNG │ └── beta │ ├── ksp_allsettings_0.9.png │ ├── ksp_category_0.9.0.JPG │ ├── ksp_tt_preset-pa_ex1.png │ └── ksp_tt_preset-rt_ex1.png └── models ├── ringing_tower.stl └── square_tower.stl /KlipperSettingsPlugin.py: -------------------------------------------------------------------------------- 1 | # KlipperSettingsPlugin v1.0.2 2 | # Copyright (c) 2023 J.Jarrard / JJFX 3 | # The KlipperSettingsPlugin is released under the terms of the AGPLv3 or higher. 4 | # 5 | # ** CREDIT ** 6 | # Special thanks to Aldo Hoeben / fieldOfView whose previous work made this possible. 7 | # Thanks to everyone who has provided feedback and helped test the beta. 8 | 9 | ''' 10 | KLIPPER SETTINGS PLUGIN 11 | ----------------------- 12 | Compatible only with Klipper firmware. 13 | Creates new 'Klipper Settings' category at the bottom of Cura settings list. 14 | Designed to work without the need for additional Klipper macros. 15 | Multiple extruders are supported for compatible settings. 16 | 17 | Ultimaker Cura compatibility tested up to version 5.2.2: 18 | Recommended Version: 5.0.0 (SDK 8.0.0) and newer. 19 | Minimum Supported Version: 4.0.0 (SDK 6.0.0) 20 | 21 | ------------------------------------------------- 22 | Version | Release Notes & Features 23 | ------------------------------------------------- 24 | v0.8.0 + Tested up to Cura version 5.0 25 | | Pressure Advance Settings (v1.5) 26 | | Tuning Tower Settings 27 | | Velocity Limits Settings 28 | v0.8.1 + Fixed custom category icon 29 | v0.9.0 + Firmware Retraction Settings 30 | | Input Shaper Settings 31 | | Tuning Tower Presets feature 32 | | Tuning Tower Suggested Settings feature 33 | | Tuning Tower Preset: Pressure Advance 34 | | Tuning Tower Preset: Ringing Tower 35 | v0.9.1 + Fixed crashing in older Cura versions 36 | | Custom icon now only enabled for Cura 5.0+ 37 | | Improved preset and backup behavior 38 | v0.9.2 + P.A. Preset: Fixed incorrect parameter 39 | | Preset layer height suggested from nozzle size 40 | --------| 41 | v1.0.0 + Support for 3 Tuning Tower User Presets 42 | | Pressure Advance Smooth Time 43 | | Z Offset Control 44 | | Z Offset Layer 0 feature 45 | | P.A. Preset: Suggested factor set automatically 46 | | Improved UI behavior 47 | | Experimental Features: 48 | | - Bed Mesh Calibrate 49 | | - Klipper UI Preheat Support 50 | v1.0.1 + Firmware retraction multi-extruder support 51 | | Firmware retraction uses cura values by default 52 | | Various bug fixes 53 | v1.0.2 + Setting definition compatibility for older versions 54 | | Fixed duplicate setting relations 55 | | Fixed changing machines with preset settings enabled 56 | | Smooth time not tied to pressure advance control 57 | | Final warnings combined into a single message 58 | | Setting definition cleanup 59 | 60 | ''' 61 | 62 | import os.path, json, re 63 | import configparser # To parse settings backup in config file 64 | from collections import OrderedDict # Ensure order of settings in all Cura versions 65 | from typing import List, Optional, Any, Dict, Set, TYPE_CHECKING 66 | 67 | try: 68 | from PyQt6.QtCore import QUrl # Import custom images 69 | except ImportError: # Older cura versions 70 | from PyQt5.QtCore import QUrl 71 | 72 | from cura.CuraApplication import CuraApplication 73 | 74 | from UM.Qt.Bindings.Theme import Theme # Update theme with path to custom icon 75 | 76 | from UM.Extension import Extension 77 | from UM.Logger import Logger # Debug logging 78 | from UM.Version import Version # Some features not supported in older versions 79 | from UM.Resources import Resources # Add local path to plugin resources 80 | 81 | from UM.Settings.SettingDefinition import SettingDefinition # Create and register setting definitions 82 | from UM.Settings.DefinitionContainer import DefinitionContainer 83 | from UM.Settings.ContainerRegistry import ContainerRegistry 84 | 85 | from UM.Message import Message # Display messages to user 86 | from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator # Get per-object settings 87 | 88 | from UM.i18n import i18nCatalog # Translations 89 | catalog = i18nCatalog("cura") 90 | 91 | if TYPE_CHECKING: 92 | from UM.OutputDevice.OutputDevice import OutputDevice 93 | 94 | class KlipperSettingsPlugin(Extension): 95 | def __init__(self, parent=None) -> None: 96 | super().__init__() 97 | 98 | Resources.addSearchPath(os.path.join(os.path.dirname(__file__), "resources")) # Plugin resource path 99 | 100 | self._application = CuraApplication.getInstance() 101 | self._cura_version = Version(self._application.getVersion()) 102 | self._i18n_catalog = None # type: Optional[i18nCatalog] 103 | self._global_container_stack = None # type: Optional[ContainerStack] 104 | 105 | self.comment = ";KlipperSettingsPlugin" # Plugin signature added to all new gcode commands 106 | 107 | self._settings_dict = {} # type: Dict[str, Any] 108 | category_icon = self._updateCategoryIcon("Klipper") # Get supported category icon 109 | 110 | self._category_key = "klipper_settings" 111 | self._category_dict = { 112 | "label": "Klipper Settings", 113 | "description": "Features and Settings Specific to Klipper Firmware", 114 | "type": "category", 115 | "icon": "%s" % category_icon 116 | } 117 | ## Message box 118 | self._active_msg_list = [] # type: List[str] 119 | self._warning_msg = [] # type: List[str] 120 | self._previous_msg = None 121 | ## Tuning tower 122 | self._user_settings = {} # type: Dict[str, Any] 123 | self._current_preset = None 124 | self._override_on = False 125 | # Support for 3 custom presets 126 | self._custom_presets = {} # type: Dict[(int, str), Any] 127 | 128 | # Current firmware retraction values 129 | self._firmware_retract = {} # type: Dict[str, float] 130 | 131 | try: # Get setting definitions from json 132 | with open(os.path.join(os.path.dirname(__file__), "klipper_settings.def.json"), encoding = "utf-8") as f: 133 | self._settings_dict = json.load(f, object_pairs_hook = OrderedDict) 134 | except: 135 | Logger.logException('e', "Could not load klipper settings definition") 136 | return 137 | else: # Modify definitions for older Cura compatibility 138 | if self._cura_version < Version("4.7.0"): 139 | self._fixSettingsCompatibility() 140 | 141 | ContainerRegistry.getInstance().containerLoadComplete.connect(self._onContainerLoadComplete) 142 | self._application.initializationFinished.connect(self._onInitialization) 143 | 144 | def _onInitialization(self) -> None: 145 | ## Connect signals 146 | self._application.getPreferences().preferenceChanged.connect(self._fixCategoryVisibility) 147 | self._application.getMachineManager().globalContainerChanged.connect(self._onGlobalContainerChanged) 148 | self._application.getOutputDeviceManager().writeStarted.connect(self._filterGcode) 149 | ## Startup actions 150 | # Checks user settings backup in Cura config 151 | self._user_settings = self._getBackup() # type: Dict[str, Any] 152 | self._fixCategoryVisibility() # Ensure visibility of new settings category 153 | self._onGlobalContainerChanged() # Connect to Cura setting changes 154 | self._setTuningTowerPreset() # Set status of tuning tower settings 155 | # Defines custom preset profiles 156 | for profile_nr in [1, 2, 3]: 157 | # Checks for preset backup in Cura config 158 | self._custom_presets.update(self._getBackup("preset%s" % profile_nr)) 159 | 160 | def _onContainerLoadComplete(self, container_id: str) -> None: 161 | """Checks loaded containers for active definition containers. 162 | 163 | Registers new Klipper Settings category and setting definitions. 164 | """ 165 | if not ContainerRegistry.getInstance().isLoaded(container_id): 166 | return # Skip containers that could not be loaded 167 | try: 168 | container = ContainerRegistry.getInstance().findContainers(id = container_id)[0] 169 | except IndexError: 170 | return # Sanity check 171 | if not isinstance(container, DefinitionContainer) or container.getMetaDataEntry('type') == "extruder": 172 | return # Skip non-definition and extruder containers 173 | 174 | # Create new settings category 175 | klipper_category = SettingDefinition(self._category_key, container, None, self._i18n_catalog) 176 | klipper_category.deserialize(self._category_dict) 177 | container.addDefinition(klipper_category) # Register category setting definition 178 | 179 | try: # Make sure new category actually exists 180 | klipper_category = container.findDefinitions(key=self._category_key)[0] 181 | except IndexError: 182 | Logger.log('e', "Could not find settings category: '%s'", self._category_key) 183 | return 184 | 185 | # Adds all setting definitions to new category 186 | for setting_key in self._settings_dict: 187 | setting_definition = SettingDefinition(setting_key, container, klipper_category, self._i18n_catalog) 188 | setting_definition.deserialize(self._settings_dict[setting_key]) 189 | ## Restricted: Appends new setting to the existing category definition. 190 | ## No existing commands are affected in the new restricted list and simply updating the 191 | ## definition container cache/relations seems safe in relevant Cura versions. 192 | klipper_category._children.append(setting_definition) 193 | container._definition_cache[setting_key] = setting_definition 194 | if setting_definition.children: 195 | self._updateAddedChildren(container, setting_definition) 196 | 197 | container._updateRelations(klipper_category) # Update relations for all category settings 198 | 199 | def _updateAddedChildren(self, container: DefinitionContainer, setting_definition: SettingDefinition) -> None: 200 | # Updates definition cache for all setting definition children 201 | for child in setting_definition.children: 202 | container._definition_cache[child.key] = child 203 | 204 | if child.children: 205 | self._updateAddedChildren(container, child) 206 | 207 | def _updateCategoryIcon(self, icon_name: str) -> str: 208 | """Returns string of compatible category icon to update Cura theme. 209 | 210 | Updates default Cura theme with custom icon for new settings category. 211 | In Cura versions before 5.0 a default icon name is returned. 212 | * icon_name: String for name of icon image resource without extension. 213 | """ 214 | category_icon = "plugin" # Existing Cura icon if new icon fails to load 215 | 216 | if self._cura_version < Version("5.0.0"): 217 | Logger.log('d', "Category icon not compatible with Cura version %s", self._cura_version) 218 | else: 219 | try: 220 | icon_path = Resources.getPath(6, "%s.svg" % icon_name) # Resource type 6 (images) 221 | except FileNotFoundError: 222 | Logger.log('w', "Category icon image could not be found.") 223 | else: 224 | current_theme = Theme.getInstance() 225 | category_icon = icon_name 226 | ## Restricted: Adds new custom icon to the default theme icon dict. 227 | ## The only alternative found is to load an entire cloned theme with the icon. 228 | if icon_name not in current_theme._icons['default']: 229 | current_theme._icons['default'][icon_name] = QUrl.fromLocalFile(icon_path) 230 | 231 | return category_icon 232 | 233 | def _fixSettingsCompatibility(self) -> None: 234 | """Update setting definitions for older Cura version compatibility. 235 | 236 | Prior to 4.7.0 'support_meshes_present' did not exist and tree supports was an experimental option. 237 | """ 238 | pa_support = self._settings_dict['klipper_pressure_advance_factor'].get('children')['klipper_pressure_advance_support'] 239 | pa_support_infill = pa_support.get('children')['klipper_pressure_advance_support_infill'] 240 | pa_support_interface = pa_support.get('children')['klipper_pressure_advance_support_interface'] 241 | 242 | for definition in [pa_support, pa_support_infill, pa_support_interface]: 243 | definition['enabled'] = str(definition['enabled']).replace("support_meshes_present", "support_tree_enable") 244 | 245 | # Updates support setting definition 246 | self._settings_dict['klipper_pressure_advance_factor'].get('children').update({'klipper_pressure_advance_support': pa_support}) 247 | # Updates setting children 248 | self._settings_dict['klipper_pressure_advance_factor'].get('children')['klipper_pressure_advance_support'].get('children').update({ 249 | 'klipper_pressure_advance_support_infill': pa_support_infill, 250 | 'klipper_pressure_advance_support_interface': pa_support_interface}) 251 | 252 | def _fixCategoryVisibility(self, preference: str = "general/visible_settings") -> None: 253 | """Ensure new category is visible at start and when visibility changes. 254 | 255 | """ 256 | if preference != "general/visible_settings": 257 | return 258 | 259 | preferences = self._application.getPreferences() 260 | visible_settings = preferences.getValue(preference) 261 | 262 | if not visible_settings: 263 | return # Empty list fixed once user adds a visible setting 264 | if self._category_key not in visible_settings: 265 | visible_settings += ";%s" % self._category_key 266 | 267 | preferences.setValue(preference, visible_settings) # Category added to visible settings 268 | 269 | def _onGlobalContainerChanged(self) -> None: 270 | """The active machine global container stack has changed. 271 | 272 | Signals when a property changes in global or extruder stacks. 273 | Restores user settings if the active machine changed with preset override enabled. 274 | """ 275 | if self._global_container_stack: # Disconnect inactive container 276 | self._global_container_stack.propertyChanged.disconnect(self._onGlobalSettingChanged) 277 | for extruder in self._global_container_stack.extruderList: 278 | extruder.propertyChanged.disconnect(self._onExtruderSettingChanged) 279 | 280 | if self._user_settings: # Restore user settings when switching machines 281 | try: # Get new machine ID 282 | new_active_machine_id = self._application.getMachineManager().activeMachine.getId() 283 | except AttributeError: 284 | Logger.log('w', "Could not get active machine ID.") 285 | else: # Switch to previous machine because global container already changed 286 | self._application.getMachineManager().setActiveMachine(self._global_container_stack.getId()) 287 | self._restoreUserSettings(announce = False) 288 | # Sets the new active machine 289 | self._application.getMachineManager().setActiveMachine(new_active_machine_id) 290 | 291 | self._current_preset = None 292 | self._setTuningTowerPreset() # Set tuning tower status 293 | 294 | self._global_container_stack = self._application.getMachineManager().activeMachine 295 | 296 | if self._global_container_stack: # Connect active container stack 297 | self._global_container_stack.propertyChanged.connect(self._onGlobalSettingChanged) 298 | for extruder in self._global_container_stack.extruderList: 299 | extruder.propertyChanged.connect(self._onExtruderSettingChanged) 300 | 301 | def _onGlobalSettingChanged(self, setting: str, property: str) -> None: 302 | """Setting in the global container stack has changed. 303 | 304 | Monitors when klipper settings in the global stack have new values. 305 | * setting: String of the setting key that changed. 306 | * property: String of the setting property that changed. 307 | """ 308 | if setting.startswith("klipper") and property in ["value", "enabled"]: 309 | if setting.startswith("klipper_tuning"): 310 | self._setTuningTowerPreset() # Update tuning tower presets 311 | 312 | def _onExtruderSettingChanged(self, setting: str, property: str) -> None: 313 | """Setting in an extruder container stack has changed. 314 | 315 | Monitors when certain klipper settings in the active extruder stack have new values. 316 | Klipper retraction settings mimic Cura values until user changes are detected. 317 | * setting: String of the setting key that changed. 318 | * property: String of the setting property that changed. 319 | """ 320 | if setting.startswith("klipper") and property in ["value", "enabled"]: 321 | is_user_value = self.settingWizard(setting, "Get hasUserValue") 322 | 323 | if setting.startswith("klipper_retract"): 324 | if setting == "klipper_retraction_speed" and is_user_value: 325 | retraction_speed = self.settingWizard("klipper_retraction_speed") 326 | 327 | for child in ["klipper_retract_speed", "klipper_retract_prime_speed"]: 328 | values_match = (self._firmware_retract.get(setting, None) == self._firmware_retract.get(child, None)) 329 | value_changed = self.settingWizard(child, "Get hasUserValue") 330 | # Ensures children tied to cura values follow user changes to parent setting 331 | # TODO: Minor bug if parent value is set to default value again; 332 | # Stop-gap until solution is found for changing the 'value' function of existing settings. 333 | if not value_changed or values_match: 334 | self.settingWizard(child, retraction_speed, "Set") 335 | 336 | # Saves previously set values to compare changes 337 | self._firmware_retract[setting] = self.settingWizard(setting) 338 | 339 | 340 | def _forceErrorCheck(self, setting_key: str=None) -> None: 341 | """Force error check on current setting values. 342 | 343 | Ensures user can't slice if Cura doesn't recognize default value as error. 344 | May not be necessary for all Cura versions but best to play it safe. 345 | All tuning tower settings checked if no setting_key specified. 346 | + setting_key: String for specific setting to check. 347 | """ 348 | error_checker = self._application.getMachineErrorChecker() 349 | 350 | if setting_key: 351 | error_checker.startErrorCheckPropertyChanged(setting_key, "value") 352 | else: 353 | for setting in self.__tuning_tower_setting_key.values(): 354 | error_checker.startErrorCheckPropertyChanged(setting, "value") 355 | 356 | 357 | def _filterGcode(self, output_device: "OutputDevice") -> None: 358 | """Inserts command strings for enabled Klipper settings into final gcode. 359 | 360 | Cura gcode is post-processed at the time of saving a new sliced file. 361 | """ 362 | scene = self._application.getController().getScene() 363 | global_stack = self._application.getGlobalContainerStack() 364 | extruder_manager = self._application.getExtruderManager() 365 | used_extruder_stacks = extruder_manager.getUsedExtruderStacks() 366 | 367 | if not global_stack or not used_extruder_stacks: 368 | return 369 | 370 | # Extruders currently affected by klipper settings 371 | active_extruder_list = set() # type: Set[int] 372 | # Mesh features for pressure advance 373 | active_mesh_features = set() # type: Set[str] 374 | 375 | cura_start_gcode = global_stack.getProperty('machine_start_gcode', 'value') # To search for existing commands 376 | 377 | # Gets global state of klipper setting controls (bool) 378 | firmware_retract_enabled = global_stack.getProperty('machine_firmware_retract', 'value') 379 | pressure_advance_enabled = global_stack.getProperty('klipper_pressure_advance_enable', 'value') 380 | velocity_limits_enabled = global_stack.getProperty('klipper_velocity_limits_enable', 'value') 381 | input_shaper_enabled = global_stack.getProperty('klipper_input_shaper_enable', 'value') 382 | tuning_tower_enabled = global_stack.getProperty('klipper_tuning_tower_enable', 'value') 383 | smooth_time_enabled = global_stack.getProperty('klipper_smooth_time_enable', 'value') 384 | z_offset_enabled = global_stack.getProperty('klipper_z_offset_control_enable', 'value') 385 | # Experimental features 386 | experimental_features_enabled = global_stack.getProperty('klipper_experimental_enable', 'value') 387 | mesh_calibrate_enabled = global_stack.getProperty('klipper_mesh_calibrate_enable', 'value') 388 | ui_temp_support_enabled = global_stack.getProperty('klipper_ui_temp_support_enable', 'value') 389 | 390 | gcode_dict = getattr(scene, 'gcode_dict', {}) 391 | if not gcode_dict: 392 | Logger.log('w', "Scene has no gcode to process") 393 | return 394 | 395 | gcode_changed = False 396 | 397 | new_gcode_commands = "" # String container for all new commands 398 | 399 | for plate_id in gcode_dict: 400 | gcode_list = gcode_dict[plate_id] 401 | if len(gcode_list) < 2: 402 | Logger.log('w', "Plate %s does not contain any layers", plate_id) 403 | continue 404 | if ";KLIPPERSETTINGSPROCESSED\n" in gcode_list[0]: # Only process new files 405 | Logger.log('d', "Plate %s has already been processed", plate_id) 406 | continue 407 | 408 | # Searches start gcode for tool change command 409 | # Compatibility for cura versions without getInitialExtruder 410 | initial_toolchange = re.search(r"(?m)^T([0-9])+$", gcode_list[1]) 411 | 412 | if initial_toolchange: # Set initial extruder number 413 | start_extruder_nr = int(initial_toolchange.group(1)) 414 | else: # Set active extruder number 415 | start_extruder_nr = int(self.settingWizard('extruder_nr')) 416 | 417 | start_extruder_stack = extruder_manager.getExtruderStack(start_extruder_nr) 418 | 419 | ## EXPERIMENTAL FEATURES -------------------------------- 420 | if not experimental_features_enabled: 421 | Logger.log('d', "Klipper Experimental Features Disabled") 422 | else: 423 | ## BED MESH CALIBRATE COMMAND 424 | if not mesh_calibrate_enabled: 425 | Logger.log('d', "Klipper Bed Mesh Calibration is Disabled") 426 | else: 427 | # Search start gcode for existing command 428 | mesh_calibrate_exists = self.gcodeSearch(cura_start_gcode, 'BED_MESH_CALIBRATE') 429 | 430 | if mesh_calibrate_exists: # Do not add commands 431 | self.showMessage( 432 | "Calibration command is already active in Cura start gcode.", 433 | "WARNING", "Bed Mesh Calibrate Not Applied", stack_msg = True) 434 | 435 | else: # Add mesh calibration command sequence to gcode 436 | preheat_bed_temp = global_stack.getProperty("material_bed_temperature_layer_0", 'value') 437 | gcode_list[1] = "M190 S%s %s\n" % (preheat_bed_temp, self.comment) + ( 438 | "G28 %s\n" % self.comment) + ( 439 | "BED_MESH_CALIBRATE %s\n\n" % self.comment) + gcode_list[1] 440 | gcode_changed = True 441 | 442 | self.showMessage( 443 | "Calibration will heat bed then run before the start gcode sequence.", 444 | "NEUTRAL", "Klipper Bed Mesh Calibration Enabled") 445 | 446 | ## KLIPPER UI SUPPORT 447 | if not ui_temp_support_enabled: 448 | Logger.log('d', "Klipper UI Temp Support is Disabled") 449 | else: 450 | # Checks if M190 and M109 commands exist in start gcode 451 | new_gcode_commands += self._gcodeUiSupport(gcode_list[1]) 452 | 453 | ## FIRMWARE RETRACTION COMMAND -------------------------- 454 | if not firmware_retract_enabled: 455 | Logger.log('d', "Klipper Firmware Retraction is Disabled") 456 | extruder_fw_retraction = None 457 | else: 458 | initial_retraction_settings = {} # type: Dict[str, float] 459 | extruder_fw_retraction = {} # type: Dict[int, Dict[str, float]] 460 | 461 | if len(used_extruder_stacks) > 1: # Add empty dict for each extruder 462 | for extruder_nr in range(len(used_extruder_stacks)): 463 | extruder_fw_retraction[extruder_nr] = {} # type: Dict[str, float] 464 | 465 | for klipper_cmd, setting in self.__firmware_retraction_setting_key.items(): 466 | # Gets initial retraction settings for the print 467 | initial_retraction_settings[klipper_cmd] = start_extruder_stack.getProperty(setting, 'value') 468 | 469 | if extruder_fw_retraction: 470 | for extruder in used_extruder_stacks: 471 | extruder_nr = int(extruder.getProperty('extruder_nr', 'value')) 472 | # Gets settings for each extruder and updates active extruders 473 | extruder_fw_retraction[extruder_nr].update({klipper_cmd: extruder.getProperty(setting, 'value')}) 474 | active_extruder_list.add(extruder_nr) # type: Set[int] 475 | 476 | for extruder_nr, settings in extruder_fw_retraction.items(): # Create gcode command for each extruder 477 | extruder_fw_retraction[extruder_nr] = self._gcodeFirmwareRetraction(settings) + self.comment # type: Dict[int, str] 478 | 479 | try: # Add enabled commands for initial extruder to start gcode 480 | new_gcode_commands += (self._gcodeFirmwareRetraction(initial_retraction_settings) + self.comment + "\n") 481 | 482 | except TypeError: 483 | Logger.log('d', "Klipper initial firmware retraction was not set.") 484 | 485 | ## VELOCITY LIMITS COMMAND ------------------------------ 486 | if not velocity_limits_enabled: 487 | Logger.log('d', "Klipper Velocity Limit Control is Disabled") 488 | else: 489 | velocity_limits = {} # type: Dict[str, int] 490 | # Get all velocity setting values 491 | for limit_key, limit_setting in self.__velocity_limit_setting_key.items(): 492 | velocity_limits[limit_key] = global_stack.getProperty(limit_setting, 'value') 493 | try: # Add enabled commands to gcode 494 | new_gcode_commands += (self._gcodeVelocityLimits(velocity_limits) + self.comment + "\n") 495 | 496 | except TypeError: 497 | Logger.log('d', "Klipper velocity limits were not set.") 498 | 499 | ## INPUT SHAPER COMMAND --------------------------------- 500 | if not input_shaper_enabled: 501 | Logger.log('d', "Klipper Input Shaper Control is Disabled") 502 | else: 503 | shaper_settings = {} # type: Dict[str, Any] 504 | # Get all input shaper setting values 505 | for shaper_key, shaper_setting in self.__input_shaper_setting_key.items(): 506 | shaper_settings[shaper_key] = global_stack.getProperty(shaper_setting, 'value') 507 | try: # Add enabled commands to gcode 508 | new_gcode_commands += (self._gcodeInputShaper(shaper_settings) + self.comment + "\n") 509 | 510 | except TypeError: 511 | Logger.log('d', "Klipper input shaper settings were not set.") 512 | 513 | ## TUNING TOWER COMMAND --------------------------------- 514 | if not tuning_tower_enabled: 515 | Logger.log('d', "Klipper Tuning Tower is Disabled") 516 | else: 517 | tower_settings = OrderedDict() # type: OrderedDict[str, Any] 518 | # Get all tuning tower setting values 519 | for tower_key, tower_setting in self.__tuning_tower_setting_key.items(): 520 | tower_settings[tower_key] = global_stack.getProperty(tower_setting, 'value') 521 | try: # Add tuning tower sequence to gcode 522 | gcode_list[1] += (self._gcodeTuningTower(tower_settings) + self.comment + "\n") 523 | gcode_changed = True 524 | 525 | except TypeError: 526 | Logger.log('w', "Klipper tuning tower could not be processed.") 527 | return # Stop on error 528 | 529 | ## Z OFFSET COMMAND ------------------------------------- 530 | if not z_offset_enabled: 531 | Logger.log('d', "Klipper Z Offset Adjustment is Disabled") 532 | z_offset_layer_0 = 0 533 | else: 534 | z_offset_adjust_pattern = "SET_GCODE_OFFSET Z_ADJUST=%g " + self.comment 535 | z_offset_set_pattern = "SET_GCODE_OFFSET Z=%g " + self.comment 536 | 537 | z_offset_override = global_stack.getProperty('klipper_z_offset_set_enable', 'value') 538 | z_offset_layer_0 = global_stack.getProperty('klipper_z_offset_layer_0', 'value') 539 | 540 | if not z_offset_override: 541 | Logger.log('d', "Klipper total z offset was not changed.") 542 | else: 543 | z_offset_total = global_stack.getProperty('klipper_z_offset_set_total', 'value') 544 | # Overrides any existing z offset with new value 545 | # This will compound with any additional first layer z offset adjustment. 546 | gcode_list[1] += z_offset_set_pattern % z_offset_total + "\n" # Applied after start gcode 547 | gcode_changed = True 548 | # Add z offset override warning 549 | self._warning_msg.insert(0, "• Z Offset Override is set to %s mm" % z_offset_total) 550 | 551 | if not z_offset_layer_0: 552 | Logger.log('d', "Klipper first layer z offset was not changed.") 553 | else: 554 | layer_0_height = global_stack.getProperty('layer_height_0', 'value') 555 | # Matches z axis coordinate in gcode lines that haven't been processed 556 | # Z offset only applies if z axis coordinate equals the layer 0 height; 557 | # This is safer and necessary to avoid conflicts with settings such as z hop. 558 | z_axis_regex = re.compile(r"^G[01]\s.*Z(%g)(?!.*%s)" % (layer_0_height, self.comment)) 559 | 560 | self._warning_msg.insert(0, "• Initial Layer Z Offset will %s nozzle by %s mm" % ( 561 | "lower" if z_offset_layer_0 < 0 else "raise", z_offset_layer_0)) # Add to final warning message 562 | 563 | ## PRESSURE ADVANCE COMMAND ----------------------------- 564 | if not pressure_advance_enabled and not smooth_time_enabled: 565 | Logger.log('d', "Klipper Pressure Advance Control is Disabled") 566 | 567 | else: 568 | # Extruder Settings 569 | apply_factor_per_feature = {} # type: Dict[int, bool] 570 | extruder_factors = {} # type: Dict[(int,str), float] 571 | current_factor = {} # type: Dict[int, float] 572 | # Mesh Object Settings 573 | per_mesh_factors = {} # type: Dict[(str,str), float] 574 | non_mesh_features = [*self.__pressure_advance_setting_key][8:] # SUPPORT, SKIRT, etc. 575 | 576 | smooth_time_factor = 0 577 | pressure_advance_factor = -1 578 | 579 | for extruder_stack in used_extruder_stacks: # Get settings for all active extruders 580 | extruder_nr = int(extruder_stack.getProperty('extruder_nr', 'value')) 581 | 582 | if not smooth_time_enabled: 583 | Logger.log('d', "Klipper Pressure Advance Smooth Time is Disabled") 584 | else: 585 | smooth_time_factor = extruder_stack.getProperty('klipper_smooth_time_factor', 'value') 586 | 587 | if not pressure_advance_enabled: 588 | Logger.log('d', "Klipper Pressure Advance Factor is Disabled") 589 | else: 590 | pressure_advance_factor = extruder_stack.getProperty('klipper_pressure_advance_factor', 'value') 591 | current_factor[extruder_nr] = pressure_advance_factor 592 | 593 | # Gets feature settings for each extruder 594 | for feature_key, setting_key in self.__pressure_advance_setting_key.items(): 595 | extruder_factors[(extruder_nr, feature_key)] = extruder_stack.getProperty(setting_key, 'value') 596 | # Checks for unique feature values 597 | if extruder_factors[(extruder_nr, feature_key)] != pressure_advance_factor: 598 | apply_factor_per_feature[extruder_nr] = True # Flag to process gcode 599 | 600 | try: # Add initial pressure advance command for all active extruders 601 | new_gcode_commands += self._gcodePressureAdvance( 602 | str(extruder_nr).strip('0'), pressure_advance_factor, smooth_time_factor) + "\n" 603 | 604 | except TypeError: 605 | Logger.log('w', "Klipper pressure advance values invalid: %s", str(pressure_adv_values)) 606 | return 607 | 608 | 609 | if pressure_advance_enabled: 610 | ## Per Object Settings 611 | # Gets printable mesh objects that are not support 612 | nodes = [node for node in DepthFirstIterator(scene.getRoot()) 613 | if node.isSelectable()and not node.callDecoration('isNonThumbnailVisibleMesh')] 614 | if not nodes: 615 | Logger.log('w', "No valid objects in scene to process.") 616 | return 617 | 618 | for node in nodes: 619 | mesh_name = node.getName() # Filename of mesh with extension 620 | mesh_settings = node.callDecoration('getStack').getTop() 621 | extruder_nr = int(node.callDecoration('getActiveExtruderPosition')) 622 | 623 | # Get active feature settings for mesh object 624 | for feature_key, setting_key in self.__pressure_advance_setting_key.items(): 625 | if mesh_settings.getInstance(setting_key) is not None: 626 | mesh_setting_value = mesh_settings.getInstance(setting_key).value 627 | else: 628 | continue 629 | 630 | # Save the children! 631 | for feature in ( 632 | ["WALL-OUTER", "WALL-INNER", "SKIN", "FILL"] if feature_key == "_FACTORS" 633 | else ['WALL-OUTER', 'WALL-INNER'] if feature_key == "_WALLS" 634 | else ['SUPPORT', 'SUPPORT-INTERFACE'] if feature_key == "_SUPPORTS" 635 | else [feature_key]): 636 | 637 | per_mesh_factors[(mesh_name, feature)] = mesh_setting_value 638 | active_mesh_features.add(feature) # All per-object features 639 | apply_factor_per_feature[extruder_nr] = True # Flag to process gcode 640 | 641 | # Set gcode loop parameters 642 | if any(apply_factor_per_feature.values()): 643 | for extruder_nr in list(apply_factor_per_feature): 644 | active_extruder_list.add(extruder_nr) 645 | else: 646 | pressure_advance_enabled = False 647 | 648 | 649 | ## POST-PROCESS GCODE LOOP ------------------------------ 650 | # TODO: This should eventually get reworked into a function. 651 | if pressure_advance_enabled or (z_offset_layer_0 or extruder_fw_retraction): 652 | extruder_nr = start_extruder_nr 653 | current_layer_nr = -1 654 | current_mesh = None 655 | feature_type_error = False 656 | 657 | for layer_nr, layer in enumerate(gcode_list): 658 | lines = layer.split("\n") 659 | lines_changed = False 660 | for line_nr, line in enumerate(lines): 661 | apply_new_factor = False 662 | 663 | if line.startswith(";LAYER:"): 664 | try: 665 | current_layer_nr = int(line[7:]) # Integer for current gcode layer 666 | except ValueError: 667 | Logger.log('w', "Could not get layer number: %s", line) 668 | 669 | new_layer = bool(active_mesh_features) # Sanity check for mesh features 670 | 671 | if z_offset_layer_0 and current_layer_nr == 0: 672 | # Matches new line with z coordinate equal to layer 0 height 673 | z_axis_change = z_axis_regex.fullmatch(line) 674 | 675 | if z_axis_change: 676 | # Inserts z offset command before matched line, then instructs klipper to 677 | # revert the offset on the next z axis change even if the print is stopped. 678 | lines.insert(line_nr + 1, z_offset_adjust_pattern % -(z_offset_layer_0)) 679 | lines[line_nr] = line + self.comment # Append line to prevent infinite match 680 | lines.insert(line_nr, z_offset_adjust_pattern % z_offset_layer_0) 681 | lines_changed = True 682 | 683 | if len(active_extruder_list) > 1: 684 | # Sets extruder number from tool change commands (T0,T1...) 685 | if line in ["T" + str(i) for i in active_extruder_list]: 686 | try: 687 | extruder_nr = int(line[1:]) # Active extruder number 688 | except ValueError: 689 | Logger.log('w', "Could not get extruder number: %s", line) 690 | 691 | # Applies retraction values for the current extruder 692 | if extruder_fw_retraction and current_layer_nr >= 0: 693 | lines.insert(line_nr + 1, extruder_fw_retraction[extruder_nr]) 694 | lines_changed = True 695 | 696 | if not pressure_advance_enabled: 697 | if extruder_fw_retraction or (current_layer_nr <= 0 and z_offset_layer_0): 698 | continue 699 | else: 700 | break 701 | 702 | if line.startswith(";MESH:") and line[6:] != "NONMESH": 703 | current_mesh = line[6:] # String for gcode mesh name 704 | 705 | if not feature_type_error: 706 | continue 707 | 708 | apply_new_factor = True # Command will insert before current line 709 | feature_type_error = False 710 | 711 | if line.startswith(";TYPE:"): 712 | feature_type = line[6:] # String for gcode feature 713 | 714 | if current_layer_nr <= 0 and feature_type != "SKIRT": 715 | feature_type = "LAYER_0" 716 | 717 | # Fixes when MESH name is not specified prior to its feature TYPE 718 | # Mostly an issue in older cura versions. 719 | if new_layer and feature_type in active_mesh_features: 720 | feature_type_error = True 721 | continue # Error corrected at next MESH line 722 | 723 | apply_new_factor = True 724 | line_nr += 1 # Command will insert after current line 725 | 726 | if apply_new_factor: 727 | # Sets current extruder value if no mesh setting exists 728 | pressure_advance_factor = per_mesh_factors.get((current_mesh, feature_type), 729 | extruder_factors[(extruder_nr, feature_type)]) 730 | new_layer = False 731 | 732 | # Sets new factor if different from the active value 733 | if pressure_advance_factor != current_factor.get(extruder_nr, None): 734 | current_factor[extruder_nr] = pressure_advance_factor 735 | 736 | lines.insert(line_nr, self._gcodePressureAdvance( 737 | str(extruder_nr).strip('0'), pressure_advance_factor)) 738 | lines_changed = True 739 | 740 | ## Restores gcode layer formatting 741 | if lines_changed: 742 | gcode_list[layer_nr] = "\n".join(lines) 743 | gcode_changed = True 744 | 745 | ## Adds new commands to start of gcode 746 | if not new_gcode_commands: 747 | Logger.log('d', "Klipper start gcode commands were not added.") 748 | else: 749 | gcode_list[1] = new_gcode_commands + "\n" + gcode_list[1] 750 | gcode_changed = True 751 | 752 | ## Finalize processed gcode 753 | if gcode_changed: 754 | self._showWarningMessage(60) # Display any active setting warnings 755 | gcode_list[0] += ";KLIPPERSETTINGSPROCESSED\n" 756 | gcode_dict[plate_id] = gcode_list 757 | setattr(scene, 'gcode_dict', gcode_dict) 758 | 759 | 760 | def gcodeSearch(self, gcode: str, command: str, ignore_comment: bool=False) -> bool: 761 | """Returns true if command exists in gcode string. 762 | 763 | Regex multi-line search for active or inactive gcode command string. 764 | Any characters on the line after the search string are ignored. 765 | * gcode: String containing gcode to search in. 766 | * command: String for gcode command to find. 767 | + ignore_comment: True includes commented command as a match. 768 | """ 769 | # Command is assumed to be the start of the line, ignoring white space; 770 | # Technically treats any preceding character as a comment which is functionally 771 | # identical for this purpose because the command would be invalid anyway. 772 | result = re.search(r"(?mi)^(?P.*)(%s)[.]*" % re.escape(command), gcode) 773 | 774 | if result: 775 | line_match = result.group().lstrip(" \t") 776 | if line_match == command: 777 | Logger.log('i', "Active command found in gcode: '%s'", line_match) 778 | result = bool(result) 779 | elif result.group('comment') and ignore_comment: 780 | Logger.log('i', "Inactive command found in gcode: '%s'", line_match) 781 | result = line_match # Full line returned 782 | else: 783 | result = False 784 | 785 | return result 786 | 787 | def _gcodeUiSupport(self, gcode = List[str]) -> str: 788 | """Command string of commented print start temps. 789 | 790 | Allows fluidd/mainsail to detect gcode print temps when start gcode uses 791 | klipper macros without visible M190 and M109 gcode commands. 792 | * gcode: String containing gcode to search in. 793 | """ 794 | bed_temp = self.settingWizard("material_bed_temperature_layer_0", 'value') 795 | nozzle_temp = self.settingWizard("material_print_temperature", 'value') 796 | nozzle_start_temp = self.settingWizard("material_print_temperature_layer_0", 'value') 797 | 798 | bed_temp_exists = self.gcodeSearch(gcode, "M190", True) 799 | nozzle_temp_exists = self.gcodeSearch(gcode, "M109", True) 800 | 801 | gcode_comment = "" 802 | if not bed_temp_exists: 803 | gcode_comment += ";M190 S%s %s\n" % (bed_temp, self.comment) 804 | if not nozzle_temp_exists: 805 | nozzle_temp = nozzle_start_temp if nozzle_start_temp > 0 else nozzle_temp 806 | gcode_comment += ";M109 S%s %s\n" % (nozzle_temp, self.comment) 807 | 808 | if gcode_comment: 809 | gcode_comment = ";Support for Klipper UI\n" + gcode_comment 810 | 811 | return gcode_comment 812 | 813 | def _gcodePressureAdvance(self, extruder_nr: str, pressure_advance: float=-1, smooth_time: float=0) -> str: 814 | """Returns enabled pressure advance settings as gcode command string. 815 | 816 | """ 817 | gcode_command = "SET_PRESSURE_ADVANCE" 818 | 819 | if pressure_advance >= 0: 820 | gcode_command += " ADVANCE=%g" % pressure_advance 821 | 822 | if smooth_time > 0: 823 | gcode_command += " SMOOTH_TIME=%g" % smooth_time 824 | 825 | gcode_command += " EXTRUDER=extruder%s %s" % (extruder_nr, self.comment) 826 | 827 | return gcode_command 828 | 829 | def _gcodeVelocityLimits(self, velocity_limits: Dict[str, float]) -> str: 830 | """Returns enabled velocity settings as gcode command string. 831 | 832 | """ 833 | # Remove disabled settings 834 | velocity_limits = {key: d for key, d in velocity_limits.items() if ( 835 | key != "square_corner_velocity" and d > 0) or ( 836 | key == "square_corner_velocity" and d >= 0)} 837 | 838 | if velocity_limits: 839 | gcode_command = "SET_VELOCITY_LIMIT " 840 | 841 | for key, value in velocity_limits.items(): 842 | gcode_command += "%s=%d " % (key.upper(), value) 843 | 844 | if not self._override_on and (key == "square_corner_velocity" and value == 0): 845 | self._warning_msg.append("• Square Corner Velocity Limit = 0") 846 | 847 | return gcode_command # TypeError msg if no return 848 | 849 | def _gcodeFirmwareRetraction(self, retraction_settings: Dict[str, float]) -> str: 850 | """Returns enabled firmware retraction settings as gcode command string. 851 | 852 | """ 853 | # Remove disabled settings 854 | retraction_settings = {key: d for key, d in retraction_settings.items() if ( 855 | key.endswith("speed") and d > 0) or (key.endswith("length") and d >= 0)} 856 | 857 | if retraction_settings: 858 | gcode_command = "SET_RETRACTION " 859 | 860 | for key, value in retraction_settings.items(): 861 | gcode_command += "%s=%g " % (key.upper(), value) # Create gcode command 862 | 863 | return gcode_command # TypeError msg if no return 864 | 865 | def _gcodeInputShaper(self, shaper_settings: Dict[str, Any]) -> str: 866 | """Returns enabled input shaper settings as gcode command string. 867 | 868 | """ 869 | if shaper_settings['shaper_type_x'] == shaper_settings['shaper_type_y']: 870 | shaper_settings['shaper_type'] = shaper_settings.pop('shaper_type_x') 871 | del shaper_settings['shaper_type_y'] # Use single command for both axes 872 | 873 | # Remove all disabled settings 874 | shaper_settings = {key: v for key, v in shaper_settings.items() if ( 875 | key.startswith("type", 7) and v != "disabled") or (not key.startswith("type", 7) and v >= 0)} 876 | 877 | value_warnings = len([v for v in shaper_settings.values() if v == 0]) # Number of values set to 0 878 | 879 | if shaper_settings: 880 | gcode_command = "SET_INPUT_SHAPER " 881 | 882 | for key, value in shaper_settings.items(): 883 | value = value.upper() if key.startswith("type", 7) else value 884 | gcode_command += "%s=%s " % (key.upper(), value) # Create gcode command 885 | 886 | if not self._override_on and value_warnings: 887 | self._warning_msg.append("• %d Input Shaper setting(s) = 0" % value_warnings) 888 | 889 | return gcode_command # TypeError msg if no return 890 | 891 | def _gcodeTuningTower(self, tower_settings: Dict[str, Any]) -> str: 892 | """Returns enabled tuning tower settings as gcode command string. 893 | 894 | Real-time string input validation done with regex patterns in setting definitions; 895 | Accepts only word characters but 'command' also allows spaces, 'single-quotes' and '='. 896 | 'command' allows multiple words, up to arbitrary limit of 60 approved characters. 897 | 'parameter' allows single word up to arbitrary limit of 40 word characters. 898 | """ 899 | used_extruder_stacks = self._application.getExtruderManager().getUsedExtruderStacks() 900 | gcode_settings = OrderedDict() # Preserve dict order in all Cura versions 901 | 902 | # Remove disabled and optional values 903 | for setting, value in tower_settings.items(): 904 | if not (setting in ['skip', 'band'] and value == 0): 905 | gcode_settings[setting] = value 906 | 907 | # Strips any white space, quotes and '=' from ends of 'command' string 908 | gcode_settings['command'] = gcode_settings['command'].strip(" \t'=") 909 | # Add single quotes if 'command' has multiple words 910 | if len(gcode_settings['command'].split()) > 1: 911 | gcode_settings['command'] = "'%s'" % gcode_settings['command'] 912 | 913 | gcode_command = "TUNING_TOWER " 914 | method = gcode_settings.pop('tuning_method') 915 | 916 | for key, value in gcode_settings.items(): 917 | if method == "factor" and key in ['step_delta', 'step_height']: 918 | continue 919 | if method == "step" and key in ['factor', 'band']: 920 | continue 921 | 922 | gcode_command += "%s=%s " % (key.upper(), value) 923 | 924 | ## Final Tuning Tower Warning Message 925 | warning_msg = "Tuning Tower is Active:
%s

" % gcode_command 926 | if len(used_extruder_stacks) > 1: 927 | warning_msg += "Tuning Tower with multiple extruders could be unpredictable!

" 928 | warning_msg += "Tuning tower calibration affects all objects on the build plate." 929 | 930 | self._warning_msg.append(warning_msg) 931 | 932 | return gcode_command # TypeError stop if no return 933 | 934 | def _setTuningTowerPreset(self) -> None: 935 | """Monitors and controls changes to tuning tower preset options. 936 | 937 | User settings overridden by a preset are preserved in config file in case Cura closes. 938 | Support for up to 3 user presets stored in Cura config sections. 939 | """ 940 | if not self._global_container_stack: # Cura needs to finish loading 941 | return 942 | 943 | tuning_tower_enabled = self.settingWizard("klipper_tuning_tower_enable") 944 | 945 | if not tuning_tower_enabled: 946 | self._hideActiveMessages() # Hide any active tuning tower messages 947 | self._restoreUserSettings() # Ensure setting override is reset 948 | self._current_preset = None 949 | return 950 | 951 | elif not self._current_preset: # Tuning tower already enabled 952 | self._restoreUserSettings(announce = False) 953 | self._forceErrorCheck() # Default value error check 954 | self._hideActiveMessages() 955 | self.showMessage( 956 | "Tuning tower calibration affects all objects on the build plate.", 957 | "WARNING", "Klipper Tuning Tower is Active", 30) # Show startup warning 958 | 959 | preset_settings = {} #type: Dict[str, Any] 960 | apply_preset = False 961 | 962 | new_preset = self.settingWizard("klipper_tuning_tower_preset") 963 | override_enabled = self.settingWizard("klipper_tuning_tower_override") 964 | 965 | preset_changed = self._current_preset not in [None, new_preset] 966 | 967 | ## Suggested Settings Override 968 | if not override_enabled: 969 | self._restoreUserSettings(override_enabled) 970 | apply_preset = preset_changed 971 | 972 | elif preset_changed: # Reset setting override so user must re-enable it 973 | self._restoreUserSettings() 974 | return 975 | 976 | elif not self._override_on: 977 | Logger.log('d', "Tuning Tower Suggested Settings Enabled") 978 | self.hideMessageType(self._previous_msg, msg_type = 0) 979 | apply_preset = True 980 | 981 | # Gets integer of preset identity if any custom profiles are active 982 | active_custom_preset = int(new_preset[-1]) if new_preset.startswith("custom") else None 983 | 984 | ## Custom Preset Control 985 | # It is not necessary to constantly save changes to the active profile because 986 | # current values are handled by Cura and then saved upon changing profiles. 987 | if preset_changed: 988 | self._hideActiveMessages(msg_type = 1) # Hide neutral messages 989 | 990 | # Saves changes to custom preset when switching presets 991 | if self._current_preset.startswith("custom"): 992 | preset_key = int(self._current_preset[-1]) 993 | for setting in self.__tuning_tower_setting_key.values(): 994 | setting = (preset_key, setting) 995 | self.settingWizard(setting, action = "SaveCustom") 996 | 997 | # Applies current custom preset values 998 | if active_custom_preset: 999 | for setting, value in self._custom_presets.items(): 1000 | if setting[0] == active_custom_preset: # Current preset settings 1001 | self.settingWizard(setting, value, "Set") 1002 | 1003 | self._current_preset = new_preset 1004 | 1005 | ## Klipper Preset Control 1006 | if apply_preset and not active_custom_preset: 1007 | self._forceErrorCheck() 1008 | preset_message = None 1009 | # Gets settings dict for enabled preset 1010 | preset_settings = self.getPresetDefinition(new_preset, override_enabled) # type: Dict[str, Any] 1011 | 1012 | ## Preset Modifiers 1013 | if new_preset == "pressure": # Update settings dict with any calculated values 1014 | Logger.log('d', "Pressure Advance Tuning Tower Preset Enabled") 1015 | preset_message = self._presetPressureAdvance(override = override_enabled) # type: List[str] 1016 | preset_settings.update(self._presetPressureAdvance(preset_settings, override_enabled)) # type: Dict[str, Any] 1017 | 1018 | ## Next preset... 1019 | 1020 | if not preset_settings: 1021 | return 1022 | 1023 | self._override_on = override_enabled # Save current override state 1024 | 1025 | settings_changed = "" 1026 | 1027 | for setting, value in preset_settings.items(): 1028 | setting_label = self.settingWizard(setting, action = "Get label") 1029 | # TODO: Should eventually check every setting for conflicting children. 1030 | if setting == "klipper_pressure_advance_factor": 1031 | # Ensures all defined sub-settings are saved and cleared 1032 | for subsetting in self.__pressure_advance_setting_key.values(): 1033 | self.settingWizard(subsetting, value, "Save&Reset") 1034 | 1035 | if setting.startswith("klipper_tuning"): 1036 | self.settingWizard(setting, value, "Set") # No setting backup 1037 | 1038 | else: # Override is enabled 1039 | self.settingWizard(setting, value, "Save&Set") 1040 | if setting in self._user_settings: # Add name and value to string of changed settings 1041 | if not setting.startswith("klipper"): 1042 | setting_label = "(Cura) %s" % setting_label # Non-Klipper setting 1043 | 1044 | settings_changed += "%s = %s
" % (setting_label, value) 1045 | Logger.log('d', "Klipper preset setting override: %s = %s", setting, value) 1046 | 1047 | ## Klipper Preset Message Box 1048 | if settings_changed or preset_message: 1049 | self._showPresetMessage(settings_changed, preset_message) 1050 | 1051 | 1052 | def _presetPressureAdvance(self, preset_dict: Dict[str, Any]=None, override: bool=False) -> Any: 1053 | """Modified dict or message with suggested values for pressure advance preset. 1054 | 1055 | """ 1056 | preset_title = "Pressure Advance Tuning Tower" 1057 | 1058 | # Suggested factor from current retraction distance 1059 | retract_length = self.settingWizard("klipper_retract_length") if ( 1060 | self.settingWizard("machine_firmware_retract")) else ( 1061 | self.settingWizard("retraction_amount")) 1062 | 1063 | suggested_factor = (0.02 if retract_length > 2.0 else 0.005) # Above 2 mm is likely bowden 1064 | 1065 | if preset_dict: # Change specific settings to suggested values 1066 | for setting, value in preset_dict.items(): 1067 | current_value = self.settingWizard(setting) 1068 | user_value = self.settingWizard(setting, "Get hasUserValue") 1069 | # Applies suggested factor a unless user value already defined 1070 | if override and setting.endswith("tower_factor"): 1071 | self.settingWizard(setting, action = "Save") # Backup value to restore 1072 | preset_dict[setting] = suggested_factor if not user_value else current_value 1073 | 1074 | return preset_dict 1075 | 1076 | elif override: 1077 | # Suggested layer heights from current nozzle diameter 1078 | nozzle_size = self.settingWizard("machine_nozzle_size") 1079 | layer_heights = 0.04 * (nozzle_size * 0.75 // 0.04) 1080 | layer_heights = "%.2f - %.2f mm (%.2g mm Nozzle)" % ( 1081 | layer_heights, layer_heights + 0.04, nozzle_size) 1082 | # Returns suggested settings message 1083 | message = ( 1084 | "Some Printer Settings Need to be Set Manually:

\ 1085 | Print Speeds: ~100+ mm/s
\ 1086 | Layer Height: %s

" % layer_heights) 1087 | 1088 | else: # Return default help message 1089 | message = ( 1090 | "Recommended Factor for Extruder Type:

\ 1091 | Direct Drive: 0.005
\ 1092 | Bowden Extruder: 0.02
\ 1093 | Suggested for Current Retraction Distance: %s" % suggested_factor) 1094 | 1095 | return [message, preset_title] # type: List[str] 1096 | 1097 | def _showPresetMessage(self, settings_changed: str=None, preset_msg: List[str]=None) -> None: 1098 | """Shows message box with a preset message and/or any affected user settings. 1099 | 1100 | + settings_changed: String of every user setting affected by preset. 1101 | + preset_msg: List of strings for preset message[0] and message title[1]. 1102 | """ 1103 | show_changes = [] # type: List[str] 1104 | preset_title = None 1105 | msg_title = "Suggested Settings Applied to Preset" 1106 | 1107 | if preset_msg and type(preset_msg) is list: 1108 | try: preset_title = preset_msg[1] # Safety check 1109 | except: preset_title = "Tuning Tower Preset" 1110 | finally: preset_msg = preset_msg[0] 1111 | 1112 | if settings_changed: 1113 | show_changes.append("Settings Changed:

") 1114 | show_changes.append("
* Disable suggested settings to revert changes") 1115 | show_changes.insert(1, settings_changed) 1116 | 1117 | if preset_msg: # Preface with preset message 1118 | show_changes.insert(0, preset_msg) 1119 | 1120 | show_changes = "".join(show_changes) # Convert message to single string 1121 | 1122 | elif preset_msg and not self._override_on: # Show only default preset message 1123 | msg_title = preset_title 1124 | show_changes = preset_msg 1125 | 1126 | if show_changes: 1127 | self.showMessage( 1128 | show_changes, "WARNING" if settings_changed else "NEUTRAL", 1129 | msg_title, 1130 | msg_time = 60 if settings_changed else 30, 1131 | stack_msg = bool(settings_changed)) 1132 | 1133 | 1134 | def _getBackup(self, section: str="") -> Dict[Any, Any]: 1135 | """Dict of settings stored in Cura user config. 1136 | 1137 | Uses existing config parser to get preference data from [klipper_settings] sections. 1138 | The user settings backup is only needed if Cura closes with override enabled. 1139 | Preset section 'preset' returns user preset values or defaults if none exist. 1140 | * section: Str for [klipper_settings_] config section 1141 | """ 1142 | ## Restricted: Uses Cura config parser for simplicity. 1143 | config_parser = self._application.getPreferences()._parser 1144 | 1145 | config_key = "klipper_settings" + ("_%s" % section.lstrip("_") if section else "") 1146 | config_settings = {} # type: Dict[str, Any] 1147 | preset_settings = {} # type: Dict[str, Any] 1148 | 1149 | try: # Get preset section key 1150 | preset_key = int(section[-1]) 1151 | except IndexError: 1152 | preset_key = None 1153 | 1154 | try: # Get any settings in config section 1155 | config_settings.update(config_parser.items(config_key)) 1156 | except configparser.NoSectionError: 1157 | Logger.log('d', "[%s] not found in Cura config", config_key) 1158 | except: 1159 | Logger.logException('e', "Could not load Cura config file.") 1160 | 1161 | if not preset_key: 1162 | return config_settings 1163 | 1164 | if not config_settings: # Get default preset settings 1165 | config_settings = self.getPresetDefinition("default") 1166 | 1167 | for setting, value in config_settings.items(): 1168 | try: value = float(value) if value != None else "" # Convert number values back into float 1169 | except ValueError: pass 1170 | 1171 | preset_settings[preset_key, setting] = value 1172 | 1173 | return preset_settings # type: Dict[(int, str), Any] 1174 | 1175 | def _restoreUserSettings(self, reset_override: bool=True, announce: bool=True) -> None: 1176 | """Restore non tuning tower settings changed by preset. 1177 | 1178 | All user settings are restored from backup in real time. 1179 | + announce: False disables status message when complete. 1180 | + reset_override: True ensures suggested settings option is disabled. 1181 | """ 1182 | if reset_override: # Disables suggested settings option if enabled 1183 | self.settingWizard("klipper_tuning_tower_override", action = 'Reset') 1184 | 1185 | if not self._user_settings: 1186 | if self._override_on: 1187 | Logger.log('d', "No saved user settings to restore.") 1188 | else: 1189 | for setting, value in self._user_settings.items(): 1190 | self.settingWizard(setting, value, "Restore") 1191 | 1192 | self._user_settings.clear() 1193 | Logger.log('d', "All user settings have been restored.") 1194 | 1195 | if announce and self._override_on: 1196 | self.showMessage( 1197 | "Suggested tuning tower settings restored to original values.", 1198 | "POSITIVE", "Suggested Settings Disabled", 5) 1199 | 1200 | self._override_on = False 1201 | 1202 | 1203 | def settingWizard(self, setting_key: str, new_value: Any=None, action: str='Get') -> Optional[Any]: 1204 | """Action manager to control Cura settings and store values to local Cura config. 1205 | 1206 | Returns Cura setting from either global or active extruder stack. 1207 | Clears setting instance if new set value same as default value. 1208 | User setting changes are stored in Cura config under [klipper_settings]. 1209 | Custom preset values stored in Cura config under [klipper_settings_preset]. 1210 | * setting_key: String for existing Cura setting. 1211 | + new_value: Any value for setting_key or comparative for 'Save' action. 1212 | + action: String specifying the operation for setting_key; 1213 | Get (default) : Return value from global or active extruder stack 1214 | Get : Return any existing setting property (e.g. 'Get label') 1215 | Save, Set, Save&Set : Save value to config and temp dict [and/or] set new_value 1216 | SaveCustom : Save current preset value to config and preset dict 1217 | Restore : Restore setting_key value from local config 1218 | Reset, Save&Reset : Save value to config and temp dict [and/or] reset to default value 1219 | """ 1220 | # TODO: Only active extruder is currently supported. 1221 | extruder_stack = self._application.getExtruderManager().getActiveExtruderStack() 1222 | global_stack = self._application.getGlobalContainerStack() 1223 | 1224 | if not global_stack or not extruder_stack: 1225 | return 1226 | 1227 | if isinstance(setting_key, tuple): # Get setting key if a custom preset tuple key 1228 | custom_key = setting_key 1229 | setting_key = setting_key[1] 1230 | 1231 | if action.startswith(("Save", "Restore")): # Set and check config key 1232 | preferences = self._application.getPreferences() 1233 | config_setting = "klipper_settings/%s" % setting_key 1234 | 1235 | extruder_setting = True if setting_key.startswith("extruder") else ( 1236 | global_stack.getProperty(setting_key,'settable_per_extruder')) 1237 | 1238 | for stack in [extruder_stack] if extruder_setting else [global_stack]: 1239 | current_value = stack.getProperty(setting_key, 'value') 1240 | value_changed = current_value != new_value 1241 | 1242 | if action.startswith("Get"): 1243 | if not action.endswith("Get"): # Action string contains property 1244 | property = "".join(action.split()).lower()[3:] 1245 | try: # Get requested property 1246 | if property.endswith("uservalue"): # Return true if user value 1247 | current_value = stack.hasUserValue(setting_key) 1248 | else: # Return value of property 1249 | current_value = stack.getProperty(setting_key, property) 1250 | except: 1251 | Logger.log('e', "Invalid Property '%s'", property) 1252 | 1253 | return current_value 1254 | 1255 | if action.startswith("Save"): 1256 | if action.endswith("Custom"): # Value saved to global dict and preset in user config 1257 | config_setting = "klipper_settings_preset%i/%s" % (custom_key[0], custom_key[1]) 1258 | self._custom_presets[custom_key] = current_value # type: Dict[(int, str), Any] 1259 | preferences.addPreference(config_setting, None) 1260 | preferences.setValue(config_setting, str(current_value)) 1261 | 1262 | elif value_changed: # New value saved to global dict and user config 1263 | self._user_settings[setting_key] = current_value # type: Dict[str, Any] 1264 | preferences.addPreference(config_setting, None) 1265 | preferences.setValue(config_setting, current_value) 1266 | 1267 | if action == "Restore": 1268 | # Clear redundant config backup 1269 | preferences.removePreference(config_setting) # Logged by cura 1270 | 1271 | action += "Set" # Set original user value 1272 | Logger.log('d', "%s restored to original value.", setting_key) 1273 | 1274 | if action.endswith("Set") and value_changed: 1275 | stack.setProperty(setting_key, 'value', new_value) 1276 | 1277 | # Clear setting instance if new value same as default value 1278 | if new_value == stack.getProperty(setting_key, 'default_value'): 1279 | action += "Reset" 1280 | 1281 | if action.endswith("Reset"): # Removes setting instance 1282 | # TODO: Settings tied to multiple extruders may not get reset. 1283 | stack.getTop().removeInstance(setting_key) 1284 | 1285 | 1286 | def _showWarningMessage(self, msg_time: int=45) -> None: 1287 | """Show final setting warnings as a single message box upon saving print file. 1288 | 1289 | + msg_time: Integer in seconds until message disappears. 1290 | """ 1291 | if self._warning_msg: 1292 | self.showMessage("

".join(self._warning_msg), "WARNING", "Klipper Settings Warnings", msg_time) 1293 | self._warning_msg.clear() 1294 | 1295 | def _hideActiveMessages(self, msg_type: Optional[List[int]]=-3) -> None: 1296 | """Hide potentially active plugin messages. 1297 | 1298 | + msg_type: Integer or list[int] from 0-3 for icon type(s) to hide; 1299 | Negative integer hides all types except the specified value. 1300 | """ 1301 | if self._previous_msg: 1302 | for message in self._active_msg_list: 1303 | self.hideMessageType(message, msg_type) 1304 | 1305 | def showMessage(self, text: str, msg_type: Any=1, msg_title: str="Klipper Settings", msg_time: int=20, stack_msg: bool=False) -> None: 1306 | """Display customized message box in Cura. 1307 | 1308 | Previous plugin message will be hidden by default. 1309 | Maintains list of potentially active messages to be hidden when necessary. 1310 | Message types only compatible with Cura version 4.10+ 1311 | * text: String to set message status. 1312 | + msg_type: String or integer to set icon type; 0:POSITIVE 1:NEUTRAL 2:WARNING 3:ERROR 1313 | + msg_title: String to set message title. 1314 | + msg_time: Integer in seconds until message disappears. 1315 | + stack_msg: True will not hide a previous message. 1316 | """ 1317 | # TODO: Should really categorize plugin messages instead of just using universal types. 1318 | if not isinstance(msg_type, int): 1319 | msg_type = ( 1320 | 0 if msg_type == "POSITIVE" else 1321 | 1 if msg_type == "NEUTRAL" else 1322 | 2 if msg_type == "WARNING" else 3 1323 | ) 1324 | 1325 | if not stack_msg and self._previous_msg: 1326 | self.hideMessageType(self._previous_msg, -3) # Hides a previous non-error message 1327 | if self._previous_msg in self._active_msg_list: 1328 | self._active_msg_list.remove(self._previous_msg) 1329 | 1330 | if self._cura_version <= Version("4.10.0"): 1331 | display_message = Message(catalog.i18nc("@info:status", text), 1332 | lifetime = msg_time, 1333 | title = catalog.i18nc("@info:title", "%s" % msg_title)) 1334 | else: 1335 | display_message = Message(catalog.i18nc("@info:status", text), 1336 | lifetime = msg_time, 1337 | title = catalog.i18nc("@info:title", "%s" % msg_title), 1338 | message_type = msg_type) 1339 | 1340 | self._previous_msg = display_message # Saves copy of message 1341 | if display_message not in self._active_msg_list: # Add to potentially active messages 1342 | self._active_msg_list.append(display_message) 1343 | 1344 | display_message.show() 1345 | 1346 | def hideMessageType(self, message: Message, msg_type: Optional[List[int]]=1) -> None: 1347 | """Hide previous message box only by specific icon types. 1348 | 1349 | Defaults to hiding neutral messages only. 1350 | All message types are hidden if Cura version < 4.10. 1351 | * message: Message object to hide if still active. 1352 | + msg_type: Integer or list[int] from '0-3' for icon type(s) to be hidden; 1353 | Negative integer will hide all types except the specified value. 1354 | """ 1355 | if not message: 1356 | return 1357 | 1358 | legacy_version = self._cura_version <= Version("4.10.0") 1359 | hide_types = [0, 1, 2, 3] 1360 | active_msg_type = message.getMessageType() if not legacy_version else 1 1361 | 1362 | try: 1363 | if msg_type < 0: 1364 | hide_types.pop(abs(msg_type)) # Hides all other types 1365 | else: 1366 | hide_types = [msg_type] # Hides a specific type 1367 | except TypeError: 1368 | hide_types = list(msg_type) # type: List[int] 1369 | 1370 | if active_msg_type in hide_types or legacy_version: 1371 | if message in self._active_msg_list: 1372 | self._active_msg_list.remove(message) 1373 | 1374 | message.hide() 1375 | 1376 | 1377 | def getPresetDefinition(self, new_preset: str, override: bool=False) -> Dict[str, Any]: 1378 | """Dict of predefined setting values for tuning tower presets. 1379 | 1380 | Klipper Pressure Advance and Input Shaper calibrations currently supported. 1381 | * new_preset: String for preset name 1382 | + override: True includes any settings enabled by 'Apply Suggested Settings'. 1383 | """ 1384 | # Tuple lists only necessary to guarantee OrderedDict in older Cura versions 1385 | presets = [( 1386 | 'default', [ 1387 | ('klipper_tuning_tower_command', ''), 1388 | ('klipper_tuning_tower_parameter', ''), 1389 | ('klipper_tuning_tower_method', 'factor'), 1390 | ('klipper_tuning_tower_start', 0), 1391 | ('klipper_tuning_tower_skip', 0), 1392 | ('klipper_tuning_tower_factor', 0), 1393 | ('klipper_tuning_tower_band', 0), 1394 | ('klipper_tuning_tower_step_delta', 0), 1395 | ('klipper_tuning_tower_step_height', 0), 1396 | ]),( 1397 | 'pressure', [ 1398 | ('klipper_tuning_tower_command', 'SET_PRESSURE_ADVANCE'), 1399 | ('klipper_tuning_tower_parameter', 'ADVANCE'), 1400 | ('klipper_tuning_tower_method', 'factor'), 1401 | ('klipper_tuning_tower_start', 0), 1402 | ('klipper_tuning_tower_skip', 0), 1403 | ('klipper_tuning_tower_factor', 0), 1404 | ('klipper_tuning_tower_band', 0), 1405 | ('klipper_velocity_limits_enable', True), 1406 | ('klipper_velocity_limit', 0), 1407 | ('klipper_accel_limit', 500), 1408 | ('klipper_accel_to_decel_limit', 0), 1409 | ('klipper_corner_velocity_limit', 1.0), 1410 | ('klipper_pressure_advance_enable', True), 1411 | ('klipper_pressure_advance_factor', 0), 1412 | ('acceleration_enabled', False) 1413 | ]),( 1414 | 'accel', [ 1415 | ('klipper_tuning_tower_command', 'SET_VELOCITY_LIMIT'), 1416 | ('klipper_tuning_tower_parameter', 'ACCEL'), 1417 | ('klipper_tuning_tower_method', 'step'), 1418 | ('klipper_tuning_tower_start', 1500), 1419 | ('klipper_tuning_tower_skip', 0), 1420 | ('klipper_tuning_tower_step_delta', 500), 1421 | ('klipper_tuning_tower_step_height', 5), 1422 | ('klipper_velocity_limits_enable', True), 1423 | ('klipper_velocity_limit', 0), 1424 | ('klipper_accel_limit', 0), 1425 | ('klipper_accel_to_decel_limit', 7000), 1426 | ('klipper_corner_velocity_limit', 1.0), 1427 | ('klipper_pressure_advance_enable', True), 1428 | ('klipper_pressure_advance_factor', 0), 1429 | ('klipper_input_shaper_enable', True), 1430 | ('klipper_shaper_freq_x', 0), 1431 | ('klipper_shaper_freq_y', 0), 1432 | ('acceleration_enabled', False) 1433 | ]) 1434 | ## Next Preset: 1435 | ] 1436 | presets = OrderedDict(presets) # Convert and preserve setting order 1437 | preset_dict = OrderedDict() # type: OrderedDict[str, Any] 1438 | 1439 | for preset in presets: 1440 | 1441 | if preset == new_preset: 1442 | preset_dict.update(presets[preset]) 1443 | 1444 | if not override: # Dict order isn't necessary 1445 | preset_dict = {k: v for k, v in preset_dict.items() if k.startswith('klipper_tuning')} 1446 | 1447 | return preset_dict 1448 | 1449 | 1450 | # Dict order must be preserved 1451 | __pressure_advance_setting_key = [ 1452 | ("_FACTORS", "klipper_pressure_advance_factor"), ## [0-3] Parent settings 1453 | ("_WALLS", "klipper_pressure_advance_wall"), 1454 | ("_SUPPORTS", "klipper_pressure_advance_support"), 1455 | ("LAYER_0", "klipper_pressure_advance_layer_0"), 1456 | ("WALL-OUTER", "klipper_pressure_advance_wall_0"), ## [4-7] Gcode mesh features 1457 | ("WALL-INNER", "klipper_pressure_advance_wall_x"), 1458 | ("SKIN", "klipper_pressure_advance_topbottom"), 1459 | ("FILL", "klipper_pressure_advance_infill"), 1460 | ("SUPPORT", "klipper_pressure_advance_support_infill"), ## [8-11] Gcode non-mesh features 1461 | ("SUPPORT-INTERFACE", "klipper_pressure_advance_support_interface"), 1462 | ("PRIME-TOWER", "klipper_pressure_advance_prime_tower"), 1463 | ("SKIRT", "klipper_pressure_advance_skirt_brim") 1464 | ] 1465 | __pressure_advance_setting_key = OrderedDict(__pressure_advance_setting_key) # Older cura compatibility 1466 | 1467 | __tuning_tower_setting_key = [ 1468 | ("tuning_method", "klipper_tuning_tower_method"), 1469 | ("command", "klipper_tuning_tower_command"), 1470 | ("parameter", "klipper_tuning_tower_parameter"), 1471 | ("start", "klipper_tuning_tower_start"), 1472 | ("skip", "klipper_tuning_tower_skip"), 1473 | ("factor", "klipper_tuning_tower_factor"), 1474 | ("band", "klipper_tuning_tower_band"), 1475 | ("step_delta", "klipper_tuning_tower_step_delta"), 1476 | ("step_height", "klipper_tuning_tower_step_height") 1477 | ] 1478 | __tuning_tower_setting_key = OrderedDict(__tuning_tower_setting_key) 1479 | 1480 | __velocity_limit_setting_key = { 1481 | "velocity": "klipper_velocity_limit", 1482 | "accel": "klipper_accel_limit", 1483 | "accel_to_decel": "klipper_accel_to_decel_limit", 1484 | "square_corner_velocity": "klipper_corner_velocity_limit" 1485 | } 1486 | __firmware_retraction_setting_key = { 1487 | "retract_length": "klipper_retract_length", 1488 | "unretract_extra_length": "klipper_retract_prime_length", 1489 | "retract_speed": "klipper_retract_speed", 1490 | "unretract_speed": "klipper_retract_prime_speed" 1491 | } 1492 | __input_shaper_setting_key = { 1493 | "shaper_freq_x": "klipper_shaper_freq_x", 1494 | "shaper_freq_y": "klipper_shaper_freq_y", 1495 | "shaper_type_x": "klipper_shaper_type_x", 1496 | "shaper_type_y": "klipper_shaper_type_y", 1497 | "damping_ratio_x": "klipper_damping_ratio_x", 1498 | "damping_ratio_y": "klipper_damping_ratio_y" 1499 | } 1500 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## KlipperSettingsPlugin 2 | 3 | **Klipper Settings 1.0 is now available in the [Cura Marketplace](https://marketplace.ultimaker.com/app/cura/plugins/JJGraphiX/KlipperSettingsPlugin)!**
4 | *Thank you to everyone who helped with beta testing and provided feedback.* 5 | 6 | Plugin for Ultimaker Cura which adds a new **Klipper Settings** category with a number of Klipper-specific settings and features to the main settings list. Only compatible with [*Klipper firmware*](https://github.com/Klipper3d/klipper/). All features are designed to work without the need for additional Klipper macros. 7 | 8 | Klipper Settings is an evolution of my [PressureAdvanceSettingPlugin](https://github.com/jjgraphix/PressureAdvanceSettingPlugin), which is no longer supported. The new Klipper settings category includes improved Pressure Advance settings as well as a number of additional settings and features, including firmware retraction and calibration presets to initiate Klipper's Tuning Tower sequence. Most settings can be saved for indvidual material profiles using the [Material Settings Plugin](https://marketplace.ultimaker.com/app/cura/plugins/fieldofview/MaterialSettingsPlugin) by FieldOfView. 9 | 10 | ### Major Release Notes - v1.0.x 11 | - Z Offset Setting 12 | - Z Offset Layer 0 feature 13 | - Pressure Advance Smooth Time 14 | - Support for 3 Tuning Tower user presets 15 | - Pressure Advance preset calculates suggested factor value 16 | - Firmware retraction multi-extruder support 17 | - Firmware retraction uses Cura retraction values by default 18 | - Various bug fixes and UI improvements 19 | - *Experimental Features:* 20 | - Bed Mesh Calibrate 21 | - Klipper UI Preheat Support 22 | 23 | ***Check setting visibility after updating from a previous version.*** 24 | 25 |
Latest Update Notes 26 |

    27 |
  • Bug Fix v1.0.2
  • 28 |
      29 |
    • Setting definition compatibility for older versions
    • 30 |
    • Fixed duplicate setting relations
    • 31 |
    • Fixed changing machines with preset settings enabled
    • 32 |
    • Smooth time not tied to pressure advance control
    • 33 |
    • Final warnings now combined into single message
    • 34 |
    • Minor fixes and setting cleanup
    • 35 |
    36 |

37 |
38 | 39 |
Previous Release Notes (Beta) 40 |

    41 |
  • v0.8.0
  • 42 |
      43 |
    • Compatibility for Cura version 5
    • 44 |
    • Adds new "Klipper Settings" category
    • 45 |
    • Adds Klipper velocity limit settings
    • 46 |
    • Pressure Advance supports per-object settings and multiple extruders
    • 47 |
    • Simplified Tuning Tower settings
    • 48 |
    49 |
  • v0.9.0
  • 50 |
      51 |
    • Adds Klipper category icon
    • 52 |
    • Firmware retraction settings
    • 53 |
    • Input shaper settings
    • 54 |
    • New presets feature for tuning tower:
    • 55 |
        56 |
      • Pressure Advance preset
      • 57 |
      • Ringing Tower preset
      • 58 |
      59 |
    • Improved descriptions and setting behavior
    • 60 |
    • Various bug fixes and improvements
    • 61 |
    62 |
  • v0.9.1
  • 63 |
      64 |
    • Fixed crashing in older Cura versions
    • 65 |
    • Custom icon now only enabled for Cura 5.0+
    • 66 |
    • Improved presets and backup behavior
    • 67 |
    68 |
  • v0.9.2
  • 69 |
      70 |
    • Fixed incorrect parameter in Pressure Advance Preset
    • 71 |
    • Preset layer height now suggested from nozzle size
    • 72 |
    73 |

74 |
75 | 76 | ### Cura Compatibility 77 | **Recommended to use Cura 5.0 (SDK 8.0.0) and newer.**
78 | Versions prior to 4.0.0 (SDK 6.0.0) are not supported and prior to 4.5.0 may not be compatible in the future. Testing may be limited in versions before Cura 5.0 so please report any issues if they are still needed. 79 | 80 | **Multiple extruders are supported for compatible settings.** 81 | 82 | ### How to Use 83 | After installation the new Klipper Settings category will be hidden and appears at the bottom of setting visibility preferences. It's recommended to first enable visibility of every setting then hide whatever isn't needed later. If it's not appearing, try selecting the "All" settings preset. Options such as *Apply Suggested Settings* only appear when other settings are active and should be left visible. 84 | 85 | **Most setting values will remain applied after the print until the printer is restarted**. Klipper config values cannot be modified by the plugin. 86 | 87 |
88 | Example of Available Klipper Settings:
89 | Tool tips explain why some values are negative by default.

90 | 91 | ![image](https://github.com/jjgraphix/KlipperSettingsPlugin/blob/main/resources/images/examples/KSP_AllSettings_v1.0.PNG) 92 |
93 | 94 | **See tool tips in Cura for descriptions of every setting.** 95 | 96 | *I highly recommend Ghostkeeper's [Settings Guide](https://marketplace.ultimaker.com/app/cura/plugins/Ghostkeeper/SettingsGuide2) plugin to improve tool tip readability.*

97 | 98 | ## Feature Overview 99 | - **Tuning Tower Calibration**
100 | [Klipper Tuning Tower](https://www.klipper3d.org/G-Codes.html#tuning_tower) settings can be used to fine tune a wide range of Klipper commands. Presets are available to run common *Pressure Advance* and *Input Shaper* calibrations. The *Apply Suggested Settings* option will automatically apply additional printer settings necessary for the calibration as defined in the Klipper documentation. Any changes to Cura settings are backed up and restored to their prior values when the tuning tower is disabled. Custom presets allow 3 unique tuning tower profiles to be saved for frequent calibrations. 101 | 102 |
103 | Example of tuning tower preset:

104 | 105 | ![image](https://github.com/jjgraphix/KlipperSettingsPlugin/blob/main/resources/images/examples/KSP_Preset-ex1_v1.0.PNG) 106 |

107 | 108 | - **Pressure Advance**
109 | Klipper's pressure advance is used sharpen the appearance of corners, improve line width consistency and reduce ooze during non-extrude moves. This can be adjusted for multiple extruders, individual line types and different mesh objects in the same print. The *Pressure Advance* tuning tower preset can be used to tune these values as described in the [Klipper documentation](https://www.klipper3d.org/Pressure_Advance.html). *Pressure Advance Smooth Time* can also be adjusted for each print. 110 | 111 | - **Firmware Retraction**
112 | Enables the use of G10 and G11 firmware retraction gcode commands. The [firmware_retraction] section in [Klipper configuration](https://www.klipper3d.org/Config_Reference.html#firmware_retraction) must first be enabled to use this feature. Cura's standard retraction settings are mirrored as the default values, allowing settings to easily be stored for individual materials. Multiple extruders are supported without needing additional macros. Settings for each extruder are applied immediately following gcode tool change commands (T0, T1, etc.). 113 | 114 | - **Z Offset Control**
115 | Due to the inherent risk, no setting will apply a permanent adjustment to an existing offset. The *Initial Layer Z Offset* feature applies SET_GCODE_OFFSET Z_ADJUST= before all gcode coordinates equal to the first layer height then instructs Klipper to revert the offset on the next z axis change, even if the print is stopped. For added safety, the maximum adjustment is +/- first layer height.
116 | The *Override Z Offset* option defines a total offset value with SET_GCODE_OFFSET Z= after the start gcode sequence. This overrides any existing z offset adjustment and will remain applied. **Use caution when enabling these options.** 117 | 118 | *If both options are enabled, their effects will be combined for the first layer.* 119 | 120 | - **Input Shaper Control**
121 | Controls settings associated with Klipper's resonance compensation. The *Ringing Tower* tuning tower preset can be used to manually tune these values as described in the [Klipper documentation](https://www.klipper3d.org/Resonance_Compensation.html). 122 | 123 | - **Velocity Limits Control**
124 | Controls the printer's [velocity and acceleration limits](https://www.klipper3d.org/Config_Reference.html#printer). Any changes will persist after the print has completed. These are generally not necessary to adjust outside of tuning tower calibrations. 125 | 126 | - **Experimental Features**
127 | New features in development which have been tested but may be modified or removed in the future. Read corresponding tool tips in Cura for more information. Most new feature requests will first be tested here moving forward. 128 |

129 | 130 | ## Installation 131 | Klipper Settings can now be installed directly from the [Cura Marketplace](https://marketplace.ultimaker.com/app/cura/plugins/JJGraphiX/KlipperSettingsPlugin). 132 | 133 | After installing, enable visibility of all new settings in Cura preferences. 134 | 135 |
To Install/Update from Source Files:
136 |

137 | - Download source .zip file from Github.
138 | - Open Cura, click Help, Show Configuration Folder, then navigate to "plugins" folder and unpack .zip file.
139 | - Rename the unpacked folder to "KlipperSettingsPlugin", removing Github suffix (e.g. "-main").
140 | - Restart Cura and check settings visibility in preferences.

141 | To update a previous version, simply replace all contents of the KlipperSettingsPlugin folder with the latest release. 142 |

143 |
144 | 145 | ## More Info 146 | 147 | For more information about Klipper firmware, see the official documentation at [Klipper3D.org](https://www.klipper3d.org). 148 | 149 | *For questions or feedback, you can contact me directly at jjfx.contact@gmail.com.* 150 | 151 | *If you wish to support my work, buying me a coffee on [Ko-Fi](https://ko-fi.com/jjjfx) is greatly appreciated.* 152 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 J.Jarrard / JJFX 2 | # The KlipperSettingsPlugin is released under the terms of the AGPLv3 or higher. 3 | 4 | from . import KlipperSettingsPlugin 5 | 6 | 7 | def getMetaData(): 8 | return {} 9 | 10 | def register(app): 11 | return {"extension": KlipperSettingsPlugin.KlipperSettingsPlugin()} 12 | -------------------------------------------------------------------------------- /klipper_settings.def.json: -------------------------------------------------------------------------------- 1 | { 2 | "klipper_tuning_tower_enable": { 3 | "label": "Enable Tuning Tower", 4 | "description": "Enable Klipper's tuning tower sequence to precisely tune a specified parameter at given intervals during the print.

Any models on the build plate will be affected by the tuning sequence.", 5 | "type": "bool", 6 | "default_value": false, 7 | "warning_value": true, 8 | "settable_per_mesh": false, 9 | "settable_per_extruder": false 10 | }, 11 | "klipper_tuning_tower_preset": { 12 | "label": "Tuning Tower Presets", 13 | "description": "Presets for common Tuning Tower calibrations and custom user profiles. Only Tuning Tower settings are affected by a preset unless Apply Suggested Settings is also enabled.

Custom preset profiles are saved in the Cura config and only affect Tuning Tower settings.

Recommended to use with Klipper's calibration models.", 14 | "type": "enum", 15 | "options": { 16 | "pressure": "Pressure Advance", 17 | "accel": "Ringing Tower", 18 | "custom1": "Custom Preset 1", 19 | "custom2": "Custom Preset 2", 20 | "custom3": "Custom Preset 3" 21 | }, 22 | "default_value": "custom1", 23 | "enabled": "klipper_tuning_tower_enable", 24 | "settable_per_mesh": false, 25 | "settable_per_extruder": false, 26 | "children": { 27 | "klipper_tuning_tower_override": { 28 | "label": "Apply Suggested Settings", 29 | "description": "Applies additional Klipper settings necessary for the current calibration sequence. When enabled, a number of additional Klipper and Cura settings defined by the preset will be adjusted. Otherwise presets only affect Tuning Tower setting values. All changes are as described in the Klipper documentation.

Suggestions are shown for any settings which still need to be set manually.

Disable to restore changed setting values.", 30 | "type": "bool", 31 | "default_value": false, 32 | "enabled": "klipper_tuning_tower_enable and klipper_tuning_tower_preset in ['pressure', 'accel']", 33 | "warning_value": true, 34 | "settable_per_mesh": false, 35 | "settable_per_extruder": false 36 | } 37 | } 38 | }, 39 | "klipper_tuning_tower_command": { 40 | "label": "Tuning Tower Command", 41 | "description": "The Klipper command to execute during the tuning process. This value must be specified.

Common Examples:
SET_PRESSURE_ADVANCE
SET_VELOCITY_LIMIT
SET_RETRACTION

Quotes automatically added for multiple words:
'SET_HEATER_TEMPERATURE HEATER=extruder'", 42 | "type": "str", 43 | "default_value": "", 44 | "allow_empty": false, 45 | "regex_blacklist_pattern": ".{60,}|^.{,59}[^a-zA-Z0-9_='\\s].*(?# Limit 60 usable chars)", 46 | "enabled": "klipper_tuning_tower_enable", 47 | "settable_per_mesh": false, 48 | "settable_per_extruder": false 49 | }, 50 | "klipper_tuning_tower_parameter": { 51 | "label": "Tuning Tower Parameter", 52 | "description": "The parameter of the command to execute during the tuning process. This value must be specified.

Input can not contain spaces or special characters.

Common Examples:
FACTOR
ACCEL
RETRACT_LENGTH
TARGET", 53 | "type": "str", 54 | "default_value": "", 55 | "allow_empty": false, 56 | "regex_blacklist_pattern": ".{40,}|.{,39}\\W.*(?# Limit 40 usable chars)", 57 | "enabled": "klipper_tuning_tower_enable", 58 | "settable_per_mesh": false, 59 | "settable_per_extruder": false 60 | }, 61 | "klipper_tuning_tower_start": { 62 | "label": "Tuning Tower Start Value", 63 | "description": "The starting value of the parameter specified for the tuning process.

A value of '0' typically starts with the command disabled.", 64 | "type": "float", 65 | "default_value": 0, 66 | "minimum_value": "0", 67 | "enabled": "klipper_tuning_tower_enable", 68 | "settable_per_mesh": false, 69 | "settable_per_extruder": false, 70 | "children": { 71 | "klipper_tuning_tower_skip": { 72 | "label": "Tuning Tower Skip Height", 73 | "description": "(Optional) The z-height in mm at which the tuning process will begin. Below this height only the start value will be used. If omitted, the tuning process simply begins at the first layer. This is often used to skip the initial layers of the print.

A value of '0' will disable skip height.", 74 | "type": "float", 75 | "unit": "mm", 76 | "default_value": 0, 77 | "minimum_value": "0", 78 | "maximum_value_warning": "99", 79 | "enabled": "klipper_tuning_tower_enable", 80 | "settable_per_mesh": false, 81 | "settable_per_extruder": false 82 | } 83 | } 84 | }, 85 | "klipper_tuning_tower_method": { 86 | "label": "Tuning Tower Method", 87 | "description": "The adjustment method used for the tuning process.

Use FACTOR when precisely measuring the z-height of the tuning tower to determine the optimum value. Used to tune a wide range of values for features like pressure advance. This enables the optional band height setting to specify an incremental height adjustment.

Use STEP if the tower model has steps of discrete values which can be counted to determine the optimum value. Typically best suited for objects like temperature towers. This enables the required settings step delta and step height.", 88 | "type": "enum", 89 | "options": { 90 | "factor": "Factor", 91 | "step": "Step" 92 | }, 93 | "default_value": "factor", 94 | "enabled": "klipper_tuning_tower_enable", 95 | "settable_per_mesh": false, 96 | "settable_per_extruder": false, 97 | "children": { 98 | "klipper_tuning_tower_factor": { 99 | "label": "Tuning Tower Factor", 100 | "description": "The factor used to continuously adjust the start value throughout the tuning process. The value will change at a rate of factor per mm. This may be used in combination with band height.

A value greater than '0' is required.

To determine result, precisely measure the desired Z height then use the following formula:

START + FACTOR * Z_HEIGHT", 101 | "type": "float", 102 | "default_value": 0, 103 | "minimum_value": "0.001", 104 | "enabled": "klipper_tuning_tower_enable and klipper_tuning_tower_method == 'factor'", 105 | "settable_per_mesh": false, 106 | "settable_per_extruder": false 107 | }, 108 | "klipper_tuning_tower_band": { 109 | "label": "Tuning Tower Band Height", 110 | "description": "(Optional) The height in mm of each adjustment band. The value is adjusted at an average rate of factor per mm, but only applied in discrete bands of Z height.

A value of '0' disables the band height option.

Formula with band enabled:
START + FACTOR * ((floor(Z_HEIGHT / BAND) + .5) * BAND)", 111 | "type": "float", 112 | "unit": "mm", 113 | "default_value": 0, 114 | "minimum_value": "0", 115 | "maximum_value_warning": "99", 116 | "enabled": "klipper_tuning_tower_enable and klipper_tuning_tower_method == 'factor'", 117 | "settable_per_mesh": false, 118 | "settable_per_extruder": false 119 | }, 120 | "klipper_tuning_tower_step_delta": { 121 | "label": "Tuning Tower Step Delta", 122 | "description": "The step factor used to adjust the start value throughout the tuning process. The start value will change by step delta every step height in mm.

Value can be positive or negative and used in combination with step height.

To determine result, simply count the bands or labels on the model.

Formula:
START + STEP_DELTA * floor(Z_HEIGHT / STEP_HEIGHT)", 123 | "type": "float", 124 | "default_value": 0, 125 | "minimum_value_warning": "-0.001", 126 | "maximum_value_warning": "9999", 127 | "enabled": "klipper_tuning_tower_enable and klipper_tuning_tower_method == 'step'", 128 | "settable_per_mesh": false, 129 | "settable_per_extruder": false 130 | }, 131 | "klipper_tuning_tower_step_height": { 132 | "label": "Tuning Tower Step Height", 133 | "description": "An incremental distance in mm at which step delta will adjust the start value throughout the tuning process.

Value must be greater than '0' and used in combination with step delta.

To determine the result, simply count the bands or labels on the model.

Formula:
START + STEP_DELTA * floor(Z_HEIGHT / STEP_HEIGHT)", 134 | "type": "float", 135 | "unit": "mm", 136 | "default_value": 0, 137 | "minimum_value": "0.0001", 138 | "maximum_value_warning": "50", 139 | "enabled": "klipper_tuning_tower_enable and klipper_tuning_tower_method == 'step'", 140 | "settable_per_mesh": false, 141 | "settable_per_extruder": false 142 | } 143 | } 144 | }, 145 | "klipper_pressure_advance_enable": { 146 | "label": "Pressure Advance Control", 147 | "description": "Enables control of Pressure Advance for Klipper firmware. This feature can greatly sharpen the appearance of corners, improve line width consistency and reduce the need for retraction during non-extrusion moves. Supports control of individual mesh objects and multiple extruders.

To disable Pressure Advance, enable and set values to '0'.", 148 | "type": "bool", 149 | "default_value": false, 150 | "settable_per_mesh": false, 151 | "settable_per_extruder": false 152 | }, 153 | "klipper_pressure_advance_factor": { 154 | "label": "Pressure Advance Factor", 155 | "description": "Extrusion coefficient for Klipper's Pressure Advance feature.

Common values are 0.01 - 0.10 for direct drive and 0.20 - 0.60 for bowden extruders. High values can cause excessive extruder movements which may result in missed extruder steps when accelerating/decelerating. Recommended to keep values below 0.50. Adjustments may be necessary for different materials, nozzles, etc.

A value of '0' will disable Pressure Advance.

Default: 0 (Disable)", 156 | "type": "float", 157 | "default_value": 0, 158 | "minimum_value": "0", 159 | "maximum_value": "2", 160 | "maximum_value_warning": "0.8", 161 | "enabled": "resolveOrValue('klipper_pressure_advance_enable')", 162 | "settable_per_mesh": true, 163 | "settable_per_extruder": true, 164 | "children": { 165 | "klipper_pressure_advance_infill": { 166 | "label": "Infill Pressure Advance", 167 | "description": "Pressure Advance factor when printing infill. Could be used to minimize excessive extruder movement during infill but reducing too much may increase stringing.

A value of '0' disables pressure advance for this feature.", 168 | "type": "float", 169 | "default_value": 0, 170 | "value": "klipper_pressure_advance_factor", 171 | "minimum_value": "0", 172 | "maximum_value": "2", 173 | "maximum_value_warning": "0.8", 174 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and infill_sparse_density > 0", 175 | "settable_per_mesh": true, 176 | "settable_per_extruder": true, 177 | "limit_to_extruder": "infill_extruder_nr" 178 | }, 179 | "klipper_pressure_advance_wall": { 180 | "label": "Wall Pressure Advance", 181 | "description": "Pressure Advance factor used when printing walls. Optimized values can sharpen the appearance of corners, reduce bulging and improve extrusion consistency when varying print speeds.

A value of '0' disables pressure advance for this feature.", 182 | "type": "float", 183 | "default_value": 0, 184 | "value": "klipper_pressure_advance_factor", 185 | "minimum_value": "0", 186 | "maximum_value": "2", 187 | "maximum_value_warning": "0.8", 188 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and wall_line_count > 0", 189 | "settable_per_mesh": true, 190 | "settable_per_extruder": true, 191 | "children": { 192 | "klipper_pressure_advance_wall_0": { 193 | "label": "Outer Wall Pressure Advance", 194 | "description": "Pressure Advance factor used for the outermost wall. Optimized values can greatly improve the appearance of corners.

A value of '0' disables pressure advance for this feature.", 195 | "type": "float", 196 | "default_value": 0, 197 | "value": "klipper_pressure_advance_wall", 198 | "minimum_value": "0", 199 | "maximum_value": "2", 200 | "maximum_value_warning": "0.8", 201 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and wall_line_count > 0", 202 | "settable_per_mesh": true, 203 | "settable_per_extruder": true, 204 | "limit_to_extruder": "wall_0_extruder_nr" 205 | }, 206 | "klipper_pressure_advance_wall_x": { 207 | "label": "Inner Wall Pressure Advance", 208 | "description": "Pressure Advance factor used only for inner walls.

A value of '0' disables pressure advance for this feature.", 209 | "type": "float", 210 | "default_value": 0, 211 | "value": "klipper_pressure_advance_wall", 212 | "minimum_value": "0", 213 | "maximum_value": "2", 214 | "maximum_value_warning": "0.8", 215 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and wall_line_count > 1", 216 | "settable_per_mesh": true, 217 | "settable_per_extruder": true, 218 | "limit_to_extruder": "wall_x_extruder_nr" 219 | } 220 | } 221 | }, 222 | "klipper_pressure_advance_topbottom": { 223 | "label": "Top/Bottom Pressure Advance", 224 | "description": "Pressure Advance factor used for top/bottom skin layers. Optimized value can improve surface appearance and line width consistency for these layers. High values may lead to excessive extruder movements.

A value of '0' disables pressure advance for this feature.", 225 | "type": "float", 226 | "default_value": 0, 227 | "value": "klipper_pressure_advance_factor", 228 | "minimum_value": "0", 229 | "maximum_value": "2", 230 | "maximum_value_warning": "0.8", 231 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and top_bottom_thickness > 0", 232 | "settable_per_mesh": true, 233 | "settable_per_extruder": true, 234 | "limit_to_extruder": "top_bottom_extruder_nr" 235 | }, 236 | "klipper_pressure_advance_layer_0": { 237 | "label": "Initial Layer Pressure Advance", 238 | "description": "Pressure Advance factor used only during the first layer. This value overrides all other line types while printing the first layer. Adjusting could be used to optimize line width consistency when varying print speed.

A value of '0' disables pressure advance for the first layer.", 239 | "type": "float", 240 | "default_value": 0, 241 | "value": "klipper_pressure_advance_factor", 242 | "minimum_value": "0", 243 | "maximum_value": "2", 244 | "maximum_value_warning": "0.8", 245 | "enabled": "resolveOrValue('klipper_pressure_advance_enable')", 246 | "settable_per_mesh": false, 247 | "settable_per_extruder": true 248 | }, 249 | "klipper_pressure_advance_support": { 250 | "label": "Support Pressure Advance", 251 | "description": "Pressure Advance factor used for support infill and interface structures. Adjustments could be used to minimize excessive extruder movement but there is typically little benefit from changing these values.

A value of '0' disables pressure advance for this feature.", 252 | "type": "float", 253 | "default_value": 0, 254 | "value": "klipper_pressure_advance_factor", 255 | "minimum_value": "0", 256 | "maximum_value": "2", 257 | "maximum_value_warning": "0.8", 258 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and (support_enable or support_meshes_present)", 259 | "settable_per_mesh": false, 260 | "settable_per_extruder": true, 261 | "limit_to_extruder": "support_extruder_nr", 262 | "children": { 263 | "klipper_pressure_advance_support_infill": { 264 | "label": "Support Infill Pressure Advance", 265 | "description": "Pressure Advance factor used only for support infill.

A value of '0' disables pressure advance for this feature.", 266 | "type": "float", 267 | "default_value": 0, 268 | "value": "klipper_pressure_advance_support", 269 | "minimum_value": "0", 270 | "maximum_value": "2", 271 | "maximum_value_warning": "0.8", 272 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and (support_enable or support_meshes_present)", 273 | "settable_per_mesh": false, 274 | "settable_per_extruder": true, 275 | "limit_to_extruder": "support_infill_extruder_nr" 276 | }, 277 | "klipper_pressure_advance_support_interface": { 278 | "label": "Support Interface Pressure Advance", 279 | "description": "Pressure Advance factor used only for the support interface.

A value of '0' disables pressure advance for this feature.", 280 | "type": "float", 281 | "default_value": 0, 282 | "value": "klipper_pressure_advance_support", 283 | "minimum_value": "0", 284 | "maximum_value": "2", 285 | "maximum_value_warning": "0.8", 286 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and support_interface_enable and (support_enable or support_meshes_present)", 287 | "settable_per_mesh": false, 288 | "settable_per_extruder": true, 289 | "limit_to_extruder": "support_interface_extruder_nr" 290 | } 291 | } 292 | }, 293 | "klipper_pressure_advance_prime_tower": { 294 | "label": "Prime Tower Pressure Advance", 295 | "description": "Pressure Advance factor used when printing a prime tower.

A value of '0' disables pressure advance for this feature.", 296 | "type": "float", 297 | "default_value": 0, 298 | "value": "klipper_pressure_advance_factor", 299 | "minimum_value": "0", 300 | "maximum_value": "2", 301 | "maximum_value_warning": "0.8", 302 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and resolveOrValue('prime_tower_enable')", 303 | "settable_per_mesh": false, 304 | "settable_per_extruder": true 305 | }, 306 | "klipper_pressure_advance_skirt_brim": { 307 | "label": "Skirt/Brim Pressure Advance", 308 | "description": "Pressure Advance factor used when printing skirts or brims.

A value of '0' disables pressure advance for this feature.", 309 | "type": "float", 310 | "default_value": 0, 311 | "value": "klipper_pressure_advance_factor", 312 | "minimum_value": "0", 313 | "maximum_value": "2", 314 | "maximum_value_warning": "0.8", 315 | "enabled": "resolveOrValue('klipper_pressure_advance_enable') and (resolveOrValue('adhesion_type') == 'skirt' or resolveOrValue('adhesion_type') == 'brim' or resolveOrValue('draft_shield_enabled') or resolveOrValue('ooze_shield_enabled'))", 316 | "settable_per_mesh": false, 317 | "settable_per_extruder": true, 318 | "limit_to_extruder": "adhesion_extruder_nr" 319 | } 320 | } 321 | }, 322 | "klipper_smooth_time_enable": { 323 | "label": "Pressure Advance Smooth Time", 324 | "description": "Enables control of the smooth time variable for Klipper's Pressure Advance. Can be applied with or without Pressure Advance Control but has no effect if pressure advance factor is '0'.", 325 | "type": "bool", 326 | "default_value": false, 327 | "resolve": "any(extruderValues('klipper_smooth_time_enable'))", 328 | "settable_per_mesh": false, 329 | "settable_per_extruder": false, 330 | "children": { 331 | "klipper_smooth_time_factor": { 332 | "label": "Smooth Time Range", 333 | "description": "The time range in seconds used when calculating the average extruder velocity for pressure advance. It is generally recommended to use the default Klipper value. Higher values may result in smoother extruder movements.

Value must be above 0 with a maximum range of 0.20 sec.

Has no effect if pressure advance factor is '0'.

Default: 0.04 (Klipper Default)", 334 | "type": "float", 335 | "unit": "sec", 336 | "default_value": 0.04, 337 | "minimum_value": "0.001", 338 | "maximum_value": "0.2", 339 | "maximum_value_warning": "0.1", 340 | "enabled": "resolveOrValue('klipper_smooth_time_enable')", 341 | "settable_per_mesh": false, 342 | "settable_per_extruder": true 343 | } 344 | } 345 | }, 346 | "machine_firmware_retract": { 347 | "label": "Enable Firmware Retraction", 348 | "description": "Enables G10 & G11 firmware retraction commands in gcode. This is a duplicate of the firmware retraction option normally hidden in machine settings. When enabled, Cura's retraction settings are used as the default values. Any specified retraction values will override current values in Klipper config.

Multiple extruders are supported.

The [firmware_retraction] section must be enabled in Klipper config.", 349 | "type": "bool", 350 | "default_value": false, 351 | "settable_per_mesh": false, 352 | "settable_per_extruder": false 353 | }, 354 | "klipper_retract_length": { 355 | "label": "Retraction Length", 356 | "description": "The length in mm of material retracted during a G10 retract command. Cura's retraction setting is used as the default value.

The [firmware_retraction] section must be enabled in Klipper config.

A value of '-1.0' will disable control and use the current Klipper config value.

Default: Cura 'retraction_amount'", 357 | "type": "float", 358 | "unit": "mm", 359 | "default_value": -1, 360 | "value": "retraction_amount", 361 | "minimum_value": "-1", 362 | "minimum_value_warning": "0.0001 if klipper_retract_length >= 0 else -1", 363 | "maximum_value_warning": "10", 364 | "enabled": "resolveOrValue('machine_firmware_retract')", 365 | "settable_per_mesh": false, 366 | "settable_per_extruder": true 367 | }, 368 | "klipper_retract_prime_length": { 369 | "label": "Unretract Extra Length", 370 | "description": "The length in mm of extra material added to a G11 unretract command. Cura's retraction setting is ignored by default. A value above zero is generally not necessary but can be used to compensate for material oozing during travel moves.

The [firmware_retraction] section must be enabled in Klipper config.

A value of '-1.0' will disable control and use the current Klipper config value.

Default: -1.0 (Disabled)", 371 | "type": "float", 372 | "unit": "mm", 373 | "default_value": -1, 374 | "minimum_value": "-1", 375 | "maximum_value_warning": "5", 376 | "enabled": "resolveOrValue('machine_firmware_retract')", 377 | "settable_per_mesh": false, 378 | "settable_per_extruder": true 379 | }, 380 | "klipper_retraction_speed": { 381 | "label": "Retraction Speed", 382 | "description": "The speed in mm/s at which filament is retracted and primed during G10 & G11 commands. Cura's retraction setting is used as the default value.

The [firmware_retraction] section must be enabled in Klipper config.

A value of '0' will disable speed control and use current Klipper config values.

Default: Cura 'Retraction Speed'", 383 | "type": "float", 384 | "unit": "mm/s", 385 | "default_value": 0, 386 | "value": "retraction_speed", 387 | "minimum_value": "0", 388 | "minimum_value_warning": "5 if klipper_retract_speed >= 1 or klipper_retract_prime_speed >= 1 else 0", 389 | "maximum_value_warning": "99", 390 | "enabled": "resolveOrValue('machine_firmware_retract')", 391 | "settable_per_mesh": false, 392 | "settable_per_extruder": true, 393 | "children": { 394 | "klipper_retract_speed": { 395 | "label": "Retract Speed", 396 | "description": "The speed at which filament is retracted during a G10 command. Cura's retraction setting is used as the default value.

Klipper Default: 20 mm/s

The [firmware_retraction] section must be enabled in Klipper config.

A value of '0' will disable control and use the current Klipper config value.

Default: Cura 'Retraction Retract Speed'", 397 | "type": "float", 398 | "unit": "mm/s", 399 | "default_value": 0, 400 | "value": "retraction_retract_speed", 401 | "minimum_value": "0", 402 | "minimum_value_warning": "5 if klipper_retract_speed >= 1 else 0", 403 | "maximum_value_warning": "99", 404 | "enabled": "resolveOrValue('machine_firmware_retract')", 405 | "settable_per_mesh": false, 406 | "settable_per_extruder": true 407 | }, 408 | "klipper_retract_prime_speed": { 409 | "label": "Unretract Speed", 410 | "description": "The speed at which filament unretracts during a G11 command. Cura's retraction setting is used as the default value.

Klipper Default: 10 mm/s

The [firmware_retraction] section must be enabled in Klipper config.

A value of '0' will disable control and use the current Klipper config value.

Default: Cura 'Retraction Prime Speed'", 411 | "type": "float", 412 | "unit": "mm/s", 413 | "default_value": 0, 414 | "value": "retraction_prime_speed", 415 | "minimum_value": "0", 416 | "minimum_value_warning": "5 if klipper_retract_prime_speed >= 1 else 0", 417 | "maximum_value_warning": "99", 418 | "enabled": "resolveOrValue('machine_firmware_retract')", 419 | "settable_per_mesh": false, 420 | "settable_per_extruder": true 421 | } 422 | } 423 | }, 424 | "klipper_z_offset_control_enable": { 425 | "label": "Z Offset Control", 426 | "description": "Enables control of Klipper's Z offset and first layer Z offset feature.", 427 | "type": "bool", 428 | "default_value": false, 429 | "settable_per_mesh": false, 430 | "settable_per_extruder": false, 431 | "children": { 432 | "klipper_z_offset_set_enable": { 433 | "label": "Override Z Axis Offset", 434 | "description": "Enable to define a total Z axis offset adjustment for the toolhead. This will override and remove any existing Z offset since restarting the printer. It is only recommended to enable this feature to remove an existing offset or if an exact value is needed.

SET_GCODE_OFFSET Z=", 435 | "type": "bool", 436 | "default_value": false, 437 | "enabled": "klipper_z_offset_control_enable", 438 | "settable_per_mesh": false, 439 | "settable_per_extruder": false 440 | }, 441 | "klipper_z_offset_set_total": { 442 | "label": "Set Z Axis Offset", 443 | "description": "Defines a total Z axis offset adjustment in mm for the toolhead. If defined, the Z height of all gcode commands will be adjusted by this value after the start gcode sequence. For safety, the max adjustment range is +/- 0.4 mm.

If Adjust Initial Layer Z Offset is also defined, it will combine with this value.

A negative value will move the nozzle closer to the bed.

A value of '0' resets any adjustment since the printer was restarted.

Default: 0", 444 | "type": "float", 445 | "unit": "mm", 446 | "default_value": 0, 447 | "minimum_value": "-0.4", 448 | "minimum_value_warning": "-0.1 if klipper_z_offset_set_total < 0 else 0.0001", 449 | "maximum_value": "0.4", 450 | "maximum_value_warning": "0.1", 451 | "enabled": "klipper_z_offset_control_enable and klipper_z_offset_set_enable", 452 | "settable_per_mesh": false, 453 | "settable_per_extruder": false 454 | }, 455 | "klipper_z_offset_layer_0": { 456 | "label": "Adjust Initial Layer Z Offset", 457 | "description": "Z axis offset adjustment in mm applied only to initial layer of the print. Additional first layer 'squish' is often used to improve bed adhesion. The offset applies only to z coordinates equal to the first layer height then instructs Klipper to revert the offset for the next z axis change. Typical adjustments are between -0.005 and -0.05. The max adjustment range is +/- first layer height.

If Set Z Axis Offset is also enabled, the values will be combined.

A negative value will move the nozzle closer to the bed.

A value of '0' has no effect.

Default: 0 (Disabled)", 458 | "type": "float", 459 | "unit": "mm", 460 | "default_value": 0, 461 | "minimum_value": "-(layer_height_0)", 462 | "minimum_value_warning": "-(layer_height_0 / 2)", 463 | "maximum_value": "layer_height_0", 464 | "maximum_value_warning": "0.01", 465 | "enabled": "klipper_z_offset_control_enable", 466 | "settable_per_mesh": false, 467 | "settable_per_extruder": false 468 | } 469 | } 470 | }, 471 | "klipper_velocity_limits_enable": { 472 | "label": "Velocity Limits Control", 473 | "description": "Enable control of Klipper's velocity and acceleration limits.

Typically only necessary to change these values for calibration purposes.", 474 | "type": "bool", 475 | "default_value": false, 476 | "settable_per_mesh": false, 477 | "settable_per_extruder": false, 478 | "children": { 479 | "klipper_velocity_limit": { 480 | "label": "Velocity Limit", 481 | "description": "The maximum velocity limit in mm/s of the toolhead relative to the print. Print speeds will not be able to exceed this value. It is usually not necessary to adjust a printer's default value.

A value of '0' will disable control and not affect current config.

Default: 0 (Disabled)", 482 | "type": "int", 483 | "unit": "mm/s", 484 | "default_value": 0, 485 | "minimum_value": "0", 486 | "minimum_value_warning": "10 if klipper_velocity_limit > 0 else 0", 487 | "maximum_value_warning": "999", 488 | "enabled": "klipper_velocity_limits_enable", 489 | "settable_per_mesh": false, 490 | "settable_per_extruder": false 491 | }, 492 | "klipper_accel_limit": { 493 | "label": "Acceleration Limit", 494 | "description": "The maximum acceleration limit in mm/s² of the toolhead relative to the print. If Cura's acceleration control is enabled those values also change max_accel so they will override this value. This is intended to adjust max_accel temporarily, such as in preparation for a tuning sequence.

A value of '0' will disable control and not affect current config.

Default: 0 (Disabled)", 495 | "type": "int", 496 | "unit": "mm/s²", 497 | "default_value": 0, 498 | "minimum_value": "0", 499 | "minimum_value_warning": "100 if klipper_accel_limit > 0 else 0", 500 | "maximum_value_warning": "50000", 501 | "enabled": "klipper_velocity_limits_enable", 502 | "settable_per_mesh": false, 503 | "settable_per_extruder": false 504 | }, 505 | "klipper_accel_to_decel_limit": { 506 | "label": "Accel to Decel Limit", 507 | "description": "The maximum rate in mm/s² for how quickly the toolhead can switch from acceleration to deceleration. This is a pseudo acceleration used to reduce the top speed of short zig-zag moves which can cause excessive vibration.

The Klipper default is generally recommended which is calculated as 'max_accel / 2' and does not dynamically change with max_accel during the print.

A value of '0' will disable control and not affect current config.

Default: 0 (Disabled)", 508 | "type": "int", 509 | "unit": "mm/s²", 510 | "default_value": 0, 511 | "minimum_value": "0", 512 | "minimum_value_warning": "100 if klipper_accel_to_decel_limit > 0 else 0", 513 | "maximum_value_warning": "50000", 514 | "enabled": "klipper_velocity_limits_enable", 515 | "settable_per_mesh": false, 516 | "settable_per_extruder": false 517 | }, 518 | "klipper_corner_velocity_limit": { 519 | "label": "Square Corner Velocity Limit", 520 | "description": "The maximum velocity in mm/s of the toolhead during a 90 degree cornering move. A non-zero value can reduce changes in extruder flow rates when cornering by enabling instantaneous velocity changes. Corners with angles above 90 degrees will have a higher cornering velocity while corners with angles with less will have a lower cornering velocity.

A value of '0' would decelerate the toolhead to a stop at each corner.

Klipper default is 5.0 mm/s.

A value of '-1.0' will disable control and not affect current config.

Default: -1.0 (Disabled)", 521 | "type": "float", 522 | "unit": "mm/s", 523 | "default_value": -1, 524 | "minimum_value": "-1", 525 | "minimum_value_warning": "1 if klipper_corner_velocity_limit >= -0.999 else -1", 526 | "maximum_value_warning": "99", 527 | "enabled": "klipper_velocity_limits_enable", 528 | "settable_per_mesh": false, 529 | "settable_per_extruder": false 530 | } 531 | } 532 | }, 533 | "klipper_input_shaper_enable": { 534 | "label": "Input Shaper Control", 535 | "description": "Enable control of Klipper's input shaper commands.

The [input_shaper] section must be enabled in Klipper config.

Typically only recommended to enable for calibration purposes.", 536 | "type": "bool", 537 | "default_value": false, 538 | "settable_per_mesh": false, 539 | "settable_per_extruder": false, 540 | "children": { 541 | "klipper_shaper_freq_x": { 542 | "label": "Shaper Frequency X", 543 | "description": "The frequency in Hz for the X axis input shaper. Typically a resonance frequency of the X axis to suppress.

The Klipper default of '0' will disable input shaping for X axis.

A value of '-1' will disable control and not affect current config.

Default: -1 (Disabled)", 544 | "type": "float", 545 | "unit": "Hz", 546 | "default_value": -1, 547 | "minimum_value": "-1", 548 | "minimum_value_warning": "0.0001 if klipper_shaper_freq_x >= 0 else -1", 549 | "maximum_value_warning": "999", 550 | "enabled": "klipper_input_shaper_enable", 551 | "settable_per_mesh": false, 552 | "settable_per_extruder": false 553 | }, 554 | "klipper_shaper_freq_y": { 555 | "label": "Shaper Frequency Y", 556 | "description": "The frequency in Hz for the Y axis input shaper. Typically a resonance frequency of the Y axis to suppress.

The Klipper default of '0' will disable input shaping for Y axis.

A value of '-1' will disable control and not affect current config.

Default: -1 (Disabled)", 557 | "type": "float", 558 | "unit": "Hz", 559 | "default_value": -1, 560 | "minimum_value": "-1", 561 | "minimum_value_warning": "0.0001 if klipper_shaper_freq_y >= 0 else -1", 562 | "maximum_value_warning": "999", 563 | "enabled": "klipper_input_shaper_enable", 564 | "settable_per_mesh": false, 565 | "settable_per_extruder": false 566 | }, 567 | "klipper_shaper_type": { 568 | "label": "Shaper Type", 569 | "description": "The type of input shaper to use for both X and Y axes.

Supported Types:
ZV, MZV, ZVD, EI, 2HUMP_EI, 3HUMP_EI

Klipper Default: MZV

Not specifying a type will use current shaper_type in Klipper config.", 570 | "type": "enum", 571 | "options": { 572 | "disabled": "", 573 | "mzv": "MZV", 574 | "zv": "ZV", 575 | "zvd": "ZVD", 576 | "ei": "EI", 577 | "2hump_ei": "2HUMP_EI", 578 | "3hump_ei": "3HUMP_EI" 579 | }, 580 | "default_value": "disabled", 581 | "enabled": "klipper_input_shaper_enable", 582 | "settable_per_mesh": false, 583 | "settable_per_extruder": false, 584 | "children": { 585 | "klipper_shaper_type_x": { 586 | "label": "Shaper Type X", 587 | "description": "The type of input shaper to use for only the X axis.

Klipper Default: MZV", 588 | "type": "enum", 589 | "options": { 590 | "disabled": "", 591 | "mzv": "MZV", 592 | "zv": "ZV", 593 | "zvd": "ZVD", 594 | "ei": "EI", 595 | "2hump_ei": "2HUMP_EI", 596 | "3hump_ei": "3HUMP_EI" 597 | }, 598 | "default_value": "disabled", 599 | "value": "klipper_shaper_type", 600 | "enabled": "klipper_input_shaper_enable", 601 | "settable_per_mesh": false, 602 | "settable_per_extruder": false 603 | }, 604 | "klipper_shaper_type_y": { 605 | "label": "Shaper Type Y", 606 | "description": "The input shaper type to use only for the Y axis.

Klipper Default: MZV", 607 | "type": "enum", 608 | "options": { 609 | "disabled": "", 610 | "mzv": "MZV", 611 | "zv": "ZV", 612 | "zvd": "ZVD", 613 | "ei": "EI", 614 | "2hump_ei": "2HUMP_EI", 615 | "3hump_ei": "3HUMP_EI" 616 | }, 617 | "default_value": "disabled", 618 | "value": "klipper_shaper_type", 619 | "enabled": "klipper_input_shaper_enable", 620 | "settable_per_mesh": false, 621 | "settable_per_extruder": false 622 | } 623 | } 624 | }, 625 | "klipper_damping_ratio_x": { 626 | "label": "Damping Ratio X", 627 | "description": "Damping ratio of X axis vibrations used by input shapers to improve vibration suppression. This generally requires no tuning and is recommended to use the default value.

A value of '-1' will disable control and not affect current config.

Klipper Default: 0.1
Default: -1 (Disabled)", 628 | "type": "float", 629 | "default_value": -1, 630 | "minimum_value": "-1", 631 | "maximum_value": "1", 632 | "minimum_value_warning": "0.0001 if klipper_damping_ratio_x >= 0 else -1", 633 | "enabled": "klipper_input_shaper_enable", 634 | "settable_per_mesh": false, 635 | "settable_per_extruder": false 636 | }, 637 | "klipper_damping_ratio_y": { 638 | "label": "Damping Ratio Y", 639 | "description": "Damping ratio of Y axis vibrations used by input shapers to improve vibration suppression. This generally requires no tuning and is not recommended to change from default value.

A value of '-1' will disable control and not affect current config.

Klipper Default: 0.1
Default: -1 (Disabled)", 640 | "type": "float", 641 | "default_value": -1, 642 | "minimum_value": "-1", 643 | "maximum_value": "1", 644 | "minimum_value_warning": "0.0001 if klipper_damping_ratio_y >= 0 else -1", 645 | "enabled": "klipper_input_shaper_enable", 646 | "settable_per_mesh": false, 647 | "settable_per_extruder": false 648 | } 649 | } 650 | }, 651 | "klipper_experimental_enable": { 652 | "label": "Experimental Features", 653 | "description": "Klipper setting features currently in development will frequently be listed in this section. These are beta features which have been tested but may be modified or removed in future versions.

Feedback or suggestions is appreciated.", 654 | "type": "bool", 655 | "default_value": false, 656 | "settable_per_mesh": false, 657 | "settable_per_extruder": false, 658 | "children": { 659 | "klipper_mesh_calibrate_enable": { 660 | "label": "Enable Bed Mesh Calibration", 661 | "description": "Enable to preheat the bed and run Klipper's Bed Mesh Calibrate before the start of the print. Before enabling, ensure any existing bed mesh calibration in start gcode is disabled. This option simply offers a convenient way to toggle on/off the standard calibration sequence.

If enabled, the following commands will execute before Cura's start gcode:

M190 S{material_bed_temperature_layer_0}
G28 ;Home
BED_MESH_CALIBRATE", 662 | "type": "bool", 663 | "default_value": false, 664 | "warning_value": true, 665 | "enabled": "klipper_experimental_enable", 666 | "settable_per_mesh": false, 667 | "settable_per_extruder": false 668 | }, 669 | "klipper_ui_temp_support_enable": { 670 | "label": "UI Preheating Support", 671 | "description": "Ensures a Klipper UI such as Fluidd or Mainsail are able to detect print temps in gcode for preheating actions. If enabled, commented lines defining initial bed and nozzle temps are added to start gcode, unless they already exist. This is only necessary when using internal klipper macros and M190 and M109 gcode commands are not visible in the start gcode.

This should have no affect on the print.", 672 | "type": "bool", 673 | "default_value": false, 674 | "enabled": "klipper_experimental_enable", 675 | "settable_per_mesh": false, 676 | "settable_per_extruder": false 677 | } 678 | } 679 | } 680 | } -------------------------------------------------------------------------------- /plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Klipper Settings Plugin", 3 | "author": "JJFX", 4 | "version": "1.0.2", 5 | "description": "Adds Features and Settings Specific to Klipper Firmware", 6 | "api": 5, 7 | "supported_sdk_versions": ["6.0.0", "7.0.0", "8.0.0"] 8 | } 9 | -------------------------------------------------------------------------------- /resources/images/Klipper.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 25 | 32 | 42 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 64 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /resources/images/examples/KSP_AllSettings_v1.0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgraphix/KlipperSettingsPlugin/a1ba423c702b4a4005d1f548262b16d4712a7985/resources/images/examples/KSP_AllSettings_v1.0.PNG -------------------------------------------------------------------------------- /resources/images/examples/KSP_Category_v1.0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgraphix/KlipperSettingsPlugin/a1ba423c702b4a4005d1f548262b16d4712a7985/resources/images/examples/KSP_Category_v1.0.PNG -------------------------------------------------------------------------------- /resources/images/examples/KSP_Preset-ex1_v1.0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgraphix/KlipperSettingsPlugin/a1ba423c702b4a4005d1f548262b16d4712a7985/resources/images/examples/KSP_Preset-ex1_v1.0.PNG -------------------------------------------------------------------------------- /resources/images/examples/beta/ksp_allsettings_0.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgraphix/KlipperSettingsPlugin/a1ba423c702b4a4005d1f548262b16d4712a7985/resources/images/examples/beta/ksp_allsettings_0.9.png -------------------------------------------------------------------------------- /resources/images/examples/beta/ksp_category_0.9.0.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgraphix/KlipperSettingsPlugin/a1ba423c702b4a4005d1f548262b16d4712a7985/resources/images/examples/beta/ksp_category_0.9.0.JPG -------------------------------------------------------------------------------- /resources/images/examples/beta/ksp_tt_preset-pa_ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgraphix/KlipperSettingsPlugin/a1ba423c702b4a4005d1f548262b16d4712a7985/resources/images/examples/beta/ksp_tt_preset-pa_ex1.png -------------------------------------------------------------------------------- /resources/images/examples/beta/ksp_tt_preset-rt_ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgraphix/KlipperSettingsPlugin/a1ba423c702b4a4005d1f548262b16d4712a7985/resources/images/examples/beta/ksp_tt_preset-rt_ex1.png --------------------------------------------------------------------------------