DangerKlippers / danger-klipper

Klipper but... Dangerous
GNU General Public License v3.0
255 stars 83 forks source link

Not possible to use multi_pin fans for bed_heater cooling_fan with MPC #418

Closed CunningLogic closed 3 weeks ago

CunningLogic commented 3 weeks ago

I cant seem to get multi_pin fans working as the cooling_fan for my bed when doing a MPC calibration. No matter what, the pins are unknown. It works fine for PID calibration. Any feedback would be appreciated.

"Unknown pin chip name 'multi_pin'""

or if i remove the multi_pin preface I get

"Unknown pin chip name 'bedfan_pins'""

I have tried both of these configs:

[heater_bed]
control: mpc
heater_power: 600
cooling_fan: fan_generic bed_fans
heater_pin: PF6
sensor_type: ATC Semitec 104NT-4-R025H42G
sensor_pin: PB0
max_power: 0.7
min_temp: 18
max_temp: 130

#Bed Fans
[multi_pin bedfan_pins]
pins: mcu:PA4, mcu:PA3, mcu:PA2

[fan_generic bed_fans]
pin: multi_pin:bedfan_pins
max_power: 1.0
kick_start_time: 0.5
off_below: 0.10
[heater_bed]
control: mpc
heater_power: 600
cooling_fan: heater_fan bed_fan
heater_pin: PF6
sensor_type: ATC Semitec 104NT-4-R025H42G
sensor_pin: PB0
max_power: 0.7
min_temp: 18
max_temp: 130

#Bed Fans
[multi_pin bedfan_pins]
pins: mcu:PA4, mcu:PA3, mcu:PA2

[heater_fan bed_fan]
pin: multi_pin:bedfan_pins
max_power: 1.0
shutdown_speed: 0.0
kick_start_time: 5.0
heater: heater_bed
heater_temp: 50
fan_speed: 1.0

My original config when using PID calibration works with multi_pin and is as follows:

[multi_pin bedfan_pins]
pins: mcu:PA4, mcu:PA3, mcu:PA2

[heater_bed]
heater_pin: PF6
sensor_type: ATC Semitec 104NT-4-R025H42G
sensor_pin: PB0
max_power: 0.7
min_temp: 18
max_temp: 130

[heater_fan bed_fan]
pin: multi_pin:bedfan_pins
max_power: 1.0
shutdown_speed: 0.0
kick_start_time: 5.0
heater: heater_bed
heater_temp: 40
fan_speed: 1.0

Relevant log section showing exception:

=======================
Extruder max_extrude_ratio=2.078758
mcu 'mcu': Starting serial connect
webhooks client 548110041776: New connection
webhooks client 548110041776: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'}
Loaded MCU 'mcu' 119 commands (Danger-Klipper v0.12.0-471-gb356768e / gcc: (15:8-2019-q3-1+b1) 8.3.1 20190703 (release) [gcc-8-branch revision 273027] binutils: (2.35.2-2+14+b2) 2.35.2)
MCU 'mcu' config: ADC_MAX=4095 BUS_PINS_i2c1_PB6_PB7=PB6,PB7 BUS_PINS_i2c1_PB8_PB9=PB8,PB9 BUS_PINS_i2c2_PB10_PB11=PB10,PB11 BUS_PINS_i2c3_PA8_PC9=PA8,PC9 BUS_PINS_spi1=PA6,PA7,PA5 BUS_PINS_spi1a=PB4,PB5,PB3 BUS_PINS_spi2=PB14,PB15,PB13 BUS_PINS_spi2a=PC2,PC3,PB10 BUS_PINS_spi3a=PC11,PC12,PC10 BUS_PINS_spi4=PE13,PE14,PE12 BUS_PINS_spi5=PF8,PF9,PF7 BUS_PINS_spi5a=PH7,PF11,PH6 BUS_PINS_spi6=PG12,PG14,PG13 CLOCK_FREQ=400000000 MCU=stm32h723xx PWM_MAX=255 RESERVE_PINS_USB=PA11,PA12 RESERVE_PINS_crystal=PH0,PH1 STATS_SUMSQ_BASE=256 STEPPER_BOTH_EDGE=1
mcu 'can0': Starting CAN connect
Created a socket
Loaded MCU 'can0' 115 commands (Danger-Klipper v0.12.0-441-g9648ee15 / gcc: (15:8-2019-q3-1+b1) 8.3.1 20190703 (release) [gcc-8-branch revision 273027] binutils: (2.35.2-2+14+b2) 2.35.2)
MCU 'can0' config: ADC_MAX=4095 BUS_PINS_i2c1_PA9_PA10=PA9,PA10 BUS_PINS_i2c1_PB6_PB7=PB6,PB7 BUS_PINS_i2c1_PB8_PB9=PB8,PB9 BUS_PINS_i2c2_PB10_PB11=PB10,PB11 BUS_PINS_i2c2_PB13_PB14=PB13,PB14 BUS_PINS_i2c3_PB3_PB4=PB3,PB4 BUS_PINS_i2c3_PC0_PC1=PC0,PC1 BUS_PINS_spi1=PA6,PA7,PA5 BUS_PINS_spi1a=PB4,PB5,PB3 BUS_PINS_spi2=PB14,PB15,PB13 BUS_PINS_spi2_PB2_PB11_PB10=PB2,PB11,PB10 BUS_PINS_spi2a=PC2,PC3,PB10 BUS_PINS_spi3=PB4,PB5,PB3 CANBUS_FREQUENCY=1000000 CLOCK_FREQ=64000000 MCU=stm32g0b1xx PWM_MAX=255 RECEIVE_WINDOW=192 RESERVE_PINS_CAN=PB0,PB1 RESERVE_PINS_crystal=PF0,PF1 STATS_SUMSQ_BASE=256 STEPPER_BOTH_EDGE=1
mcu_temperature 'mcu' nominal base=-281.788618 slope=1664.634146
mcu_temperature 'can0' nominal base=-271.453488 slope=1309.447674
mcu 'beacon': Starting serial connect
Loaded MCU 'beacon' 42 commands ( Beacon 2.1.0 / )
MCU 'beacon' config: ADC_MAX=4095 BEACON_ADC_SMOOTH_COUNT=16 BEACON_REV=D CLOCK_FREQ=32000000 MCU=beacon STATS_SUMSQ_BASE=256
mcu_temperature 'mcu' nominal base=-281.788618 slope=1664.634146
Sending MCU 'mcu' printer configuration...
Config error
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/mcu.py", line 1017, in _send_config
    self._serial.send(c)
  File "/home/pi/klipper/klippy/serialhdl.py", line 406, in send
    cmd = self.msgparser.create_command(msg)
  File "/home/pi/klipper/klippy/msgproto.py", line 414, in create_command
    cmd = mp.encode_by_name(**argparts)
  File "/home/pi/klipper/klippy/msgproto.py", line 220, in encode_by_name
    t.encode(out, params[name])
  File "/home/pi/klipper/klippy/msgproto.py", line 137, in encode
    raise enumeration_error(self.enum_name, v)
msgproto.enumeration_error: Unknown value 'bedfan_pins' in enumeration 'pin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 284, in _connect
    cb()
  File "/home/pi/klipper/klippy/mcu.py", line 1103, in _connect
    self._send_config(None)
  File "/home/pi/klipper/klippy/mcu.py", line 1028, in _send_config
    raise self._printer.config_error(
configparser.Error: Pin 'bedfan_pins' is not a valid pin name on mcu 'mcu'
CunningLogic commented 3 weeks ago

rogerlz worked it out in discord, placing the pins in order solved.

This could still possibly be considered a bug? pin order did not matter before.

#Bed Fans
[multi_pin bedfan_pins]
pins: PA2, PA3, PA4

[fan_generic bed_fans]
pin: multi_pin:bedfan_pins
max_power: 1.0
kick_start_time: 0.5
off_below: 0.10

[heater_bed]
control: mpc
heater_power: 600
cooling_fan: fan_generic bed_fans
heater_pin: PF6
sensor_type: ATC Semitec 104NT-4-R025H42G
sensor_pin: PB0
max_power: 0.7
min_temp: 18
max_temp: 130