From 2554d219255c23ae5621efeb9295fe9c9d76cceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Mon, 2 Aug 2021 12:20:10 +0000 Subject: [PATCH 01/11] Use uint8_t when using axis enum Saves 76 bytes of flash memory --- Firmware/Marlin.h | 4 ++-- Firmware/Marlin_main.cpp | 12 ++++++------ Firmware/ultralcd.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index c2c5ca93..e6c5685d 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -294,9 +294,9 @@ extern int8_t lcd_change_fil_state; extern float default_retraction; #ifdef TMC2130 -void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0); +void homeaxis(uint8_t axis, uint8_t cnt = 1, uint8_t* pstep = 0); #else -void homeaxis(int axis, uint8_t cnt = 1); +void homeaxis(uint8_t axis, uint8_t cnt = 1); #endif //TMC2130 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d1bc83a1..32dc7106 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2034,9 +2034,9 @@ DEFINE_PGM_READ_ANY(signed char, byte); #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \ static const PROGMEM type array##_P[3] = \ { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \ -static inline type array(int axis) \ +static inline type array(uint8_t axis) \ { return pgm_read_any(&array##_P[axis]); } \ -type array##_ext(int axis) \ +type array##_ext(uint8_t axis) \ { return pgm_read_any(&array##_P[axis]); } XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); @@ -2046,7 +2046,7 @@ XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH); XYZ_CONSTS_FROM_CONFIG(float, home_retract_mm, HOME_RETRACT_MM); XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); -static void axis_is_at_home(int axis) { +static void axis_is_at_home(uint8_t axis) { current_position[axis] = base_home_pos(axis) + cs.add_homing[axis]; min_pos[axis] = base_min_pos(axis) + cs.add_homing[axis]; max_pos[axis] = base_max_pos(axis) + cs.add_homing[axis]; @@ -2362,9 +2362,9 @@ static void check_Z_crash(void) #endif //TMC2130 #ifdef TMC2130 -void homeaxis(int axis, uint8_t cnt, uint8_t* pstep) +void homeaxis(uint8_t axis, uint8_t cnt, uint8_t* pstep) #else -void homeaxis(int axis, uint8_t cnt) +void homeaxis(uint8_t axis, uint8_t cnt) #endif //TMC2130 { bool endstops_enabled = enable_endstops(true); //RP: endstops should be allways enabled durring homing @@ -2835,7 +2835,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon { current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0; - int x_axis_home_dir = home_dir(X_AXIS); + uint8_t x_axis_home_dir = home_dir(X_AXIS); plan_set_position_curposXYZE(); destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 81fef967..d7b2a02c 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -161,8 +161,8 @@ static void lcd_belttest_v(); static void lcd_selftest_v(); #ifdef TMC2130 -static void reset_crash_det(unsigned char axis); -static bool lcd_selfcheck_axis_sg(unsigned char axis); +static void reset_crash_det(uint8_t axis); +static bool lcd_selfcheck_axis_sg(uint8_t axis); #else static bool lcd_selfcheck_axis(int _axis, int _travel); static bool lcd_selfcheck_pulleys(int axis); @@ -7706,14 +7706,14 @@ bool lcd_selftest() #ifdef TMC2130 -static void reset_crash_det(unsigned char axis) { +static void reset_crash_det(uint8_t axis) { current_position[axis] += 10; plan_buffer_line_curposXYZE(manual_feedrate[0] / 60); st_synchronize(); if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_DET)) tmc2130_sg_stop_on_crash = true; } -static bool lcd_selfcheck_axis_sg(unsigned char axis) { +static bool lcd_selfcheck_axis_sg(uint8_t axis) { // each axis length is measured twice float axis_length, current_position_init, current_position_final; float measured_axis_length[2]; From a54a133968156d194e294e3a196ee15b9dbc1a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Mon, 2 Aug 2021 19:20:51 +0000 Subject: [PATCH 02/11] Use memset instead of nested for-loop to zero a 2d array Saves 26 bytes of flash memory and removes two 'int' types --- Firmware/mesh_bed_leveling.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Firmware/mesh_bed_leveling.cpp b/Firmware/mesh_bed_leveling.cpp index 344d41e3..aa969340 100644 --- a/Firmware/mesh_bed_leveling.cpp +++ b/Firmware/mesh_bed_leveling.cpp @@ -10,9 +10,7 @@ mesh_bed_leveling::mesh_bed_leveling() { reset(); } void mesh_bed_leveling::reset() { active = 0; - for (int y = 0; y < MESH_NUM_Y_POINTS; y++) - for (int x = 0; x < MESH_NUM_X_POINTS; x++) - z_values[y][x] = 0; + memset(z_values, 0, sizeof(float) * MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS); } static inline bool vec_undef(const float v[2]) From 05ed5b9668eb341116102e79b3a849a81f081c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Tue, 3 Aug 2021 21:35:28 +0000 Subject: [PATCH 03/11] Improve lcd_selftest_screen_step() parameter types Saves 62 bytes of flash memory --- Firmware/ultralcd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d7b2a02c..91010b69 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -207,7 +207,7 @@ enum class TestError : uint_least8_t }; static int lcd_selftest_screen(TestScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); -static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator); +static void lcd_selftest_screen_step(uint8_t _row, uint8_t _col, uint8_t _state, const char *_name, const char *_indicator); static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, bool _default=false); @@ -8547,7 +8547,7 @@ static int lcd_selftest_screen(TestScreen screen, int _progress, int _progress_s return (_progress >= _progress_scale * 2) ? 0 : _progress; } -static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name_PROGMEM, const char *_indicator) +static void lcd_selftest_screen_step(uint8_t _row, uint8_t _col, uint8_t _state, const char *_name_PROGMEM, const char *_indicator) { lcd_set_cursor(_col, _row); uint8_t strlenNameP = strlen_P(_name_PROGMEM); From 1946c58d21cf60cdbeeb2d49a4769e96e7981f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Tue, 3 Aug 2021 21:46:11 +0000 Subject: [PATCH 04/11] 1. Remove redundant variable 'inters' 2. 'gh' variable can be 1 byte instead of 2 This saves 26 bytes of flash memory --- Firmware/ultralcd.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 91010b69..e580eba3 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -610,15 +610,14 @@ void lcdui_print_status_line(void) else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status)) { // If printing from SD, show what we are printing const char* longFilenameOLD = (card.longFilename[0] ? card.longFilename : card.filename); if(strlen(longFilenameOLD) > LCD_WIDTH) { - int inters = 0; - int gh = scrollstuff; - while (((gh - scrollstuff) < LCD_WIDTH) && (inters == 0)) { + uint8_t gh = scrollstuff; + while (((gh - scrollstuff) < LCD_WIDTH)) { if (longFilenameOLD[gh] == '\0') { lcd_set_cursor(gh - scrollstuff, 3); lcd_print(longFilenameOLD[gh - 1]); scrollstuff = 0; gh = scrollstuff; - inters = 1; + break; } else { lcd_set_cursor(gh - scrollstuff, 3); lcd_print(longFilenameOLD[gh - 1]); From 8d7d1698ee1e86812f06518889e68b2912300754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Tue, 3 Aug 2021 21:48:26 +0000 Subject: [PATCH 05/11] Remove unused global variable 'chunkHead' No change in memory on my end, but it is one less 'int' :) --- Firmware/Marlin_main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 32dc7106..06d38a78 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1759,7 +1759,6 @@ void trace(); #define CHUNK_SIZE 64 // bytes #define SAFETY_MARGIN 1 char chunk[CHUNK_SIZE+SAFETY_MARGIN]; -int chunkHead = 0; void serial_read_stream() { From b716c208d783c106353443b066408ebfcb258d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Tue, 3 Aug 2021 22:42:01 +0000 Subject: [PATCH 06/11] Various optimisation to change int to uint8_t This commit saves 174 bytes of flash memory --- Firmware/Marlin_main.cpp | 12 ++++++------ Firmware/lcd.cpp | 2 +- Firmware/mesh_bed_calibration.cpp | 2 +- Firmware/planner.cpp | 2 +- Firmware/tmc2130.cpp | 2 +- Firmware/ultralcd.cpp | 6 +++--- Firmware/ultralcd.h | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 06d38a78..493ad68f 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5293,7 +5293,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) */ case 75: { - for (int i = 40; i <= 110; i++) + for (uint8_t i = 40; i <= 110; i++) printf_P(_N("%d %.2f"), i, temp_comp_interpolation(i)); } break; @@ -7791,8 +7791,8 @@ Sigma_Exit: */ case 300: // M300 { - int beepS = code_seen('S') ? code_value() : 110; - int beepP = code_seen('P') ? code_value() : 1000; + uint16_t beepS = code_seen('S') ? code_value() : 110; + uint16_t beepP = code_seen('P') ? code_value() : 1000; if (beepS > 0) { #if BEEPER > 0 @@ -11487,8 +11487,8 @@ void restore_print_from_eeprom(bool mbl_was_active) { depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_DEPTH); MYSERIAL.println(int(depth)); - for (int i = 0; i < depth; i++) { - for (int j = 0; j < 8; j++) { + for (uint8_t i = 0; i < depth; i++) { + for (uint8_t j = 0; j < 8; j++) { dir_name[j] = eeprom_read_byte((uint8_t*)EEPROM_DIRS + j + 8 * i); } dir_name[8] = '\0'; @@ -11497,7 +11497,7 @@ void restore_print_from_eeprom(bool mbl_was_active) { card.chdir(dir_name, false); } - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { filename[i] = eeprom_read_byte((uint8_t*)EEPROM_FILENAME + i); } filename[8] = '\0'; diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 37b70f1a..024f973f 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -344,7 +344,7 @@ void lcd_createChar_P(uint8_t location, const uint8_t* charmap) { location &= 0x7; // we only have 8 locations 0-7 lcd_command(LCD_SETCGRAMADDR | (location << 3)); - for (int i=0; i<8; i++) + for (uint8_t i = 0; i < 8; i++) lcd_send(pgm_read_byte(&charmap[i]), HIGH); } diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index ef83e573..f9785105 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -2240,7 +2240,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level /// Retry point scanning if a point with bad data appears. /// Bad data could be cause by "cold" sensor. /// This behavior vanishes after few point scans so retry will help. - for (int retries = 0; retries <= 1; ++retries) { + for (uint8_t retries = 0; retries <= 1; ++retries) { bool retry = false; for (int k = 0; k < 4; ++k) { // Don't let the manage_inactivity() function remove power from the motors. diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index b6d012b2..5c89a545 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -1023,7 +1023,7 @@ Having the real displacement of the head, we can calculate the total movement le // Calculate speed in mm/second for each axis. No divide by zero due to previous checks. float inverse_second = feed_rate * inverse_millimeters; - int moves_queued = moves_planned(); + uint8_t moves_queued = moves_planned(); // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill #ifdef SLOWDOWN diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index dbce5ea0..30712379 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -911,7 +911,7 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000) uint8_t s = 0; //current segment int8_t b; //encoded bit value int8_t dA; //delta value - int i; //microstep index + uint8_t i; //microstep index uint32_t reg = 0; //tmc2130 register tmc2130_wr_MSLUTSTART(axis, 0, amp); for (i = 0; i < 256; i++) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e580eba3..5ed326a0 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -693,7 +693,7 @@ void lcdui_print_status_line(void) } // Fill the rest of line to have nice and clean output - for(int fillspace = 0; fillspace < LCD_WIDTH; fillspace++) + for(uint8_t fillspace = 0; fillspace < LCD_WIDTH; fillspace++) if ((lcd_status_message[fillspace] <= 31 )) lcd_print(' '); } @@ -2737,7 +2737,7 @@ void lcd_menu_statistics() } -static void _lcd_move(const char *name, int axis, int min, int max) +static void _lcd_move(const char *name, uint8_t axis, int min, int max) { if (homing_flag || mesh_bed_leveling_flag) { @@ -3920,7 +3920,7 @@ static void prusa_statistics_case0(uint8_t statnr){ prusa_stat_printinfo(); } -void prusa_statistics(int _message, uint8_t _fil_nr) { +void prusa_statistics(uint8_t _message, uint8_t _fil_nr) { #ifdef DEBUG_DISABLE_PRUSA_STATISTICS return; #endif //DEBUG_DISABLE_PRUSA_STATISTICS diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 68b933d0..06763556 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -41,7 +41,7 @@ void lcd_pause_print(); void lcd_pause_usb_print(); void lcd_resume_print(); void lcd_print_stop(); -void prusa_statistics(int _message, uint8_t _col_nr = 0); +void prusa_statistics(uint8_t _message, uint8_t _col_nr = 0); unsigned char lcd_choose_color(); void lcd_load_filament_color_check(); //void lcd_mylang(); From db1e5a203b60393ae810cd1e4e3a3d10c049def1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Fri, 6 Aug 2021 15:03:35 +0000 Subject: [PATCH 07/11] Change temp_runaway_status from float to uint8_t and its enum Saves 90 bytes of flash, and 12 bytes of SRAM --- Firmware/temperature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 3765589b..7e48575a 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -204,7 +204,7 @@ static float analog2tempAmbient(int raw); #endif static void updateTemperaturesFromRawValues(); -enum TempRunawayStates +enum TempRunawayStates : uint8_t { TempRunaway_INACTIVE = 0, TempRunaway_PREHEAT = 1, @@ -220,7 +220,7 @@ enum TempRunawayStates //=========================================================================== #if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) -static float temp_runaway_status[4]; +static uint8_t temp_runaway_status[4]; static float temp_runaway_target[4]; static float temp_runaway_timer[4]; static int temp_runaway_error_counter[4]; From e6a7abf2c1a3991b3b18815a92df3c54f6de5346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Fri, 6 Aug 2021 15:08:46 +0000 Subject: [PATCH 08/11] Change temp_runaway_timer from float to uint32_t Saves 32 bytes of flash Also change temp_runaway_error_counter from int to uint16_t to be specific --- Firmware/temperature.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 7e48575a..abeaa264 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -222,8 +222,8 @@ enum TempRunawayStates : uint8_t #if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) static uint8_t temp_runaway_status[4]; static float temp_runaway_target[4]; -static float temp_runaway_timer[4]; -static int temp_runaway_error_counter[4]; +static uint32_t temp_runaway_timer[4]; +static uint16_t temp_runaway_error_counter[4]; static void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed); static void temp_runaway_stop(bool isPreheat, bool isBed); @@ -1244,7 +1244,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren { float __delta; float __hysteresis = 0; - int __timeout = 0; + uint16_t __timeout = 0; bool temp_runaway_check_active = false; static float __preheat_start[2] = { 0,0}; //currently just bed and one extruder static int __preheat_counter[2] = { 0,0}; From 7535fa3a4437e70416bd41c164db77014ff1b184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 8 Aug 2021 18:48:20 +0000 Subject: [PATCH 09/11] Remove unused variable Saves 2 bytes of SRAM --- Firmware/cardreader.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/cardreader.h b/Firmware/cardreader.h index f7e3acc9..32a02452 100644 --- a/Firmware/cardreader.h +++ b/Firmware/cardreader.h @@ -136,7 +136,6 @@ private: bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware. int16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. - char* diveDirName; bool diveSubfolder (const char *&fileName); void lsDive(const char *prepend, SdFile parent, const char * const match=NULL, LsAction lsAction = LS_GetFilename, ls_param lsParams = ls_param()); From 261f31182573db4bee4e89f007290a6cbb3db7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 8 Aug 2021 19:45:29 +0000 Subject: [PATCH 10/11] Change two arrays from int to uint8_t __preheat_counter has max value of 16 __preheat_errors has max value of 5 Saves 58 bytes of flash memory and 4 bytes of SRAM --- Firmware/temperature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index abeaa264..4faf1341 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1247,8 +1247,8 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren uint16_t __timeout = 0; bool temp_runaway_check_active = false; static float __preheat_start[2] = { 0,0}; //currently just bed and one extruder - static int __preheat_counter[2] = { 0,0}; - static int __preheat_errors[2] = { 0,0}; + static uint8_t __preheat_counter[2] = { 0,0}; + static uint8_t __preheat_errors[2] = { 0,0}; if (_millis() - temp_runaway_timer[_heater_id] > 2000) From f81db567930b1e2faa4b28567e5a72fd00b0f810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 8 Aug 2021 19:53:37 +0000 Subject: [PATCH 11/11] temp_runaway_check() parameter _heater_id should be uint8_t Saves 58 bytes of flash --- Firmware/temperature.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 4faf1341..67fb496e 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -225,7 +225,7 @@ static float temp_runaway_target[4]; static uint32_t temp_runaway_timer[4]; static uint16_t temp_runaway_error_counter[4]; -static void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed); +static void temp_runaway_check(uint8_t _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed); static void temp_runaway_stop(bool isPreheat, bool isBed); #endif @@ -683,7 +683,7 @@ void manage_heater() temp_runaway_check(0, target_temperature_bed, current_temperature_bed, (int)soft_pwm_bed, true); #endif - for(int e = 0; e < EXTRUDERS; e++) + for(uint8_t e = 0; e < EXTRUDERS; e++) { #ifdef TEMP_RUNAWAY_EXTRUDER_HYSTERESIS @@ -1240,7 +1240,7 @@ void tp_init() } #if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) -void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed) +void temp_runaway_check(uint8_t _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed) { float __delta; float __hysteresis = 0;