Browse Source

Merge pull request #1584 from galexander1/stringcleanup

fix a handful of cases where strtod() was cast to int, instead of just using strtol()
Scott Lahteine 10 years ago
parent
commit
c321c97f35
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      Marlin/Marlin_main.cpp

+ 4
- 4
Marlin/Marlin_main.cpp View File

765
           while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++];
765
           while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++];
766
           strchr_pointer = strchr(cmdbuffer[bufindw], '*');
766
           strchr_pointer = strchr(cmdbuffer[bufindw], '*');
767
 
767
 
768
-          if( (int)(strtod(strchr_pointer + 1, NULL)) != checksum) {
768
+          if(strtol(strchr_pointer + 1, NULL, 10) != checksum) {
769
             SERIAL_ERROR_START;
769
             SERIAL_ERROR_START;
770
             SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH);
770
             SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH);
771
             SERIAL_ERRORLN(gcode_LastN);
771
             SERIAL_ERRORLN(gcode_LastN);
801
       }
801
       }
802
       if((strchr(cmdbuffer[bufindw], 'G') != NULL)){
802
       if((strchr(cmdbuffer[bufindw], 'G') != NULL)){
803
         strchr_pointer = strchr(cmdbuffer[bufindw], 'G');
803
         strchr_pointer = strchr(cmdbuffer[bufindw], 'G');
804
-        switch((int)((strtod(strchr_pointer + 1, NULL)))){
804
+        switch(strtol(strchr_pointer + 1, NULL, 10)){
805
         case 0:
805
         case 0:
806
         case 1:
806
         case 1:
807
         case 2:
807
         case 2:
4198
  */
4198
  */
4199
 inline void gcode_M351() {
4199
 inline void gcode_M351() {
4200
   #if defined(X_MS1_PIN) && X_MS1_PIN > -1
4200
   #if defined(X_MS1_PIN) && X_MS1_PIN > -1
4201
-    if (code_seen('S')) switch((int)code_value()) {
4201
+    if (code_seen('S')) switch(code_value_long()) {
4202
       case 1:
4202
       case 1:
4203
         for(int i=0;i<NUM_AXIS;i++) if (code_seen(axis_codes[i])) microstep_ms(i, code_value(), -1);
4203
         for(int i=0;i<NUM_AXIS;i++) if (code_seen(axis_codes[i])) microstep_ms(i, code_value(), -1);
4204
         if (code_seen('B')) microstep_ms(4, code_value(), -1);
4204
         if (code_seen('B')) microstep_ms(4, code_value(), -1);
4397
   }
4397
   }
4398
 
4398
 
4399
   else if (code_seen('M')) {
4399
   else if (code_seen('M')) {
4400
-    switch( (int)code_value() ) {
4400
+    switch( code_value_long() ) {
4401
       #ifdef ULTIPANEL
4401
       #ifdef ULTIPANEL
4402
         case 0: // M0 - Unconditional stop - Wait for user button press on LCD
4402
         case 0: // M0 - Unconditional stop - Wait for user button press on LCD
4403
         case 1: // M1 - Conditional stop - Wait for user button press on LCD
4403
         case 1: // M1 - Conditional stop - Wait for user button press on LCD

Loading…
Cancel
Save