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

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