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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,10 @@ All dates in this document are approximate.
## 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
when the thickness of the filament exceeds `max_diameter`. The maximum diameter
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
# is false the value fields should be either 0 or 1. The default is
# 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:
# The value to initially set the pin to during MCU configuration.
# The default is 0 (for low voltage).
@ -3133,6 +3128,8 @@ pin:
# then the 'value' parameter can be specified using the desired
# amperage for the stepper. The default is to not scale the 'value'
# parameter.
#static_value:
# This option is deprecated and should no longer be specified.
```
### [pwm_tool]

View File

@ -12,6 +12,7 @@ class PrinterOutputPin:
def __init__(self, config):
self.printer = config.get_printer()
ppins = self.printer.lookup_object('pins')
# Determine pin type
self.is_pwm = config.getboolean('pwm', False)
if self.is_pwm:
self.mcu_pin = ppins.setup_pin('pwm', config.get('pin'))
@ -26,29 +27,29 @@ class PrinterOutputPin:
self.scale = 1.
self.last_cycle_time = self.default_cycle_time = 0.
self.last_print_time = 0.
static_value = config.getfloat('static_value', None,
minval=0., maxval=self.scale)
# Support mcu checking for maximum duration
self.reactor = self.printer.get_reactor()
self.resend_timer = None
self.resend_interval = 0.
if static_value is not None:
self.mcu_pin.setup_max_duration(0.)
self.last_value = static_value / self.scale
self.mcu_pin.setup_start_value(
self.last_value, self.last_value, True)
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
# Determine start and shutdown values
static_value = config.getfloat('static_value', None,
minval=0., maxval=self.scale)
if static_value is not None:
config.deprecate('static_value')
self.last_value = self.shutdown_value = static_value / self.scale
else:
self.last_value = config.getfloat(
'value', 0., minval=0., maxval=self.scale) / self.scale
self.shutdown_value = config.getfloat(
'shutdown_value', 0., minval=0., maxval=self.scale) / self.scale
self.mcu_pin.setup_start_value(self.last_value, self.shutdown_value)
# Register commands
pin_name = config.get_name().split()[1]
gcode = self.printer.lookup_object('gcode')
gcode.register_mux_command("SET_PIN", "PIN", pin_name,