Browse Source

No casting needed for SERIAL_ECHOPAIR

Scott Lahteine 8 years ago
parent
commit
dc19b69697
5 changed files with 38 additions and 33 deletions
  1. 5
    5
      Marlin/M100_Free_Mem_Chk.cpp
  2. 3
    1
      Marlin/Marlin.h
  3. 12
    9
      Marlin/Marlin_main.cpp
  4. 14
    14
      Marlin/configuration_store.cpp
  5. 4
    4
      Marlin/stepper.cpp

+ 5
- 5
Marlin/M100_Free_Mem_Chk.cpp View File

180
     x = code_value();
180
     x = code_value();
181
     SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
181
     SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
182
     ptr = (unsigned char*) __brkval;
182
     ptr = (unsigned char*) __brkval;
183
-    SERIAL_ECHOPAIR("\n__brkval : ", (long) ptr);
183
+    SERIAL_ECHOPAIR("\n__brkval : ", ptr);
184
     ptr += 8;
184
     ptr += 8;
185
     sp = top_of_stack();
185
     sp = top_of_stack();
186
-    SERIAL_ECHOPAIR("\nStack Pointer : ", (long) sp);
186
+    SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
187
     SERIAL_ECHOLNPGM("\n");
187
     SERIAL_ECHOLNPGM("\n");
188
     n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
188
     n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
189
     // has altered the stack.
189
     // has altered the stack.
204
   if (m100_not_initialized || code_seen('I')) {       // If no sub-command is specified, the first time
204
   if (m100_not_initialized || code_seen('I')) {       // If no sub-command is specified, the first time
205
     SERIAL_ECHOLNPGM("Initializing free memory block.\n");    // this happens, it will Initialize.
205
     SERIAL_ECHOLNPGM("Initializing free memory block.\n");    // this happens, it will Initialize.
206
     ptr = (unsigned char*) __brkval;        // Repeated M100 with no sub-command will not destroy the
206
     ptr = (unsigned char*) __brkval;        // Repeated M100 with no sub-command will not destroy the
207
-    SERIAL_ECHOPAIR("\n__brkval : ", (long) ptr);     // state of the initialized free memory pool.
207
+    SERIAL_ECHOPAIR("\n__brkval : ", ptr);     // state of the initialized free memory pool.
208
     ptr += 8;
208
     ptr += 8;
209
     sp = top_of_stack();
209
     sp = top_of_stack();
210
-    SERIAL_ECHOPAIR("\nStack Pointer : ", (long) sp);
210
+    SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
211
     SERIAL_ECHOLNPGM("\n");
211
     SERIAL_ECHOLNPGM("\n");
212
     n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
212
     n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
213
     // has altered the stack.
213
     // has altered the stack.
217
       *(ptr + i) = (unsigned char) 0xe5;
217
       *(ptr + i) = (unsigned char) 0xe5;
218
     for (i = 0; i < n; i++) {
218
     for (i = 0; i < n; i++) {
219
       if (*(ptr + i) != (unsigned char) 0xe5) {
219
       if (*(ptr + i) != (unsigned char) 0xe5) {
220
-        SERIAL_ECHOPAIR("? address : ", (unsigned long) ptr + i);
220
+        SERIAL_ECHOPAIR("? address : ", ptr + i);
221
         SERIAL_ECHOPAIR("=", *(ptr + i));
221
         SERIAL_ECHOPAIR("=", *(ptr + i));
222
         SERIAL_ECHOLNPGM("\n");
222
         SERIAL_ECHOLNPGM("\n");
223
       }
223
       }

+ 3
- 1
Marlin/Marlin.h View File

101
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
101
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
102
 #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
102
 #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
103
 
103
 
104
-#define SERIAL_ECHOPAIR(name,value) do{ serial_echopair_P(PSTR(name),(value)); }while(0)
104
+#define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
105
 
105
 
106
 void serial_echopair_P(const char* s_P, int v);
106
 void serial_echopair_P(const char* s_P, int v);
107
 void serial_echopair_P(const char* s_P, long v);
107
 void serial_echopair_P(const char* s_P, long v);
108
 void serial_echopair_P(const char* s_P, float v);
108
 void serial_echopair_P(const char* s_P, float v);
109
 void serial_echopair_P(const char* s_P, double v);
109
 void serial_echopair_P(const char* s_P, double v);
110
 void serial_echopair_P(const char* s_P, unsigned long v);
110
 void serial_echopair_P(const char* s_P, unsigned long v);
111
+FORCE_INLINE void serial_echopair_P(const char* s_P, bool v) { serial_echopair_P(s_P, (int)v); }
112
+FORCE_INLINE void serial_echopair_P(const char* s_P, void *v) { serial_echopair_P(s_P, (unsigned long)v); }
111
 
113
 
112
 // Things to write to serial from Program memory. Saves 400 to 2k of RAM.
114
 // Things to write to serial from Program memory. Saves 400 to 2k of RAM.
113
 FORCE_INLINE void serialprintPGM(const char* str) {
115
 FORCE_INLINE void serialprintPGM(const char* str) {

+ 12
- 9
Marlin/Marlin_main.cpp View File

1170
 static void set_axis_is_at_home(AxisEnum axis) {
1170
 static void set_axis_is_at_home(AxisEnum axis) {
1171
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1171
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1172
     if (DEBUGGING(LEVELING)) {
1172
     if (DEBUGGING(LEVELING)) {
1173
-      SERIAL_ECHOPAIR("set_axis_is_at_home(", (unsigned long)axis);
1173
+      SERIAL_ECHOPAIR("set_axis_is_at_home(", axis);
1174
       SERIAL_ECHOLNPGM(") >>>");
1174
       SERIAL_ECHOLNPGM(") >>>");
1175
     }
1175
     }
1176
   #endif
1176
   #endif
1258
   }
1258
   }
1259
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1259
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1260
     if (DEBUGGING(LEVELING)) {
1260
     if (DEBUGGING(LEVELING)) {
1261
-      SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", (unsigned long)axis);
1261
+      SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis);
1262
       SERIAL_ECHOLNPGM(")");
1262
       SERIAL_ECHOLNPGM(")");
1263
     }
1263
     }
1264
   #endif
1264
   #endif
1653
           if (doRaise) {
1653
           if (doRaise) {
1654
             #if ENABLED(DEBUG_LEVELING_FEATURE)
1654
             #if ENABLED(DEBUG_LEVELING_FEATURE)
1655
               if (DEBUGGING(LEVELING)) {
1655
               if (DEBUGGING(LEVELING)) {
1656
-                SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBING);
1656
+                SERIAL_ECHOPAIR("Raise Z (after) by ", Z_RAISE_AFTER_PROBING);
1657
                 SERIAL_EOL;
1657
                 SERIAL_EOL;
1658
                 SERIAL_ECHO("> SERVO_ENDSTOPS > raise_z_after_probing()");
1658
                 SERIAL_ECHO("> SERVO_ENDSTOPS > raise_z_after_probing()");
1659
                 SERIAL_EOL;
1659
                 SERIAL_EOL;
1749
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1749
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1750
       if (DEBUGGING(LEVELING)) {
1750
       if (DEBUGGING(LEVELING)) {
1751
         SERIAL_ECHOLNPGM("probe_pt >>>");
1751
         SERIAL_ECHOLNPGM("probe_pt >>>");
1752
-        SERIAL_ECHOPAIR("> ProbeAction:", (unsigned long)probe_action);
1752
+        SERIAL_ECHOPAIR("> ProbeAction:", probe_action);
1753
         SERIAL_EOL;
1753
         SERIAL_EOL;
1754
         DEBUG_POS("", current_position);
1754
         DEBUG_POS("", current_position);
1755
       }
1755
       }
1970
 static void homeaxis(AxisEnum axis) {
1970
 static void homeaxis(AxisEnum axis) {
1971
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1971
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1972
     if (DEBUGGING(LEVELING)) {
1972
     if (DEBUGGING(LEVELING)) {
1973
-      SERIAL_ECHOPAIR(">>> homeaxis(", (unsigned long)axis);
1973
+      SERIAL_ECHOPAIR(">>> homeaxis(", axis);
1974
       SERIAL_ECHOLNPGM(")");
1974
       SERIAL_ECHOLNPGM(")");
1975
     }
1975
     }
1976
   #endif
1976
   #endif
2158
 
2158
 
2159
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2159
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2160
     if (DEBUGGING(LEVELING)) {
2160
     if (DEBUGGING(LEVELING)) {
2161
-      SERIAL_ECHOPAIR("<<< homeaxis(", (unsigned long)axis);
2161
+      SERIAL_ECHOPAIR("<<< homeaxis(", axis);
2162
       SERIAL_ECHOLNPGM(")");
2162
       SERIAL_ECHOLNPGM(")");
2163
     }
2163
     }
2164
   #endif
2164
   #endif
2486
         feedrate = max_feedrate[Z_AXIS] * 60;  // feedrate (mm/m) = max_feedrate (mm/s)
2486
         feedrate = max_feedrate[Z_AXIS] * 60;  // feedrate (mm/m) = max_feedrate (mm/s)
2487
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2487
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2488
           if (DEBUGGING(LEVELING)) {
2488
           if (DEBUGGING(LEVELING)) {
2489
-            SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)(MIN_Z_HEIGHT_FOR_HOMING));
2489
+            SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
2490
             SERIAL_EOL;
2490
             SERIAL_EOL;
2491
             DEBUG_POS("> (home_all_axis || homeZ)", current_position);
2491
             DEBUG_POS("> (home_all_axis || homeZ)", current_position);
2492
             DEBUG_POS("> (home_all_axis || homeZ)", destination);
2492
             DEBUG_POS("> (home_all_axis || homeZ)", destination);
3117
           if (probePointCounter) {
3117
           if (probePointCounter) {
3118
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3118
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3119
               if (DEBUGGING(LEVELING)) {
3119
               if (DEBUGGING(LEVELING)) {
3120
-                SERIAL_ECHOPAIR("z_before = (between) ", (float)(Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS]));
3120
+                SERIAL_ECHOPAIR("z_before = (between) ", (Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS]));
3121
                 SERIAL_EOL;
3121
                 SERIAL_EOL;
3122
               }
3122
               }
3123
             #endif
3123
             #endif
3125
           else {
3125
           else {
3126
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3126
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3127
               if (DEBUGGING(LEVELING)) {
3127
               if (DEBUGGING(LEVELING)) {
3128
-                SERIAL_ECHOPAIR("z_before = (before) ", (float)Z_RAISE_BEFORE_PROBING);
3128
+                SERIAL_ECHOPAIR("z_before = (before) ", Z_RAISE_BEFORE_PROBING);
3129
                 SERIAL_EOL;
3129
                 SERIAL_EOL;
3130
               }
3130
               }
3131
             #endif
3131
             #endif
3483
   inline void gcode_M0_M1() {
3483
   inline void gcode_M0_M1() {
3484
     char* args = current_command_args;
3484
     char* args = current_command_args;
3485
 
3485
 
3486
+    uint8_t test_value = 12;
3487
+    SERIAL_ECHOPAIR("TEST", test_value);
3488
+
3486
     millis_t codenum = 0;
3489
     millis_t codenum = 0;
3487
     bool hasP = false, hasS = false;
3490
     bool hasP = false, hasS = false;
3488
     if (code_seen('P')) {
3491
     if (code_seen('P')) {

+ 14
- 14
Marlin/configuration_store.cpp View File

328
 
328
 
329
   // Report storage size
329
   // Report storage size
330
   SERIAL_ECHO_START;
330
   SERIAL_ECHO_START;
331
-  SERIAL_ECHOPAIR("Settings Stored (", (unsigned long)i);
331
+  SERIAL_ECHOPAIR("Settings Stored (", i);
332
   SERIAL_ECHOLNPGM(" bytes)");
332
   SERIAL_ECHOLNPGM(" bytes)");
333
 }
333
 }
334
 
334
 
507
     // Report settings retrieved and length
507
     // Report settings retrieved and length
508
     SERIAL_ECHO_START;
508
     SERIAL_ECHO_START;
509
     SERIAL_ECHO(ver);
509
     SERIAL_ECHO(ver);
510
-    SERIAL_ECHOPAIR(" stored settings retrieved (", (unsigned long)i);
510
+    SERIAL_ECHOPAIR(" stored settings retrieved (", i);
511
     SERIAL_ECHOLNPGM(" bytes)");
511
     SERIAL_ECHOLNPGM(" bytes)");
512
   }
512
   }
513
 
513
 
730
       SERIAL_ECHOLNPGM("Mesh bed leveling:");
730
       SERIAL_ECHOLNPGM("Mesh bed leveling:");
731
       CONFIG_ECHO_START;
731
       CONFIG_ECHO_START;
732
     }
732
     }
733
-    SERIAL_ECHOPAIR("  M420 S", (unsigned long)mbl.active);
734
-    SERIAL_ECHOPAIR(" X", (unsigned long)MESH_NUM_X_POINTS);
735
-    SERIAL_ECHOPAIR(" Y", (unsigned long)MESH_NUM_Y_POINTS);
733
+    SERIAL_ECHOPAIR("  M420 S", mbl.active);
734
+    SERIAL_ECHOPAIR(" X", MESH_NUM_X_POINTS);
735
+    SERIAL_ECHOPAIR(" Y", MESH_NUM_Y_POINTS);
736
     SERIAL_EOL;
736
     SERIAL_EOL;
737
     for (uint8_t y = 0; y < MESH_NUM_Y_POINTS; y++) {
737
     for (uint8_t y = 0; y < MESH_NUM_Y_POINTS; y++) {
738
       for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) {
738
       for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) {
783
       SERIAL_ECHOLNPGM("Material heatup parameters:");
783
       SERIAL_ECHOLNPGM("Material heatup parameters:");
784
       CONFIG_ECHO_START;
784
       CONFIG_ECHO_START;
785
     }
785
     }
786
-    SERIAL_ECHOPAIR("  M145 S0 H", (unsigned long)plaPreheatHotendTemp);
787
-    SERIAL_ECHOPAIR(" B", (unsigned long)plaPreheatHPBTemp);
788
-    SERIAL_ECHOPAIR(" F", (unsigned long)plaPreheatFanSpeed);
786
+    SERIAL_ECHOPAIR("  M145 S0 H", plaPreheatHotendTemp);
787
+    SERIAL_ECHOPAIR(" B", plaPreheatHPBTemp);
788
+    SERIAL_ECHOPAIR(" F", plaPreheatFanSpeed);
789
     SERIAL_EOL;
789
     SERIAL_EOL;
790
     CONFIG_ECHO_START;
790
     CONFIG_ECHO_START;
791
-    SERIAL_ECHOPAIR("  M145 S1 H", (unsigned long)absPreheatHotendTemp);
792
-    SERIAL_ECHOPAIR(" B", (unsigned long)absPreheatHPBTemp);
793
-    SERIAL_ECHOPAIR(" F", (unsigned long)absPreheatFanSpeed);
791
+    SERIAL_ECHOPAIR("  M145 S1 H", absPreheatHotendTemp);
792
+    SERIAL_ECHOPAIR(" B", absPreheatHPBTemp);
793
+    SERIAL_ECHOPAIR(" F", absPreheatFanSpeed);
794
     SERIAL_EOL;
794
     SERIAL_EOL;
795
   #endif // ULTIPANEL
795
   #endif // ULTIPANEL
796
 
796
 
805
         if (forReplay) {
805
         if (forReplay) {
806
           for (uint8_t i = 0; i < EXTRUDERS; i++) {
806
           for (uint8_t i = 0; i < EXTRUDERS; i++) {
807
             CONFIG_ECHO_START;
807
             CONFIG_ECHO_START;
808
-            SERIAL_ECHOPAIR("  M301 E", (unsigned long)i);
808
+            SERIAL_ECHOPAIR("  M301 E", i);
809
             SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i));
809
             SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i));
810
             SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, i)));
810
             SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, i)));
811
             SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, i)));
811
             SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, i)));
848
       SERIAL_ECHOLNPGM("LCD Contrast:");
848
       SERIAL_ECHOLNPGM("LCD Contrast:");
849
       CONFIG_ECHO_START;
849
       CONFIG_ECHO_START;
850
     }
850
     }
851
-    SERIAL_ECHOPAIR("  M250 C", (unsigned long)lcd_contrast);
851
+    SERIAL_ECHOPAIR("  M250 C", lcd_contrast);
852
     SERIAL_EOL;
852
     SERIAL_EOL;
853
   #endif
853
   #endif
854
 
854
 
882
       SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
882
       SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
883
       CONFIG_ECHO_START;
883
       CONFIG_ECHO_START;
884
     }
884
     }
885
-    SERIAL_ECHOPAIR("  M209 S", (unsigned long)(autoretract_enabled ? 1 : 0));
885
+    SERIAL_ECHOPAIR("  M209 S", (autoretract_enabled ? 1 : 0));
886
     SERIAL_EOL;
886
     SERIAL_EOL;
887
 
887
 
888
   #endif // FWRETRACT
888
   #endif // FWRETRACT

+ 4
- 4
Marlin/stepper.cpp View File

294
     SERIAL_ECHO_START;
294
     SERIAL_ECHO_START;
295
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
295
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
296
     if (TEST(endstop_hit_bits, X_MIN)) {
296
     if (TEST(endstop_hit_bits, X_MIN)) {
297
-      SERIAL_ECHOPAIR(" X:", (float)endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]);
297
+      SERIAL_ECHOPAIR(" X:", endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]);
298
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
298
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
299
     }
299
     }
300
     if (TEST(endstop_hit_bits, Y_MIN)) {
300
     if (TEST(endstop_hit_bits, Y_MIN)) {
301
-      SERIAL_ECHOPAIR(" Y:", (float)endstops_trigsteps[Y_AXIS] / axis_steps_per_unit[Y_AXIS]);
301
+      SERIAL_ECHOPAIR(" Y:", endstops_trigsteps[Y_AXIS] / axis_steps_per_unit[Y_AXIS]);
302
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
302
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
303
     }
303
     }
304
     if (TEST(endstop_hit_bits, Z_MIN)) {
304
     if (TEST(endstop_hit_bits, Z_MIN)) {
305
-      SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
305
+      SERIAL_ECHOPAIR(" Z:", endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
306
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
306
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
307
     }
307
     }
308
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
308
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
309
       if (TEST(endstop_hit_bits, Z_MIN_PROBE)) {
309
       if (TEST(endstop_hit_bits, Z_MIN_PROBE)) {
310
-        SERIAL_ECHOPAIR(" Z_MIN_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
310
+        SERIAL_ECHOPAIR(" Z_MIN_PROBE:", endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
311
         LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
311
         LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
312
       }
312
       }
313
     #endif
313
     #endif

Loading…
Cancel
Save