My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configuration_store.h 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 "MarlinConfig.h"
  25. class MarlinSettings {
  26. public:
  27. MarlinSettings() { }
  28. static void reset();
  29. static bool save();
  30. #if ENABLED(EEPROM_SETTINGS)
  31. static bool load();
  32. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  33. // That can store is enabled
  34. FORCE_INLINE static int get_start_of_meshes() { return meshes_begin; }
  35. FORCE_INLINE static int get_end_of_meshes() { return meshes_end; }
  36. static int calc_num_meshes();
  37. static void store_mesh(int8_t slot);
  38. static void load_mesh(int8_t slot, void *into = 0);
  39. //static void delete_mesh(); // necessary if we have a MAT
  40. //static void defrag_meshes(); // "
  41. #endif
  42. #else
  43. FORCE_INLINE
  44. static bool load() { reset(); report(); return true; }
  45. #endif
  46. #if DISABLED(DISABLE_M503)
  47. static void report(bool forReplay=false);
  48. #else
  49. FORCE_INLINE
  50. static void report(bool forReplay=false) { UNUSED(forReplay); }
  51. #endif
  52. private:
  53. static void postprocess();
  54. #if ENABLED(EEPROM_SETTINGS)
  55. static bool eeprom_error;
  56. #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
  57. // That can store is enabled
  58. static int meshes_begin;
  59. const static int meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
  60. // live at the very end of the eeprom
  61. #endif
  62. static void write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc);
  63. static void read_data(int &pos, uint8_t *value, uint16_t size, uint16_t *crc);
  64. #endif
  65. };
  66. extern MarlinSettings settings;
  67. #endif // CONFIGURATION_STORE_H