Sfoglia il codice sorgente

Additional wrapping for #3140

Scott Lahteine 8 anni fa
parent
commit
6e1bc03d3b

+ 1
- 1
Marlin/Marlin_main.cpp Vedi File

6699
 
6699
 
6700
   float mm_of_travel = hypot(angular_travel * radius, fabs(linear_travel));
6700
   float mm_of_travel = hypot(angular_travel * radius, fabs(linear_travel));
6701
   if (mm_of_travel < 0.001)  return;
6701
   if (mm_of_travel < 0.001)  return;
6702
-  uint16_t segments = floor(mm_of_travel / MM_PER_ARC_SEGMENT);
6702
+  uint16_t segments = floor(mm_of_travel / (MM_PER_ARC_SEGMENT));
6703
   if (segments == 0) segments = 1;
6703
   if (segments == 0) segments = 1;
6704
 
6704
 
6705
   float theta_per_segment = angular_travel / segments;
6705
   float theta_per_segment = angular_travel / segments;

+ 2
- 2
Marlin/mesh_bed_leveling.h Vedi File

14
 
14
 
15
     void reset();
15
     void reset();
16
 
16
 
17
-    float get_x(int i) { return MESH_MIN_X + MESH_X_DIST * i; }
18
-    float get_y(int i) { return MESH_MIN_Y + MESH_Y_DIST * i; }
17
+    float get_x(int i) { return MESH_MIN_X + (MESH_X_DIST) * i; }
18
+    float get_y(int i) { return MESH_MIN_Y + (MESH_Y_DIST) * i; }
19
     void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; }
19
     void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; }
20
 
20
 
21
     int select_x_index(float x) {
21
     int select_x_index(float x) {

+ 4
- 4
Marlin/planner.cpp Vedi File

331
   // Last/newest block in buffer. Exit speed is set with MINIMUM_PLANNER_SPEED. Always recalculated.
331
   // Last/newest block in buffer. Exit speed is set with MINIMUM_PLANNER_SPEED. Always recalculated.
332
   if (next) {
332
   if (next) {
333
     float nom = next->nominal_speed;
333
     float nom = next->nominal_speed;
334
-    calculate_trapezoid_for_block(next, next->entry_speed / nom, MINIMUM_PLANNER_SPEED / nom);
334
+    calculate_trapezoid_for_block(next, next->entry_speed / nom, (MINIMUM_PLANNER_SPEED) / nom);
335
     next->recalculate_flag = false;
335
     next->recalculate_flag = false;
336
   }
336
   }
337
 }
337
 }
389
     float t = autotemp_min + high * autotemp_factor;
389
     float t = autotemp_min + high * autotemp_factor;
390
     t = constrain(t, autotemp_min, autotemp_max);
390
     t = constrain(t, autotemp_min, autotemp_max);
391
     if (oldt > t) {
391
     if (oldt > t) {
392
-      t *= (1 - AUTOTEMP_OLDWEIGHT);
393
-      t += AUTOTEMP_OLDWEIGHT * oldt;
392
+      t *= (1 - (AUTOTEMP_OLDWEIGHT));
393
+      t += (AUTOTEMP_OLDWEIGHT) * oldt;
394
     }
394
     }
395
     oldt = t;
395
     oldt = t;
396
     setTargetHotend0(t);
396
     setTargetHotend0(t);
839
          max_y_segment_time = max(ys0, max(ys1, ys2)),
839
          max_y_segment_time = max(ys0, max(ys1, ys2)),
840
          min_xy_segment_time = min(max_x_segment_time, max_y_segment_time);
840
          min_xy_segment_time = min(max_x_segment_time, max_y_segment_time);
841
     if (min_xy_segment_time < MAX_FREQ_TIME) {
841
     if (min_xy_segment_time < MAX_FREQ_TIME) {
842
-      float low_sf = speed_factor * min_xy_segment_time / MAX_FREQ_TIME;
842
+      float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME);
843
       speed_factor = min(speed_factor, low_sf);
843
       speed_factor = min(speed_factor, low_sf);
844
     }
844
     }
845
   #endif // XY_FREQUENCY_LIMIT
845
   #endif // XY_FREQUENCY_LIMIT

+ 4
- 4
Marlin/servo.cpp Vedi File

57
 
57
 
58
 #define TRIM_DURATION       2                               // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009
58
 #define TRIM_DURATION       2                               // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009
59
 
59
 
60
-//#define NBR_TIMERS        (MAX_SERVOS / SERVOS_PER_TIMER)
60
+//#define NBR_TIMERS        ((MAX_SERVOS) / (SERVOS_PER_TIMER))
61
 
61
 
62
 static ServoInfo_t servo_info[MAX_SERVOS];                  // static array of servo info structures
62
 static ServoInfo_t servo_info[MAX_SERVOS];                  // static array of servo info structures
63
 static volatile int8_t Channel[_Nbr_16timers ];             // counter for the servo being pulsed for each timer (or -1 if refresh interval)
63
 static volatile int8_t Channel[_Nbr_16timers ];             // counter for the servo being pulsed for each timer (or -1 if refresh interval)
66
 
66
 
67
 
67
 
68
 // convenience macros
68
 // convenience macros
69
-#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / SERVOS_PER_TIMER)) // returns the timer controlling this servo
70
-#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % SERVOS_PER_TIMER)       // returns the index of the servo on this timer
71
-#define SERVO_INDEX(_timer,_channel)  ((_timer*SERVOS_PER_TIMER) + _channel)     // macro to access servo index by timer and channel
69
+#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / (SERVOS_PER_TIMER))) // returns the timer controlling this servo
70
+#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % (SERVOS_PER_TIMER))       // returns the index of the servo on this timer
71
+#define SERVO_INDEX(_timer,_channel)  ((_timer*(SERVOS_PER_TIMER)) + _channel)     // macro to access servo index by timer and channel
72
 #define SERVO(_timer,_channel)  (servo_info[SERVO_INDEX(_timer,_channel)])       // macro to access servo class by timer and channel
72
 #define SERVO(_timer,_channel)  (servo_info[SERVO_INDEX(_timer,_channel)])       // macro to access servo class by timer and channel
73
 
73
 
74
 #define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4)  // minimum value in uS for this servo
74
 #define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4)  // minimum value in uS for this servo

+ 3
- 3
Marlin/stepper.cpp Vedi File

1220
     digitalPotWrite(digipot_ch[driver], current);
1220
     digitalPotWrite(digipot_ch[driver], current);
1221
   #elif defined(MOTOR_CURRENT_PWM_XY_PIN)
1221
   #elif defined(MOTOR_CURRENT_PWM_XY_PIN)
1222
     switch (driver) {
1222
     switch (driver) {
1223
-      case 0: analogWrite(MOTOR_CURRENT_PWM_XY_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
1224
-      case 1: analogWrite(MOTOR_CURRENT_PWM_Z_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
1225
-      case 2: analogWrite(MOTOR_CURRENT_PWM_E_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
1223
+      case 0: analogWrite(MOTOR_CURRENT_PWM_XY_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)); break;
1224
+      case 1: analogWrite(MOTOR_CURRENT_PWM_Z_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)); break;
1225
+      case 2: analogWrite(MOTOR_CURRENT_PWM_E_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)); break;
1226
     }
1226
     }
1227
   #else
1227
   #else
1228
     UNUSED(driver);
1228
     UNUSED(driver);

+ 1
- 1
Marlin/ultralcd.cpp Vedi File

465
 
465
 
466
   static void _lcd_babystep(int axis, const char* msg) {
466
   static void _lcd_babystep(int axis, const char* msg) {
467
     if (encoderPosition != 0) {
467
     if (encoderPosition != 0) {
468
-      babystepsTodo[axis] += BABYSTEP_MULTIPLICATOR * (int)encoderPosition;
468
+      babystepsTodo[axis] += (BABYSTEP_MULTIPLICATOR) * (int)encoderPosition;
469
       encoderPosition = 0;
469
       encoderPosition = 0;
470
       lcdDrawUpdate = 1;
470
       lcdDrawUpdate = 1;
471
     }
471
     }

+ 3
- 3
Marlin/ultralcd_st7920_u8glib_rrd.h Vedi File

59
       ST7920_WRITE_BYTE(0x01);       //clear CGRAM ram
59
       ST7920_WRITE_BYTE(0x01);       //clear CGRAM ram
60
       u8g_Delay(15);                 //delay for CGRAM clear
60
       u8g_Delay(15);                 //delay for CGRAM clear
61
       ST7920_WRITE_BYTE(0x3E);       //extended mode + GDRAM active
61
       ST7920_WRITE_BYTE(0x3E);       //extended mode + GDRAM active
62
-      for (y = 0; y < LCD_PIXEL_HEIGHT / 2; y++) { //clear GDRAM
62
+      for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM
63
         ST7920_WRITE_BYTE(0x80 | y); //set y
63
         ST7920_WRITE_BYTE(0x80 | y); //set y
64
         ST7920_WRITE_BYTE(0x80);     //set x = 0
64
         ST7920_WRITE_BYTE(0x80);     //set x = 0
65
         ST7920_SET_DAT();
65
         ST7920_SET_DAT();
91
           ST7920_WRITE_BYTE(0x80 | 8);       //x=64
91
           ST7920_WRITE_BYTE(0x80 | 8);       //x=64
92
         }
92
         }
93
         ST7920_SET_DAT();
93
         ST7920_SET_DAT();
94
-        ST7920_WRITE_BYTES(ptr, LCD_PIXEL_WIDTH / 8); //ptr is incremented inside of macro
94
+        ST7920_WRITE_BYTES(ptr, (LCD_PIXEL_WIDTH) / 8); //ptr is incremented inside of macro
95
         y++;
95
         y++;
96
       }
96
       }
97
       ST7920_NCS();
97
       ST7920_NCS();
107
 #endif
107
 #endif
108
 }
108
 }
109
 
109
 
110
-uint8_t   u8g_dev_st7920_128x64_rrd_buf[LCD_PIXEL_WIDTH * (PAGE_HEIGHT / 8)] U8G_NOCOMMON;
110
+uint8_t   u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U8G_NOCOMMON;
111
 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};
111
 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};
112
 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};
112
 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};
113
 
113
 

Loading…
Annulla
Salva