heater: if pwm is set to 1, hardware pwm is forced, if available.

This commit is contained in:
Nico Tonnhofer 2017-03-21 08:43:52 +01:00
parent 6e78757385
commit 4882d19215
26 changed files with 80 additions and 95 deletions

View File

@ -226,8 +226,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -238,9 +237,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO10, 0, 2, 100) DEFINE_HEATER(extruder, DIO10, 0, 1, 100)
DEFINE_HEATER(bed, DIO9, 0, 2, 100) DEFINE_HEATER(bed, DIO9, 0, 1, 100)
DEFINE_HEATER(fan, DIO8, 0, 2, 100) DEFINE_HEATER(fan, DIO8, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -226,8 +226,7 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO3, THERMISTOR_EXTRUDER)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -238,7 +237,7 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO3, THERMISTOR_EXTRUDER)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, AIO2, 0, 2, 100) DEFINE_HEATER(extruder, AIO2, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
//DEFINE_HEATERS_END //DEFINE_HEATERS_END

View File

@ -220,7 +220,7 @@ DEFINE_TEMP_SENSOR(noheater, TT_INTERCOM, AIO0, 0)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
1 for using PWM on a PWM-able pin and on/off on other pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict

View File

@ -221,8 +221,7 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO5, THERMISTOR_EXTRUDER)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -233,7 +232,7 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO5, THERMISTOR_EXTRUDER)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO6, 0, 2, 100) DEFINE_HEATER(extruder, DIO6, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
//DEFINE_HEATERS_END //DEFINE_HEATERS_END

View File

@ -225,13 +225,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, PIO1_0,THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
>=2 in Hertz (Hz) on ARM based controllers to set PWM frequency of frequency in Hertz (Hz) on ARM based controllers to set PWM frequency of
this pin's output. Frequency isn't always accurate, Teacup this pin's output. Frequency isn't always accurate, Teacup
will choose the closest possible one. FAST_PWM is ignored will choose the closest possible one. FAST_PWM is ignored
on such controllers. Valid range is 2 to 200'000 Hz. on such controllers. Valid range is 2 to 200'000 Hz.
It will force to 1 on none-PWM-able pins. 1 on AVR based controllers for using Pulse Width Modulation (PWM)
1 for using software emulated PWM at 100Hz. on a pin supporting it. PWM frequency can be influenced only
0 for using on/off on a PWM-able pin, too. somewhat and only globally with FAST_PWM.
0 for using a PWM-able pin in on/off mode.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
with slow switches, like solid state relays. A too high frequency can with slow switches, like solid state relays. A too high frequency can

View File

@ -230,11 +230,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO2, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
with slow switches, like solid state relays. PWM frequency can be with slow switches, like solid state relays. PWM frequency can be
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
@ -243,8 +241,8 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO2, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO4, 0, 2, 100) DEFINE_HEATER(extruder, DIO4, 0, 1, 100)
DEFINE_HEATER(bed, DIO3, 0, 2, 100) DEFINE_HEATER(bed, DIO3, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -231,8 +231,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -243,8 +242,8 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO4, 0, 2, 100) DEFINE_HEATER(extruder, DIO4, 0, 1, 100)
DEFINE_HEATER(bed, DIO3, 0, 2, 100) DEFINE_HEATER(bed, DIO3, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -230,8 +230,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -242,9 +241,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO13, 0, 2, 100) DEFINE_HEATER(extruder, DIO13, 0, 1, 100)
DEFINE_HEATER(bed, DIO12, 0, 2, 100) DEFINE_HEATER(bed, DIO12, 0, 1, 100)
DEFINE_HEATER(fan, DIO4, 0, 1, 100) DEFINE_HEATER(fan, DIO4, 0, 0, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -228,8 +228,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO7, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -240,8 +239,8 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO7, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO11, 0, 2, 100) DEFINE_HEATER(extruder, DIO11, 0, 1, 100)
DEFINE_HEATER(bed, DIO3, 0, 2, 100) DEFINE_HEATER(bed, DIO3, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -247,8 +247,7 @@
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict

View File

@ -227,8 +227,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -239,9 +238,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO10, 0, 2, 100) DEFINE_HEATER(extruder, DIO10, 0, 1, 100)
DEFINE_HEATER(bed, DIO8, 0, 2, 100) DEFINE_HEATER(bed, DIO8, 0, 1, 100)
DEFINE_HEATER(fan, DIO9, 0, 2, 100) DEFINE_HEATER(fan, DIO9, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -232,8 +232,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -244,9 +243,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO10, 0, 2, 100) DEFINE_HEATER(extruder, DIO10, 0, 1, 100)
DEFINE_HEATER(bed, DIO8, 0, 2, 100) DEFINE_HEATER(bed, DIO8, 0, 1, 100)
DEFINE_HEATER(fan, DIO9, 0, 2, 100) DEFINE_HEATER(fan, DIO9, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -230,8 +230,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO11, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -242,9 +241,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO11, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO2, 0, 2, 100) DEFINE_HEATER(extruder, DIO2, 0, 1, 100)
DEFINE_HEATER(bed, DIO9, 0, 2, 100) DEFINE_HEATER(bed, DIO9, 0, 1, 100)
DEFINE_HEATER(fan, DIO8, 0, 2, 100) DEFINE_HEATER(fan, DIO8, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -228,8 +228,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -240,8 +239,8 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO13, 0, 2, 100) DEFINE_HEATER(extruder, DIO13, 0, 1, 100)
DEFINE_HEATER(bed, DIO14, 0, 2, 100) DEFINE_HEATER(bed, DIO14, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -228,8 +228,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -240,8 +239,8 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO12, 0, 2, 100) DEFINE_HEATER(extruder, DIO12, 0, 1, 100)
DEFINE_HEATER(bed, DIO13, 0, 2, 100) DEFINE_HEATER(bed, DIO13, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -228,8 +228,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -240,8 +239,8 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO3, 0, 2, 100) DEFINE_HEATER(extruder, DIO3, 0, 1, 100)
DEFINE_HEATER(bed, DIO4, 0, 2, 100) DEFINE_HEATER(bed, DIO4, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -229,8 +229,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -241,9 +240,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO3, 0, 2, 100) DEFINE_HEATER(extruder, DIO3, 0, 1, 100)
DEFINE_HEATER(bed, DIO6, 0, 2, 100) DEFINE_HEATER(bed, DIO6, 0, 1, 100)
DEFINE_HEATER(fan, DIO5, 0, 2, 100) DEFINE_HEATER(fan, DIO5, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -226,8 +226,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -238,9 +237,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO15, 0, 2, 100) DEFINE_HEATER(extruder, DIO15, 0, 1, 100)
DEFINE_HEATER(bed, DIO14, 0, 2, 100) DEFINE_HEATER(bed, DIO14, 0, 1, 100)
DEFINE_HEATER(fan, DIO16, 0, 1, 100) DEFINE_HEATER(fan, DIO16, 0, 0, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -226,8 +226,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -238,9 +237,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO10, 0, 2, 100) DEFINE_HEATER(extruder, DIO10, 0, 1, 100)
DEFINE_HEATER(bed, DIO9, 0, 2, 100) DEFINE_HEATER(bed, DIO9, 0, 1, 100)
DEFINE_HEATER(fan, DIO8, 0, 1, 100) DEFINE_HEATER(fan, DIO8, 0, 0, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -228,8 +228,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
2 for using PWM on a PWM-able pin. It will force to 1 on none-PWM-able pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
1 for using software emulated PWM.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict
@ -240,9 +239,9 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm
DEFINE_HEATER(extruder, DIO13, 0, 2, 100) DEFINE_HEATER(extruder, DIO13, 0, 1, 100)
DEFINE_HEATER(bed, DIO12, 0, 2, 100) DEFINE_HEATER(bed, DIO12, 0, 1, 100)
DEFINE_HEATER(fan, DIO4, 0, 2, 100) DEFINE_HEATER(fan, DIO4, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder
#define HEATER_BED HEATER_bed #define HEATER_BED HEATER_bed

View File

@ -222,7 +222,7 @@
for this pin, e.g. for a MOSFET with a driver. for this pin, e.g. for a MOSFET with a driver.
Set 'pwm' to ... Set 'pwm' to ...
1 for using PWM on a PWM-able pin and on/off on other pins. 1 for using hardware PWM on a PWM-able pin and software PWM on other pins.
0 for using on/off on a PWM-able pin, too. 0 for using on/off on a PWM-able pin, too.
Using PWM usually gives smoother temperature control but can conflict Using PWM usually gives smoother temperature control but can conflict

View File

@ -22,7 +22,7 @@ typedef struct {
volatile uint8_t *heater_pwm; ///< pointer to 8-bit PWM register, eg OCR0A (8-bit) or ORC3L (low byte, 16-bit) volatile uint8_t *heater_pwm; ///< pointer to 8-bit PWM register, eg OCR0A (8-bit) or ORC3L (low byte, 16-bit)
}; };
uint8_t masked_pin; ///< heater pin, masked. eg for PB3 enter '1 << 3' here, or 1 << PB3_PIN or similar uint8_t masked_pin; ///< heater pin, masked. eg for PB3 enter '1 << 3' here, or 1 << PB3_PIN or similar
uint16_t max_value; ///< max value for the heater, for PWM in percent * 256 uint16_t max_value; ///< max value for the heater, for PWM in percent * 256
pwm_type_t pwm_type; ///< saves the pwm-type: NO_PWM, SOFTWARE_PWM, HARDWARE_PWM pwm_type_t pwm_type; ///< saves the pwm-type: NO_PWM, SOFTWARE_PWM, HARDWARE_PWM
uint8_t invert; ///< Wether the heater pin signal needs to be inverted. uint8_t invert; ///< Wether the heater pin signal needs to be inverted.
@ -32,7 +32,7 @@ typedef struct {
// When pwm == 1 it's software pwm. // When pwm == 1 it's software pwm.
// pwm == 0 is no pwm at all. // pwm == 0 is no pwm at all.
// Use this macro only in DEFINE_HEATER_ACTUAL-macros. // Use this macro only in DEFINE_HEATER_ACTUAL-macros.
#define PWM_TYPE(pwm, pin) (((pwm) >= HARDWARE_PWM) ? ((pin ## _PWM) ? HARDWARE_PWM : SOFTWARE_PWM) : (pwm)) #define PWM_TYPE(pwm, pin) (((pwm) >= HARDWARE_PWM_START) ? ((pin ## _PWM) ? HARDWARE_PWM : SOFTWARE_PWM) : pwm)
#undef DEFINE_HEATER_ACTUAL #undef DEFINE_HEATER_ACTUAL
/// \brief helper macro to fill heater definition struct from config.h /// \brief helper macro to fill heater definition struct from config.h
@ -163,7 +163,7 @@ void heater_init() {
void do_heater(heater_t index, uint8_t value) { void do_heater(heater_t index, uint8_t value) {
if (index < NUM_HEATERS) { if (index < NUM_HEATERS) {
if (heaters[index].pwm_type >= HARDWARE_PWM) { if (heaters[index].pwm_type == HARDWARE_PWM) {
uint8_t pwm_value; uint8_t pwm_value;
// Remember, we scale, and the timer inverts already. // Remember, we scale, and the timer inverts already.

View File

@ -77,7 +77,7 @@ typedef struct {
// When pwm == 1 it's software pwm. // When pwm == 1 it's software pwm.
// pwm == 0 is no pwm at all. // pwm == 0 is no pwm at all.
// Use this macro only in DEFINE_HEATER_ACTUAL-macros. // Use this macro only in DEFINE_HEATER_ACTUAL-macros.
#define PWM_TYPE(pwm, pin) (((pwm) >= HARDWARE_PWM) ? ((pin ## _TIMER) ? HARDWARE_PWM : SOFTWARE_PWM) : (pwm)) #define PWM_TYPE(pwm, pin) (((pwm) >= HARDWARE_PWM_START) ? ((pin ## _TIMER) ? HARDWARE_PWM : SOFTWARE_PWM) : (pwm))
#undef DEFINE_HEATER_ACTUAL #undef DEFINE_HEATER_ACTUAL
#define DEFINE_HEATER_ACTUAL(name, pin, invert, pwm, max_value) \ #define DEFINE_HEATER_ACTUAL(name, pin, invert, pwm, max_value) \

View File

@ -76,6 +76,9 @@ typedef enum {
HARDWARE_PWM = 2 HARDWARE_PWM = 2
} pwm_type_t; } pwm_type_t;
// Force hardware PWM if available.
#define HARDWARE_PWM_START SOFTWARE_PWM
void heater_init(void); void heater_init(void);
void pid_init(void); void pid_init(void);

View File

@ -63,7 +63,7 @@
DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER) DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER)
DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO2, THERMISTOR_BED) DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO2, THERMISTOR_BED)
DEFINE_HEATER(extruder, DIO4, 0, 2, 100) DEFINE_HEATER(extruder, DIO4, 0, 1, 100)
DEFINE_HEATER(bed, DIO3, 0, 1, 100) DEFINE_HEATER(bed, DIO3, 0, 1, 100)
#define HEATER_EXTRUDER HEATER_extruder #define HEATER_EXTRUDER HEATER_extruder

View File

@ -523,7 +523,7 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_EXTRUDER)
* signal for this pin, e.g. for a MOSFET with a driver. * * signal for this pin, e.g. for a MOSFET with a driver. *
* * * *
* Set 'pwm' to ... * * Set 'pwm' to ... *
* 1 for using PWM on a PWM-able pin and on/off on other pins. * * 1 for using hardware PWM on a PWM-able pin and software PWM on other pins. *
* 0 for using on/off on a PWM-able pin, too. * * 0 for using on/off on a PWM-able pin, too. *
* Using PWM usually gives smoother temperature control but can conflict * * Using PWM usually gives smoother temperature control but can conflict *
* with slow switches, like solid state relays. PWM frequency can be * * with slow switches, like solid state relays. PWM frequency can be *
@ -551,8 +551,8 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_EXTRUDER)
// #define HEATER_MAX_ACTIVE // #define HEATER_MAX_ACTIVE
// name pin invert pwm // name pin invert pwm
DEFINE_HEATER(extruder, DIO4, 0, 2, 100) DEFINE_HEATER(extruder, DIO4, 0, 1, 100)
DEFINE_HEATER(bed, DIO3, 0, 2, 100) DEFINE_HEATER(bed, DIO3, 0, 1, 100)
/// and now because the c preprocessor isn't as smart as it could be, /// and now because the c preprocessor isn't as smart as it could be,
/// uncomment the ones you've listed above and comment the rest. /// uncomment the ones you've listed above and comment the rest.