My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

configuration_store.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "../inc/MarlinConfig.h"
  24. #if ENABLED(EEPROM_SETTINGS)
  25. #include "../HAL/shared/eeprom_api.h"
  26. #endif
  27. class MarlinSettings {
  28. public:
  29. static uint16_t datasize();
  30. static void reset();
  31. static bool save(); // Return 'true' if data was saved
  32. FORCE_INLINE static bool init_eeprom() {
  33. reset();
  34. #if ENABLED(EEPROM_SETTINGS)
  35. const bool success = save();
  36. if (TERN0(EEPROM_CHITCHAT, success)) report();
  37. return success;
  38. #else
  39. return true;
  40. #endif
  41. }
  42. #if ENABLED(SD_FIRMWARE_UPDATE)
  43. static bool sd_update_status(); // True if the SD-Firmware-Update EEPROM flag is set
  44. static bool set_sd_update_status(const bool enable); // Return 'true' after EEPROM is set (-> always true)
  45. #endif
  46. #if ENABLED(EEPROM_SETTINGS)
  47. static bool load(); // Return 'true' if data was loaded ok
  48. static bool validate(); // Return 'true' if EEPROM data is ok
  49. static inline void first_load() {
  50. static bool loaded = false;
  51. if (!loaded && load()) loaded = true;
  52. }
  53. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  54. // That can store is enabled
  55. static uint16_t meshes_start_index();
  56. FORCE_INLINE static uint16_t meshes_end_index() { return meshes_end; }
  57. static uint16_t calc_num_meshes();
  58. static int mesh_slot_offset(const int8_t slot);
  59. static void store_mesh(const int8_t slot);
  60. static void load_mesh(const int8_t slot, void * const into=nullptr);
  61. //static void delete_mesh(); // necessary if we have a MAT
  62. //static void defrag_meshes(); // "
  63. #endif
  64. #else
  65. FORCE_INLINE
  66. static bool load() { reset(); report(); return true; }
  67. FORCE_INLINE
  68. static void first_load() { (void)load(); }
  69. #endif
  70. #if DISABLED(DISABLE_M503)
  71. static void report(const bool forReplay=false);
  72. #else
  73. FORCE_INLINE
  74. static void report(const bool=false) {}
  75. #endif
  76. private:
  77. static void postprocess();
  78. #if ENABLED(EEPROM_SETTINGS)
  79. static bool eeprom_error, validating;
  80. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  81. // That can store is enabled
  82. static const uint16_t meshes_end; // 128 is a placeholder for the size of the MAT; the MAT will always
  83. // live at the very end of the eeprom
  84. #endif
  85. static bool _load();
  86. static bool size_error(const uint16_t size);
  87. #endif
  88. };
  89. extern MarlinSettings settings;