Browse Source

Flag EEPROM write errors on serial output

- Also adds a language string for the error.
- Also adds SERIAL_EOL as an alias for SERIAL_ECHOLN(“”)
Scott Lahteine 9 years ago
parent
commit
9bc9051405
3 changed files with 33 additions and 22 deletions
  1. 29
    22
      Marlin/ConfigurationStore.cpp
  2. 2
    0
      Marlin/Marlin.h
  3. 2
    0
      Marlin/language.h

+ 29
- 22
Marlin/ConfigurationStore.cpp View File

@@ -62,17 +62,24 @@
62 62
  *
63 63
  */
64 64
 #include "Marlin.h"
65
+#include "language.h"
65 66
 #include "planner.h"
66 67
 #include "temperature.h"
67 68
 #include "ultralcd.h"
68 69
 #include "ConfigurationStore.h"
69 70
 
70 71
 void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
71
-  do {
72
+  uint8_t c;
73
+  while(size--) {
72 74
     eeprom_write_byte((unsigned char*)pos, *value);
75
+    eeprom_read_byte((unsigned char*)pos, *c);
76
+    if (*c != *value) {
77
+      SERIAL_ECHO_START;
78
+      SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
79
+    }
73 80
     pos++;
74 81
     value++;
75
-  } while (--size);
82
+  };
76 83
 }
77 84
 void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
78 85
   do {
@@ -471,7 +478,7 @@ void Config_PrintSettings(bool forReplay) {
471 478
   SERIAL_ECHOPAIR(" Y", axis_steps_per_unit[Y_AXIS]);
472 479
   SERIAL_ECHOPAIR(" Z", axis_steps_per_unit[Z_AXIS]);
473 480
   SERIAL_ECHOPAIR(" E", axis_steps_per_unit[E_AXIS]);
474
-  SERIAL_ECHOLN("");
481
+  SERIAL_EOL;
475 482
 
476 483
   SERIAL_ECHO_START;
477 484
 
@@ -483,7 +490,7 @@ void Config_PrintSettings(bool forReplay) {
483 490
     SERIAL_ECHOPAIR("  M365 X", axis_scaling[X_AXIS]);
484 491
     SERIAL_ECHOPAIR(" Y", axis_scaling[Y_AXIS]);
485 492
     SERIAL_ECHOPAIR(" Z", axis_scaling[Z_AXIS]);
486
-    SERIAL_ECHOLN("");
493
+    SERIAL_EOL;
487 494
     SERIAL_ECHO_START;
488 495
   #endif // SCARA
489 496
 
@@ -495,7 +502,7 @@ void Config_PrintSettings(bool forReplay) {
495 502
   SERIAL_ECHOPAIR(" Y", max_feedrate[Y_AXIS]);
496 503
   SERIAL_ECHOPAIR(" Z", max_feedrate[Z_AXIS]);
497 504
   SERIAL_ECHOPAIR(" E", max_feedrate[E_AXIS]);
498
-  SERIAL_ECHOLN("");
505
+  SERIAL_EOL;
499 506
 
500 507
   SERIAL_ECHO_START;
501 508
   if (!forReplay) {
@@ -506,7 +513,7 @@ void Config_PrintSettings(bool forReplay) {
506 513
   SERIAL_ECHOPAIR(" Y", max_acceleration_units_per_sq_second[Y_AXIS] );
507 514
   SERIAL_ECHOPAIR(" Z", max_acceleration_units_per_sq_second[Z_AXIS] );
508 515
   SERIAL_ECHOPAIR(" E", max_acceleration_units_per_sq_second[E_AXIS]);
509
-  SERIAL_ECHOLN("");
516
+  SERIAL_EOL;
510 517
   SERIAL_ECHO_START;
511 518
   if (!forReplay) {
512 519
     SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
@@ -514,7 +521,7 @@ void Config_PrintSettings(bool forReplay) {
514 521
   }
515 522
   SERIAL_ECHOPAIR("  M204 S", acceleration );
516 523
   SERIAL_ECHOPAIR(" T", retract_acceleration);
517
-  SERIAL_ECHOLN("");
524
+  SERIAL_EOL;
518 525
 
519 526
   SERIAL_ECHO_START;
520 527
   if (!forReplay) {
@@ -527,7 +534,7 @@ void Config_PrintSettings(bool forReplay) {
527 534
   SERIAL_ECHOPAIR(" X", max_xy_jerk );
528 535
   SERIAL_ECHOPAIR(" Z", max_z_jerk);
529 536
   SERIAL_ECHOPAIR(" E", max_e_jerk);
530
-  SERIAL_ECHOLN("");
537
+  SERIAL_EOL;
531 538
 
532 539
   SERIAL_ECHO_START;
533 540
   if (!forReplay) {
@@ -537,7 +544,7 @@ void Config_PrintSettings(bool forReplay) {
537 544
   SERIAL_ECHOPAIR("  M206 X", add_homing[X_AXIS] );
538 545
   SERIAL_ECHOPAIR(" Y", add_homing[Y_AXIS] );
539 546
   SERIAL_ECHOPAIR(" Z", add_homing[Z_AXIS] );
540
-  SERIAL_ECHOLN("");
547
+  SERIAL_EOL;
541 548
 
542 549
   #ifdef DELTA
543 550
     SERIAL_ECHO_START;
@@ -548,14 +555,14 @@ void Config_PrintSettings(bool forReplay) {
548 555
     SERIAL_ECHOPAIR("  M666 X", endstop_adj[X_AXIS] );
549 556
     SERIAL_ECHOPAIR(" Y", endstop_adj[Y_AXIS] );
550 557
     SERIAL_ECHOPAIR(" Z", endstop_adj[Z_AXIS] );
551
-    SERIAL_ECHOLN("");
558
+    SERIAL_EOL;
552 559
     SERIAL_ECHO_START;
553 560
     SERIAL_ECHOLNPGM("Delta settings: L=delta_diagonal_rod, R=delta_radius, S=delta_segments_per_second");
554 561
     SERIAL_ECHO_START;
555 562
     SERIAL_ECHOPAIR("  M665 L", delta_diagonal_rod );
556 563
     SERIAL_ECHOPAIR(" R", delta_radius );
557 564
     SERIAL_ECHOPAIR(" S", delta_segments_per_second );
558
-    SERIAL_ECHOLN("");
565
+    SERIAL_EOL;
559 566
   #endif // DELTA
560 567
 
561 568
   #ifdef PIDTEMP
@@ -567,7 +574,7 @@ void Config_PrintSettings(bool forReplay) {
567 574
     SERIAL_ECHOPAIR("   M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echos values for E0
568 575
     SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
569 576
     SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
570
-    SERIAL_ECHOLN("");
577
+    SERIAL_EOL;
571 578
   #endif // PIDTEMP
572 579
 
573 580
   #ifdef FWRETRACT
@@ -580,7 +587,7 @@ void Config_PrintSettings(bool forReplay) {
580 587
     SERIAL_ECHOPAIR("   M207 S", retract_length);
581 588
     SERIAL_ECHOPAIR(" F", retract_feedrate*60);
582 589
     SERIAL_ECHOPAIR(" Z", retract_zlift);
583
-    SERIAL_ECHOLN("");
590
+    SERIAL_EOL;
584 591
     SERIAL_ECHO_START;
585 592
     if (!forReplay) {
586 593
       SERIAL_ECHOLNPGM("Recover: S=Extra length (mm) F:Speed (mm/m)");
@@ -588,14 +595,14 @@ void Config_PrintSettings(bool forReplay) {
588 595
     }
589 596
     SERIAL_ECHOPAIR("   M208 S", retract_recover_length);
590 597
     SERIAL_ECHOPAIR(" F", retract_recover_feedrate*60);
591
-    SERIAL_ECHOLN("");
598
+    SERIAL_EOL;
592 599
     SERIAL_ECHO_START;
593 600
     if (!forReplay) {
594 601
       SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
595 602
       SERIAL_ECHO_START;
596 603
     }
597 604
     SERIAL_ECHOPAIR("   M209 S", (unsigned long)(autoretract_enabled ? 1 : 0));
598
-    SERIAL_ECHOLN("");
605
+    SERIAL_EOL;
599 606
 
600 607
     #if EXTRUDERS > 1
601 608
       if (!forReplay) {
@@ -603,10 +610,10 @@ void Config_PrintSettings(bool forReplay) {
603 610
         SERIAL_ECHOLNPGM("Multi-extruder settings:");
604 611
         SERIAL_ECHO_START;
605 612
         SERIAL_ECHOPAIR("   Swap retract length (mm):    ", retract_length_swap);
606
-        SERIAL_ECHOLN("");
613
+        SERIAL_EOL;
607 614
         SERIAL_ECHO_START;
608 615
         SERIAL_ECHOPAIR("   Swap rec. addl. length (mm): ", retract_recover_length_swap);
609
-        SERIAL_ECHOLN("");
616
+        SERIAL_EOL;
610 617
       }
611 618
     #endif // EXTRUDERS > 1
612 619
 
@@ -619,20 +626,20 @@ void Config_PrintSettings(bool forReplay) {
619 626
       SERIAL_ECHO_START;
620 627
     }
621 628
     SERIAL_ECHOPAIR("   M200 D", filament_size[0]);
622
-    SERIAL_ECHOLN("");
629
+    SERIAL_EOL;
623 630
 
624 631
     #if EXTRUDERS > 1
625 632
       SERIAL_ECHO_START;
626 633
       SERIAL_ECHOPAIR("   M200 T1 D", filament_size[1]);
627
-      SERIAL_ECHOLN("");
634
+      SERIAL_EOL;
628 635
       #if EXTRUDERS > 2
629 636
         SERIAL_ECHO_START;
630 637
         SERIAL_ECHOPAIR("   M200 T2 D", filament_size[2]);
631
-        SERIAL_ECHOLN("");
638
+        SERIAL_EOL;
632 639
         #if EXTRUDERS > 3
633 640
           SERIAL_ECHO_START;
634 641
           SERIAL_ECHOPAIR("   M200 T3 D", filament_size[3]);
635
-          SERIAL_ECHOLN("");
642
+          SERIAL_EOL;
636 643
         #endif
637 644
       #endif
638 645
     #endif
@@ -652,7 +659,7 @@ void Config_PrintSettings(bool forReplay) {
652 659
     SERIAL_ECHO("   M");
653 660
     SERIAL_ECHO(CUSTOM_M_CODE_SET_Z_PROBE_OFFSET);
654 661
     SERIAL_ECHOPAIR(" Z", -zprobe_zoffset);
655
-    SERIAL_ECHOLN("");
662
+    SERIAL_EOL;
656 663
   #endif
657 664
 }
658 665
 

+ 2
- 0
Marlin/Marlin.h View File

@@ -86,6 +86,8 @@ extern const char echomagic[] PROGMEM;
86 86
 
87 87
 #define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
88 88
 
89
+#define SERIAL_EOL SERIAL_ECHOLN("")
90
+
89 91
 void serial_echopair_P(const char *s_P, float v);
90 92
 void serial_echopair_P(const char *s_P, double v);
91 93
 void serial_echopair_P(const char *s_P, unsigned long v);

+ 2
- 0
Marlin/language.h View File

@@ -155,6 +155,8 @@
155 155
 #define MSG_BABYSTEPPING_Z                  "Babystepping Z"
156 156
 #define MSG_SERIAL_ERROR_MENU_STRUCTURE     "Error in menu structure"
157 157
 
158
+#define MSG_ERR_EEPROM_WRITE                "Error writing to EEPROM!"
159
+
158 160
 // LCD Menu Messages
159 161
 
160 162
 #include LANGUAGE_INCLUDE

Loading…
Cancel
Save