mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-22 22:24:02 -06:00
gpiocmds: Allow the start value for a pin to differ from the default_value
Allow the start value to be different from the default/shutdown value for the pin. This will be useful for "heater fans" that should startup in the off state, and transition to full on in a shutdown state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
d03cf2b83f
commit
db97f36631
4 changed files with 62 additions and 46 deletions
|
@ -44,14 +44,15 @@ digital_out_event(struct timer *timer)
|
|||
void
|
||||
command_config_digital_out(uint32_t *args)
|
||||
{
|
||||
struct gpio_out pin = gpio_out_setup(args[1], args[2]);
|
||||
struct digital_out_s *d = oid_alloc(args[0], command_config_digital_out
|
||||
, sizeof(*d));
|
||||
d->default_value = args[2];
|
||||
d->pin = gpio_out_setup(args[1], d->default_value);
|
||||
d->max_duration = args[3];
|
||||
d->pin = pin;
|
||||
d->default_value = args[3];
|
||||
d->max_duration = args[4];
|
||||
}
|
||||
DECL_COMMAND(command_config_digital_out,
|
||||
"config_digital_out oid=%c pin=%u default_value=%c"
|
||||
"config_digital_out oid=%c pin=%u value=%c default_value=%c"
|
||||
" max_duration=%u");
|
||||
|
||||
void
|
||||
|
@ -159,17 +160,18 @@ soft_pwm_load_event(struct timer *timer)
|
|||
void
|
||||
command_config_soft_pwm_out(uint32_t *args)
|
||||
{
|
||||
struct gpio_out pin = gpio_out_setup(args[1], !!args[3]);
|
||||
struct soft_pwm_s *s = oid_alloc(args[0], command_config_soft_pwm_out
|
||||
, sizeof(*s));
|
||||
s->pin = pin;
|
||||
s->cycle_time = args[2];
|
||||
s->default_value = !!args[3];
|
||||
s->max_duration = args[4];
|
||||
s->default_value = !!args[4];
|
||||
s->max_duration = args[5];
|
||||
s->flags = s->default_value ? SPF_ON : 0;
|
||||
s->pin = gpio_out_setup(args[1], s->default_value);
|
||||
}
|
||||
DECL_COMMAND(command_config_soft_pwm_out,
|
||||
"config_soft_pwm_out oid=%c pin=%u cycle_ticks=%u default_value=%c"
|
||||
" max_duration=%u");
|
||||
"config_soft_pwm_out oid=%c pin=%u cycle_ticks=%u value=%c"
|
||||
" default_value=%c max_duration=%u");
|
||||
|
||||
void
|
||||
command_schedule_soft_pwm_out(uint32_t *args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue