My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

configuration_store.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2019 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/persistent_store_api.h"
  26. #endif
  27. class MarlinSettings {
  28. public:
  29. MarlinSettings() { }
  30. static uint16_t datasize();
  31. static void reset();
  32. static bool save(); // Return 'true' if data was saved
  33. FORCE_INLINE static bool init_eeprom() {
  34. reset();
  35. #if ENABLED(EEPROM_SETTINGS)
  36. const bool success = save();
  37. #if ENABLED(EEPROM_CHITCHAT)
  38. if (success) report();
  39. #endif
  40. return success;
  41. #else
  42. return true;
  43. #endif
  44. }
  45. #if ENABLED(SD_FIRMWARE_UPDATE)
  46. static bool sd_update_status(); // True if the SD-Firmware-Update EEPROM flag is set
  47. static bool set_sd_update_status(const bool enable); // Return 'true' after EEPROM is set (-> always true)
  48. #endif
  49. #if ENABLED(EEPROM_SETTINGS)
  50. static bool load(); // Return 'true' if data was loaded ok
  51. static bool validate(); // Return 'true' if EEPROM data is ok
  52. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  53. // That can store is enabled
  54. static uint16_t meshes_start_index();
  55. FORCE_INLINE static uint16_t meshes_end_index() { return meshes_end; }
  56. static uint16_t calc_num_meshes();
  57. static int mesh_slot_offset(const int8_t slot);
  58. static void store_mesh(const int8_t slot);
  59. static void load_mesh(const int8_t slot, void * const into=NULL);
  60. //static void delete_mesh(); // necessary if we have a MAT
  61. //static void defrag_meshes(); // "
  62. #endif
  63. #else
  64. FORCE_INLINE
  65. static bool load() { reset(); report(); return true; }
  66. #endif
  67. #if DISABLED(DISABLE_M503)
  68. static void report(const bool forReplay=false);
  69. #else
  70. FORCE_INLINE
  71. static void report(const bool forReplay=false) { UNUSED(forReplay); }
  72. #endif
  73. private:
  74. static void postprocess();
  75. #if ENABLED(EEPROM_SETTINGS)
  76. static bool eeprom_error, validating;
  77. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  78. // That can store is enabled
  79. static const uint16_t meshes_end; // 128 is a placeholder for the size of the MAT; the MAT will always
  80. // live at the very end of the eeprom
  81. #endif
  82. static bool _load();
  83. static bool size_error(const uint16_t size);
  84. #endif
  85. };
  86. extern MarlinSettings settings;