From 23859921b9b52d7afedf1e697833644d9155abc8 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 15:56:20 +0100 Subject: [PATCH 1/9] Fix compiler warnings macro redefined. --- Firmware/pins.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Firmware/pins.h b/Firmware/pins.h index a0b6f462..5d3b4f83 100644 --- a/Firmware/pins.h +++ b/Firmware/pins.h @@ -3,20 +3,6 @@ #include "boards.h" -#if !MB(5DPRINT) -#define X_MS1_PIN -1 -#define X_MS2_PIN -1 -#define Y_MS1_PIN -1 -#define Y_MS2_PIN -1 -#define Z_MS1_PIN -1 -#define Z_MS2_PIN -1 -#define E0_MS1_PIN -1 -#define E0_MS2_PIN -1 -#define E1_MS1_PIN -1 -#define E1_MS2_PIN -1 -#define DIGIPOTSS_PIN -1 -#endif - #define LARGE_FLASH true /***************************************************************** From 5b9e7c4fe7359c6eeb173e232ef19e040056fd69 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 16:27:47 +0100 Subject: [PATCH 2/9] Fix warning: assignment makes pointer from integer without a cast. --- Firmware/language.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/language.c b/Firmware/language.c index 3c168638..c4b501b9 100644 --- a/Firmware/language.c +++ b/Firmware/language.c @@ -77,7 +77,7 @@ uint8_t lang_select(uint8_t lang) if (lang_check(table)) if (pgm_read_dword(((uint32_t*)(table + 12))) == pgm_read_dword(((uint32_t*)(_PRI_LANG_SIGNATURE)))) //signature valid { - lang_table = table; // set table pointer + lang_table = (lang_table_t*)table; // set table pointer lang_selected = lang; // set language id } } @@ -157,7 +157,7 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off if (lang == LANG_ID_SEC) { uint16_t ui = _SEC_LANG_TABLE; //table pointer - memcpy_P(header, ui, sizeof(lang_table_header_t)); //read table header from progmem + memcpy_P(header, (lang_table_header_t*)ui, sizeof(lang_table_header_t)); //read table header from progmem if (offset) *offset = ui; return (header->magic == LANG_MAGIC)?1:0; //return 1 if magic valid } From 790ae9f0cec7cfed2e730f9a66afe45c3810d03e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 16:41:41 +0100 Subject: [PATCH 3/9] Fix compiler warning: unused parameter 'pstep'. --- Firmware/Marlin.h | 7 ++++++- Firmware/Marlin_main.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2d469a76..df64338d 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -297,9 +297,14 @@ extern float min_pos[3]; extern float max_pos[3]; extern bool axis_known_position[3]; extern int fanSpeed; -extern void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0); extern int8_t lcd_change_fil_state; +#ifdef TMC2130 +void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0); +#else +void homeaxis(int axis, uint8_t cnt = 1); +#endif //TMC2130 + #ifdef FAN_SOFT_PWM extern unsigned char fanSpeedSoftPwm; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d14226f3..671afe21 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2126,7 +2126,11 @@ bool calibrate_z_auto() } #endif //TMC2130 +#ifdef TMC2130 void homeaxis(int axis, uint8_t cnt, uint8_t* pstep) +#else +void homeaxis(int axis, uint8_t cnt) +#endif //TMC2130 { bool endstops_enabled = enable_endstops(true); //RP: endstops should be allways enabled durring homing #define HOMEAXIS_DO(LETTER) \ From ebfd4b2f4712b4e1be6e094fe86fe294f559fc36 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 17:02:57 +0100 Subject: [PATCH 4/9] Fix compiler warning: unused parameter 'calib' --- Firmware/Marlin.h | 2 -- Firmware/Marlin_main.cpp | 24 +++++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index df64338d..9706cfbb 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -483,8 +483,6 @@ void force_high_power_mode(bool start_high_power_section); #endif //TMC2130 // G-codes -void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl); -void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); bool gcode_M45(bool onlyZ, int8_t verbosity_level); void gcode_M114(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 671afe21..73e5aa61 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2439,11 +2439,12 @@ void force_high_power_mode(bool start_high_power_section) { } #endif //TMC2130 -void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis) { - gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, false, true); -} - -void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl) { +#ifdef TMC2130 +static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl) +#else +static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool without_mbl) +#endif //TMC2130 +{ st_synchronize(); #if 0 @@ -2728,6 +2729,15 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_ #endif } +static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis) +{ +#ifdef TMC2130 + gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, false, true); +#else + gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, true); +#endif //TMC2130 +} + void adjust_bed_reset() { eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1); @@ -3834,8 +3844,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) home_z_value = code_value_long(); bool without_mbl = code_seen('W'); // calibrate? +#ifdef TMC2130 bool calib = code_seen('C'); gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, calib, without_mbl); +#else + gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, without_mbl); +#endif //TMC2130 if ((home_x || home_y || without_mbl || home_z) == false) { // Push the commands to the front of the message queue in the reverse order! // There shall be always enough space reserved for these commands. From 7bcd54f8badf1faad5cb7bf91afbd72dc8324912 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 17:30:27 +0100 Subject: [PATCH 5/9] Add missing function prototype. --- Firmware/Marlin_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 73e5aa61..52e1e356 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -407,6 +407,7 @@ static void get_arc_coordinates(); static bool setTargetedHotend(int code, uint8_t &extruder); static void print_time_remaining_init(); static void wait_for_heater(long codenum, uint8_t extruder); +static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); uint16_t gcode_in_progress = 0; uint16_t mcode_in_progress = 0; From 28f1e309a240e0433a6ebb002b2ccbe1f6150cf4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 17:44:47 +0100 Subject: [PATCH 6/9] Fix compiler warning: 'old_x_max_endstop' defined but not used Fix compiler warning: 'old_y_max_endstop' defined but not used --- Firmware/stepper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index bb5d22f7..c21a4e9f 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -92,10 +92,15 @@ bool abort_on_endstop_hit = false; int motor_current_setting_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; #endif -static bool old_x_min_endstop=false; +#if ( (defined(X_MAX_PIN) && (X_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_XMAXLIMIT) static bool old_x_max_endstop=false; -static bool old_y_min_endstop=false; +#endif +#if ( (defined(Y_MAX_PIN) && (Y_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_YMAXLIMIT) static bool old_y_max_endstop=false; +#endif + +static bool old_x_min_endstop=false; +static bool old_y_min_endstop=false; static bool old_z_min_endstop=false; static bool old_z_max_endstop=false; From 484259cbb2447f4fd82e07f62984c0e5ff23c520 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 18:00:16 +0100 Subject: [PATCH 7/9] Fix compiler warning: 'lcd_settings_linearity_correction_menu_save' defined but not used --- Firmware/ultralcd.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ccf037f5..5c7e9693 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5404,10 +5404,9 @@ static void lcd_ustep_linearity_menu_save() } #endif //TMC2130 - +#ifdef TMC2130 static void lcd_settings_linearity_correction_menu_save() { -#ifdef TMC2130 bool changed = false; if (tmc2130_wave_fac[X_AXIS] < TMC2130_WAVE_FAC1000_MIN) tmc2130_wave_fac[X_AXIS] = 0; if (tmc2130_wave_fac[Y_AXIS] < TMC2130_WAVE_FAC1000_MIN) tmc2130_wave_fac[Y_AXIS] = 0; @@ -5419,9 +5418,8 @@ static void lcd_settings_linearity_correction_menu_save() changed |= (eeprom_read_byte((uint8_t*)EEPROM_TMC2130_WAVE_E_FAC) != tmc2130_wave_fac[E_AXIS]); lcd_ustep_linearity_menu_save(); if (changed) tmc2130_init(); -#endif //TMC2130 } - +#endif //TMC2130 static void lcd_calibration_menu() { From 7fcecabd5fdfea446fea7f880586d2b717642382 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 18:04:58 +0100 Subject: [PATCH 8/9] Fix compiler warning: variable 'previous_millis_cmd' set but not used --- Firmware/ultralcd.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5c7e9693..7c122c0f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3518,7 +3518,6 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z) // Until confirmed by the confirmation dialog. for (;;) { - unsigned long previous_millis_cmd = _millis(); const char *msg = only_z ? _i("Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done.") : _i("Calibrating XYZ. Rotate the knob to move the Z carriage up to the end stoppers. Click when done.");////MSG_MOVE_CARRIAGE_TO_THE_TOP c=20 r=8////MSG_MOVE_CARRIAGE_TO_THE_TOP_Z c=20 r=8 const char *msg_next = lcd_display_message_fullscreen_P(msg); const bool multi_screen = msg_next != NULL; @@ -3527,13 +3526,10 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z) lcd_encoder_diff = 0; lcd_encoder = 0; for (;;) { -// if (_millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS) -// goto canceled; manage_heater(); manage_inactivity(true); if (abs(lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP) { _delay(50); - previous_millis_cmd = _millis(); lcd_encoder += abs(lcd_encoder_diff / ENCODER_PULSES_PER_STEP); lcd_encoder_diff = 0; if (! planner_queue_full()) { From 1eab058ad46ae9e4943a49f326bf259f756b2dab Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 18:08:35 +0100 Subject: [PATCH 9/9] Fix uninitialized variable used. --- Firmware/ultralcd.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7c122c0f..9b25d0b4 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6802,8 +6802,7 @@ bool lcd_selftest() _result = lcd_selftest_manual_fan_check(1, false); if (!_result) { - const char *_err; - lcd_selftest_error(6, _err, _err); //print fan not spinning + lcd_selftest_error(6, 0, 0); //print fan not spinning } #endif //defined(TACH_1)