Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion meta-opencentauri/recipes-apps/klipper/files/macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ gcode:
{% set adaptive_purge = settings.adaptive_purge|default('true')|lower == 'true' %}
{% set nozzle_z_homing = settings.nozzle_z_homing|default('false')|lower == 'true' %}
{% set all_calibrated = printer["gcode_macro _CHECK_CALIBRATION_VARS"].all_calibrated %}
{% set load_skew_profile = settings.load_skew_profile|default('false')|lower == 'true' %}
{% set skew_profile_name = settings.skew_profile_name|default('')|string %}

{% if not all_calibrated %}
SET_DISPLAY_TEXT MSG="Calibration process not completed. Please complete initial calibration first"
Expand Down Expand Up @@ -100,6 +102,11 @@ gcode:
{% if adaptive_purge %}
LINE_PURGE
{% endif %}

{% if load_skew_profile %}
SET_DISPLAY_TEXT MSG="Loading skew profile"
SKEW_PROFILE LOAD={skew_profile_name}
{% endif %}
SET_TEMPERATURE_FAN_TARGET temperature_fan=mainboard TARGET=30
SET_DISPLAY_TEXT ; Clear display text after print start
G90
Expand All @@ -112,7 +119,12 @@ gcode:
{% set z_ideal = settings.z_ideal_lifting_distance|default(170)|int %}
{% set e_mintemp = printer.configfile.settings['extruder'].min_extrude_temp %}
{% set sensor = printer['filament_switch_sensor filament_sensor'] %}

{% set load_skew_profile = settings.load_skew_profile|default('false')|lower == 'true' %}

{% if load_skew_profile %}
SET_SKEW CLEAR=1
{% endif %}

{% if printer.toolhead.homed_axes|lower == "xyz" %}
G91
{% if sensor.enabled and sensor.filament_detected %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ z_ideal_lifting_distance=$(get_config_value z_ideal_lifting_distance)
full_calibrate_hotend_temperature=$(get_config_value full_calibrate_hotend_temperature)
full_calibrate_bed_temperature=$(get_config_value full_calibrate_bed_temperature)
bypass_calibration=$(get_config_value bypass_calibration)
load_skew_profile=$(get_config_value load_skew_profile)
if $(echo "$load_skew_profile" | tr '[:upper:]' '[:lower:]'); then
skew_profile_name=$(get_config_value skew_profile_name)
else
#if someone has set load_skew_profile to false and also deleted skew_profile_name,
#provide a dummy value since we are set -eu
skew_profile_name="undefined"
fi

mkdir -p "${OUTPUT_DIR}"

Expand All @@ -38,6 +46,9 @@ variable_z_ideal_lifting_distance: ${z_ideal_lifting_distance}
variable_full_calibrate_hotend_temperature: ${full_calibrate_hotend_temperature}
variable_full_calibrate_bed_temperature: ${full_calibrate_bed_temperature}
variable_bypass_calibration: ${bypass_calibration}
variable_load_skew_profile: ${load_skew_profile}
variable_skew_profile_name: '"$skew_profile_name"'

gcode:

EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
'z_ideal_lifting_distance': [str(i) for i in range(257)],
'full_calibrate_hotend_temperature': [str(i) for i in range(200, 301)],
'full_calibrate_bed_temperature': [str(i) for i in range(40, 101)],
'load_skew_profile' : ['True', 'False'],
'skew_profile_name': None,
},
}

Expand All @@ -35,6 +37,11 @@ def validate_config(config : dict):
if option not in config[section]:
continue
value = config[section][option]
if valid_values is None:
if not isinstance(value, str):
print(f"Warning: Invalid value '{value}' for '{option}' in section '{section}'. Expected a string.", file=sys.stderr)
del config[section][option]
continue
if value not in valid_values:
print(f"Warning: Invalid value '{value}' for '{option}' in section '{section}'. Valid options are: {valid_values}", file=sys.stderr)
del config[section][option]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ z_ideal_lifting_distance = 170
full_calibrate_hotend_temperature = 250
# Bed temperature in Celsius used during the full calibration workflow. Range: 40-100.
full_calibrate_bed_temperature = 60
#load a user defined skew_profile at print start
load_skew_profile = False
#if load_skew_profile is True, the name of the skew profile to load
skew_profile_name = Califlower