From 15c598fd6aa37ba385c80ca824d6e7fcd83659f3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 1 Aug 2018 19:38:05 +0200 Subject: [PATCH 01/30] Fix compiler warning: sketch/Dcodes.cpp: In function 'void print_eeprom(uint16_t, uint16_t, uint8_t)': sketch/Dcodes.cpp:37:12: warning: unused variable 'data' [-Wunused-variable] --- Firmware/Dcodes.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/Dcodes.cpp b/Firmware/Dcodes.cpp index d1ddc61e..554ec48d 100644 --- a/Firmware/Dcodes.cpp +++ b/Firmware/Dcodes.cpp @@ -34,7 +34,6 @@ void print_eeprom(uint16_t address, uint16_t count, uint8_t countperline = 16) uint8_t count_line = countperline; while (count && count_line) { - uint8_t data = 0; putchar(' '); print_hex_byte(eeprom_read_byte((uint8_t*)address++)); count_line--; From d66da3084394985aa9d5bc54e3a344da85d13660 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 1 Aug 2018 19:40:41 +0200 Subject: [PATCH 02/30] Fix compiler warning: sketch/Dcodes.cpp: In function 'void dcode_3()': sketch/Dcodes.cpp:117:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < count; i++) --- Firmware/Dcodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Dcodes.cpp b/Firmware/Dcodes.cpp index 554ec48d..966e7af4 100644 --- a/Firmware/Dcodes.cpp +++ b/Firmware/Dcodes.cpp @@ -114,7 +114,7 @@ void dcode_3() count = parse_hex(strchr_pointer + 1, data, 16); if (count > 0) { - for (int i = 0; i < count; i++) + for (uint16_t i = 0; i < count; i++) eeprom_write_byte((uint8_t*)(address + i), data[i]); printf_P(_N("%d bytes written to EEPROM at address 0x%04x"), count, address); putchar('\n'); From 904fe7e8861d5051683304a741afd32b5c130bf9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 1 Aug 2018 20:59:42 +0200 Subject: [PATCH 03/30] Fix compiler warning: In file included from sketch/Marlin_main.cpp:67:0: sketch/temperature.h: In function 'void M600_wait_for_user()': sketch/temperature.h:142:30: warning: array subscript is above array bounds [-Warray-bounds] target_temperature[extruder] = celsius; --- Firmware/Marlin_main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 699368ec..49f96c8a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3092,7 +3092,6 @@ void gcode_M600(bool automatic, float x_position, float y_position, float z_shif //First backup current position and settings feedmultiplyBckp=feedmultiply; - float HotendTempBckp = degTargetHotend(active_extruder); int fanSpeedBckp = fanSpeed; lastpos[X_AXIS]=current_position[X_AXIS]; lastpos[Y_AXIS]=current_position[Y_AXIS]; @@ -9066,9 +9065,7 @@ void M600_wait_for_user() { if (millis() > waiting_start_time + (unsigned long)M600_TIMEOUT * 1000) { lcd_display_message_fullscreen_P(_i("Press knob to preheat nozzle and continue."));////MSG_PRESS_TO_PREHEAT c=20 r=4 wait_for_user_state = 1; - setTargetHotend(0, 0); - setTargetHotend(0, 1); - setTargetHotend(0, 2); + setAllTargetHotends(0); st_synchronize(); disable_e0(); disable_e1(); From 25c00393ffa8527a395d470a79b3cd5a30cc37e0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 1 Aug 2018 21:16:08 +0200 Subject: [PATCH 04/30] Fix compiler warning sketch/fsensor.cpp:221:10: warning: unused variable 'fsensor_autoload_c_old' [-Wunused-variable] --- Firmware/fsensor.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index c4657293..c76ee157 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -218,7 +218,9 @@ bool fsensor_check_autoload(void) fsensor_autoload_check_start(); return false; } +#if 0 uint8_t fsensor_autoload_c_old = fsensor_autoload_c; +#endif if ((millis() - fsensor_autoload_last_millis) < 25) return false; fsensor_autoload_last_millis = millis(); if (!pat9125_update_y()) //update sensor @@ -243,9 +245,11 @@ bool fsensor_check_autoload(void) else if (fsensor_autoload_c > 0) fsensor_autoload_c--; if (fsensor_autoload_c == 0) fsensor_autoload_sum = 0; -// puts_P(_N("fsensor_check_autoload\n")); -// if (fsensor_autoload_c != fsensor_autoload_c_old) -// printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum); +#if 0 + puts_P(_N("fsensor_check_autoload\n")); + if (fsensor_autoload_c != fsensor_autoload_c_old) + printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum); +#endif // if ((fsensor_autoload_c >= 15) && (fsensor_autoload_sum > 30)) if ((fsensor_autoload_c >= 12) && (fsensor_autoload_sum > 20)) { From 1b299618c13249295f454f4f896ddc34fce6da9f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 1 Aug 2018 21:49:23 +0200 Subject: [PATCH 05/30] Fix compiler warnings: sketch/fsensor.cpp: In function 'void __vector_11()': sketch/fsensor.cpp:370:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (pat9125_y > 0) if (fsensor_oq_yd_min > pat9125_y) fsensor_oq_yd_min = (fsensor_oq_yd_min + pat9125_y) / 2; ^ sketch/fsensor.cpp:371:51: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (pat9125_y >= 0) if (fsensor_oq_yd_max < pat9125_y) fsensor_oq_yd_max = (fsensor_oq_yd_max + pat9125_y) / 2; --- Firmware/fsensor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index c76ee157..34fab48f 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -101,9 +101,9 @@ uint16_t fsensor_oq_er_sum; //max error counter value durring meassurement uint8_t fsensor_oq_er_max; //minimum delta value -uint16_t fsensor_oq_yd_min; +int16_t fsensor_oq_yd_min; //maximum delta value -uint16_t fsensor_oq_yd_max; +int16_t fsensor_oq_yd_max; //sum of shutter value uint16_t fsensor_oq_sh_sum; From 79057f070b80ef1d2867166212d0777fc85601f0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 1 Aug 2018 21:56:39 +0200 Subject: [PATCH 06/30] Fix compiler warning sketch/lcd.cpp:509:1: warning: label 'end' defined but not used [-Wunused-label]. --- Firmware/lcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index c14c55f1..806ef246 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -506,7 +506,6 @@ uint8_t lcd_escape_write(uint8_t chr) break; } escape_cnt = 0; // reset escape -end: return 1; // assume sucess } From 660a4c0d7567c47eca15ea69175be12134456e9b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 14:28:39 +0200 Subject: [PATCH 07/30] Fix compiler warnings: sketch/Marlin_main.cpp: In function 'void process_commands()': sketch/Marlin_main.cpp:6311:3: warning: 'filament' may be used uninitialized in this function [-Wmaybe-uninitialized] switch (filament) { sketch/Marlin_main.cpp:6310:44: warning: 'extruder' may be used uninitialized in this function [-Wmaybe-uninitialized] printf_P(PSTR("Extruder: %d; "), extruder); --- Firmware/Marlin_main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 49f96c8a..855c0823 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -144,6 +144,7 @@ #define FILAMENT_DEFAULT 0 #define FILAMENT_FLEX 1 #define FILAMENT_PVA 2 +#define FILAMENT_UNDEFINED 255 // look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html // http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes @@ -6301,8 +6302,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) //add storing this information for different load/unload profiles etc. in the future //firmware does not wait for "ok" from mmu - uint8_t extruder; - uint8_t filament; + uint8_t extruder = 255; + uint8_t filament = FILAMENT_UNDEFINED; if(code_seen('E')) extruder = code_value(); if(code_seen('F')) filament = code_value(); From 5ac98afeec57191da18004e4a7c466502460ce4a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 14:55:38 +0200 Subject: [PATCH 08/30] Fix compiler warning sketch/optiboot_w25x20cl.cpp: In function 'void optiboot_w25x20cl_enter()': sketch/optiboot_w25x20cl.cpp:275:15: warning: variable 'desttype' set but not used [-Wunused-but-set-variable] --- Firmware/optiboot_w25x20cl.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Firmware/optiboot_w25x20cl.cpp b/Firmware/optiboot_w25x20cl.cpp index cc6c66cd..d05ae59f 100644 --- a/Firmware/optiboot_w25x20cl.cpp +++ b/Firmware/optiboot_w25x20cl.cpp @@ -272,7 +272,6 @@ void optiboot_w25x20cl_enter() /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { uint32_t addr = (((uint32_t)rampz) << 16) | address; - uint8_t desttype; register pagelen_t i; // Read the page length, with the length transferred each nibble separately to work around // the Prusa's USB to serial infamous semicolon issue. @@ -280,8 +279,8 @@ void optiboot_w25x20cl_enter() length |= ((pagelen_t)getch()) << 8; length |= getch(); length |= getch(); - // Read the destination type. It should always be 'F' as flash. - desttype = getch(); + // Read the destination type. It should always be 'F' as flash. It is not checked. + (void)getch(); verifySpace(); w25x20cl_wait_busy(); w25x20cl_rd_data(addr, buff, length); From aee31bdb8d56180ec9b69b83cbe4b8d9d1bf4eb7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 15:45:33 +0200 Subject: [PATCH 09/30] Fix compiler warnings sketch/stepper.cpp: In function 'void babystep(uint8_t, bool)': sketch/stepper.cpp:1429:20: warning: unused variable 'x' [-Wunused-variable] volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit sketch/stepper.cpp:1455:20: warning: unused variable 'x' [-Wunused-variable] volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit sketch/stepper.cpp:1485:20: warning: unused variable 'x' [-Wunused-variable] volatile float x=1./float(axis+1); //absolutely useless sketch/stepper.cpp: In function 'void microstep_init()': sketch/stepper.cpp:1571:17: warning: unused variable 'microstep_modes' [-Wunused-variable] const uint8_t microstep_modes[] = MICROSTEP_MODES; --- Firmware/stepper.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index b2d71e2a..8f74ae6f 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1425,9 +1425,7 @@ void babystep(const uint8_t axis,const bool direction) #ifdef DEBUG_XSTEP_DUP_PIN WRITE(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN); #endif //DEBUG_XSTEP_DUP_PIN - { - volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit - } + delayMicroseconds(1); WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); #ifdef DEBUG_XSTEP_DUP_PIN WRITE(DEBUG_XSTEP_DUP_PIN,INVERT_X_STEP_PIN); @@ -1451,9 +1449,7 @@ void babystep(const uint8_t axis,const bool direction) #ifdef DEBUG_YSTEP_DUP_PIN WRITE(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN); #endif //DEBUG_YSTEP_DUP_PIN - { - volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit - } + delayMicroseconds(1); WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); #ifdef DEBUG_YSTEP_DUP_PIN WRITE(DEBUG_YSTEP_DUP_PIN,INVERT_Y_STEP_PIN); @@ -1480,10 +1476,7 @@ void babystep(const uint8_t axis,const bool direction) #ifdef Z_DUAL_STEPPER_DRIVERS WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN); #endif - //wait a tiny bit - { - volatile float x=1./float(axis+1); //absolutely useless - } + delayMicroseconds(1); WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); #ifdef Z_DUAL_STEPPER_DRIVERS WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN); @@ -1568,7 +1561,6 @@ void st_current_set(uint8_t driver, int current) void microstep_init() { - const uint8_t microstep_modes[] = MICROSTEP_MODES; #if defined(E1_MS1_PIN) && E1_MS1_PIN > -1 pinMode(E1_MS1_PIN,OUTPUT); @@ -1576,6 +1568,7 @@ void microstep_init() #endif #if defined(X_MS1_PIN) && X_MS1_PIN > -1 + const uint8_t microstep_modes[] = MICROSTEP_MODES; pinMode(X_MS1_PIN,OUTPUT); pinMode(X_MS2_PIN,OUTPUT); pinMode(Y_MS1_PIN,OUTPUT); From ea3d407aa7a950a4cbca3af9df88e89c4485c5ec Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 15:52:28 +0200 Subject: [PATCH 10/30] Fix compiler warning: remove unused function float analog2tempPINDA(int raw). --- Firmware/temperature.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 6a21b825..34539483 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -183,7 +183,6 @@ static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP; static float analog2temp(int raw, uint8_t e); static float analog2tempBed(int raw); static float analog2tempAmbient(int raw); -static float analog2tempPINDA(int raw); static void updateTemperaturesFromRawValues(); enum TempRunawayStates @@ -936,35 +935,6 @@ static float analog2tempBed(int raw) { #endif } -#ifdef PINDA_THERMISTOR - -static float analog2tempPINDA(int raw) { - - float celsius = 0; - byte i; - - for (i = 1; i raw) - { - celsius = PGM_RD_W(BEDTEMPTABLE[i - 1][1]) + - (raw - PGM_RD_W(BEDTEMPTABLE[i - 1][0])) * - (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i - 1][1])) / - (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i - 1][0])); - break; - } - } - - // Overflow: Set to last value in the table - if (i == BEDTEMPTABLE_LEN) celsius = PGM_RD_W(BEDTEMPTABLE[i - 1][1]); - - return celsius; -} - - -#endif //PINDA_THERMISTOR - - #ifdef AMBIENT_THERMISTOR static float analog2tempAmbient(int raw) { From 9f68681a1bb94a9766a90dd30e3fcb3057a68357 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 16:21:38 +0200 Subject: [PATCH 11/30] Fix compiler warnings: sketch/tmc2130.cpp: In function 'void tmc2130_goto_step(uint8_t, uint8_t, uint8_t, uint16_t, uint16_t)': sketch/tmc2130.cpp:795:94: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] sketch/tmc2130.cpp:807:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] sketch/tmc2130.cpp: In function 'void tmc2130_get_wave(uint8_t, uint8_t*, __file*)': sketch/tmc2130.cpp:839:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] --- Firmware/tmc2130.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index d4295701..c8af1a23 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -792,7 +792,7 @@ void tmc2130_do_steps(uint8_t axis, uint16_t steps, uint8_t dir, uint16_t delay_ void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_us, uint16_t microstep_resolution) { printf_P(PSTR("tmc2130_goto_step %d %d %d %d \n"), axis, step, dir, delay_us, microstep_resolution); - uint8_t shift; for (shift = 0; shift < 8; shift++) if (microstep_resolution == (256 >> shift)) break; + uint8_t shift; for (shift = 0; shift < 8; shift++) if (microstep_resolution == (256u >> shift)) break; uint16_t cnt = 4 * (1 << (8 - shift)); uint16_t mscnt = tmc2130_rd_MSCNT(axis); if (dir == 2) @@ -804,7 +804,7 @@ void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_u dir ^= 1; steps = -steps; } - if (steps > (cnt / 2)) + if (steps > static_cast(cnt / 2)) { dir ^= 1; steps = cnt - steps; @@ -829,7 +829,7 @@ void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream) tmc2130_setup_chopper(axis, tmc2130_usteps2mres(256), tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_goto_step(axis, 0, 2, 100, 256); tmc2130_set_dir(axis, tmc2130_get_inv(axis)?0:1); - for (int i = 0; i <= 255; i++) + for (unsigned int i = 0; i <= 255; i++) { uint32_t val = tmc2130_rd_MSCURACT(axis); uint16_t mscnt = tmc2130_rd_MSCNT(axis); From 3248d219f28f18f2a5238ea82a6987c8b0f5f3a3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 16:23:30 +0200 Subject: [PATCH 12/30] Restore motor power, after it is disabled in tmc2130_get_wave(). This bug manifested itself as compiler warning: sketch/tmc2130.cpp:827:10: warning: unused variable 'pwr' [-Wunused-variable] --- Firmware/tmc2130.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index c8af1a23..9548af37 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -846,6 +846,7 @@ void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream) delayMicroseconds(100); } tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); + tmc2130_set_pwr(axis, pwr); } void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000) From bf8808ce22e3056480c5820e3367a5544e31f62e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 16:50:04 +0200 Subject: [PATCH 13/30] Fix compiler warning sketch/tmc2130.cpp: In function 'void tmc2130_set_wave(uint8_t, uint8_t, uint8_t)': sketch/tmc2130.cpp:921:32: warning: 'reg' may be used uninitialized in this function [-Wmaybe-uninitialized] This was completely innocent, as reg was zeroed inside for loop. --- Firmware/tmc2130.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 9548af37..27600e92 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -869,7 +869,7 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000) int8_t b; //encoded bit value int8_t dA; //delta value int i; //microstep index - uint32_t reg; //tmc2130 register + uint32_t reg = 0; //tmc2130 register tmc2130_wr_MSLUTSTART(axis, 0, amp); for (i = 0; i < 256; i++) { From 1898ef9896bb5d8c634f6feb3da51a0f462dc6f0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 17:02:12 +0200 Subject: [PATCH 14/30] Fix compiler warning sketch/ultralcd.cpp:2533:7: warning: unused variable '_cm' [-Wunused-variable] --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4b20c9fb..7122b3b5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2530,7 +2530,6 @@ void lcd_menu_statistics() if (IS_SD_PRINTING) { float _met = ((float)total_filament_used) / (100000.f); - int _cm = (total_filament_used - (_met * 100000)) / 10; int _t = (millis() - starttime) / 1000; int _h = _t / 3600; int _m = (_t - (_h * 3600)) / 60; From d85c36cc77fa9cd4402744c2f55864aee13e1992 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 17:08:46 +0200 Subject: [PATCH 15/30] Fix compiler warning sketch/ultralcd.cpp:3588:9: warning: unused variable 'enc_dif' [-Wunused-variable] --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7122b3b5..d18c07fd 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3584,7 +3584,6 @@ static void menu_show_end_stops() { // Otherwise the Z calibration is not changed and false is returned. void lcd_diag_show_end_stops() { - int enc_dif = lcd_encoder_diff; lcd_clear(); for (;;) { manage_heater(); From 05d455fc3065a4f356ff9640f10360e8326e9e7b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 17:11:23 +0200 Subject: [PATCH 16/30] Fix compiler warning sketch/ultralcd.cpp:6301:7: warning: unused variable 'tempScrool' [-Wunused-variable]. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d18c07fd..767fafd7 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6296,7 +6296,7 @@ void lcd_sdcard_stop() void lcd_sdcard_menu() { uint8_t sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT); - int tempScrool = 0; + if (presort_flag == true) { presort_flag = false; card.presort(); From 02f5a60065a651d1283ad21214d0599b817b3a8c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 17:23:11 +0200 Subject: [PATCH 17/30] Fix compiler warning: sketch/ultralcd.cpp:6540:23: warning: array subscript has type 'char' [-Wchar-subscripts] --- Firmware/ultralcd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 767fafd7..70e3a0db 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -149,7 +149,7 @@ static void lcd_selftest_v(); static bool lcd_selfcheck_endstops(); #ifdef TMC2130 -static void reset_crash_det(char axis); +static void reset_crash_det(unsigned char axis); static bool lcd_selfcheck_axis_sg(char axis); static bool lcd_selfcheck_axis(int _axis, int _travel); #else @@ -6536,7 +6536,7 @@ bool lcd_selftest() #ifdef TMC2130 -static void reset_crash_det(char axis) { +static void reset_crash_det(unsigned char axis) { current_position[axis] += 10; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); st_synchronize(); From 87a650f2cb853093e2772d5c375790feeaf7f725 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 17:25:32 +0200 Subject: [PATCH 18/30] Fix compiler warning: sketch/ultralcd.cpp:6573:23: warning: array subscript has type 'char' [-Wchar-subscripts] --- Firmware/ultralcd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 70e3a0db..526df062 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -150,7 +150,7 @@ static bool lcd_selfcheck_endstops(); #ifdef TMC2130 static void reset_crash_det(unsigned char axis); -static bool lcd_selfcheck_axis_sg(char axis); +static bool lcd_selfcheck_axis_sg(unsigned char axis); static bool lcd_selfcheck_axis(int _axis, int _travel); #else static bool lcd_selfcheck_endstops(); @@ -6543,7 +6543,7 @@ static void reset_crash_det(unsigned char axis) { if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_DET)) tmc2130_sg_stop_on_crash = true; } -static bool lcd_selfcheck_axis_sg(char axis) { +static bool lcd_selfcheck_axis_sg(unsigned char axis) { // each axis length is measured twice float axis_length, current_position_init, current_position_final; float measured_axis_length[2]; From 268c52207b59b434359f78c4af02cb4f0e855d75 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 17:29:14 +0200 Subject: [PATCH 19/30] Fix compiler warning: sketch/ultralcd.cpp:7457:7: warning: unused variable 'pressed' [-Wunused-variable]. --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 526df062..8dfee2f7 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -7454,7 +7454,6 @@ static void lcd_connect_printer() { lcd_update_enable(false); lcd_clear(); - bool pressed = false; int i = 0; int t = 0; lcd_set_custom_characters_progress(); From fd70078606dfd1f97225597ab6d15f547a371109 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 18:18:31 +0200 Subject: [PATCH 20/30] Remove or disable by preprocessor unused functions in ultralcd.cpp. --- Firmware/ultralcd.cpp | 102 +++++++++++------------------------------- 1 file changed, 27 insertions(+), 75 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8dfee2f7..b9afa034 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -118,19 +118,15 @@ static const char* lcd_display_message_fullscreen_nonBlocking_P(const char *msg, static void lcd_status_screen(); static void lcd_language_menu(); -extern bool powersupply; static void lcd_main_menu(); static void lcd_tune_menu(); -static void lcd_prepare_menu(); //static void lcd_move_menu(); static void lcd_settings_menu(); static void lcd_calibration_menu(); static void lcd_control_temperature_menu(); -static void lcd_control_temperature_preheat_pla_settings_menu(); -static void lcd_control_temperature_preheat_abs_settings_menu(); -static void lcd_control_motion_menu(); -static void lcd_control_volumetric_menu(); +#ifdef LINEARITY_CORRECTION static void lcd_settings_menu_back(); +#endif //LINEARITY_CORRECTION static void prusa_stat_printerstatus(int _status); static void prusa_stat_farm_number(); @@ -146,7 +142,6 @@ static void lcd_menu_fails_stats(); #endif //TMC2130 or FILAMENT_SENSOR static void lcd_selftest_v(); -static bool lcd_selfcheck_endstops(); #ifdef TMC2130 static void reset_crash_det(unsigned char axis); @@ -166,7 +161,10 @@ static bool lcd_selftest_fan_dialog(int _fan); static bool lcd_selftest_fsensor(); static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2); static void lcd_colorprint_change(); +#ifdef SNMM static int get_ext_nr(); +#endif //SNMM +#if defined (SNMM) || defined(SNMM_V2) static void extr_adj_0(); static void extr_adj_1(); static void extr_adj_2(); @@ -177,6 +175,7 @@ static void extr_unload_0(); static void extr_unload_1(); static void extr_unload_2(); static void extr_unload_3(); +#endif // SNMM || SNMM_V2 static void lcd_disable_farm_mode(); static void lcd_set_fan_check(); static char snmm_stop_print_menu(); @@ -186,11 +185,12 @@ static char snmm_stop_print_menu(); static float count_e(float layer_heigth, float extrusion_width, float extrusion_length); static void lcd_babystep_z(); static void lcd_send_status(); +#ifdef FARM_CONNECT_MESSAGE static void lcd_connect_printer(); +#endif //FARM_CONNECT_MESSAGE void lcd_finishstatus(); -static void lcd_control_retract_menu(); static void lcd_sdcard_menu(); #ifdef DELTA_CALIBRATION_MENU @@ -2853,12 +2853,6 @@ static void _lcd_babystep(int axis, const char *msg) if (LCD_CLICKED) menu_back(); } -static void lcd_babystep_x() { - _lcd_babystep(X_AXIS, (_i("Babystepping X")));////MSG_BABYSTEPPING_X c=0 r=0 -} -static void lcd_babystep_y() { - _lcd_babystep(Y_AXIS, (_i("Babystepping Y")));////MSG_BABYSTEPPING_Y c=0 r=0 -} static void lcd_babystep_z() { _lcd_babystep(Z_AXIS, (_i("Adjusting Z")));////MSG_BABYSTEPPING_Z c=20 r=0 } @@ -3574,10 +3568,12 @@ static void lcd_show_end_stops() { lcd_puts_P((READ(Z_MIN_PIN) ^ (bool)Z_MIN_ENDSTOP_INVERTING) ? (PSTR("Z1")) : (PSTR("Z0"))); } +#ifndef TMC2130 static void menu_show_end_stops() { lcd_show_end_stops(); if (LCD_CLICKED) menu_back(); } +#endif // not defined TMC2130 // Lets the user move the Z carriage up to the end stoppers. // When done, it sets the current Z to Z_MAX_POS and returns true. @@ -4534,7 +4530,7 @@ void lcd_wizard(int state) { lcd_return_to_status(); lcd_update(2); } -/* +#ifdef LINEARITY_CORRECTION void lcd_settings_linearity_correction_menu(void) { MENU_BEGIN(); @@ -4555,7 +4551,7 @@ void lcd_settings_linearity_correction_menu(void) MENU_ITEM_EDIT_int3_P(_i("E-correct"), &corr[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 MENU_END(); } -*/ +#endif //LINEARITY_CORRECTION static void lcd_settings_menu() { EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); @@ -4625,8 +4621,9 @@ static void lcd_settings_menu() } else MENU_ITEM_SUBMENU_P(_T(MSG_CRASHDETECT_NA), lcd_crash_mode_info); } - -// MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu); +#ifdef LINEARITY_CORRECTION + MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu); +#endif //LINEARITY_CORRECTION #endif //TMC2130 if (temp_cal_active == false) @@ -4696,11 +4693,7 @@ switch(eSoundMode) MENU_END(); } -static void lcd_selftest_() -{ - lcd_selftest(); -} - +#ifdef LINEARITY_CORRECTION #ifdef TMC2130 static void lcd_ustep_linearity_menu_save() { @@ -4727,8 +4720,8 @@ static void lcd_settings_menu_back() if (changed) tmc2130_init(); #endif //TMC2130 menu_menu = lcd_main_menu; -// lcd_main_menu(); } +#endif //LINEARITY_CORRECTION static void lcd_calibration_menu() @@ -5186,6 +5179,7 @@ void change_extr(int extr) { //switches multiplexer for extruders #endif } +#ifdef SNMM static int get_ext_nr() { //reads multiplexer input pins and return current extruder number (counted from 0) #ifdef SNMM_V2 return(snmm_extruder); //update needed @@ -5193,6 +5187,7 @@ static int get_ext_nr() { //reads multiplexer input pins and return current extr return(2 * READ(E_MUX1_PIN) + READ(E_MUX0_PIN)); #endif } +#endif //SNMM void display_loading() { @@ -5835,6 +5830,7 @@ void lcd_confirm_print() #include "w25x20cl.h" +#ifdef LCD_TEST static void lcd_test_menu() { W25X20CL_SPI_ENTER(); @@ -5842,6 +5838,7 @@ static void lcd_test_menu() w25x20cl_chip_erase(); w25x20cl_disable_wr(); } +#endif //LCD_TEST static void lcd_main_menu() { @@ -6013,8 +6010,9 @@ static void lcd_main_menu() #endif MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT c=0 r=0 - -// MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0 +#ifdef LCD_TEST + MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0 +#endif //LCD_TEST MENU_END(); @@ -6051,34 +6049,6 @@ void stepper_timer_overflow() { } #endif /* DEBUG_STEPPER_TIMER_MISSED */ -#ifdef SDSUPPORT -static void lcd_autostart_sd() -{ - card.lastnr = 0; - card.setroot(); - card.checkautostart(true); -} -#endif - - - -static void lcd_silent_mode_set_tune() { - switch (SilentModeMenu) { -#ifdef TMC2130 - case SILENT_MODE_NORMAL: SilentModeMenu = SILENT_MODE_STEALTH; break; - case SILENT_MODE_STEALTH: SilentModeMenu = SILENT_MODE_NORMAL; break; - default: SilentModeMenu = SILENT_MODE_NORMAL; break; // (probably) not needed -#else - case SILENT_MODE_POWER: SilentModeMenu = SILENT_MODE_SILENT; break; - case SILENT_MODE_SILENT: SilentModeMenu = SILENT_MODE_AUTO; break; - case SILENT_MODE_AUTO: SilentModeMenu = SILENT_MODE_POWER; break; - default: SilentModeMenu = SILENT_MODE_POWER; break; // (probably) not needed -#endif //TMC2130 - } - eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); - st_current_init(); - menu_back(); -} static void lcd_colorprint_change() { @@ -6174,12 +6144,6 @@ static void lcd_tune_menu() MENU_END(); } -static void lcd_move_menu_01mm() -{ - move_menu_scale = 0.1; - lcd_move_menu_axis(); -} - static void lcd_control_temperature_menu() { #ifdef PIDTEMP @@ -6830,7 +6794,6 @@ static bool lcd_selfcheck_pulleys(int axis) } return(true); } -#endif //TMC2130 static bool lcd_selfcheck_endstops() @@ -6863,7 +6826,7 @@ static bool lcd_selfcheck_endstops() manage_inactivity(true); return _result; } -//#endif //not defined TMC2130 +#endif //not defined TMC2130 static bool lcd_selfcheck_check_heater(bool _isbed) { @@ -7450,6 +7413,7 @@ static void lcd_send_status() { } } +#ifdef FARM_CONNECT_MESSAGE static void lcd_connect_printer() { lcd_update_enable(false); lcd_clear(); @@ -7482,6 +7446,7 @@ static void lcd_connect_printer() { lcd_update_enable(true); lcd_update(2); } +#endif //FARM_CONNECT_MESSAGE void lcd_ping() { //chceck if printer is connected to monitoring when in farm mode if (farm_mode) { @@ -7545,19 +7510,6 @@ uint8_t get_message_level() } - - - - - - - - - - - - - void menu_lcd_longpress_func(void) { move_menu_scale = 1.0; From 63724c5f0e674bbf58527c5c2f54e388414a1365 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 18:26:49 +0200 Subject: [PATCH 21/30] Comment out variable used only for commented out debug. --- Firmware/xyzcal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/xyzcal.cpp b/Firmware/xyzcal.cpp index 027cfdfb..3984a83d 100644 --- a/Firmware/xyzcal.cpp +++ b/Firmware/xyzcal.cpp @@ -285,7 +285,7 @@ void xyzcal_scan_pixels_32x32(int16_t cx, int16_t cy, int16_t min_z, int16_t max xyzcal_lineXYZ_to(cx, cy, z, 2*delay_us, 0); for (uint8_t r = 0; r < 32; r++) { - int8_t _pinda = _PINDA; +// int8_t _pinda = _PINDA; xyzcal_lineXYZ_to((r&1)?(cx+1024):(cx-1024), cy - 1024 + r*64, z, 2*delay_us, 0); xyzcal_lineXYZ_to(_X, _Y, min_z, delay_us, 1); xyzcal_lineXYZ_to(_X, _Y, max_z, delay_us, -1); @@ -330,7 +330,7 @@ void xyzcal_scan_pixels_32x32(int16_t cx, int16_t cy, int16_t min_z, int16_t max } sm4_do_step(X_AXIS_MASK); delayMicroseconds(600); - _pinda = pinda; +// _pinda = pinda; } sum >>= 6; //div 64 if (z_sum < 0) From d3360c6868b36c87230f3fc8cda4aca29c95de45 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 2 Aug 2018 21:46:50 +0200 Subject: [PATCH 22/30] Fix compiler warning sketch/Marlin_main.cpp:9099:7: warning: unused variable 'response' [-Wunused-variable]. --- Firmware/Marlin_main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a39339e4..24237b64 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9096,7 +9096,6 @@ void M600_wait_for_user() { void mmu_M600_load_filament(bool automatic) { //load filament for mmu v2 - bool response = false; bool yes = false; if (!automatic) { From bd907aec867c576343fc7e3a4ab9fba6be5e5c37 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 14:35:18 +0200 Subject: [PATCH 23/30] Fix 4 compiler warnings of type sketch/sm4.c:88:2: warning: 'register' is not at beginning of declaration [-Wold-style-declaration]. --- Firmware/sm4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/sm4.c b/Firmware/sm4.c index 509ac23f..34cf8a3c 100644 --- a/Firmware/sm4.c +++ b/Firmware/sm4.c @@ -85,8 +85,8 @@ void sm4_set_dir(uint8_t axis, uint8_t dir) uint8_t sm4_get_dir_bits(void) { - uint8_t register dir_bits = 0; - uint8_t register portL = PORTL; + register uint8_t dir_bits = 0; + register uint8_t portL = PORTL; //TODO -optimize in asm #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3)) if (portL & 2) dir_bits |= 1; @@ -106,7 +106,7 @@ uint8_t sm4_get_dir_bits(void) void sm4_set_dir_bits(uint8_t dir_bits) { - uint8_t register portL = PORTL; + register uint8_t portL = PORTL; portL &= 0xb8; //set direction bits to zero //TODO -optimize in asm #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3)) @@ -129,7 +129,7 @@ void sm4_set_dir_bits(uint8_t dir_bits) void sm4_do_step(uint8_t axes_mask) { #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3) || (MOTHERBOARD == BOARD_EINSY_1_0a)) - uint8_t register portC = PORTC & 0xf0; + register uint8_t portC = PORTC & 0xf0; PORTC = portC | (axes_mask & 0x0f); //set step signals by mask asm("nop"); PORTC = portC; //set step signals to zero From f7f4ba25128706ab450d4865e48323568f8fa760 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 14:44:56 +0200 Subject: [PATCH 24/30] Make functions static, save 270B of flash. --- Firmware/ConfigurationStore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 264486b7..85e13e83 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -14,7 +14,7 @@ #else //DEBUG_EEPROM_WRITE #define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value), 0) #endif //DEBUG_EEPROM_WRITE -void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) +static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) { #ifdef DEBUG_EEPROM_WRITE printf_P(PSTR("EEPROM_WRITE_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name); @@ -42,7 +42,7 @@ void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) #else //DEBUG_EEPROM_READ #define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value), 0) #endif //DEBUG_EEPROM_READ -void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size, char* name) +static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size, char* name) { #ifdef DEBUG_EEPROM_READ printf_P(PSTR("EEPROM_READ_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name); From 0632f3b6d8d19cd45807b832ce1d23c66ca769e7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 14:50:51 +0200 Subject: [PATCH 25/30] Fix compiler warnings: sketch/ConfigurationStore.cpp:17:13: warning: unused parameter 'name' [-Wunused-parameter] static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) sketch/ConfigurationStore.cpp:45:13: warning: unused parameter 'name' [-Wunused-parameter] static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size, char* name) --- Firmware/ConfigurationStore.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 85e13e83..388ded1a 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -11,10 +11,11 @@ #ifdef DEBUG_EEPROM_WRITE #define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value), #value) -#else //DEBUG_EEPROM_WRITE -#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value), 0) -#endif //DEBUG_EEPROM_WRITE static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) +#else //DEBUG_EEPROM_WRITE +#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value)) +static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) +#endif //DEBUG_EEPROM_WRITE { #ifdef DEBUG_EEPROM_WRITE printf_P(PSTR("EEPROM_WRITE_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name); @@ -39,10 +40,11 @@ static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name #ifdef DEBUG_EEPROM_READ #define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value), #value) -#else //DEBUG_EEPROM_READ -#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value), 0) -#endif //DEBUG_EEPROM_READ static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size, char* name) +#else //DEBUG_EEPROM_READ +#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value)) +static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) +#endif //DEBUG_EEPROM_READ { #ifdef DEBUG_EEPROM_READ printf_P(PSTR("EEPROM_READ_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name); From 0638e490c10955800f0cecc52c18f2391b4c2ad4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 15:23:24 +0200 Subject: [PATCH 26/30] Fix compiler warnings: sketch/Marlin_main.cpp:923:19: warning: missing initializer for member '__file::unget' [-Wmissing-field-initializers] FILE _uartout = {0}; sketch/Marlin_main.cpp:923:19: warning: missing initializer for member '__file::flags' [-Wmissing-field-initializers] sketch/Marlin_main.cpp:923:19: warning: missing initializer for member '__file::size' [-Wmissing-field-initializers] sketch/Marlin_main.cpp:923:19: warning: missing initializer for member '__file::len' [-Wmissing-field-initializers] sketch/Marlin_main.cpp:923:19: warning: missing initializer for member '__file::put' [-Wmissing-field-initializers] sketch/Marlin_main.cpp:923:19: warning: missing initializer for member '__file::get' [-Wmissing-field-initializers] sketch/Marlin_main.cpp:923:19: warning: missing initializer for member '__file::udata' [-Wmissing-field-initializers] --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 24237b64..c10125f6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -920,7 +920,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } -FILE _uartout = {0}; +FILE _uartout; //= {0}; Global variable is always zero initialized. No need to explicitly state this. int uart_putchar(char c, FILE *stream) { From 373b4a1ea978fda96457ab2ef16de2c2aca1b76b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 15:25:52 +0200 Subject: [PATCH 27/30] Fix compiler warnings sketch/lcd.cpp:59:18: warning: missing initializer for member '__file::unget' [-Wmissing-field-initializers] FILE _lcdout = {0}; sketch/lcd.cpp:59:18: warning: missing initializer for member '__file::flags' [-Wmissing-field-initializers] sketch/lcd.cpp:59:18: warning: missing initializer for member '__file::size' [-Wmissing-field-initializers] sketch/lcd.cpp:59:18: warning: missing initializer for member '__file::len' [-Wmissing-field-initializers] sketch/lcd.cpp:59:18: warning: missing initializer for member '__file::put' [-Wmissing-field-initializers] sketch/lcd.cpp:59:18: warning: missing initializer for member '__file::get' [-Wmissing-field-initializers] sketch/lcd.cpp:59:18: warning: missing initializer for member '__file::udata' [-Wmissing-field-initializers] --- Firmware/lcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index fa6556de..badb170d 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -56,7 +56,7 @@ #define LCD_5x8DOTS 0x00 -FILE _lcdout = {0}; +FILE _lcdout; // = {0}; Global variable is always zero initialized, no need to explicitly state that. uint8_t lcd_rs_pin; // LOW: command. HIGH: character. From a85d5948c3d68854005db562836d34bcbec9b134 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 15:32:28 +0200 Subject: [PATCH 28/30] Make function static, save 38B flash. --- Firmware/lcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index badb170d..24eb28ae 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -157,7 +157,7 @@ uint8_t lcd_write(uint8_t value) return 1; // assume sucess } -void lcd_begin(uint8_t cols, uint8_t lines, uint8_t dotsize, uint8_t clear) +static void lcd_begin(uint8_t cols, uint8_t lines, uint8_t dotsize, uint8_t clear) { if (lines > 1) lcd_displayfunction |= LCD_2LINE; lcd_numlines = lines; From f6094a58f789abf2ebd626501264d8881c45d683 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 15:37:40 +0200 Subject: [PATCH 29/30] Fix compiler warning sketch/lcd.cpp:160:6: warning: unused parameter 'cols' [-Wunused-parameter]. --- Firmware/lcd.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 24eb28ae..6def491e 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -157,7 +157,7 @@ uint8_t lcd_write(uint8_t value) return 1; // assume sucess } -static void lcd_begin(uint8_t cols, uint8_t lines, uint8_t dotsize, uint8_t clear) +static void lcd_begin(uint8_t lines, uint8_t dotsize, uint8_t clear) { if (lines > 1) lcd_displayfunction |= LCD_2LINE; lcd_numlines = lines; @@ -247,20 +247,20 @@ void lcd_init(void) pinMode(lcd_enable_pin, OUTPUT); if (fourbitmode) lcd_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; else lcd_displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; - lcd_begin(LCD_WIDTH, LCD_HEIGHT, LCD_5x8DOTS, 1); + lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); //lcd_clear(); fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream } void lcd_refresh(void) { - lcd_begin(LCD_WIDTH, LCD_HEIGHT, LCD_5x8DOTS, 1); + lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); lcd_set_custom_characters(); } void lcd_refresh_noclear(void) { - lcd_begin(LCD_WIDTH, LCD_HEIGHT, LCD_5x8DOTS, 0); + lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 0); lcd_set_custom_characters(); } From 5846707c5ad04de605ac23217c3564b8253cd882 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 3 Aug 2018 15:49:20 +0200 Subject: [PATCH 30/30] Remove local variable verbosity_level, which was masking function parameter of the same name. Remove duplicate code to derive verbosity level. Problem manifested itself as compiler warning: sketch/Marlin_main.cpp:2881:6: warning: unused parameter 'verbosity_level' [-Wunused-parameter] bool gcode_M45(bool onlyZ, int8_t verbosity_level) --- Firmware/Marlin_main.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c10125f6..5c6fb75b 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2965,15 +2965,6 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) if (st_get_position_mm(Z_AXIS) == MESH_HOME_Z_SEARCH) { - - int8_t verbosity_level = 0; - if (code_seen('V')) - { - // Just 'V' without a number counts as V1. - char c = strchr_pointer[1]; - verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); - } - if (onlyZ) { clean_up_after_endstop_move();