heaters: rework max heater value

remove the define USE_MAX_HEATER
this will cost only neglabile space when not enabled on AVR.
This commit is contained in:
Nico Tonnhofer 2017-03-11 18:18:14 +01:00
parent 4b3c6fee7b
commit fb83d2de57
24 changed files with 27 additions and 290 deletions

View File

@ -234,17 +234,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -234,17 +234,6 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO3, THERMISTOR_EXTRUDER)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -228,17 +228,6 @@ DEFINE_TEMP_SENSOR(noheater, TT_INTERCOM, AIO0, 0)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -229,17 +229,6 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO5, THERMISTOR_EXTRUDER)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -242,17 +242,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, PIO1_0,THERMISTOR_BED)
Pins which don't allow PWM are always operated in on/off mode. Pins which don't allow PWM are always operated in on/off mode.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -238,17 +238,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO2, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -239,17 +239,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -238,17 +238,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -236,17 +236,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO7, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -255,17 +255,6 @@
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -235,17 +235,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -240,17 +240,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -238,17 +238,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO11, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -236,17 +236,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -236,17 +236,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -236,17 +236,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -237,17 +237,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -234,17 +234,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -234,17 +234,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -236,17 +236,6 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
// #define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
// name pin invert pwm max_pwm // name pin invert pwm max_pwm

View File

@ -230,17 +230,6 @@
influenced globally with FAST_PWM, see below. influenced globally with FAST_PWM, see below.
*/ */
/** \def MAX_PWM_ACTIVE
Enable max_pwm value.
When you have a heater which has very huge power, you can reduce it.
For example you have a 40W 12V heater and want to use it at 24V. At 24V
the heater has 120W. To reduce it again to 40W set the max_pwm to 25%.
max_pwm values are allowed between 1 and 100.
*/
#define MAX_PWM_ACTIVE
//DEFINE_HEATERS_START //DEFINE_HEATERS_START
//DEFINE_HEATERS_END //DEFINE_HEATERS_END

View File

@ -14,8 +14,6 @@ class HeatersPage(wx.Panel, Page):
self.font = font self.font = font
self.id = idPg self.id = idPg
self.labels = {'MAX_PWM_ACTIVE':"Activate max. PWM [%]"}
sz = wx.GridBagSizer() sz = wx.GridBagSizer()
sz.AddSpacer((30, 30), pos = (0, 0)) sz.AddSpacer((30, 30), pos = (0, 0))
@ -26,13 +24,6 @@ class HeatersPage(wx.Panel, Page):
sz.Add(self.lb, pos = (1, 1)) sz.Add(self.lb, pos = (1, 1))
sz.AddSpacer((20, 20), pos = (1, 2)) sz.AddSpacer((20, 20), pos = (1, 2))
k = 'MAX_PWM_ACTIVE'
cb = self.addCheckBox(k, self.onCheckBox)
cb.SetToolTipString("Enable all max. PWM [%] values.")
sz.Add(cb, pos = (2, 1))
sz.AddSpacer((20, 20), pos = (2, 2))
bsz = wx.BoxSizer(wx.VERTICAL) bsz = wx.BoxSizer(wx.VERTICAL)
self.bAdd = wx.Button(self, wx.ID_ANY, "Add", size = BSIZESMALL) self.bAdd = wx.Button(self, wx.ID_ANY, "Add", size = BSIZESMALL)

View File

@ -21,17 +21,9 @@ typedef struct {
/// Wether the heater pin signal needs to be inverted. /// Wether the heater pin signal needs to be inverted.
uint8_t invert; uint8_t invert;
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)
#ifdef MAX_PWM_ACTIVE uint16_t max_value;
uint16_t max_value;
#endif
} heater_definition_t; } heater_definition_t;
#ifdef MAX_PWM_ACTIVE
#define HEATER_MAX_VALUE(max_value) (max_value * 64 + 12) / 25) /* scale 100% = 256 */
#else
#define HEATER_MAX_VALUE(dummy)
#endif
#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
#define DEFINE_HEATER_ACTUAL(name, pin, invert, pwm, max_value) { \ #define DEFINE_HEATER_ACTUAL(name, pin, invert, pwm, max_value) { \
@ -39,7 +31,7 @@ typedef struct {
pin ## _PIN, \ pin ## _PIN, \
invert ? 1 : 0, \ invert ? 1 : 0, \
pwm ? (pin ## _PWM) : NULL, \ pwm ? (pin ## _PWM) : NULL, \
HEATER_MAX_VALUE(max_value)\ ((max_value * 64 + 12) / 25) \
}, },
static const heater_definition_t heaters[NUM_HEATERS] = static const heater_definition_t heaters[NUM_HEATERS] =
{ {
@ -225,31 +217,31 @@ void heater_init() {
anything done by this function is overwritten by heater_tick above if the heater has an associated temp sensor anything done by this function is overwritten by heater_tick above if the heater has an associated temp sensor
*/ */
void heater_set(heater_t index, uint8_t value) { void heater_set(heater_t index, uint8_t value) {
if (index >= NUM_HEATERS) if (index < NUM_HEATERS) {
return;
#ifdef MAX_PWM_ACTIVE heaters_runtime[index].heater_output = value;
value = (uint8_t)((heaters[index].max_value * value + 128) / 256);
#endif
heaters_runtime[index].heater_output = value;
if (heaters[index].heater_pwm) { if (heaters[index].heater_pwm) {
*(heaters[index].heater_pwm) = heaters[index].invert ?
(255 - value) : value; value = (uint8_t)((heaters[index].max_value * value) / 256);
if (DEBUG_PID && (debug_flags & DEBUG_PID)) *(heaters[index].heater_pwm) = heaters[index].invert ?
sersendf_P(PSTR("PWM{%u = %u}\n"), index, *heaters[index].heater_pwm); (255 - value) : value;
}
else {
if ((value >= HEATER_THRESHOLD && ! heaters[index].invert) ||
(value < HEATER_THRESHOLD && heaters[index].invert))
*(heaters[index].heater_port) |= MASK(heaters[index].heater_pin);
else
*(heaters[index].heater_port) &= ~MASK(heaters[index].heater_pin);
}
if (value) if (DEBUG_PID && (debug_flags & DEBUG_PID))
power_on(); sersendf_P(PSTR("PWM{%u = %u}\n"), index, *heaters[index].heater_pwm);
}
else {
if ((value >= HEATER_THRESHOLD && ! heaters[index].invert) ||
(value < HEATER_THRESHOLD && heaters[index].invert))
*(heaters[index].heater_port) |= MASK(heaters[index].heater_pin);
else
*(heaters[index].heater_port) &= ~MASK(heaters[index].heater_pin);
}
if (value)
power_on();
}
} }
#endif /* defined TEACUP_C_INCLUDE && defined __AVR__ */ #endif /* defined TEACUP_C_INCLUDE && defined __AVR__ */

View File

@ -51,11 +51,7 @@
frequency, so you should bother about PWM_SCALE only of you need frequencies frequency, so you should bother about PWM_SCALE only of you need frequencies
below 3 Hz. below 3 Hz.
*/ */
#ifndef MAX_PWM_ACTIVE #define PWM_SCALE 255
#define PWM_SCALE 255
#else
#define PWM_SCALE 1020
#endif
/** \struct heater_definition_t /** \struct heater_definition_t
@ -70,26 +66,18 @@ typedef struct {
/// Pointer to the port for non-PWM pins. /// Pointer to the port for non-PWM pins.
__IO uint32_t* masked_port; __IO uint32_t* masked_port;
}; };
#ifdef MAX_PWM_ACTIVE
uint16_t max_value; uint16_t max_value;
#endif
uint8_t uses_pwm; uint8_t uses_pwm;
uint8_t invert; uint8_t invert;
} heater_definition_t; } heater_definition_t;
#ifdef MAX_PWM_ACTIVE
#define HEATER_MAX_VALUE(max_value) (max_value * 64 + 12) / 25), /* scale 100% = 256 */
#else
#define HEATER_MAX_VALUE(dummy)
#endif
#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) \
{ \ { \
{ pwm && pin ## _TIMER ? \ { pwm && pin ## _TIMER ? \
&(pin ## _TIMER->MR[pin ## _MATCH]) : \ &(pin ## _TIMER->MR[pin ## _MATCH]) : \
&(pin ## _PORT->MASKED_ACCESS[MASK(pin ## _PIN)]) }, \ &(pin ## _PORT->MASKED_ACCESS[MASK(pin ## _PIN)]) }, \
HEATER_MAX_VALUE(max_value) /*no comma here!*/ \ ((max_value * 64 + 12) / 25), \
pwm && pin ## _TIMER, \ pwm && pin ## _TIMER, \
invert ? 1 : 0 \ invert ? 1 : 0 \
}, },
@ -144,7 +132,7 @@ void heater_init() {
*/ */
// Auto-generate pin setup. // Auto-generate pin setup.
#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, ...) \
if (pwm && pin ## _TIMER) { \ if (pwm && pin ## _TIMER) { \
uint32_t freq; \ uint32_t freq; \
\ \
@ -209,11 +197,8 @@ void heater_set(heater_t index, uint8_t value) {
uint32_t pwm_value; uint32_t pwm_value;
// Remember, we scale, and the timer inverts already. // Remember, we scale, and the timer inverts already.
#ifdef MAX_PWM_ACTIVE
pwm_value = (uint32_t)((heaters[index].max_value * value) * (PWM_SCALE / 255) / 256); pwm_value = (uint32_t)((heaters[index].max_value * value) * (PWM_SCALE / 255) / 256);
#else
pwm_value = (uint32_t)value * (PWM_SCALE / 255);
#endif
if ( ! heaters[index].invert) if ( ! heaters[index].invert)
pwm_value = PWM_SCALE - pwm_value; pwm_value = PWM_SCALE - pwm_value;
*heaters[index].match = pwm_value; *heaters[index].match = pwm_value;