|
@@ -421,13 +421,13 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
|
421
|
421
|
bedKp = workKp; \
|
422
|
422
|
bedKi = scalePID_i(workKi); \
|
423
|
423
|
bedKd = scalePID_d(workKd); \
|
424
|
|
- updatePID(); } while(0)
|
|
424
|
+ updatePID(); }while(0)
|
425
|
425
|
|
426
|
426
|
#define _SET_EXTRUDER_PID() do { \
|
427
|
427
|
PID_PARAM(Kp, hotend) = workKp; \
|
428
|
428
|
PID_PARAM(Ki, hotend) = scalePID_i(workKi); \
|
429
|
429
|
PID_PARAM(Kd, hotend) = scalePID_d(workKd); \
|
430
|
|
- updatePID(); } while(0)
|
|
430
|
+ updatePID(); }while(0)
|
431
|
431
|
|
432
|
432
|
// Use the result? (As with "M303 U1")
|
433
|
433
|
if (set_result) {
|
|
@@ -505,7 +505,7 @@ int Temperature::getHeaterPower(int heater) {
|
505
|
505
|
//
|
506
|
506
|
// Temperature Error Handlers
|
507
|
507
|
//
|
508
|
|
-void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg) {
|
|
508
|
+void Temperature::_temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg) {
|
509
|
509
|
static bool killed = false;
|
510
|
510
|
if (IsRunning()) {
|
511
|
511
|
SERIAL_ERROR_START();
|
|
@@ -524,7 +524,7 @@ void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg
|
524
|
524
|
#endif
|
525
|
525
|
}
|
526
|
526
|
|
527
|
|
-void Temperature::max_temp_error(int8_t e) {
|
|
527
|
+void Temperature::max_temp_error(const int8_t e) {
|
528
|
528
|
#if HAS_TEMP_BED
|
529
|
529
|
_temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
|
530
|
530
|
#else
|
|
@@ -534,7 +534,7 @@ void Temperature::max_temp_error(int8_t e) {
|
534
|
534
|
#endif
|
535
|
535
|
#endif
|
536
|
536
|
}
|
537
|
|
-void Temperature::min_temp_error(int8_t e) {
|
|
537
|
+void Temperature::min_temp_error(const int8_t e) {
|
538
|
538
|
#if HAS_TEMP_BED
|
539
|
539
|
_temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
|
540
|
540
|
#else
|
|
@@ -545,7 +545,7 @@ void Temperature::min_temp_error(int8_t e) {
|
545
|
545
|
#endif
|
546
|
546
|
}
|
547
|
547
|
|
548
|
|
-float Temperature::get_pid_output(int e) {
|
|
548
|
+float Temperature::get_pid_output(const int8_t e) {
|
549
|
549
|
#if HOTENDS == 1
|
550
|
550
|
UNUSED(e);
|
551
|
551
|
#define _HOTEND_TEST true
|
|
@@ -890,7 +890,7 @@ float Temperature::analog2temp(int raw, uint8_t e) {
|
890
|
890
|
|
891
|
891
|
// Derived from RepRap FiveD extruder::getTemperature()
|
892
|
892
|
// For bed temperature measurement.
|
893
|
|
-float Temperature::analog2tempBed(int raw) {
|
|
893
|
+float Temperature::analog2tempBed(const int raw) {
|
894
|
894
|
#if ENABLED(BED_USES_THERMISTOR)
|
895
|
895
|
float celsius = 0;
|
896
|
896
|
byte i;
|
|
@@ -1148,7 +1148,7 @@ void Temperature::init() {
|
1148
|
1148
|
|
1149
|
1149
|
#define TEMP_MIN_ROUTINE(NR) \
|
1150
|
1150
|
minttemp[NR] = HEATER_ ##NR## _MINTEMP; \
|
1151
|
|
- while(analog2temp(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \
|
|
1151
|
+ while (analog2temp(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \
|
1152
|
1152
|
if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
|
1153
|
1153
|
minttemp_raw[NR] += OVERSAMPLENR; \
|
1154
|
1154
|
else \
|
|
@@ -1156,7 +1156,7 @@ void Temperature::init() {
|
1156
|
1156
|
}
|
1157
|
1157
|
#define TEMP_MAX_ROUTINE(NR) \
|
1158
|
1158
|
maxttemp[NR] = HEATER_ ##NR## _MAXTEMP; \
|
1159
|
|
- while(analog2temp(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \
|
|
1159
|
+ while (analog2temp(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \
|
1160
|
1160
|
if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
|
1161
|
1161
|
maxttemp_raw[NR] -= OVERSAMPLENR; \
|
1162
|
1162
|
else \
|
|
@@ -1203,7 +1203,7 @@ void Temperature::init() {
|
1203
|
1203
|
#endif // HOTENDS > 1
|
1204
|
1204
|
|
1205
|
1205
|
#ifdef BED_MINTEMP
|
1206
|
|
- while(analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
|
|
1206
|
+ while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
|
1207
|
1207
|
#if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
|
1208
|
1208
|
bed_minttemp_raw += OVERSAMPLENR;
|
1209
|
1209
|
#else
|
|
@@ -1292,7 +1292,7 @@ void Temperature::init() {
|
1292
|
1292
|
SERIAL_EOL();
|
1293
|
1293
|
*/
|
1294
|
1294
|
|
1295
|
|
- int heater_index = heater_id >= 0 ? heater_id : HOTENDS;
|
|
1295
|
+ const int heater_index = heater_id >= 0 ? heater_id : HOTENDS;
|
1296
|
1296
|
|
1297
|
1297
|
#if HEATER_IDLE_HANDLER
|
1298
|
1298
|
// If the heater idle timeout expires, restart
|
|
@@ -1922,7 +1922,7 @@ void Temperature::isr() {
|
1922
|
1922
|
case SensorsReady: {
|
1923
|
1923
|
// All sensors have been read. Stay in this state for a few
|
1924
|
1924
|
// ISRs to save on calls to temp update/checking code below.
|
1925
|
|
- constexpr int extra_loops = MIN_ADC_ISR_LOOPS - (int)SensorsReady;
|
|
1925
|
+ constexpr int8_t extra_loops = MIN_ADC_ISR_LOOPS - (int8_t)SensorsReady;
|
1926
|
1926
|
static uint8_t delay_count = 0;
|
1927
|
1927
|
if (extra_loops > 0) {
|
1928
|
1928
|
if (delay_count == 0) delay_count = extra_loops; // Init this delay
|