Pārlūkot izejas kodu

No casting needed for SERIAL_ECHOPAIR

Scott Lahteine 8 gadus atpakaļ
vecāks
revīzija
dc19b69697

+ 5
- 5
Marlin/M100_Free_Mem_Chk.cpp Parādīt failu

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

+ 3
- 1
Marlin/Marlin.h Parādīt failu

@@ -101,13 +101,15 @@ extern const char echomagic[] PROGMEM;
101 101
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
102 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 106
 void serial_echopair_P(const char* s_P, int v);
107 107
 void serial_echopair_P(const char* s_P, long v);
108 108
 void serial_echopair_P(const char* s_P, float v);
109 109
 void serial_echopair_P(const char* s_P, double v);
110 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 114
 // Things to write to serial from Program memory. Saves 400 to 2k of RAM.
113 115
 FORCE_INLINE void serialprintPGM(const char* str) {

+ 12
- 9
Marlin/Marlin_main.cpp Parādīt failu

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

+ 14
- 14
Marlin/configuration_store.cpp Parādīt failu

@@ -328,7 +328,7 @@ void Config_StoreSettings()  {
328 328
 
329 329
   // Report storage size
330 330
   SERIAL_ECHO_START;
331
-  SERIAL_ECHOPAIR("Settings Stored (", (unsigned long)i);
331
+  SERIAL_ECHOPAIR("Settings Stored (", i);
332 332
   SERIAL_ECHOLNPGM(" bytes)");
333 333
 }
334 334
 
@@ -507,7 +507,7 @@ void Config_RetrieveSettings() {
507 507
     // Report settings retrieved and length
508 508
     SERIAL_ECHO_START;
509 509
     SERIAL_ECHO(ver);
510
-    SERIAL_ECHOPAIR(" stored settings retrieved (", (unsigned long)i);
510
+    SERIAL_ECHOPAIR(" stored settings retrieved (", i);
511 511
     SERIAL_ECHOLNPGM(" bytes)");
512 512
   }
513 513
 
@@ -730,9 +730,9 @@ void Config_PrintSettings(bool forReplay) {
730 730
       SERIAL_ECHOLNPGM("Mesh bed leveling:");
731 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 736
     SERIAL_EOL;
737 737
     for (uint8_t y = 0; y < MESH_NUM_Y_POINTS; y++) {
738 738
       for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) {
@@ -783,14 +783,14 @@ void Config_PrintSettings(bool forReplay) {
783 783
       SERIAL_ECHOLNPGM("Material heatup parameters:");
784 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 789
     SERIAL_EOL;
790 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 794
     SERIAL_EOL;
795 795
   #endif // ULTIPANEL
796 796
 
@@ -805,7 +805,7 @@ void Config_PrintSettings(bool forReplay) {
805 805
         if (forReplay) {
806 806
           for (uint8_t i = 0; i < EXTRUDERS; i++) {
807 807
             CONFIG_ECHO_START;
808
-            SERIAL_ECHOPAIR("  M301 E", (unsigned long)i);
808
+            SERIAL_ECHOPAIR("  M301 E", i);
809 809
             SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i));
810 810
             SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, i)));
811 811
             SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, i)));
@@ -848,7 +848,7 @@ void Config_PrintSettings(bool forReplay) {
848 848
       SERIAL_ECHOLNPGM("LCD Contrast:");
849 849
       CONFIG_ECHO_START;
850 850
     }
851
-    SERIAL_ECHOPAIR("  M250 C", (unsigned long)lcd_contrast);
851
+    SERIAL_ECHOPAIR("  M250 C", lcd_contrast);
852 852
     SERIAL_EOL;
853 853
   #endif
854 854
 
@@ -882,7 +882,7 @@ void Config_PrintSettings(bool forReplay) {
882 882
       SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
883 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 886
     SERIAL_EOL;
887 887
 
888 888
   #endif // FWRETRACT

+ 4
- 4
Marlin/stepper.cpp Parādīt failu

@@ -294,20 +294,20 @@ void checkHitEndstops() {
294 294
     SERIAL_ECHO_START;
295 295
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
296 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 298
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
299 299
     }
300 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 302
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
303 303
     }
304 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 306
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
307 307
     }
308 308
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
309 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 311
         LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
312 312
       }
313 313
     #endif

Notiek ielāde…
Atcelt
Saglabāt