Преглед изворни кода

Implement the EEPROM_CHITCHAT option

Scott Lahteine пре 8 година
родитељ
комит
cf96109056
1 измењених фајлова са 66 додато и 38 уклоњено
  1. 66
    38
      Marlin/configuration_store.cpp

+ 66
- 38
Marlin/configuration_store.cpp Прегледај датотеку

@@ -655,10 +655,12 @@ void MarlinSettings::postprocess() {
655 655
       EEPROM_WRITE(final_crc);
656 656
 
657 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 666
     #if ENABLED(UBL_SAVE_ACTIVE_ON_M500)
@@ -689,10 +691,12 @@ void MarlinSettings::postprocess() {
689 691
         stored_ver[0] = '?';
690 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 700
       reset();
697 701
     }
698 702
     else {
@@ -1004,20 +1008,24 @@ void MarlinSettings::postprocess() {
1004 1008
       #endif
1005 1009
 
1006 1010
       if (working_crc == stored_crc) {
1007
-          postprocess();
1011
+        postprocess();
1012
+        #if ENABLED(EEPROM_CHITCHAT)
1008 1013
           SERIAL_ECHO_START();
1009 1014
           SERIAL_ECHO(version);
1010 1015
           SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
1011 1016
           SERIAL_ECHOPAIR(" bytes; crc ", working_crc);
1012 1017
           SERIAL_ECHOLNPGM(")");
1018
+        #endif
1013 1019
       }
1014 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 1029
         reset();
1022 1030
       }
1023 1031
 
@@ -1029,24 +1037,32 @@ void MarlinSettings::postprocess() {
1029 1037
 
1030 1038
         if (!ubl.sanity_check()) {
1031 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 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 1051
           ubl.reset();
1040 1052
         }
1041 1053
 
1042 1054
         if (ubl.state.storage_slot >= 0) {
1043 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 1061
         else {
1048 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 1067
       #endif
1052 1068
     }
@@ -1060,11 +1076,13 @@ void MarlinSettings::postprocess() {
1060 1076
 
1061 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 1087
     int MarlinSettings::calc_num_meshes() {
1070 1088
       //obviously this will get more sophisticated once we've added an actual MAT
@@ -1079,11 +1097,13 @@ void MarlinSettings::postprocess() {
1079 1097
       #if ENABLED(AUTO_BED_LEVELING_UBL)
1080 1098
         const int a = calc_num_meshes();
1081 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 1107
           return;
1088 1108
         }
1089 1109
 
@@ -1094,7 +1114,9 @@ void MarlinSettings::postprocess() {
1094 1114
 
1095 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 1121
       #else
1100 1122
 
@@ -1110,7 +1132,9 @@ void MarlinSettings::postprocess() {
1110 1132
         const int16_t a = settings.calc_num_meshes();
1111 1133
 
1112 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 1138
           return;
1115 1139
         }
1116 1140
 
@@ -1121,7 +1145,9 @@ void MarlinSettings::postprocess() {
1121 1145
 
1122 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 1152
       #else
1127 1153
 
@@ -1345,8 +1371,10 @@ void MarlinSettings::reset() {
1345 1371
 
1346 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 1380
 #if DISABLED(DISABLE_M503)

Loading…
Откажи
Сачувај