From f9ded2a7c495b36cf191cd6da8a0d3506af93a4e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 12 Mar 2016 22:38:55 -0800 Subject: [PATCH] Wrap macros to prevent bad expansions --- Marlin/Conditionals.h | 14 ++-- Marlin/Configuration.h | 4 +- Marlin/Marlin_main.cpp | 66 +++++++++---------- Marlin/SdBaseFile.cpp | 2 +- Marlin/cardreader.cpp | 4 +- Marlin/configuration_store.cpp | 2 +- Marlin/dogm_lcd_implementation.h | 34 +++++----- .../Felix/Configuration.h | 6 +- .../Felix/Configuration_DUAL.h | 6 +- .../Hephestos/Configuration.h | 6 +- .../Hephestos_2/Configuration.h | 6 +- .../K8200/Configuration.h | 6 +- .../RepRapWorld/Megatronics/Configuration.h | 6 +- .../RigidBot/Configuration.h | 6 +- .../SCARA/Configuration.h | 6 +- .../TAZ4/Configuration.h | 6 +- .../WITBOX/Configuration.h | 6 +- .../adafruit/ST7565/Configuration.h | 4 +- .../delta/biv2.5/Configuration.h | 4 +- .../delta/generic/Configuration.h | 4 +- .../delta/kossel_mini/Configuration.h | 4 +- .../delta/kossel_pro/Configuration.h | 8 +-- .../delta/kossel_xl/Configuration.h | 8 +-- .../makibox/Configuration.h | 6 +- .../tvrrug/Round2/Configuration.h | 6 +- Marlin/mesh_bed_leveling.h | 4 +- Marlin/planner.cpp | 20 +++--- Marlin/servo.cpp | 2 +- Marlin/temperature.cpp | 26 ++++---- Marlin/ultralcd.cpp | 30 ++++----- .../ultralcd_implementation_hitachi_HD44780.h | 2 +- Marlin/ultralcd_st7920_u8glib_rrd.h | 2 +- 32 files changed, 158 insertions(+), 158 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index f9b4e89b73..a5090e1ffa 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -264,9 +264,9 @@ /** * Axis lengths */ - #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS) - #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS) - #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS) + #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS)) + #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS)) + #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS)) /** * SCARA @@ -285,8 +285,8 @@ #define Z_HOME_POS MANUAL_Z_HOME_POS #else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits #if ENABLED(BED_CENTER_AT_0_0) - #define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5 - #define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5 + #define X_HOME_POS (X_MAX_LENGTH) * (X_HOME_DIR) * 0.5 + #define Y_HOME_POS (Y_MAX_LENGTH) * (Y_HOME_DIR) * 0.5 #else #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS) #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS) @@ -334,8 +334,8 @@ * Advance calculated values */ #if ENABLED(ADVANCE) - #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * M_PI) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA) + #define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI) + #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / (EXTRUSION_AREA)) #endif #if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 39e2bf9ef3..26d81837ad 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -422,9 +422,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1ccbed879b..5ae40cd128 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -285,7 +285,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42 // Inactivity shutdown millis_t previous_cmd_ms = 0; static millis_t max_inactive_time = 0; -static millis_t stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000L; +static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000L; millis_t print_job_start_ms = 0; ///< Print job start time millis_t print_job_stop_ms = 0; ///< Print job stop time static uint8_t target_extruder; @@ -1638,13 +1638,13 @@ static void setup_for_endstop_move() { #if ENABLED(DEBUG_LEVELING_FEATURE) if (marlin_debug_flags & DEBUG_LEVELING) { - SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - X_PROBE_OFFSET_FROM_EXTRUDER); - SERIAL_ECHOPAIR(", ", y - Y_PROBE_OFFSET_FROM_EXTRUDER); + SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - (X_PROBE_OFFSET_FROM_EXTRUDER)); + SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER)); SERIAL_EOL; } #endif - do_blocking_move_to_xy(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER); // this also updates current_position + do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER)); // this also updates current_position #if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY) if (probe_action & ProbeDeploy) { @@ -2281,7 +2281,7 @@ inline void gcode_G28() { sync_plan_position(); // Move all carriages up together until the first endstop is hit. - for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * Z_MAX_LENGTH; + for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * (Z_MAX_LENGTH); feedrate = 1.732 * homing_feedrate[X_AXIS]; line_to_destination(); st_synchronize(); @@ -2330,7 +2330,7 @@ inline void gcode_G28() { feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s) #if ENABLED(DEBUG_LEVELING_FEATURE) if (marlin_debug_flags & DEBUG_LEVELING) { - SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)MIN_Z_HEIGHT_FOR_HOMING); + SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)(MIN_Z_HEIGHT_FOR_HOMING)); SERIAL_EOL; print_xyz("> (home_all_axis || homeZ) > current_position", current_position); print_xyz("> (home_all_axis || homeZ) > destination", destination); @@ -2467,8 +2467,8 @@ inline void gcode_G28() { // // Set the Z probe (or just the nozzle) destination to the safe homing point // - destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER); - destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER); + destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - (X_PROBE_OFFSET_FROM_EXTRUDER)); + destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - (Y_PROBE_OFFSET_FROM_EXTRUDER)); destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height feedrate = XY_TRAVEL_SPEED; @@ -2500,10 +2500,10 @@ inline void gcode_G28() { // Make sure the Z probe is within the physical limits // NOTE: This doesn't necessarily ensure the Z probe is also within the bed! float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS]; - if ( cpx >= X_MIN_POS - X_PROBE_OFFSET_FROM_EXTRUDER - && cpx <= X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER - && cpy >= Y_MIN_POS - Y_PROBE_OFFSET_FROM_EXTRUDER - && cpy <= Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER) { + if ( cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) + && cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) + && cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER) + && cpy <= Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)) { // Home the Z axis HOMEAXIS(Z); @@ -2669,8 +2669,8 @@ inline void gcode_G28() { } else { // For others, save the Z of the previous point, then raise Z again. - ix = (probe_point - 1) % MESH_NUM_X_POINTS; - iy = (probe_point - 1) / MESH_NUM_X_POINTS; + ix = (probe_point - 1) % (MESH_NUM_X_POINTS); + iy = (probe_point - 1) / (MESH_NUM_X_POINTS); if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag mbl.set_z(ix, iy, current_position[Z_AXIS]); current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; @@ -2678,9 +2678,9 @@ inline void gcode_G28() { st_synchronize(); } // Is there another point to sample? Move there. - if (probe_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) { - ix = probe_point % MESH_NUM_X_POINTS; - iy = probe_point / MESH_NUM_X_POINTS; + if (probe_point < (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { + ix = probe_point % (MESH_NUM_X_POINTS); + iy = probe_point / (MESH_NUM_X_POINTS); if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag current_position[X_AXIS] = mbl.get_x(ix); current_position[Y_AXIS] = mbl.get_y(iy); @@ -2832,18 +2832,18 @@ inline void gcode_G28() { back_probe_bed_position = code_seen('B') ? code_value_short() : BACK_PROBE_BED_POSITION; bool left_out_l = left_probe_bed_position < MIN_PROBE_X, - left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE, + left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE), right_out_r = right_probe_bed_position > MAX_PROBE_X, right_out = right_out_r || right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE, front_out_f = front_probe_bed_position < MIN_PROBE_Y, - front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - MIN_PROBE_EDGE, + front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - (MIN_PROBE_EDGE), back_out_b = back_probe_bed_position > MAX_PROBE_Y, back_out = back_out_b || back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE; if (left_out || right_out || front_out || back_out) { if (left_out) { out_of_range_error(PSTR("(L)eft")); - left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - MIN_PROBE_EDGE; + left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - (MIN_PROBE_EDGE); } if (right_out) { out_of_range_error(PSTR("(R)ight")); @@ -2851,7 +2851,7 @@ inline void gcode_G28() { } if (front_out) { out_of_range_error(PSTR("(F)ront")); - front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - MIN_PROBE_EDGE; + front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - (MIN_PROBE_EDGE); } if (back_out) { out_of_range_error(PSTR("(B)ack")); @@ -3597,7 +3597,7 @@ inline void gcode_M42() { bool deploy_probe_for_each_reading = code_seen('E'); if (code_seen('X')) { - X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER; + X_probe_location = code_value() - (X_PROBE_OFFSET_FROM_EXTRUDER); if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) { out_of_range_error(PSTR("X")); return; @@ -3677,7 +3677,7 @@ inline void gcode_M42() { if (n_legs) { millis_t ms = millis(); - double radius = ms % (X_MAX_LENGTH / 4), // limit how far out to go + double radius = ms % ((X_MAX_LENGTH) / 4), // limit how far out to go theta = RADIANS(ms % 360L); float dir = (ms & 0x0001) ? 1 : -1; // clockwise or counter clockwise @@ -3832,7 +3832,7 @@ inline void gcode_M104() { #if HAS_TEMP_BED SERIAL_PROTOCOLPGM(" B@:"); #ifdef BED_WATTS - SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1)) / 127); + SERIAL_PROTOCOL(((BED_WATTS) * getHeaterPower(-1)) / 127); SERIAL_PROTOCOLCHAR('W'); #else SERIAL_PROTOCOL(getHeaterPower(-1)); @@ -3840,7 +3840,7 @@ inline void gcode_M104() { #endif SERIAL_PROTOCOLPGM(" @:"); #ifdef EXTRUDER_WATTS - SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder)) / 127); + SERIAL_PROTOCOL(((EXTRUDER_WATTS) * getHeaterPower(target_extruder)) / 127); SERIAL_PROTOCOLCHAR('W'); #else SERIAL_PROTOCOL(getHeaterPower(target_extruder)); @@ -3851,7 +3851,7 @@ inline void gcode_M104() { SERIAL_PROTOCOL(e); SERIAL_PROTOCOLCHAR(':'); #ifdef EXTRUDER_WATTS - SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(e)) / 127); + SERIAL_PROTOCOL(((EXTRUDER_WATTS) * getHeaterPower(e)) / 127); SERIAL_PROTOCOLCHAR('W'); #else SERIAL_PROTOCOL(getHeaterPower(e)); @@ -3943,7 +3943,7 @@ inline void gcode_M109() { #ifdef TEMP_RESIDENCY_TIME long residency_start_ms = -1; // Loop until the temperature has stabilized - #define TEMP_CONDITIONS (residency_start_ms < 0 || now < residency_start_ms + TEMP_RESIDENCY_TIME * 1000UL) + #define TEMP_CONDITIONS (residency_start_ms < 0 || now < residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL) #else // Loop until the temperature is very close target #define TEMP_CONDITIONS (fabs(degHotend(target_extruder) - degTargetHotend(target_extruder)) < 0.75f) @@ -3961,7 +3961,7 @@ inline void gcode_M109() { #ifdef TEMP_RESIDENCY_TIME SERIAL_PROTOCOLPGM(" W:"); if (residency_start_ms >= 0) { - long rem = ((TEMP_RESIDENCY_TIME * 1000UL) - (now - residency_start_ms)) / 1000UL; + long rem = (((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL; SERIAL_PROTOCOLLN(rem); } else { @@ -5533,7 +5533,7 @@ inline void gcode_M907() { // this one uses actual amps in floating point for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) digipot_i2c_set_current(i, code_value()); // for each additional extruder (named B,C,D,E..., channels 4,5,6,7...) - for (int i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (code_seen('B' + i - NUM_AXIS)) digipot_i2c_set_current(i, code_value()); + for (int i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (code_seen('B' + i - (NUM_AXIS))) digipot_i2c_set_current(i, code_value()); #endif } @@ -6821,7 +6821,7 @@ void plan_arc( ) { lastMotor = ms; //... set time to NOW so the fan will turn on } - uint8_t speed = (lastMotor == 0 || ms >= lastMotor + (CONTROLLERFAN_SECS * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; + uint8_t speed = (lastMotor == 0 || ms >= lastMotor + ((CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; // allows digital or PWM fan output to be used (see M42 handling) digitalWrite(CONTROLLERFAN_PIN, speed); analogWrite(CONTROLLERFAN_PIN, speed); @@ -7054,7 +7054,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { #endif #if ENABLED(EXTRUDER_RUNOUT_PREVENT) - if (ms > previous_cmd_ms + EXTRUDER_RUNOUT_SECONDS * 1000) + if (ms > previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000) if (degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) { bool oldstatus; switch (active_extruder) { @@ -7083,8 +7083,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { } float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS]; plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], - destination[E_AXIS] + EXTRUDER_RUNOUT_EXTRUDE * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], - EXTRUDER_RUNOUT_SPEED / 60. * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], active_extruder); + destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS], + (EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS], active_extruder); current_position[E_AXIS] = oldepos; destination[E_AXIS] = oldedes; plan_set_e_position(oldepos); diff --git a/Marlin/SdBaseFile.cpp b/Marlin/SdBaseFile.cpp index b28aeb7b6d..61deafde9f 100644 --- a/Marlin/SdBaseFile.cpp +++ b/Marlin/SdBaseFile.cpp @@ -1134,7 +1134,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) { // Sanity-check the VFAT entry. The first cluster is always set to zero. And the sequence number should be higher than 0 if (VFAT->firstClusterLow == 0 && (VFAT->sequenceNumber & 0x1F) > 0 && (VFAT->sequenceNumber & 0x1F) <= MAX_VFAT_ENTRIES) { // TODO: Store the filename checksum to verify if a none-long filename aware system modified the file table. - n = ((VFAT->sequenceNumber & 0x1F) - 1) * FILENAME_LENGTH; + n = ((VFAT->sequenceNumber & 0x1F) - 1) * (FILENAME_LENGTH); for (uint8_t i = 0; i < FILENAME_LENGTH; i++) longFilename[n + i] = (i < 5) ? VFAT->name1[i] : (i < 11) ? VFAT->name2[i - 5] : VFAT->name3[i - 11]; // If this VFAT entry is the last one, add a NUL terminator at the end of the string diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index dd4dee3af6..a94a24aa37 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -264,7 +264,7 @@ void CardReader::getAbsFilename(char *t) { workDirParents[i].getFilename(t); //SDBaseFile.getfilename! while (*t && cnt < MAXPATHNAMELENGTH) { t++; cnt++; } //crawl counter forward. } - if (cnt < MAXPATHNAMELENGTH - FILENAME_LENGTH) + if (cnt < MAXPATHNAMELENGTH - (FILENAME_LENGTH)) file.getFilename(t); else t[0] = 0; @@ -500,7 +500,7 @@ void CardReader::checkautostart(bool force) { while (root.readDir(p, NULL) > 0) { for (int8_t i = 0; i < (int8_t)strlen((char*)p.name); i++) p.name[i] = tolower(p.name[i]); if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) { - char cmd[4 + (FILENAME_LENGTH + 1) * MAX_DIR_DEPTH + 2]; + char cmd[4 + (FILENAME_LENGTH + 1) * (MAX_DIR_DEPTH) + 2]; sprintf_P(cmd, PSTR("M23 %s"), autoname); enqueuecommand(cmd); enqueuecommands_P(PSTR("M24")); diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index 9b09f22cd4..61897ed89b 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -163,7 +163,7 @@ void Config_StoreSettings() { uint8_t mesh_num_y = 3; #if ENABLED(MESH_BED_LEVELING) // Compile time test that sizeof(mbl.z_values) is as expected - typedef char c_assert[(sizeof(mbl.z_values) == MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS * sizeof(dummy)) ? 1 : -1]; + typedef char c_assert[(sizeof(mbl.z_values) == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS) * sizeof(dummy)) ? 1 : -1]; mesh_num_x = MESH_NUM_X_POINTS; mesh_num_y = MESH_NUM_Y_POINTS; EEPROM_WRITE_VAR(i, mbl.active); diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 6e25704143..3f2e0d31d1 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -225,14 +225,14 @@ static void lcd_implementation_init() { #endif #if ENABLED(SHOW_BOOTSCREEN) - int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; + int offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2; #if ENABLED(START_BMPHIGH) int offy = 0; #else int offy = DOG_CHAR_HEIGHT; #endif - int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * DOG_CHAR_WIDTH) / 2; + int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2; u8g.firstPage(); do { @@ -240,11 +240,11 @@ static void lcd_implementation_init() { u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); lcd_setFont(FONT_MENU); #ifndef STRING_SPLASH_LINE2 - u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1); + u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1); #else - int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * DOG_CHAR_WIDTH) / 2; - u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT * 3 / 2, STRING_SPLASH_LINE1); - u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT * 1 / 2, STRING_SPLASH_LINE2); + int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2; + u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1); + u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2); #endif } } while (u8g.nextPage()); @@ -288,20 +288,20 @@ static void lcd_implementation_status_screen() { #if ENABLED(SDSUPPORT) // SD Card Symbol - u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7); - u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5); - u8g.drawFrame(42, 49 - TALL_FONT_CORRECTION, 10, 4); - u8g.drawPixel(50, 43 - TALL_FONT_CORRECTION); + u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); + u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); + u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); + u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // Progress bar frame - u8g.drawFrame(54, 49, 73, 4 - TALL_FONT_CORRECTION); + u8g.drawFrame(54, 49, 73, 4 - (TALL_FONT_CORRECTION)); // SD Card Progress bar and clock lcd_setFont(FONT_STATUSMENU); if (IS_SD_PRINTING) { // Progress bar solid part - u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2 - TALL_FONT_CORRECTION); + u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2 - (TALL_FONT_CORRECTION)); } u8g.setPrintPos(80,48); @@ -443,13 +443,13 @@ static void lcd_implementation_status_screen() { static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) { if (isSelected) { u8g.setColorIndex(1); // black on white - u8g.drawBox(0, row * DOG_CHAR_HEIGHT + 3 - TALL_FONT_CORRECTION, LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT); + u8g.drawBox(0, row * (DOG_CHAR_HEIGHT) + 3 - (TALL_FONT_CORRECTION), LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT); u8g.setColorIndex(0); // following text must be white on black } else { u8g.setColorIndex(1); // unmarked text is black on white } - u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)); } static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) { @@ -463,7 +463,7 @@ static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, co pstr++; } while (n--) lcd_print(' '); - u8g.setPrintPos(LCD_PIXEL_WIDTH - DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)); lcd_print(post_char); lcd_print(' '); } @@ -481,7 +481,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c } lcd_print(':'); while (n--) lcd_print(' '); - u8g.setPrintPos(LCD_PIXEL_WIDTH - DOG_CHAR_WIDTH * vallen, (row + 1) * DOG_CHAR_HEIGHT); + u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, (row + 1) * (DOG_CHAR_HEIGHT)); if (pgm) lcd_printPGM(data); else lcd_print((char*)data); } @@ -528,7 +528,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - vallen) rows = 2; - const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2; + const float kHalfChar = (DOG_CHAR_HEIGHT_EDIT) / 2; float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3 u8g.setPrintPos(0, rowHeight + kHalfChar); diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index abf49a40d9..08195ad4b5 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -404,10 +404,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 33e49cad53..1264ce928b 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -401,10 +401,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 15c11b7ba9..0d6d8151b3 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -414,10 +414,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 8dab9096ea..6e3b7754da 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -417,10 +417,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 288beb905e..f841ff6f0a 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -437,10 +437,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 2073ac2554..b2a47ecfd9 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -422,10 +422,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 3190876f2b..bbc2fc5135 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -416,10 +416,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 4407fccd12..ed079bc1af 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -430,10 +430,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index ea6dca4361..c4e9372587 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -442,10 +442,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 1b5d7c80da..32d1429899 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -414,10 +414,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 0f5b043b94..9d97c8074b 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -422,9 +422,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index bbb9e12b5d..1722da9cb9 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -457,9 +457,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 6c419c23cf..98b4b5d92a 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -457,9 +457,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 7397eb5218..fc56da475d 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -457,9 +457,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 5a83c56269..71c835cd36 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -444,10 +444,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. @@ -713,7 +713,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #define XYZ_MICROSTEPS 32 #define XYZ_BELT_PITCH 2 #define XYZ_PULLEY_TEETH 20 -#define XYZ_STEPS (XYZ_FULL_STEPS_PER_ROTATION * XYZ_MICROSTEPS / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) +#define XYZ_STEPS ((XYZ_FULL_STEPS_PER_ROTATION) * (XYZ_MICROSTEPS) / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) // default settings // delta speeds must be the same on xyz diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 22870313e4..e6d1c19a0f 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -450,10 +450,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. @@ -634,7 +634,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #define XYZ_MICROSTEPS 16 #define XYZ_BELT_PITCH 2 #define XYZ_PULLEY_TEETH 16 -#define XYZ_STEPS (XYZ_FULL_STEPS_PER_ROTATION * XYZ_MICROSTEPS / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) +#define XYZ_STEPS ((XYZ_FULL_STEPS_PER_ROTATION) * (XYZ_MICROSTEPS) / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) #define DEFAULT_AXIS_STEPS_PER_UNIT {XYZ_STEPS, XYZ_STEPS, XYZ_STEPS, 158} // default steps per unit for PowerWasp #define DEFAULT_MAX_FEEDRATE {200, 200, 200, 200} // (mm/sec) diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 0bcde5a289..dcd0b94700 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -425,10 +425,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 388358c111..206b049346 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -412,10 +412,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) - #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) +#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. diff --git a/Marlin/mesh_bed_leveling.h b/Marlin/mesh_bed_leveling.h index cb02655ea6..7717995ef1 100644 --- a/Marlin/mesh_bed_leveling.h +++ b/Marlin/mesh_bed_leveling.h @@ -2,8 +2,8 @@ #if ENABLED(MESH_BED_LEVELING) - #define MESH_X_DIST ((MESH_MAX_X - MESH_MIN_X)/(MESH_NUM_X_POINTS - 1)) - #define MESH_Y_DIST ((MESH_MAX_Y - MESH_MIN_Y)/(MESH_NUM_Y_POINTS - 1)) + #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X))/(MESH_NUM_X_POINTS - 1)) + #define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y))/(MESH_NUM_Y_POINTS - 1)) class mesh_bed_leveling { public: diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 9f7f57e53c..fcc830e39d 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -447,7 +447,7 @@ void check_axes_activity() { } #endif //FAN_KICKSTART_TIME #if defined(FAN_MIN_PWM) - #define CALC_FAN_SPEED (tail_fan_speed ? ( FAN_MIN_PWM + (tail_fan_speed * (255 - FAN_MIN_PWM)) / 255 ) : 0) + #define CALC_FAN_SPEED (tail_fan_speed ? ( FAN_MIN_PWM + (tail_fan_speed * (255 - (FAN_MIN_PWM))) / 255 ) : 0) #else #define CALC_FAN_SPEED tail_fan_speed #endif // FAN_MIN_PWM @@ -524,7 +524,7 @@ float junction_deviation = 0.1; SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); } #if ENABLED(PREVENT_LENGTHY_EXTRUDE) - if (labs(de) > axis_steps_per_unit[E_AXIS] * EXTRUDE_MAXLENGTH) { + if (labs(de) > axis_steps_per_unit[E_AXIS] * (EXTRUDE_MAXLENGTH)) { position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part de = 0; // no difference SERIAL_ECHO_START; @@ -634,10 +634,10 @@ float junction_deviation = 0.1; #if ENABLED(DUAL_X_CARRIAGE) if (extruder_duplication_enabled) { enable_e1(); - g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE * 2; + g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; } #endif - g_uc_extruder_last_move[0] = BLOCK_BUFFER_SIZE * 2; + g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2; #if EXTRUDERS > 1 if (g_uc_extruder_last_move[1] == 0) disable_e1(); #if EXTRUDERS > 2 @@ -651,7 +651,7 @@ float junction_deviation = 0.1; #if EXTRUDERS > 1 case 1: enable_e1(); - g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE * 2; + g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; if (g_uc_extruder_last_move[0] == 0) disable_e0(); #if EXTRUDERS > 2 if (g_uc_extruder_last_move[2] == 0) disable_e2(); @@ -663,7 +663,7 @@ float junction_deviation = 0.1; #if EXTRUDERS > 2 case 2: enable_e2(); - g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE * 2; + g_uc_extruder_last_move[2] = (BLOCK_BUFFER_SIZE) * 2; if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[1] == 0) disable_e1(); #if EXTRUDERS > 3 @@ -673,7 +673,7 @@ float junction_deviation = 0.1; #if EXTRUDERS > 3 case 3: enable_e3(); - g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE * 2; + g_uc_extruder_last_move[3] = (BLOCK_BUFFER_SIZE) * 2; if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[1] == 0) disable_e1(); if (g_uc_extruder_last_move[2] == 0) disable_e2(); @@ -749,9 +749,9 @@ float junction_deviation = 0.1; // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill #if ENABLED(OLD_SLOWDOWN) || ENABLED(SLOWDOWN) - bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2; + bool mq = moves_queued > 1 && moves_queued < (BLOCK_BUFFER_SIZE) / 2; #if ENABLED(OLD_SLOWDOWN) - if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE; + if (mq) feed_rate *= 2.0 * moves_queued / (BLOCK_BUFFER_SIZE); #endif #if ENABLED(SLOWDOWN) // segment time im micro seconds @@ -974,7 +974,7 @@ float junction_deviation = 0.1; } else { long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st); - float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) * (cse * cse * EXTRUSION_AREA * EXTRUSION_AREA) * 256; + float advance = ((STEPS_PER_CUBIC_MM_E) * (EXTRUDER_ADVANCE_K)) * (cse * cse * (EXTRUSION_AREA) * (EXTRUSION_AREA)) * 256; block->advance = advance; block->advance_rate = acc_dist ? advance / (float)acc_dist : 0; } diff --git a/Marlin/servo.cpp b/Marlin/servo.cpp index d9752736a3..ecd4bdae8d 100644 --- a/Marlin/servo.cpp +++ b/Marlin/servo.cpp @@ -281,7 +281,7 @@ void Servo::writeMicroseconds(int value) { byte channel = this->servoIndex; if (channel < MAX_SERVOS) { // ensure channel is valid // ensure pulse width is valid - value = constrain(value, SERVO_MIN(), SERVO_MAX()) - TRIM_DURATION; + value = constrain(value, SERVO_MIN(), SERVO_MAX()) - (TRIM_DURATION); value = usToTicks(value); // convert to ticks after compensating for interrupt overhead - 12 Aug 2009 CRITICAL_SECTION_START; diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 9beffc4e7d..5e4ccdb2f0 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -139,8 +139,8 @@ static unsigned char soft_pwm[EXTRUDERS]; #if ENABLED(PIDTEMP) #if ENABLED(PID_PARAMS_PER_EXTRUDER) float Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kp); - float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Ki* PID_dT); - float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kd / PID_dT); + float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS1((DEFAULT_Ki) * (PID_dT)); + float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS1((DEFAULT_Kd) / (PID_dT)); #if ENABLED(PID_ADD_EXTRUSION_RATE) float Kc[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kc); #endif // PID_ADD_EXTRUSION_RATE @@ -230,9 +230,9 @@ void PID_autotune(float temp, int extruder, int ncycles) { disable_all_heaters(); // switch off all heaters. if (extruder < 0) - soft_pwm_bed = bias = d = MAX_BED_POWER / 2; + soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2; else - soft_pwm[extruder] = bias = d = PID_MAX / 2; + soft_pwm[extruder] = bias = d = (PID_MAX) / 2; // PID Tuning loop for (;;) { @@ -355,14 +355,14 @@ void PID_autotune(float temp, int extruder, int ncycles) { void updatePID() { #if ENABLED(PIDTEMP) for (int e = 0; e < EXTRUDERS; e++) { - temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e); + temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki,e); #if ENABLED(PID_ADD_EXTRUSION_RATE) last_position[e] = 0; #endif } #endif #if ENABLED(PIDTEMPBED) - temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi; + temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi; #endif } @@ -481,7 +481,7 @@ float get_pid_output(int e) { pid_output = BANG_MAX; pid_reset[e] = true; } - else if (pid_error[e] < -PID_FUNCTIONAL_RANGE || target_temperature[e] == 0) { + else if (pid_error[e] < -(PID_FUNCTIONAL_RANGE) || target_temperature[e] == 0) { pid_output = 0; pid_reset[e] = true; } @@ -698,7 +698,7 @@ void manage_heater() { if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) { if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) soft_pwm_bed = 0; - else if (current_temperature_bed <= target_temperature_bed - BED_HYSTERESIS) + else if (current_temperature_bed <= target_temperature_bed - (BED_HYSTERESIS)) soft_pwm_bed = MAX_BED_POWER >> 1; } else { @@ -759,7 +759,7 @@ static float analog2temp(int raw, uint8_t e) { return celsius; } - return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; + return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET; } // Derived from RepRap FiveD extruder::getTemperature() @@ -786,7 +786,7 @@ static float analog2tempBed(int raw) { #elif defined(BED_USES_AD595) - return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; + return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET; #else @@ -860,14 +860,14 @@ void tp_init() { maxttemp[e] = maxttemp[0]; #if ENABLED(PIDTEMP) temp_iState_min[e] = 0.0; - temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki, e); + temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e); #if ENABLED(PID_ADD_EXTRUSION_RATE) last_position[e] = 0; #endif #endif //PIDTEMP #if ENABLED(PIDTEMPBED) temp_iState_min_bed = 0.0; - temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi; + temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi; #endif //PIDTEMPBED } @@ -1042,7 +1042,7 @@ void tp_init() { void start_watching_heater(int e) { if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) { watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE; - watch_heater_next_ms[e] = millis() + WATCH_TEMP_PERIOD * 1000UL; + watch_heater_next_ms[e] = millis() + (WATCH_TEMP_PERIOD) * 1000UL; } else watch_heater_next_ms[e] = 0; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 3ffc119ebb..a012c0ec8c 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -28,7 +28,7 @@ int absPreheatFanSpeed; typedef void (*menuFunc_t)(); uint8_t lcd_status_message_level; -char lcd_status_message[3 * LCD_WIDTH + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 +char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 #if ENABLED(DOGLCD) #include "dogm_lcd_implementation.h" @@ -209,8 +209,8 @@ static void lcd_status_screen(); #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #endif //!ENCODER_RATE_MULTIPLIER #define END_MENU() \ - if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\ - if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ + if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * (ENCODER_STEPS_PER_MENU_ITEM) - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\ + if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - (LCD_HEIGHT) + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ } } while(0) /** Used variables to keep track of the menu */ @@ -352,7 +352,7 @@ static void lcd_status_screen() { } if (feedrate_multiplier == 100) { if (int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) { - feedrate_multiplier += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE; + feedrate_multiplier += int(encoderPosition) - (ENCODER_FEEDRATE_DEADZONE); encoderPosition = 0; } else if (int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) { @@ -841,7 +841,7 @@ static void _lcd_move(const char* name, AxisEnum axis, int min, int max) { } } #if ENABLED(DELTA) - static float delta_clip_radius_2 = DELTA_PRINTABLE_RADIUS * DELTA_PRINTABLE_RADIUS; + static float delta_clip_radius_2 = (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS); static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a*a); } static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); } static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); } @@ -1824,14 +1824,14 @@ bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } void lcd_setstatus(const char* message, bool persist) { if (lcd_status_message_level > 0) return; - strncpy(lcd_status_message, message, 3 * LCD_WIDTH); + strncpy(lcd_status_message, message, 3 * (LCD_WIDTH)); set_utf_strlen(lcd_status_message, LCD_WIDTH); lcd_finishstatus(persist); } void lcd_setstatuspgm(const char* message, uint8_t level) { if (level >= lcd_status_message_level) { - strncpy_P(lcd_status_message, message, 3 * LCD_WIDTH); + strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); set_utf_strlen(lcd_status_message, LCD_WIDTH); lcd_status_message_level = level; lcd_finishstatus(level > 0); @@ -1887,7 +1887,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } #if ENABLED(RIGIDBOT_PANEL) if (now > next_button_update_ms) { if (READ(BTN_UP) == 0) { - encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM; + encoderDiff = -1 * (ENCODER_STEPS_PER_MENU_ITEM); next_button_update_ms = now + 300; } else if (READ(BTN_DWN) == 0) { @@ -1895,7 +1895,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } next_button_update_ms = now + 300; } else if (READ(BTN_LFT) == 0) { - encoderDiff = -1 * ENCODER_PULSES_PER_STEP; + encoderDiff = -1 * (ENCODER_PULSES_PER_STEP); next_button_update_ms = now + 300; } else if (READ(BTN_RT) == 0) { @@ -2245,7 +2245,7 @@ char* ftostr52(const float& x) { static void _lcd_level_bed() { if (encoderPosition != 0) { refresh_cmd_timeout(); - current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP; + current_position[Z_AXIS] += float((int)encoderPosition) * (MBL_Z_STEP); if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS); if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS); encoderPosition = 0; @@ -2257,12 +2257,12 @@ char* ftostr52(const float& x) { if (LCD_CLICKED) { if (!debounce_click) { debounce_click = true; - int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS, - iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; + int ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS), + iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS); if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag mbl.set_z(ix, iy, current_position[Z_AXIS]); _lcd_level_bed_position++; - if (_lcd_level_bed_position == MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) { + if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; line_to_current(Z_AXIS); mbl.active = 1; @@ -2272,8 +2272,8 @@ char* ftostr52(const float& x) { else { current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; line_to_current(Z_AXIS); - ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; - iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; + ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS); + iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS); if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag current_position[X_AXIS] = mbl.get_x(ix); current_position[Y_AXIS] = mbl.get_y(iy); diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index f0b3c9a877..7ef5d90544 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -731,7 +731,7 @@ static void lcd_implementation_status_screen() { // Draw the progress bar if the message has shown long enough // or if there is no message set. if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { - int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100, + int tix = (int)(card.percentDone() * (LCD_WIDTH) * 3) / 100, cel = tix / 3, rem = tix % 3, i = LCD_WIDTH; char msg[LCD_WIDTH + 1], b = ' '; msg[i] = '\0'; diff --git a/Marlin/ultralcd_st7920_u8glib_rrd.h b/Marlin/ultralcd_st7920_u8glib_rrd.h index 5d5f830646..d22c0db293 100644 --- a/Marlin/ultralcd_st7920_u8glib_rrd.h +++ b/Marlin/ultralcd_st7920_u8glib_rrd.h @@ -63,7 +63,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ST7920_WRITE_BYTE(0x80 | y); //set y ST7920_WRITE_BYTE(0x80); //set x = 0 ST7920_SET_DAT(); - for (i = 0; i < 2 * LCD_PIXEL_WIDTH / 8; i++) //2x width clears both segments + for (i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments ST7920_WRITE_BYTE(0); ST7920_SET_CMD(); }