Browse Source

Reduce setTargetedHotend by removing the switch

Scott Lahteine 10 years ago
parent
commit
be5236e839
1 changed files with 10 additions and 14 deletions
  1. 10
    14
      Marlin/Marlin_main.cpp

+ 10
- 14
Marlin/Marlin_main.cpp View File

6518
   }
6518
   }
6519
 }
6519
 }
6520
 
6520
 
6521
+/**
6522
+ * Set target_extruder from the T parameter or the active_extruder
6523
+ *
6524
+ * Returns TRUE if the target is invalid
6525
+ */
6521
 bool setTargetedHotend(int code) {
6526
 bool setTargetedHotend(int code) {
6522
   target_extruder = active_extruder;
6527
   target_extruder = active_extruder;
6523
   if (code_seen('T')) {
6528
   if (code_seen('T')) {
6524
     target_extruder = code_value_short();
6529
     target_extruder = code_value_short();
6525
     if (target_extruder >= EXTRUDERS) {
6530
     if (target_extruder >= EXTRUDERS) {
6526
-      switch(code) {
6527
-        case 104:
6528
-        case 105:
6529
-        case 109:
6530
-        case 218:
6531
-        case 221:
6532
-        case 200:
6533
-          SERIAL_ECHO_START;
6534
-          SERIAL_CHAR('M');
6535
-          SERIAL_ECHO(code);
6536
-          SERIAL_ECHOPGM(" " MSG_INVALID_EXTRUDER " ");
6537
-          SERIAL_ECHOLN(target_extruder);
6538
-          break;
6539
-      }
6531
+      SERIAL_ECHO_START;
6532
+      SERIAL_CHAR('M');
6533
+      SERIAL_ECHO(code);
6534
+      SERIAL_ECHOPGM(" " MSG_INVALID_EXTRUDER " ");
6535
+      SERIAL_ECHOLN(target_extruder);
6540
       return true;
6536
       return true;
6541
     }
6537
     }
6542
   }
6538
   }

Loading…
Cancel
Save