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

+ 2
- 0
Marlin/Marlin.h View File

86
 
86
 
87
 #define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
87
 #define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
88
 
88
 
89
+#define SERIAL_EOL SERIAL_ECHOLN("")
90
+
89
 void serial_echopair_P(const char *s_P, float v);
91
 void serial_echopair_P(const char *s_P, float v);
90
 void serial_echopair_P(const char *s_P, double v);
92
 void serial_echopair_P(const char *s_P, double v);
91
 void serial_echopair_P(const char *s_P, unsigned long v);
93
 void serial_echopair_P(const char *s_P, unsigned long v);

+ 2
- 0
Marlin/language.h View File

155
 #define MSG_BABYSTEPPING_Z                  "Babystepping Z"
155
 #define MSG_BABYSTEPPING_Z                  "Babystepping Z"
156
 #define MSG_SERIAL_ERROR_MENU_STRUCTURE     "Error in menu structure"
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
 // LCD Menu Messages
160
 // LCD Menu Messages
159
 
161
 
160
 #include LANGUAGE_INCLUDE
162
 #include LANGUAGE_INCLUDE

Loading…
Cancel
Save