Browse Source

Fix up the code to eliminate warnings

Scott Lahteine 9 years ago
parent
commit
19d418cd6a

+ 15
- 14
Marlin/Marlin_main.cpp View File

@@ -388,7 +388,11 @@ const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
388 388
 static float destination[NUM_AXIS] = { 0, 0, 0, 0 };
389 389
 
390 390
 static float offset[3] = { 0, 0, 0 };
391
-static bool home_all_axis = true;
391
+
392
+#ifndef DELTA
393
+  static bool home_all_axis = true;
394
+#endif
395
+
392 396
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
393 397
 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
394 398
 
@@ -396,8 +400,8 @@ static bool relative_mode = false;  //Determines Absolute or Relative Coordinate
396 400
 
397 401
 static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
398 402
 #ifdef SDSUPPORT
399
-static bool fromsd[BUFSIZE];
400
-#endif //!SDSUPPORT
403
+  static bool fromsd[BUFSIZE];
404
+#endif
401 405
 static int bufindr = 0;
402 406
 static int bufindw = 0;
403 407
 static int buflen = 0;
@@ -1233,10 +1237,6 @@ static void do_blocking_move_to(float x, float y, float z) {
1233 1237
     feedrate = oldFeedRate;
1234 1238
 }
1235 1239
 
1236
-static void do_blocking_move_relative(float offset_x, float offset_y, float offset_z) {
1237
-    do_blocking_move_to(current_position[X_AXIS] + offset_x, current_position[Y_AXIS] + offset_y, current_position[Z_AXIS] + offset_z);
1238
-}
1239
-
1240 1240
 static void setup_for_endstop_move() {
1241 1241
     saved_feedrate = feedrate;
1242 1242
     saved_feedmultiply = feedmultiply;
@@ -2150,7 +2150,6 @@ inline void gcode_G28() {
2150 2150
     }
2151 2151
 
2152 2152
     int verbose_level = 1;
2153
-    float x_tmp, y_tmp, z_tmp, real_z;
2154 2153
 
2155 2154
     if (code_seen('V') || code_seen('v')) {
2156 2155
       verbose_level = code_value_long();
@@ -2436,6 +2435,7 @@ inline void gcode_G28() {
2436 2435
     // When the bed is uneven, this height must be corrected.
2437 2436
     if (!dryrun)
2438 2437
     {
2438
+      float x_tmp, y_tmp, z_tmp, real_z;
2439 2439
       real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS];  //get the real Z (since the auto bed leveling is already correcting the plane)
2440 2440
       x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
2441 2441
       y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
@@ -3545,7 +3545,6 @@ inline void gcode_M200() {
3545 3545
     }
3546 3546
   }
3547 3547
 
3548
-  float area = .0;
3549 3548
   if (code_seen('D')) {
3550 3549
     float diameter = code_value();
3551 3550
     // setting any extruder filament size disables volumetric on the assumption that
@@ -4283,7 +4282,7 @@ inline void gcode_M502() {
4283 4282
  * M503: print settings currently in memory
4284 4283
  */
4285 4284
 inline void gcode_M503() {
4286
-  Config_PrintSettings(code_seen('S') && code_value == 0);
4285
+  Config_PrintSettings(code_seen('S') && code_value() == 0);
4287 4286
 }
4288 4287
 
4289 4288
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
@@ -4580,9 +4579,13 @@ inline void gcode_T() {
4580 4579
     SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
4581 4580
   }
4582 4581
   else {
4583
-    boolean make_move = false;
4582
+    #if EXTRUDERS > 1
4583
+      bool make_move = false;
4584
+    #endif
4584 4585
     if (code_seen('F')) {
4585
-      make_move = true;
4586
+      #if EXTRUDERS > 1
4587
+        make_move = true;
4588
+      #endif
4586 4589
       next_feedrate = code_value();
4587 4590
       if (next_feedrate > 0.0) feedrate = next_feedrate;
4588 4591
     }
@@ -5181,12 +5184,10 @@ void ClearToSend()
5181 5184
 
5182 5185
 void get_coordinates()
5183 5186
 {
5184
-  bool seen[4]={false,false,false,false};
5185 5187
   for(int8_t i=0; i < NUM_AXIS; i++) {
5186 5188
     if(code_seen(axis_codes[i]))
5187 5189
     {
5188 5190
       destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
5189
-      seen[i]=true;
5190 5191
     }
5191 5192
     else destination[i] = current_position[i]; //Are these else lines really needed?
5192 5193
   }

+ 1
- 1
Marlin/cardreader.cpp View File

@@ -489,7 +489,7 @@ void CardReader::updir() {
489 489
   if (workDirDepth > 0) {
490 490
     --workDirDepth;
491 491
     workDir = workDirParents[0];
492
-    for (int d = 0; d < workDirDepth; d++)
492
+    for (uint16_t d = 0; d < workDirDepth; d++)
493 493
       workDirParents[d] = workDirParents[d+1];
494 494
   }
495 495
 }

+ 2
- 1
Marlin/configurator/config/language.h View File

@@ -62,11 +62,12 @@
62 62
 #endif
63 63
 
64 64
 #ifdef CUSTOM_MENDEL_NAME
65
+  #undef MACHINE_NAME
65 66
   #define MACHINE_NAME CUSTOM_MENDEL_NAME
66 67
 #endif
67 68
 
68 69
 #ifndef MACHINE_UUID
69
-   #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
70
+  #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
70 71
 #endif
71 72
 
72 73
 

+ 1
- 0
Marlin/language.h View File

@@ -62,6 +62,7 @@
62 62
 #endif
63 63
 
64 64
 #ifdef CUSTOM_MENDEL_NAME
65
+  #undef MACHINE_NAME
65 66
   #define MACHINE_NAME CUSTOM_MENDEL_NAME
66 67
 #endif
67 68
 

+ 6
- 0
Marlin/pins.h View File

@@ -167,12 +167,18 @@
167 167
 #endif
168 168
 
169 169
 #ifdef DISABLE_MAX_ENDSTOPS
170
+  #undef X_MAX_PIN
171
+  #undef Y_MAX_PIN
172
+  #undef Z_MAX_PIN
170 173
   #define X_MAX_PIN          -1
171 174
   #define Y_MAX_PIN          -1
172 175
   #define Z_MAX_PIN          -1
173 176
 #endif
174 177
 
175 178
 #ifdef DISABLE_MIN_ENDSTOPS
179
+  #undef X_MIN_PIN
180
+  #undef Y_MIN_PIN
181
+  #undef Z_MIN_PIN
176 182
   #define X_MIN_PIN          -1
177 183
   #define Y_MIN_PIN          -1
178 184
   #define Z_MIN_PIN          -1

+ 18
- 18
Marlin/planner.cpp View File

@@ -701,26 +701,26 @@ float junction_deviation = 0.1;
701 701
 
702 702
   int moves_queued = movesplanned();
703 703
 
704
-  // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
705
-  bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2;
706
-  #ifdef OLD_SLOWDOWN
707
-    if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
708
-  #endif
709
-
710
-  #ifdef SLOWDOWN
711
-    //  segment time im micro seconds
712
-    unsigned long segment_time = lround(1000000.0/inverse_second);
713
-    if (mq) {
714
-      if (segment_time < minsegmenttime) {
715
-        // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
716
-        inverse_second = 1000000.0 / (segment_time + lround(2 * (minsegmenttime - segment_time) / moves_queued));
717
-        #ifdef XY_FREQUENCY_LIMIT
718
-          segment_time = lround(1000000.0 / inverse_second);
719
-        #endif
704
+  // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
705
+  #if defined(OLD_SLOWDOWN) || defined(SLOWDOWN)
706
+    bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2;
707
+    #ifdef OLD_SLOWDOWN
708
+      if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
709
+    #endif
710
+    #ifdef SLOWDOWN
711
+      //  segment time im micro seconds
712
+      unsigned long segment_time = lround(1000000.0/inverse_second);
713
+      if (mq) {
714
+        if (segment_time < minsegmenttime) {
715
+          // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
716
+          inverse_second = 1000000.0 / (segment_time + lround(2 * (minsegmenttime - segment_time) / moves_queued));
717
+          #ifdef XY_FREQUENCY_LIMIT
718
+            segment_time = lround(1000000.0 / inverse_second);
719
+          #endif
720
+        }
720 721
       }
721
-    }
722
+    #endif
722 723
   #endif
723
-  //  END OF SLOW DOWN SECTION    
724 724
 
725 725
   block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
726 726
   block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0

+ 0
- 1
Marlin/qr_solve.cpp View File

@@ -607,7 +607,6 @@ double dnrm2 ( int n, double x[], int incx )
607 607
   double norm;
608 608
   double scale;
609 609
   double ssq;
610
-  double value;
611 610
 
612 611
   if ( n < 1 || incx < 1 )
613 612
   {

+ 21
- 15
Marlin/stepper.cpp View File

@@ -85,18 +85,24 @@ static volatile bool endstop_z_hit = false;
85 85
   int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
86 86
 #endif
87 87
 
88
-static bool old_x_min_endstop = false,
89
-            old_x_max_endstop = false,
90
-            old_y_min_endstop = false,
91
-            old_y_max_endstop = false,
92
-            old_z_min_endstop = false,
93
-            #ifndef Z_DUAL_ENDSTOPS
94
-            old_z_max_endstop = false;
95
-            #else
96
-              old_z_max_endstop = false,
97
-              old_z2_min_endstop = false,
98
-              old_z2_max_endstop = false;
99
-            #endif
88
+#if defined(X_MIN_PIN) && X_MIN_PIN >= 0
89
+  static bool old_x_min_endstop = false;
90
+#endif
91
+#if defined(X_MAX_PIN) && X_MAX_PIN >= 0
92
+  static bool old_x_max_endstop = false;
93
+#endif
94
+#if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0
95
+  static bool old_y_min_endstop = false;
96
+#endif
97
+#if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0
98
+  static bool old_y_max_endstop = false;
99
+#endif
100
+
101
+static bool old_z_min_endstop = false, old_z_max_endstop = false;
102
+
103
+#ifdef Z_DUAL_ENDSTOPS
104
+  static bool old_z2_min_endstop = false, old_z2_max_endstop = false;
105
+#endif
100 106
 
101 107
 static bool check_endstops = true;
102 108
 
@@ -1176,8 +1182,6 @@ void digipot_current(uint8_t driver, int current) {
1176 1182
 }
1177 1183
 
1178 1184
 void microstep_init() {
1179
-  const uint8_t microstep_modes[] = MICROSTEP_MODES;
1180
-
1181 1185
   #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0
1182 1186
     pinMode(E1_MS1_PIN,OUTPUT);
1183 1187
     pinMode(E1_MS2_PIN,OUTPUT); 
@@ -1192,7 +1196,9 @@ void microstep_init() {
1192 1196
     pinMode(Z_MS2_PIN,OUTPUT);
1193 1197
     pinMode(E0_MS1_PIN,OUTPUT);
1194 1198
     pinMode(E0_MS2_PIN,OUTPUT);
1195
-    for (int i = 0; i <= 4; i++) microstep_mode(i, microstep_modes[i]);
1199
+    const uint8_t microstep_modes[] = MICROSTEP_MODES;
1200
+    for (int i = 0; i < sizeof(microstep_modes) / sizeof(microstep_modes[0]); i++)
1201
+      microstep_mode(i, microstep_modes[i]);
1196 1202
   #endif
1197 1203
 }
1198 1204
 

+ 1
- 2
Marlin/ultralcd.h View File

@@ -17,10 +17,9 @@
17 17
   #ifdef DOGLCD
18 18
     extern int lcd_contrast;
19 19
     void lcd_setcontrast(uint8_t value);
20
+    static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
20 21
   #endif
21 22
 
22
-  static unsigned char blink = 0;	// Variable for visualization of fan rotation in GLCD
23
-
24 23
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
25 24
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
26 25
 

Loading…
Cancel
Save