diff --git a/Marlin/M100_Free_Mem_Chk.cpp b/Marlin/M100_Free_Mem_Chk.cpp index f7900a0f3..6033c0afe 100644 --- a/Marlin/M100_Free_Mem_Chk.cpp +++ b/Marlin/M100_Free_Mem_Chk.cpp @@ -137,8 +137,10 @@ void gcode_M100() { // other vital statistics that define the memory pool. // if (code_seen('F')) { - int max_addr = (int) __brkval; - int max_cnt = 0; + #if 0 + int max_addr = (int) __brkval; + int max_cnt = 0; + #endif int block_cnt = 0; ptr = (unsigned char*) __brkval; sp = top_of_stack(); @@ -155,10 +157,12 @@ void gcode_M100() { i += j; block_cnt++; } - if (j > max_cnt) { // We don't do anything with this information yet - max_cnt = j; // but we do know where the biggest free memory block is. - max_addr = (int) ptr + i; - } + #if 0 + if (j > max_cnt) { // We don't do anything with this information yet + max_cnt = j; // but we do know where the biggest free memory block is. + max_addr = (int) ptr + i; + } + #endif } } if (block_cnt > 1) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 968555ca4..0d3dc8af9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1638,6 +1638,9 @@ static void setup_for_endstop_move() { } static void stow_z_probe(bool doRaise = true) { + #if !(HAS_SERVO_ENDSTOPS && (Z_RAISE_AFTER_PROBING > 0)) + UNUSED(doRaise); + #endif #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { print_xyz("stow_z_probe > current_position", current_position); @@ -1912,11 +1915,13 @@ static void setup_for_endstop_move() { #endif // AUTO_BED_LEVELING_FEATURE -static void axis_unhomed_error() { - LCD_MESSAGEPGM(MSG_YX_UNHOMED); - SERIAL_ECHO_START; - SERIAL_ECHOLNPGM(MSG_YX_UNHOMED); -} +#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || ENABLED(AUTO_BED_LEVELING_FEATURE) + static void axis_unhomed_error() { + LCD_MESSAGEPGM(MSG_YX_UNHOMED); + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_YX_UNHOMED); + } +#endif #if ENABLED(Z_PROBE_SLED) @@ -2300,6 +2305,8 @@ void unknown_command_error() { SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_INPUT); break; + default: + break; } } next_busy_signal_ms = ms + 10000UL; // "busy: ..." message every 10s @@ -3820,7 +3827,7 @@ inline void gcode_M42() { } double sum = 0.0, mean = 0.0, sigma = 0.0, sample_set[50]; - uint8_t verbose_level = 1, n_samples = 10, n_legs = 0, schizoid_flag = 0; + int8_t verbose_level = 1, n_samples = 10, n_legs = 0, schizoid_flag = 0; if (code_seen('V')) { verbose_level = code_value_short(); @@ -5476,7 +5483,7 @@ inline void gcode_M400() { st_synchronize(); } if (delay_index2 == -1) { //initialize the ring buffer if it has not been done since startup int temp_ratio = widthFil_to_size_ratio(); - for (delay_index1 = 0; delay_index1 < COUNT(measurement_delay); ++delay_index1) + for (delay_index1 = 0; delay_index1 < (int)COUNT(measurement_delay); ++delay_index1) measurement_delay[delay_index1] = temp_ratio - 100; //subtract 100 to scale within a signed byte delay_index1 = delay_index2 = 0; @@ -5525,7 +5532,7 @@ inline void gcode_M410() { quickStop(); } * M421: Set a single Mesh Bed Leveling Z coordinate */ inline void gcode_M421() { - float x, y, z; + float x = 0, y = 0, z = 0; bool err = false, hasX, hasY, hasZ; if ((hasX = code_seen('X'))) x = code_value(); if ((hasY = code_seen('Y'))) y = code_value(); @@ -5688,7 +5695,10 @@ inline void gcode_M503() { return; } - float lastpos[NUM_AXIS], fr60 = feedrate / 60; + float lastpos[NUM_AXIS]; + #if ENABLED(DELTA) + float fr60 = feedrate / 60; + #endif for (int i = 0; i < NUM_AXIS; i++) lastpos[i] = destination[i] = current_position[i]; @@ -5745,7 +5755,9 @@ inline void gcode_M503() { disable_e3(); delay(100); LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE); - millis_t next_tick = 0; + #if DISABLED(AUTO_FILAMENT_CHANGE) + millis_t next_tick = 0; + #endif KEEPALIVE_STATE(PAUSED_FOR_USER); while (!lcd_clicked()) { #if DISABLED(AUTO_FILAMENT_CHANGE) diff --git a/Marlin/Sd2Card.cpp b/Marlin/Sd2Card.cpp index 53935feb1..62416b068 100644 --- a/Marlin/Sd2Card.cpp +++ b/Marlin/Sd2Card.cpp @@ -365,6 +365,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) { #if DISABLED(SOFTWARE_SPI) return setSckRate(sckRateID); #else // SOFTWARE_SPI + UNUSED(sckRateID); return true; #endif // SOFTWARE_SPI diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index c122a45ce..eabf7b08b 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -348,11 +348,11 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) { char *dirname_start, *dirname_end; if (name[0] == '/') { dirname_start = &name[1]; - while (dirname_start > 0) { + while (dirname_start != NULL) { dirname_end = strchr(dirname_start, '/'); //SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start - name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end - name)); - if (dirname_end > 0 && dirname_end > dirname_start) { + if (dirname_end != NULL && dirname_end > dirname_start) { char subdirname[FILENAME_LENGTH]; strncpy(subdirname, dirname_start, dirname_end - dirname_start); subdirname[dirname_end - dirname_start] = 0; @@ -429,11 +429,11 @@ void CardReader::removeFile(char* name) { char *dirname_start, *dirname_end; if (name[0] == '/') { dirname_start = strchr(name, '/') + 1; - while (dirname_start > 0) { + while (dirname_start != NULL) { dirname_end = strchr(dirname_start, '/'); //SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start - name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end - name)); - if (dirname_end > 0 && dirname_end > dirname_start) { + if (dirname_end != NULL && dirname_end > dirname_start) { char subdirname[FILENAME_LENGTH]; strncpy(subdirname, dirname_start, dirname_end - dirname_start); subdirname[dirname_end - dirname_start] = 0; diff --git a/Marlin/temperature.h b/Marlin/temperature.h index d6674b5a7..edccdfc5d 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -83,7 +83,7 @@ extern float current_temperature_bed; #if ENABLED(PID_PARAMS_PER_EXTRUDER) extern float Kp[EXTRUDERS], Ki[EXTRUDERS], Kd[EXTRUDERS], Kc[EXTRUDERS]; // one param per extruder - #define PID_PARAM(param,e) param[e] // use macro to point to array value + #define PID_PARAM(param, e) param[e] // use macro to point to array value #else extern float Kp, Ki, Kd, Kc; // one param per extruder - saves 20 or 36 bytes of ram (inc array pointer) #define PID_PARAM(param, e) param // use macro to point directly to value diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 28ce54194..10f2e1045 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -726,6 +726,8 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa if (temph > 0) setTargetHotend(temph, endnum); #if TEMP_SENSOR_BED != 0 setTargetBed(tempb); + #else + UNUSED(tempb); #endif #if FAN_COUNT > 0 #if FAN_COUNT > 1 @@ -733,6 +735,8 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa #else fanSpeeds[0] = fan; #endif + #else + UNUSED(fan); #endif lcd_return_to_status(); } @@ -1146,10 +1150,16 @@ static void lcd_control_menu() { // Helpers for editing PID Ki & Kd values // grab the PID value out of the temp variable; scale it; then update the PID driver void copy_and_scalePID_i(int e) { + #if DISABLED(PID_PARAMS_PER_EXTRUDER) + UNUSED(e); + #endif PID_PARAM(Ki, e) = scalePID_i(raw_Ki); updatePID(); } void copy_and_scalePID_d(int e) { + #if DISABLED(PID_PARAMS_PER_EXTRUDER) + UNUSED(e); + #endif PID_PARAM(Kd, e) = scalePID_d(raw_Kd); updatePID(); } @@ -1720,18 +1730,20 @@ static void menu_action_function(menuFunc_t func) { (*func)(); } #if ENABLED(SDSUPPORT) static void menu_action_sdfile(const char* filename, char* longFilename) { + UNUSED(longFilename); card.openAndPrintFile(filename); lcd_return_to_status(); } static void menu_action_sddirectory(const char* filename, char* longFilename) { + UNUSED(longFilename); card.chdir(filename); encoderPosition = 0; } #endif //SDSUPPORT -static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { *ptr = !(*ptr); } +static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr = !(*ptr); } static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) { menu_action_setting_edit_bool(pstr, ptr); (*callback)(); @@ -2031,6 +2043,10 @@ void lcd_ignore_click(bool b) { } void lcd_finishstatus(bool persist=false) { + #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) + UNUSED(persist); + #endif + #if ENABLED(LCD_PROGRESS_BAR) progress_bar_ms = millis(); #if PROGRESS_MSG_EXPIRE > 0 diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 9d10bce99..45b285a7f 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -873,6 +873,7 @@ void lcd_implementation_drawedit(const char* pstr, const char* value) { #if ENABLED(SDSUPPORT) static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) { + UNUSED(pstr); char c; uint8_t n = LCD_WIDTH - concat; lcd.setCursor(0, row);