My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

configuration_store.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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/persistent_store_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 ENABLED(EEPROM_CHITCHAT)
  37. if (success) report();
  38. #endif
  39. return success;
  40. #else
  41. return true;
  42. #endif
  43. }
  44. #if ENABLED(SD_FIRMWARE_UPDATE)
  45. static bool sd_update_status(); // True if the SD-Firmware-Update EEPROM flag is set
  46. static bool set_sd_update_status(const bool enable); // Return 'true' after EEPROM is set (-> always true)
  47. #endif
  48. #if ENABLED(EEPROM_SETTINGS)
  49. static bool load(); // Return 'true' if data was loaded ok
  50. static bool validate(); // Return 'true' if EEPROM data is ok
  51. static inline void first_load() {
  52. static bool loaded = false;
  53. if (!loaded && load()) loaded = true;
  54. }
  55. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  56. // That can store is enabled
  57. static uint16_t meshes_start_index();
  58. FORCE_INLINE static uint16_t meshes_end_index() { return meshes_end; }
  59. static uint16_t calc_num_meshes();
  60. static int mesh_slot_offset(const int8_t slot);
  61. static void store_mesh(const int8_t slot);
  62. static void load_mesh(const int8_t slot, void * const into=nullptr);
  63. //static void delete_mesh(); // necessary if we have a MAT
  64. //static void defrag_meshes(); // "
  65. #endif
  66. #else
  67. FORCE_INLINE
  68. static bool load() { reset(); report(); return true; }
  69. FORCE_INLINE
  70. static void first_load() { (void)load(); }
  71. #endif
  72. #if DISABLED(DISABLE_M503)
  73. static void report(const bool forReplay=false);
  74. #else
  75. FORCE_INLINE
  76. static void report(const bool=false) {}
  77. #endif
  78. private:
  79. static void postprocess();
  80. #if ENABLED(EEPROM_SETTINGS)
  81. static bool eeprom_error, validating;
  82. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  83. // That can store is enabled
  84. static const uint16_t meshes_end; // 128 is a placeholder for the size of the MAT; the MAT will always
  85. // live at the very end of the eeprom
  86. #endif
  87. static bool _load();
  88. static bool size_error(const uint16_t size);
  89. #endif
  90. };
  91. extern MarlinSettings settings;