Ver código fonte

Fix serial output for MBL, M303

Scott Lahteine 8 anos atrás
pai
commit
b63d70b186
4 arquivos alterados com 25 adições e 28 exclusões
  1. 1
    0
      Marlin/Marlin.h
  2. 3
    4
      Marlin/Marlin_main.cpp
  3. 3
    4
      Marlin/cardreader.cpp
  4. 18
    20
      Marlin/temperature.cpp

+ 1
- 0
Marlin/Marlin.h Ver arquivo

@@ -71,6 +71,7 @@
71 71
 #define SERIAL_PROTOCOLLNPGM(x) do{ serialprintPGM(PSTR(x "\n")); }while(0)
72 72
 
73 73
 #define SERIAL_PROTOCOLPAIR(name, value) SERIAL_ECHOPAIR(name, value)
74
+#define SERIAL_PROTOCOLLNPAIR(name, value) do{ SERIAL_ECHOPAIR(name, value); SERIAL_EOL; }while(0)
74 75
 
75 76
 extern const char errormagic[] PROGMEM;
76 77
 extern const char echomagic[] PROGMEM;

+ 3
- 4
Marlin/Marlin_main.cpp Ver arquivo

@@ -3280,10 +3280,9 @@ inline void gcode_G28() {
3280 3280
       case MeshReport:
3281 3281
         if (mbl.has_mesh()) {
3282 3282
           SERIAL_PROTOCOLPAIR("State: ", mbl.active() ? "On" : "Off");
3283
-          SERIAL_PROTOCOLPAIR("\nNum X,Y: ", MESH_NUM_X_POINTS);
3284
-          SERIAL_PROTOCOLCHAR(','); SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
3285
-          SERIAL_PROTOCOLPAIR("\nZ search height: ", MESH_HOME_SEARCH_Z);
3286
-          SERIAL_PROTOCOLPGM("\nZ offset: "); SERIAL_PROTOCOL_F(mbl.z_offset, 5);
3283
+          SERIAL_PROTOCOLLNPGM("\nNum X,Y: " STRINGIFY(MESH_NUM_X_POINTS) "," STRINGIFY(MESH_NUM_Y_POINTS));
3284
+          SERIAL_PROTOCOLLNPGM("Z search height: " STRINGIFY(MESH_HOME_SEARCH_Z));
3285
+          SERIAL_PROTOCOLPGM("Z offset: "); SERIAL_PROTOCOL_F(mbl.z_offset, 5);
3287 3286
           SERIAL_PROTOCOLLNPGM("\nMeasured points:");
3288 3287
           for (py = 0; py < MESH_NUM_Y_POINTS; py++) {
3289 3288
             for (px = 0; px < MESH_NUM_X_POINTS; px++) {

+ 3
- 4
Marlin/cardreader.cpp Ver arquivo

@@ -395,8 +395,7 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
395 395
     if (file.open(curDir, fname, O_READ)) {
396 396
       filesize = file.fileSize();
397 397
       SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
398
-      SERIAL_PROTOCOLPAIR(MSG_SD_SIZE, filesize);
399
-      SERIAL_EOL;
398
+      SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
400 399
       sdpos = 0;
401 400
 
402 401
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
@@ -417,8 +416,7 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
417 416
     }
418 417
     else {
419 418
       saving = true;
420
-      SERIAL_PROTOCOLPAIR(MSG_SD_WRITE_TO_FILE, name);
421
-      SERIAL_EOL;
419
+      SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, name);
422 420
       lcd_setstatus(fname);
423 421
     }
424 422
   }
@@ -449,6 +447,7 @@ void CardReader::removeFile(char* name) {
449 447
         if (!myDir.open(curDir, subdirname, O_READ)) {
450 448
           SERIAL_PROTOCOLPAIR("open failed, File: ", subdirname);
451 449
           SERIAL_PROTOCOLCHAR('.');
450
+          SERIAL_EOL;
452 451
           return;
453 452
         }
454 453
         else {

+ 18
- 20
Marlin/temperature.cpp Ver arquivo

@@ -322,17 +322,17 @@ unsigned char Temperature::soft_pwm[HOTENDS];
322 322
               SERIAL_PROTOCOLPAIR(MSG_T_MIN, min);
323 323
               SERIAL_PROTOCOLPAIR(MSG_T_MAX, max);
324 324
               if (cycles > 2) {
325
-                Ku = (4.0 * d) / (3.14159265 * (max - min) * 0.5);
325
+                Ku = (4.0 * d) / (M_PI * (max - min) * 0.5);
326 326
                 Tu = ((float)(t_low + t_high) * 0.001);
327 327
                 SERIAL_PROTOCOLPAIR(MSG_KU, Ku);
328 328
                 SERIAL_PROTOCOLPAIR(MSG_TU, Tu);
329 329
                 workKp = 0.6 * Ku;
330 330
                 workKi = 2 * workKp / Tu;
331 331
                 workKd = workKp * Tu * 0.125;
332
-                SERIAL_PROTOCOLLNPGM(MSG_CLASSIC_PID);
332
+                SERIAL_PROTOCOLLNPGM("\n" MSG_CLASSIC_PID);
333 333
                 SERIAL_PROTOCOLPAIR(MSG_KP, workKp);
334 334
                 SERIAL_PROTOCOLPAIR(MSG_KI, workKi);
335
-                SERIAL_PROTOCOLPAIR(MSG_KD, workKd);
335
+                SERIAL_PROTOCOLLNPAIR(MSG_KD, workKd);
336 336
                 /**
337 337
                 workKp = 0.33*Ku;
338 338
                 workKi = workKp/Tu;
@@ -390,40 +390,38 @@ unsigned char Temperature::soft_pwm[HOTENDS];
390 390
 
391 391
         #if HAS_PID_FOR_BOTH
392 392
           const char* estring = hotend < 0 ? "bed" : "";
393
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kp ", workKp);
394
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Ki ", workKi);
395
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kd ", workKd);
393
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kp ", workKp); SERIAL_EOL;
394
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Ki ", workKi); SERIAL_EOL;
395
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kd ", workKd); SERIAL_EOL;
396 396
         #elif ENABLED(PIDTEMP)
397
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Kp ", workKp);
398
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Ki ", workKi);
399
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Kd ", workKd);
397
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Kp ", workKp); SERIAL_EOL;
398
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Ki ", workKi); SERIAL_EOL;
399
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Kd ", workKd); SERIAL_EOL;
400 400
         #else
401
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKp ", workKp);
402
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKi ", workKi);
403
-          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKd ", workKd);
401
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKp ", workKp); SERIAL_EOL;
402
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKi ", workKi); SERIAL_EOL;
403
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKd ", workKd); SERIAL_EOL;
404 404
         #endif
405 405
 
406
-        #define _SET_BED_PID() \
406
+        #define _SET_BED_PID() do { \
407 407
           bedKp = workKp; \
408 408
           bedKi = scalePID_i(workKi); \
409 409
           bedKd = scalePID_d(workKd); \
410
-          updatePID()
410
+          updatePID(); } while(0)
411 411
 
412
-        #define _SET_EXTRUDER_PID() \
412
+        #define _SET_EXTRUDER_PID() do { \
413 413
           PID_PARAM(Kp, hotend) = workKp; \
414 414
           PID_PARAM(Ki, hotend) = scalePID_i(workKi); \
415 415
           PID_PARAM(Kd, hotend) = scalePID_d(workKd); \
416
-          updatePID()
416
+          updatePID(); } while(0)
417 417
 
418 418
         // Use the result? (As with "M303 U1")
419 419
         if (set_result) {
420 420
           #if HAS_PID_FOR_BOTH
421
-            if (hotend < 0) {
421
+            if (hotend < 0)
422 422
               _SET_BED_PID();
423
-            }
424
-            else {
423
+            else
425 424
               _SET_EXTRUDER_PID();
426
-            }
427 425
           #elif ENABLED(PIDTEMP)
428 426
             _SET_EXTRUDER_PID();
429 427
           #else

Carregando…
Cancelar
Salvar