123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #ifndef CONFIGURATION_STORE_H
- #define CONFIGURATION_STORE_H
- #include "MarlinConfig.h"
- class MarlinSettings {
- public:
- MarlinSettings() { }
- static uint16_t datasize();
- static void reset();
- static bool save();
- FORCE_INLINE static bool init_eeprom() {
- reset();
- #if ENABLED(EEPROM_SETTINGS)
- const bool success = save();
- #if ENABLED(EEPROM_CHITCHAT)
- if (success) report();
- #endif
- return success;
- #else
- return true;
- #endif
- }
- #if ENABLED(EEPROM_SETTINGS)
- static bool load();
- static bool validate();
- #if ENABLED(AUTO_BED_LEVELING_UBL)
-
- static uint16_t meshes_start_index();
- FORCE_INLINE static uint16_t meshes_end_index() { return meshes_end; }
- static uint16_t calc_num_meshes();
- static int mesh_slot_offset(const int8_t slot);
- static void store_mesh(const int8_t slot);
- static void load_mesh(const int8_t slot, void * const into=NULL);
-
-
- #endif
- #else
- FORCE_INLINE
- static bool load() { reset(); report(); return true; }
- #endif
- #if DISABLED(DISABLE_M503)
- static void report(const bool forReplay=false);
- #else
- FORCE_INLINE
- static void report(const bool forReplay=false) { UNUSED(forReplay); }
- #endif
- private:
- static void postprocess();
- #if ENABLED(EEPROM_SETTINGS)
- static bool eeprom_error, validating;
- #if ENABLED(AUTO_BED_LEVELING_UBL)
-
- static constexpr uint16_t meshes_end = E2END - 128;
-
- #endif
- static bool _load();
- static void write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc);
- static void read_data(int &pos, uint8_t *value, uint16_t size, uint16_t *crc, const bool force=false);
- static bool size_error(const uint16_t size);
- #endif
- };
- extern MarlinSettings settings;
- #endif
|