Browse Source

Fix up the code to eliminate warnings

Scott Lahteine 10 years ago
parent
commit
19d418cd6a

+ 15
- 14
Marlin/Marlin_main.cpp View File

388
 static float destination[NUM_AXIS] = { 0, 0, 0, 0 };
388
 static float destination[NUM_AXIS] = { 0, 0, 0, 0 };
389
 
389
 
390
 static float offset[3] = { 0, 0, 0 };
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
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
396
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
393
 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
397
 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
394
 
398
 
396
 
400
 
397
 static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
401
 static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
398
 #ifdef SDSUPPORT
402
 #ifdef SDSUPPORT
399
-static bool fromsd[BUFSIZE];
400
-#endif //!SDSUPPORT
403
+  static bool fromsd[BUFSIZE];
404
+#endif
401
 static int bufindr = 0;
405
 static int bufindr = 0;
402
 static int bufindw = 0;
406
 static int bufindw = 0;
403
 static int buflen = 0;
407
 static int buflen = 0;
1233
     feedrate = oldFeedRate;
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
 static void setup_for_endstop_move() {
1240
 static void setup_for_endstop_move() {
1241
     saved_feedrate = feedrate;
1241
     saved_feedrate = feedrate;
1242
     saved_feedmultiply = feedmultiply;
1242
     saved_feedmultiply = feedmultiply;
2150
     }
2150
     }
2151
 
2151
 
2152
     int verbose_level = 1;
2152
     int verbose_level = 1;
2153
-    float x_tmp, y_tmp, z_tmp, real_z;
2154
 
2153
 
2155
     if (code_seen('V') || code_seen('v')) {
2154
     if (code_seen('V') || code_seen('v')) {
2156
       verbose_level = code_value_long();
2155
       verbose_level = code_value_long();
2436
     // When the bed is uneven, this height must be corrected.
2435
     // When the bed is uneven, this height must be corrected.
2437
     if (!dryrun)
2436
     if (!dryrun)
2438
     {
2437
     {
2438
+      float x_tmp, y_tmp, z_tmp, real_z;
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)
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
       x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
2440
       x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
2441
       y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
2441
       y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
3545
     }
3545
     }
3546
   }
3546
   }
3547
 
3547
 
3548
-  float area = .0;
3549
   if (code_seen('D')) {
3548
   if (code_seen('D')) {
3550
     float diameter = code_value();
3549
     float diameter = code_value();
3551
     // setting any extruder filament size disables volumetric on the assumption that
3550
     // setting any extruder filament size disables volumetric on the assumption that
4283
  * M503: print settings currently in memory
4282
  * M503: print settings currently in memory
4284
  */
4283
  */
4285
 inline void gcode_M503() {
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
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
4288
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
4580
     SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
4579
     SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
4581
   }
4580
   }
4582
   else {
4581
   else {
4583
-    boolean make_move = false;
4582
+    #if EXTRUDERS > 1
4583
+      bool make_move = false;
4584
+    #endif
4584
     if (code_seen('F')) {
4585
     if (code_seen('F')) {
4585
-      make_move = true;
4586
+      #if EXTRUDERS > 1
4587
+        make_move = true;
4588
+      #endif
4586
       next_feedrate = code_value();
4589
       next_feedrate = code_value();
4587
       if (next_feedrate > 0.0) feedrate = next_feedrate;
4590
       if (next_feedrate > 0.0) feedrate = next_feedrate;
4588
     }
4591
     }
5181
 
5184
 
5182
 void get_coordinates()
5185
 void get_coordinates()
5183
 {
5186
 {
5184
-  bool seen[4]={false,false,false,false};
5185
   for(int8_t i=0; i < NUM_AXIS; i++) {
5187
   for(int8_t i=0; i < NUM_AXIS; i++) {
5186
     if(code_seen(axis_codes[i]))
5188
     if(code_seen(axis_codes[i]))
5187
     {
5189
     {
5188
       destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
5190
       destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
5189
-      seen[i]=true;
5190
     }
5191
     }
5191
     else destination[i] = current_position[i]; //Are these else lines really needed?
5192
     else destination[i] = current_position[i]; //Are these else lines really needed?
5192
   }
5193
   }

+ 1
- 1
Marlin/cardreader.cpp View File

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

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

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

+ 1
- 0
Marlin/language.h View File

62
 #endif
62
 #endif
63
 
63
 
64
 #ifdef CUSTOM_MENDEL_NAME
64
 #ifdef CUSTOM_MENDEL_NAME
65
+  #undef MACHINE_NAME
65
   #define MACHINE_NAME CUSTOM_MENDEL_NAME
66
   #define MACHINE_NAME CUSTOM_MENDEL_NAME
66
 #endif
67
 #endif
67
 
68
 

+ 6
- 0
Marlin/pins.h View File

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

+ 18
- 18
Marlin/planner.cpp View File

701
 
701
 
702
   int moves_queued = movesplanned();
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
   #endif
723
   #endif
723
-  //  END OF SLOW DOWN SECTION    
724
 
724
 
725
   block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
725
   block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
726
   block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0
726
   block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0

+ 0
- 1
Marlin/qr_solve.cpp View File

607
   double norm;
607
   double norm;
608
   double scale;
608
   double scale;
609
   double ssq;
609
   double ssq;
610
-  double value;
611
 
610
 
612
   if ( n < 1 || incx < 1 )
611
   if ( n < 1 || incx < 1 )
613
   {
612
   {

+ 21
- 15
Marlin/stepper.cpp View File

85
   int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
85
   int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
86
 #endif
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
 static bool check_endstops = true;
107
 static bool check_endstops = true;
102
 
108
 
1176
 }
1182
 }
1177
 
1183
 
1178
 void microstep_init() {
1184
 void microstep_init() {
1179
-  const uint8_t microstep_modes[] = MICROSTEP_MODES;
1180
-
1181
   #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0
1185
   #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0
1182
     pinMode(E1_MS1_PIN,OUTPUT);
1186
     pinMode(E1_MS1_PIN,OUTPUT);
1183
     pinMode(E1_MS2_PIN,OUTPUT); 
1187
     pinMode(E1_MS2_PIN,OUTPUT); 
1192
     pinMode(Z_MS2_PIN,OUTPUT);
1196
     pinMode(Z_MS2_PIN,OUTPUT);
1193
     pinMode(E0_MS1_PIN,OUTPUT);
1197
     pinMode(E0_MS1_PIN,OUTPUT);
1194
     pinMode(E0_MS2_PIN,OUTPUT);
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
   #endif
1202
   #endif
1197
 }
1203
 }
1198
 
1204
 

+ 1
- 2
Marlin/ultralcd.h View File

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

Loading…
Cancel
Save