Browse Source

Implement the EEPROM_CHITCHAT option

Scott Lahteine 8 years ago
parent
commit
cf96109056
1 changed files with 66 additions and 38 deletions
  1. 66
    38
      Marlin/configuration_store.cpp

+ 66
- 38
Marlin/configuration_store.cpp View File

655
       EEPROM_WRITE(final_crc);
655
       EEPROM_WRITE(final_crc);
656
 
656
 
657
       // Report storage size
657
       // Report storage size
658
-      SERIAL_ECHO_START();
659
-      SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET));
660
-      SERIAL_ECHOPAIR(" bytes; crc ", final_crc);
661
-      SERIAL_ECHOLNPGM(")");
658
+      #if ENABLED(EEPROM_CHITCHAT)
659
+        SERIAL_ECHO_START();
660
+        SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET));
661
+        SERIAL_ECHOPAIR(" bytes; crc ", final_crc);
662
+        SERIAL_ECHOLNPGM(")");
663
+      #endif
662
     }
664
     }
663
 
665
 
664
     #if ENABLED(UBL_SAVE_ACTIVE_ON_M500)
666
     #if ENABLED(UBL_SAVE_ACTIVE_ON_M500)
689
         stored_ver[0] = '?';
691
         stored_ver[0] = '?';
690
         stored_ver[1] = '\0';
692
         stored_ver[1] = '\0';
691
       }
693
       }
692
-      SERIAL_ECHO_START();
693
-      SERIAL_ECHOPGM("EEPROM version mismatch ");
694
-      SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
695
-      SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
694
+      #if ENABLED(EEPROM_CHITCHAT)
695
+        SERIAL_ECHO_START();
696
+        SERIAL_ECHOPGM("EEPROM version mismatch ");
697
+        SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
698
+        SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
699
+      #endif
696
       reset();
700
       reset();
697
     }
701
     }
698
     else {
702
     else {
1004
       #endif
1008
       #endif
1005
 
1009
 
1006
       if (working_crc == stored_crc) {
1010
       if (working_crc == stored_crc) {
1007
-          postprocess();
1011
+        postprocess();
1012
+        #if ENABLED(EEPROM_CHITCHAT)
1008
           SERIAL_ECHO_START();
1013
           SERIAL_ECHO_START();
1009
           SERIAL_ECHO(version);
1014
           SERIAL_ECHO(version);
1010
           SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
1015
           SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
1011
           SERIAL_ECHOPAIR(" bytes; crc ", working_crc);
1016
           SERIAL_ECHOPAIR(" bytes; crc ", working_crc);
1012
           SERIAL_ECHOLNPGM(")");
1017
           SERIAL_ECHOLNPGM(")");
1018
+        #endif
1013
       }
1019
       }
1014
       else {
1020
       else {
1015
-        SERIAL_ERROR_START();
1016
-        SERIAL_ERRORPGM("EEPROM CRC mismatch - (stored) ");
1017
-        SERIAL_ERROR(stored_crc);
1018
-        SERIAL_ERRORPGM(" != ");
1019
-        SERIAL_ERROR(working_crc);
1020
-        SERIAL_ERRORLNPGM(" (calculated)!");
1021
+        #if ENABLED(EEPROM_CHITCHAT)
1022
+          SERIAL_ERROR_START();
1023
+          SERIAL_ERRORPGM("EEPROM CRC mismatch - (stored) ");
1024
+          SERIAL_ERROR(stored_crc);
1025
+          SERIAL_ERRORPGM(" != ");
1026
+          SERIAL_ERROR(working_crc);
1027
+          SERIAL_ERRORLNPGM(" (calculated)!");
1028
+        #endif
1021
         reset();
1029
         reset();
1022
       }
1030
       }
1023
 
1031
 
1029
 
1037
 
1030
         if (!ubl.sanity_check()) {
1038
         if (!ubl.sanity_check()) {
1031
           SERIAL_EOL();
1039
           SERIAL_EOL();
1032
-          ubl.echo_name();
1033
-          SERIAL_ECHOLNPGM(" initialized.\n");
1040
+          #if ENABLED(EEPROM_CHITCHAT)
1041
+            ubl.echo_name();
1042
+            SERIAL_ECHOLNPGM(" initialized.\n");
1043
+          #endif
1034
         }
1044
         }
1035
         else {
1045
         else {
1036
-          SERIAL_PROTOCOLPGM("?Can't enable ");
1037
-          ubl.echo_name();
1038
-          SERIAL_PROTOCOLLNPGM(".");
1046
+          #if ENABLED(EEPROM_CHITCHAT)
1047
+            SERIAL_PROTOCOLPGM("?Can't enable ");
1048
+            ubl.echo_name();
1049
+            SERIAL_PROTOCOLLNPGM(".");
1050
+          #endif
1039
           ubl.reset();
1051
           ubl.reset();
1040
         }
1052
         }
1041
 
1053
 
1042
         if (ubl.state.storage_slot >= 0) {
1054
         if (ubl.state.storage_slot >= 0) {
1043
           load_mesh(ubl.state.storage_slot);
1055
           load_mesh(ubl.state.storage_slot);
1044
-          SERIAL_ECHOPAIR("Mesh ", ubl.state.storage_slot);
1045
-          SERIAL_ECHOLNPGM(" loaded from storage.");
1056
+          #if ENABLED(EEPROM_CHITCHAT)
1057
+            SERIAL_ECHOPAIR("Mesh ", ubl.state.storage_slot);
1058
+            SERIAL_ECHOLNPGM(" loaded from storage.");
1059
+          #endif
1046
         }
1060
         }
1047
         else {
1061
         else {
1048
           ubl.reset();
1062
           ubl.reset();
1049
-          SERIAL_ECHOLNPGM("UBL System reset()");
1063
+          #if ENABLED(EEPROM_CHITCHAT)
1064
+            SERIAL_ECHOLNPGM("UBL System reset()");
1065
+          #endif
1050
         }
1066
         }
1051
       #endif
1067
       #endif
1052
     }
1068
     }
1060
 
1076
 
1061
   #if ENABLED(AUTO_BED_LEVELING_UBL)
1077
   #if ENABLED(AUTO_BED_LEVELING_UBL)
1062
 
1078
 
1063
-    void ubl_invalid_slot(const int s) {
1064
-      SERIAL_PROTOCOLLNPGM("?Invalid slot.");
1065
-      SERIAL_PROTOCOL(s);
1066
-      SERIAL_PROTOCOLLNPGM(" mesh slots available.");
1067
-    }
1079
+    #if ENABLED(EEPROM_CHITCHAT)
1080
+      void ubl_invalid_slot(const int s) {
1081
+        SERIAL_PROTOCOLLNPGM("?Invalid slot.");
1082
+        SERIAL_PROTOCOL(s);
1083
+        SERIAL_PROTOCOLLNPGM(" mesh slots available.");
1084
+      }
1085
+    #endif
1068
 
1086
 
1069
     int MarlinSettings::calc_num_meshes() {
1087
     int MarlinSettings::calc_num_meshes() {
1070
       //obviously this will get more sophisticated once we've added an actual MAT
1088
       //obviously this will get more sophisticated once we've added an actual MAT
1079
       #if ENABLED(AUTO_BED_LEVELING_UBL)
1097
       #if ENABLED(AUTO_BED_LEVELING_UBL)
1080
         const int a = calc_num_meshes();
1098
         const int a = calc_num_meshes();
1081
         if (!WITHIN(slot, 0, a - 1)) {
1099
         if (!WITHIN(slot, 0, a - 1)) {
1082
-          ubl_invalid_slot(a);
1083
-          SERIAL_PROTOCOLPAIR("E2END=", E2END);
1084
-          SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end);
1085
-          SERIAL_PROTOCOLLNPAIR(" slot=", slot);
1086
-          SERIAL_EOL();
1100
+          #if ENABLED(EEPROM_CHITCHAT)
1101
+            ubl_invalid_slot(a);
1102
+            SERIAL_PROTOCOLPAIR("E2END=", E2END);
1103
+            SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end);
1104
+            SERIAL_PROTOCOLLNPAIR(" slot=", slot);
1105
+            SERIAL_EOL();
1106
+          #endif
1087
           return;
1107
           return;
1088
         }
1108
         }
1089
 
1109
 
1094
 
1114
 
1095
         // Write crc to MAT along with other data, or just tack on to the beginning or end
1115
         // Write crc to MAT along with other data, or just tack on to the beginning or end
1096
 
1116
 
1097
-        SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot);
1117
+        #if ENABLED(EEPROM_CHITCHAT)
1118
+          SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot);
1119
+        #endif
1098
 
1120
 
1099
       #else
1121
       #else
1100
 
1122
 
1110
         const int16_t a = settings.calc_num_meshes();
1132
         const int16_t a = settings.calc_num_meshes();
1111
 
1133
 
1112
         if (!WITHIN(slot, 0, a - 1)) {
1134
         if (!WITHIN(slot, 0, a - 1)) {
1113
-          ubl_invalid_slot(a);
1135
+          #if ENABLED(EEPROM_CHITCHAT)
1136
+            ubl_invalid_slot(a);
1137
+          #endif
1114
           return;
1138
           return;
1115
         }
1139
         }
1116
 
1140
 
1121
 
1145
 
1122
         // Compare crc with crc from MAT, or read from end
1146
         // Compare crc with crc from MAT, or read from end
1123
 
1147
 
1124
-        SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot);
1148
+        #if ENABLED(EEPROM_CHITCHAT)
1149
+          SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot);
1150
+        #endif
1125
 
1151
 
1126
       #else
1152
       #else
1127
 
1153
 
1345
 
1371
 
1346
   postprocess();
1372
   postprocess();
1347
 
1373
 
1348
-  SERIAL_ECHO_START();
1349
-  SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
1374
+  #if ENABLED(EEPROM_CHITCHAT)
1375
+    SERIAL_ECHO_START();
1376
+    SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
1377
+  #endif
1350
 }
1378
 }
1351
 
1379
 
1352
 #if DISABLED(DISABLE_M503)
1380
 #if DISABLED(DISABLE_M503)

Loading…
Cancel
Save