output_pin: Deprecate static_value parameter

Remove support for configuring "static" pins in output_pin module.  A
"static" pin only saves a few bytes of memory in the micro-controller.
The savings does not justify the increased code complexity.

Deprecate the static_value parameter to warn users.  In the interim, a
static_value parameter will set both value and shutdown_value
parameters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2023-01-13 10:02:47 -05:00
parent 2e8b54ae5f
commit 4115ea128a
9 changed files with 42 additions and 41 deletions

View File

@ -84,7 +84,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.3 value: 1.3
[output_pin stepper_z_current] [output_pin stepper_z_current]
pin: PL4 pin: PL4
@ -92,7 +92,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.3 value: 1.3
[output_pin stepper_e_current] [output_pin stepper_e_current]
pin: PL5 pin: PL5
@ -100,7 +100,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.25 value: 1.25
[static_digital_output stepper_config] [static_digital_output stepper_config]
pins: pins:

View File

@ -97,7 +97,7 @@ max_z_accel: 30
[output_pin case_light] [output_pin case_light]
pin: PH5 pin: PH5
static_value: 1.0 value: 1.0
# Motor current settings. # Motor current settings.
[output_pin stepper_xy_current] [output_pin stepper_xy_current]
@ -107,7 +107,7 @@ scale: 2.000
# Max power setting. # Max power setting.
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.200 value: 1.200
# Power adjustment setting. # Power adjustment setting.
[output_pin stepper_z_current] [output_pin stepper_z_current]
@ -116,7 +116,7 @@ pwm: True
scale: 2.000 scale: 2.000
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.200 value: 1.200
[output_pin stepper_e_current] [output_pin stepper_e_current]
pin: PL3 pin: PL3
@ -124,4 +124,4 @@ pwm: True
scale: 2.000 scale: 2.000
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.250 value: 1.250

View File

@ -89,7 +89,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.3 value: 1.3
[output_pin stepper_z_current] [output_pin stepper_z_current]
pin: PL4 pin: PL4
@ -97,7 +97,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.3 value: 1.3
[output_pin stepper_e_current] [output_pin stepper_e_current]
pin: PL3 pin: PL3
@ -105,7 +105,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.25 value: 1.25
[display] [display]
lcd_type: st7920 lcd_type: st7920

View File

@ -98,7 +98,6 @@ max_temp: 100
[output_pin led] [output_pin led]
pin: PC14 pin: PC14
static_value: 0
# Neopixel LED support # Neopixel LED support
# [neopixel led_neopixel] # [neopixel led_neopixel]

View File

@ -125,7 +125,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.300 value: 1.300
[output_pin stepper_z_current] [output_pin stepper_z_current]
pin: PL4 pin: PL4
@ -133,7 +133,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.630 value: 1.630
[output_pin stepper_e_current] [output_pin stepper_e_current]
pin: PL5 pin: PL5
@ -141,7 +141,7 @@ pwm: True
scale: 2.0 scale: 2.0
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.250 value: 1.250
[static_digital_output stepper_config] [static_digital_output stepper_config]
# Microstepping pins # Microstepping pins

View File

@ -86,7 +86,7 @@ pwm: True
scale: 2.782 scale: 2.782
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.2 value: 1.2
[output_pin stepper_z_current] [output_pin stepper_z_current]
pin: PL4 pin: PL4
@ -94,7 +94,7 @@ pwm: True
scale: 2.782 scale: 2.782
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.2 value: 1.2
[output_pin stepper_e_current] [output_pin stepper_e_current]
pin: PL3 pin: PL3
@ -102,7 +102,7 @@ pwm: True
scale: 2.782 scale: 2.782
cycle_time: .000030 cycle_time: .000030
hardware_pwm: True hardware_pwm: True
static_value: 1.0 value: 1.0
[display] [display]
lcd_type: ssd1306 lcd_type: ssd1306

View File

@ -8,6 +8,10 @@ All dates in this document are approximate.
## Changes ## Changes
20240123: The output_pin `static_value` parameter is deprecated.
Replace with `value` and `shutdown_value` parameters. The option will
be removed in the near future.
20231216: The `[hall_filament_width_sensor]` is changed to trigger filament runout 20231216: The `[hall_filament_width_sensor]` is changed to trigger filament runout
when the thickness of the filament exceeds `max_diameter`. The maximum diameter when the thickness of the filament exceeds `max_diameter`. The maximum diameter
defaults to `default_nominal_filament_diameter + max_difference`. See defaults to `default_nominal_filament_diameter + max_difference`. See

View File

@ -3096,11 +3096,6 @@ pin:
# If this is true, the value fields should be between 0 and 1; if it # If this is true, the value fields should be between 0 and 1; if it
# is false the value fields should be either 0 or 1. The default is # is false the value fields should be either 0 or 1. The default is
# False. # False.
#static_value:
# If this is set, then the pin is assigned to this value at startup
# and the pin can not be changed during runtime. A static pin uses
# slightly less ram in the micro-controller. The default is to use
# runtime configuration of pins.
#value: #value:
# The value to initially set the pin to during MCU configuration. # The value to initially set the pin to during MCU configuration.
# The default is 0 (for low voltage). # The default is 0 (for low voltage).
@ -3133,6 +3128,8 @@ pin:
# then the 'value' parameter can be specified using the desired # then the 'value' parameter can be specified using the desired
# amperage for the stepper. The default is to not scale the 'value' # amperage for the stepper. The default is to not scale the 'value'
# parameter. # parameter.
#static_value:
# This option is deprecated and should no longer be specified.
``` ```
### [pwm_tool] ### [pwm_tool]

View File

@ -12,6 +12,7 @@ class PrinterOutputPin:
def __init__(self, config): def __init__(self, config):
self.printer = config.get_printer() self.printer = config.get_printer()
ppins = self.printer.lookup_object('pins') ppins = self.printer.lookup_object('pins')
# Determine pin type
self.is_pwm = config.getboolean('pwm', False) self.is_pwm = config.getboolean('pwm', False)
if self.is_pwm: if self.is_pwm:
self.mcu_pin = ppins.setup_pin('pwm', config.get('pin')) self.mcu_pin = ppins.setup_pin('pwm', config.get('pin'))
@ -26,34 +27,34 @@ class PrinterOutputPin:
self.scale = 1. self.scale = 1.
self.last_cycle_time = self.default_cycle_time = 0. self.last_cycle_time = self.default_cycle_time = 0.
self.last_print_time = 0. self.last_print_time = 0.
static_value = config.getfloat('static_value', None, # Support mcu checking for maximum duration
minval=0., maxval=self.scale)
self.reactor = self.printer.get_reactor() self.reactor = self.printer.get_reactor()
self.resend_timer = None self.resend_timer = None
self.resend_interval = 0. self.resend_interval = 0.
max_mcu_duration = config.getfloat('maximum_mcu_duration', 0.,
minval=0.500,
maxval=MAX_SCHEDULE_TIME)
self.mcu_pin.setup_max_duration(max_mcu_duration)
if max_mcu_duration:
self.resend_interval = max_mcu_duration - RESEND_HOST_TIME
# Determine start and shutdown values
static_value = config.getfloat('static_value', None,
minval=0., maxval=self.scale)
if static_value is not None: if static_value is not None:
self.mcu_pin.setup_max_duration(0.) config.deprecate('static_value')
self.last_value = static_value / self.scale self.last_value = self.shutdown_value = static_value / self.scale
self.mcu_pin.setup_start_value(
self.last_value, self.last_value, True)
else: else:
max_mcu_duration = config.getfloat('maximum_mcu_duration', 0.,
minval=0.500,
maxval=MAX_SCHEDULE_TIME)
self.mcu_pin.setup_max_duration(max_mcu_duration)
if max_mcu_duration:
self.resend_interval = max_mcu_duration - RESEND_HOST_TIME
self.last_value = config.getfloat( self.last_value = config.getfloat(
'value', 0., minval=0., maxval=self.scale) / self.scale 'value', 0., minval=0., maxval=self.scale) / self.scale
self.shutdown_value = config.getfloat( self.shutdown_value = config.getfloat(
'shutdown_value', 0., minval=0., maxval=self.scale) / self.scale 'shutdown_value', 0., minval=0., maxval=self.scale) / self.scale
self.mcu_pin.setup_start_value(self.last_value, self.shutdown_value) self.mcu_pin.setup_start_value(self.last_value, self.shutdown_value)
pin_name = config.get_name().split()[1] # Register commands
gcode = self.printer.lookup_object('gcode') pin_name = config.get_name().split()[1]
gcode.register_mux_command("SET_PIN", "PIN", pin_name, gcode = self.printer.lookup_object('gcode')
self.cmd_SET_PIN, gcode.register_mux_command("SET_PIN", "PIN", pin_name,
desc=self.cmd_SET_PIN_help) self.cmd_SET_PIN,
desc=self.cmd_SET_PIN_help)
def get_status(self, eventtime): def get_status(self, eventtime):
return {'value': self.last_value} return {'value': self.last_value}
def _set_pin(self, print_time, value, cycle_time, is_resend=False): def _set_pin(self, print_time, value, cycle_time, is_resend=False):