Browse Source

Eliminate most warnings

- Fix a bug reading `code_value` for `M503 Sn`
- Hide and remove unused variables
Scott Lahteine 10 years ago
parent
commit
267d6bef15
3 changed files with 25 additions and 19 deletions
  1. 21
    15
      Marlin/Marlin_main.cpp
  2. 3
    3
      Marlin/stepper.cpp
  3. 1
    1
      Marlin/temperature.cpp

+ 21
- 15
Marlin/Marlin_main.cpp View File

3548
     }
3548
     }
3549
   }
3549
   }
3550
 
3550
 
3551
-  float area = .0;
3552
   if (code_seen('D')) {
3551
   if (code_seen('D')) {
3553
     float diameter = code_value();
3552
     float diameter = code_value();
3554
     // setting any extruder filament size disables volumetric on the assumption that
3553
     // setting any extruder filament size disables volumetric on the assumption that
4286
  * M503: print settings currently in memory
4285
  * M503: print settings currently in memory
4287
  */
4286
  */
4288
 inline void gcode_M503() {
4287
 inline void gcode_M503() {
4289
-  Config_PrintSettings(code_seen('S') && code_value == 0);
4288
+  Config_PrintSettings(code_seen('S') && code_value() == 0);
4290
 }
4289
 }
4291
 
4290
 
4292
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
4291
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
4583
     SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
4582
     SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
4584
   }
4583
   }
4585
   else {
4584
   else {
4586
-    boolean make_move = false;
4585
+    #if EXTRUDERS > 1
4586
+      bool make_move = false;
4587
+    #endif
4588
+
4587
     if (code_seen('F')) {
4589
     if (code_seen('F')) {
4588
-      make_move = true;
4590
+      #if EXTRUDERS > 1
4591
+        make_move = true;
4592
+      #endif
4589
       next_feedrate = code_value();
4593
       next_feedrate = code_value();
4590
       if (next_feedrate > 0.0) feedrate = next_feedrate;
4594
       if (next_feedrate > 0.0) feedrate = next_feedrate;
4591
     }
4595
     }
5182
   SERIAL_PROTOCOLLNPGM(MSG_OK);
5186
   SERIAL_PROTOCOLLNPGM(MSG_OK);
5183
 }
5187
 }
5184
 
5188
 
5185
-void get_coordinates()
5186
-{
5187
-  bool seen[4]={false,false,false,false};
5188
-  for(int8_t i=0; i < NUM_AXIS; i++) {
5189
-    if(code_seen(axis_codes[i]))
5190
-    {
5191
-      destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
5192
-      seen[i]=true;
5189
+void get_coordinates() {
5190
+  for (int i = 0; i < NUM_AXIS; i++) {
5191
+    float dest;
5192
+    if (code_seen(axis_codes[i])) {
5193
+      dest = code_value();
5194
+      if (axis_relative_modes[i] || relative_mode)
5195
+        dest += current_position[i];
5193
     }
5196
     }
5194
-    else destination[i] = current_position[i]; //Are these else lines really needed?
5197
+    else
5198
+      dest = current_position[i];
5199
+
5200
+    destination[i] = dest;
5195
   }
5201
   }
5196
-  if(code_seen('F')) {
5202
+  if (code_seen('F')) {
5197
     next_feedrate = code_value();
5203
     next_feedrate = code_value();
5198
-    if(next_feedrate > 0.0) feedrate = next_feedrate;
5204
+    if (next_feedrate > 0.0) feedrate = next_feedrate;
5199
   }
5205
   }
5200
 }
5206
 }
5201
 
5207
 

+ 3
- 3
Marlin/stepper.cpp View File

1176
 }
1176
 }
1177
 
1177
 
1178
 void microstep_init() {
1178
 void microstep_init() {
1179
-  const uint8_t microstep_modes[] = MICROSTEP_MODES;
1180
-
1181
   #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0
1179
   #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0
1182
     pinMode(E1_MS1_PIN,OUTPUT);
1180
     pinMode(E1_MS1_PIN,OUTPUT);
1183
     pinMode(E1_MS2_PIN,OUTPUT); 
1181
     pinMode(E1_MS2_PIN,OUTPUT); 
1192
     pinMode(Z_MS2_PIN,OUTPUT);
1190
     pinMode(Z_MS2_PIN,OUTPUT);
1193
     pinMode(E0_MS1_PIN,OUTPUT);
1191
     pinMode(E0_MS1_PIN,OUTPUT);
1194
     pinMode(E0_MS2_PIN,OUTPUT);
1192
     pinMode(E0_MS2_PIN,OUTPUT);
1195
-    for (int i = 0; i <= 4; i++) microstep_mode(i, microstep_modes[i]);
1193
+    const uint8_t microstep_modes[] = MICROSTEP_MODES;
1194
+    for (int i = 0; i < sizeof(microstep_modes) / sizeof(microstep_modes[0]); i++)
1195
+        microstep_mode(i, microstep_modes[i]);
1196
   #endif
1196
   #endif
1197
 }
1197
 }
1198
 
1198
 

+ 1
- 1
Marlin/temperature.cpp View File

55
 
55
 
56
 int target_temperature[EXTRUDERS] = { 0 };
56
 int target_temperature[EXTRUDERS] = { 0 };
57
 int target_temperature_bed = 0;
57
 int target_temperature_bed = 0;
58
-int current_temperature_raw[EXTRUDERS] = { 0 };
58
+int current_temperature_raw[4] = { 0 };
59
 float current_temperature[EXTRUDERS] = { 0.0 };
59
 float current_temperature[EXTRUDERS] = { 0.0 };
60
 int current_temperature_bed_raw = 0;
60
 int current_temperature_bed_raw = 0;
61
 float current_temperature_bed = 0.0;
61
 float current_temperature_bed = 0.0;

Loading…
Cancel
Save