My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

configuration_store.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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. #ifndef CONFIGURATION_STORE_H
  23. #define CONFIGURATION_STORE_H
  24. #include "../inc/MarlinConfig.h"
  25. #define ADD_PORT_ARG ENABLED(EEPROM_CHITCHAT) && NUM_SERIAL > 1
  26. class MarlinSettings {
  27. public:
  28. MarlinSettings() { }
  29. static uint16_t datasize();
  30. static void reset(
  31. #if ADD_PORT_ARG
  32. const int8_t port=-1
  33. #endif
  34. );
  35. static bool save(
  36. #if ADD_PORT_ARG
  37. const int8_t port=-1
  38. #endif
  39. ); // Return 'true' if data was saved
  40. FORCE_INLINE static bool init_eeprom() {
  41. bool success = true;
  42. reset();
  43. #if ENABLED(EEPROM_SETTINGS)
  44. success = save();
  45. #if ENABLED(EEPROM_CHITCHAT)
  46. if (success) report();
  47. #endif
  48. #endif
  49. return success;
  50. }
  51. #if ENABLED(EEPROM_SETTINGS)
  52. static bool load(
  53. #if ADD_PORT_ARG
  54. const int8_t port=-1
  55. #endif
  56. ); // Return 'true' if data was loaded ok
  57. static bool validate(
  58. #if ADD_PORT_ARG
  59. const int8_t port=-1
  60. #endif
  61. ); // Return 'true' if EEPROM data is ok
  62. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  63. // That can store is enabled
  64. static int16_t meshes_start_index();
  65. FORCE_INLINE static int16_t meshes_end_index() { return meshes_end; }
  66. static uint16_t calc_num_meshes();
  67. static void store_mesh(const int8_t slot);
  68. static void load_mesh(const int8_t slot, void * const into=NULL);
  69. //static void delete_mesh(); // necessary if we have a MAT
  70. //static void defrag_meshes(); // "
  71. #endif
  72. #else
  73. FORCE_INLINE
  74. static bool load() { reset(); report(); return true; }
  75. #endif
  76. #if DISABLED(DISABLE_M503)
  77. static void report(const bool forReplay=false
  78. #if ADD_PORT_ARG
  79. , const int8_t port=-1
  80. #endif
  81. );
  82. #else
  83. FORCE_INLINE
  84. static void report(const bool forReplay=false) { UNUSED(forReplay); }
  85. #endif
  86. private:
  87. static void postprocess();
  88. #if ENABLED(EEPROM_SETTINGS)
  89. static bool eeprom_error, validating;
  90. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  91. // That can store is enabled
  92. const static int16_t meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
  93. // live at the very end of the eeprom
  94. #endif
  95. static bool _load(
  96. #if ADD_PORT_ARG
  97. const int8_t port=-1
  98. #endif
  99. );
  100. static bool size_error(const uint16_t size
  101. #if ADD_PORT_ARG
  102. const int8_t port=-1
  103. #endif
  104. );
  105. #endif
  106. };
  107. extern MarlinSettings settings;
  108. #endif // CONFIGURATION_STORE_H