From 64a6f98fe409a3c4c38a5a9f3b6f96578d883c12 Mon Sep 17 00:00:00 2001 From: Bassam Husain Date: Tue, 14 Mar 2023 18:36:53 -0400 Subject: [PATCH] Pulling in structure from personal branch. --- cfgs/beeper.cfg | 54 -------------------------------------------- cfgs/misc-macros.cfg | 17 +++++++++++++- printer.cfg | 34 ++++++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 57 deletions(-) delete mode 100644 cfgs/beeper.cfg diff --git a/cfgs/beeper.cfg b/cfgs/beeper.cfg deleted file mode 100644 index 7904e88..0000000 --- a/cfgs/beeper.cfg +++ /dev/null @@ -1,54 +0,0 @@ -[output_pin beeper] -pin: PC6 -value: 0 -shutdown_value: 0 -pwm: True -cycle_time: 0.0005 ; Default beeper tone in kHz. 1 / 0.0005 = 2000Hz (2kHz) - -[gcode_macro BEEP] -description: BEEP I=3 DUR=200 FREQ=2000: Beep 3 times, for 200ms each, at 2kHz frequency. -gcode: - # Parameters - {% set i = params.I|default(1)|int %} ; Iterations (number of times to beep). - {% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms. - {% set freq = params.FREQ|default(2000)|int %} ; Frequency in Hz. Default 2kHz. - - {% for iteration in range(i|int) %} - SET_PIN PIN=beeper VALUE=0.8 CYCLE_TIME={ 1.0/freq if freq > 0 else 1 } - G4 P{dur} - SET_PIN PIN=beeper VALUE=0 - G4 P{dur} - {% endfor %} - -# [gcode_macro M300] -# gcode: -# {% set S = params.S|default(1000)|int %} -# {% set P = params.P|default(100)|int %} - -# SET_PIN PIN=beeper VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 } -# G4 P{P} -# SET_PIN PIN=beeper VALUE=0 - -# [gcode_macro SONG_SINGLE_BEEP] -# gcode: -# M300 S830.61 P137 - -# [gcode_macro TOGGLE_BEEPER] -# description: Toggle the printer beeper on and off. -# gcode: -# {% set beeper_state = printer.save_variables.variables.beeper_state|lower %} - -# {% if printer['gcode_macro _USER_VARIABLE'].debug == 1 %} -# {action_respond_info('==== TOGGLE_BEEPER ====')} -# {action_respond_info("beeper_state: %s" % (beeper_state))} -# {action_respond_info('===============')} -# {% endif %} - -# {% if beeper_state == "off" %} -# {action_respond_info('beeper is off, turning it on')} -# SAVE_VARIABLE VARIABLE=beeper_state VALUE='"on"' -# {% else %} -# {action_respond_info('beeper is on= turning it off')} -# SAVE_VARIABLE VARIABLE=beeper_state VALUE='"off"' -# {% endif %} -# SONG_SINGLE_BEEP \ No newline at end of file diff --git a/cfgs/misc-macros.cfg b/cfgs/misc-macros.cfg index caa2fef..664b32f 100644 --- a/cfgs/misc-macros.cfg +++ b/cfgs/misc-macros.cfg @@ -210,4 +210,19 @@ gcode: gcode: {% if "xyz" not in printer.toolhead.homed_axes %} G28 - {% endif %} \ No newline at end of file + {% endif %} + +[gcode_macro BEEP] +description: BEEP I=3 DUR=200 FREQ=2000: Beep 3 times, for 200ms each, at 2kHz frequency. +gcode: + # Parameters + {% set i = params.I|default(1)|int %} ; Iterations (number of times to beep). + {% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms. + {% set freq = params.FREQ|default(2000)|int %} ; Frequency in Hz. Default 2kHz. + + {% for iteration in range(i|int) %} + SET_PIN PIN=beeper VALUE=0.8 CYCLE_TIME={ 1.0/freq if freq > 0 else 1 } + G4 P{dur} + SET_PIN PIN=beeper VALUE=0 + G4 P{dur} + {% endfor %} \ No newline at end of file diff --git a/printer.cfg b/printer.cfg index ef6d60f..5f12b5e 100644 --- a/printer.cfg +++ b/printer.cfg @@ -7,7 +7,6 @@ [include ./cfgs/misc-macros.cfg] [include ./cfgs/PARKING.cfg] [include ./cfgs/MECHANICAL_GANTRY_CALIBRATION.cfg] -[include ./cfgs/beeper.cfg] # NOTE Uncomment the ONE of the following lines if you're using an adxl345 # [include ./cfgs/adxl-rp2040.cfg] @@ -25,6 +24,10 @@ max_accel: 3000 max_z_velocity: 15 max_z_accel: 45 +##################################################################### +# X/Y/Z Stepper Settings +##################################################################### + [stepper_x] step_pin: PC2 dir_pin: !PB9 @@ -89,11 +92,15 @@ sense_resistor: 0.150 uart_address: 3 diag_pin: PA7 +##################################################################### +# Extruder +##################################################################### + [extruder] step_pin: PB4 dir_pin: !PB3 enable_pin: !PC3 -microsteps: 32 +microsteps: 64 rotation_distance: 4.65 # NOTE Calibrate e-steps and adjust https://www.klipper3d.org/Rotation_Distance.html nozzle_diameter: 0.400 filament_diameter: 1.750 @@ -116,6 +123,10 @@ interpolate: False sense_resistor: 0.150 uart_address: 3 +##################################################################### +# Bed Heater +##################################################################### + [heater_bed] heater_pin: PA2 sensor_type: EPCOS 100K B57560G104F @@ -127,6 +138,10 @@ pid_kd: 1343.571 min_temp: 0 max_temp: 110 +##################################################################### +# Probe Related +##################################################################### + [probe] pin: PB1 x_offset: 27 @@ -153,9 +168,17 @@ fade_start: 1 fade_end: 10 fade_target: 0 +##################################################################### +# Fans +##################################################################### + [fan] pin: PA0 +##################################################################### +# Misc +##################################################################### + [display] lcd_type: st7920 cs_pin: PB12 @@ -188,3 +211,10 @@ screw5_name: back left speed: 50 horizontal_move_z: 10 screw_thread: CCW-M4 + +[output_pin beeper] +pin: PC6 +value: 0 +shutdown_value: 0 +pwm: True +cycle_time: 0.0005 ; Default beeper tone in kHz. 1 / 0.0005 = 2000Hz (2kHz)