diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 79298e0c2..16296d8bb 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -6699,7 +6699,7 @@ void plan_arc( float mm_of_travel = hypot(angular_travel * radius, fabs(linear_travel)); if (mm_of_travel < 0.001) return; - uint16_t segments = floor(mm_of_travel / MM_PER_ARC_SEGMENT); + uint16_t segments = floor(mm_of_travel / (MM_PER_ARC_SEGMENT)); if (segments == 0) segments = 1; float theta_per_segment = angular_travel / segments; diff --git a/Marlin/mesh_bed_leveling.h b/Marlin/mesh_bed_leveling.h index 7717995ef..b18d346db 100644 --- a/Marlin/mesh_bed_leveling.h +++ b/Marlin/mesh_bed_leveling.h @@ -14,8 +14,8 @@ void reset(); - float get_x(int i) { return MESH_MIN_X + MESH_X_DIST * i; } - float get_y(int i) { return MESH_MIN_Y + MESH_Y_DIST * i; } + float get_x(int i) { return MESH_MIN_X + (MESH_X_DIST) * i; } + float get_y(int i) { return MESH_MIN_Y + (MESH_Y_DIST) * i; } void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; } int select_x_index(float x) { diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index fcc830e39..ce1122c0e 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -331,7 +331,7 @@ void planner_recalculate_trapezoids() { // Last/newest block in buffer. Exit speed is set with MINIMUM_PLANNER_SPEED. Always recalculated. if (next) { float nom = next->nominal_speed; - calculate_trapezoid_for_block(next, next->entry_speed / nom, MINIMUM_PLANNER_SPEED / nom); + calculate_trapezoid_for_block(next, next->entry_speed / nom, (MINIMUM_PLANNER_SPEED) / nom); next->recalculate_flag = false; } } @@ -389,8 +389,8 @@ void plan_init() { float t = autotemp_min + high * autotemp_factor; t = constrain(t, autotemp_min, autotemp_max); if (oldt > t) { - t *= (1 - AUTOTEMP_OLDWEIGHT); - t += AUTOTEMP_OLDWEIGHT * oldt; + t *= (1 - (AUTOTEMP_OLDWEIGHT)); + t += (AUTOTEMP_OLDWEIGHT) * oldt; } oldt = t; setTargetHotend0(t); @@ -839,7 +839,7 @@ float junction_deviation = 0.1; max_y_segment_time = max(ys0, max(ys1, ys2)), min_xy_segment_time = min(max_x_segment_time, max_y_segment_time); if (min_xy_segment_time < MAX_FREQ_TIME) { - float low_sf = speed_factor * min_xy_segment_time / MAX_FREQ_TIME; + float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME); speed_factor = min(speed_factor, low_sf); } #endif // XY_FREQUENCY_LIMIT diff --git a/Marlin/servo.cpp b/Marlin/servo.cpp index ecd4bdae8..67e7acf09 100644 --- a/Marlin/servo.cpp +++ b/Marlin/servo.cpp @@ -57,7 +57,7 @@ #define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009 -//#define NBR_TIMERS (MAX_SERVOS / SERVOS_PER_TIMER) +//#define NBR_TIMERS ((MAX_SERVOS) / (SERVOS_PER_TIMER)) static ServoInfo_t servo_info[MAX_SERVOS]; // static array of servo info structures static volatile int8_t Channel[_Nbr_16timers ]; // counter for the servo being pulsed for each timer (or -1 if refresh interval) @@ -66,9 +66,9 @@ uint8_t ServoCount = 0; // the total number // convenience macros -#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / SERVOS_PER_TIMER)) // returns the timer controlling this servo -#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % SERVOS_PER_TIMER) // returns the index of the servo on this timer -#define SERVO_INDEX(_timer,_channel) ((_timer*SERVOS_PER_TIMER) + _channel) // macro to access servo index by timer and channel +#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / (SERVOS_PER_TIMER))) // returns the timer controlling this servo +#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % (SERVOS_PER_TIMER)) // returns the index of the servo on this timer +#define SERVO_INDEX(_timer,_channel) ((_timer*(SERVOS_PER_TIMER)) + _channel) // macro to access servo index by timer and channel #define SERVO(_timer,_channel) (servo_info[SERVO_INDEX(_timer,_channel)]) // macro to access servo class by timer and channel #define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4) // minimum value in uS for this servo diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 6cb36fd06..76300ac92 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -1220,9 +1220,9 @@ void digipot_current(uint8_t driver, int current) { digitalPotWrite(digipot_ch[driver], current); #elif defined(MOTOR_CURRENT_PWM_XY_PIN) switch (driver) { - case 0: analogWrite(MOTOR_CURRENT_PWM_XY_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break; - case 1: analogWrite(MOTOR_CURRENT_PWM_Z_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break; - case 2: analogWrite(MOTOR_CURRENT_PWM_E_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break; + case 0: analogWrite(MOTOR_CURRENT_PWM_XY_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)); break; + case 1: analogWrite(MOTOR_CURRENT_PWM_Z_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)); break; + case 2: analogWrite(MOTOR_CURRENT_PWM_E_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)); break; } #else UNUSED(driver); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 8718645ea..be54bcdf9 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -465,7 +465,7 @@ void lcd_set_home_offsets() { static void _lcd_babystep(int axis, const char* msg) { if (encoderPosition != 0) { - babystepsTodo[axis] += BABYSTEP_MULTIPLICATOR * (int)encoderPosition; + babystepsTodo[axis] += (BABYSTEP_MULTIPLICATOR) * (int)encoderPosition; encoderPosition = 0; lcdDrawUpdate = 1; } diff --git a/Marlin/ultralcd_st7920_u8glib_rrd.h b/Marlin/ultralcd_st7920_u8glib_rrd.h index d22c0db29..8b00fcd3d 100644 --- a/Marlin/ultralcd_st7920_u8glib_rrd.h +++ b/Marlin/ultralcd_st7920_u8glib_rrd.h @@ -59,7 +59,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ST7920_WRITE_BYTE(0x01); //clear CGRAM ram u8g_Delay(15); //delay for CGRAM clear ST7920_WRITE_BYTE(0x3E); //extended mode + GDRAM active - for (y = 0; y < LCD_PIXEL_HEIGHT / 2; y++) { //clear GDRAM + for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM ST7920_WRITE_BYTE(0x80 | y); //set y ST7920_WRITE_BYTE(0x80); //set x = 0 ST7920_SET_DAT(); @@ -91,7 +91,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ST7920_WRITE_BYTE(0x80 | 8); //x=64 } ST7920_SET_DAT(); - ST7920_WRITE_BYTES(ptr, LCD_PIXEL_WIDTH / 8); //ptr is incremented inside of macro + ST7920_WRITE_BYTES(ptr, (LCD_PIXEL_WIDTH) / 8); //ptr is incremented inside of macro y++; } ST7920_NCS(); @@ -107,7 +107,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo #endif } -uint8_t u8g_dev_st7920_128x64_rrd_buf[LCD_PIXEL_WIDTH * (PAGE_HEIGHT / 8)] U8G_NOCOMMON; +uint8_t u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U8G_NOCOMMON; u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf}; u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn};