ConfigurationStore.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef CONFIG_STORE_H
  2. #define CONFIG_STORE_H
  3. #define EEPROM_SETTINGS
  4. #include "Configuration.h"
  5. #include <stdint.h>
  6. #include <avr/eeprom.h>
  7. typedef struct
  8. {
  9. char version[4];
  10. float axis_steps_per_unit[4];
  11. float max_feedrate_normal[4];
  12. unsigned long max_acceleration_units_per_sq_second_normal[4];
  13. float acceleration; //!< Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
  14. float retract_acceleration; //!< mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
  15. float minimumfeedrate;
  16. float mintravelfeedrate;
  17. unsigned long minsegmenttime;
  18. float max_jerk[4]; //!< Jerk is a maximum immediate velocity change.
  19. float add_homing[3];
  20. float zprobe_zoffset;
  21. float Kp;
  22. float Ki;
  23. float Kd;
  24. float bedKp;
  25. float bedKi;
  26. float bedKd;
  27. int lcd_contrast; //!< unused
  28. bool autoretract_enabled;
  29. float retract_length;
  30. float retract_feedrate;
  31. float retract_zlift;
  32. float retract_recover_length;
  33. float retract_recover_feedrate;
  34. bool volumetric_enabled;
  35. float filament_size[1]; //!< cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
  36. float max_feedrate_silent[4]; //!< max speeds for silent mode
  37. unsigned long max_acceleration_units_per_sq_second_silent[4];
  38. unsigned char axis_ustep_resolution[4];
  39. float travel_acceleration; //!< travel acceleration mm/s^2
  40. // Arc Interpolation Settings, configurable via M214
  41. float mm_per_arc_segment;
  42. float min_mm_per_arc_segment;
  43. unsigned char n_arc_correction; // If equal to zero, this is disabled
  44. unsigned short min_arc_segments; // If equal to zero, this is disabled
  45. unsigned short arc_segments_per_sec; // If equal to zero, this is disabled
  46. } M500_conf;
  47. extern M500_conf cs;
  48. void Config_ResetDefault();
  49. #ifndef DISABLE_M503
  50. void Config_PrintSettings(uint8_t level = 0);
  51. #else
  52. FORCE_INLINE void Config_PrintSettings() {}
  53. #endif
  54. #ifdef EEPROM_SETTINGS
  55. void Config_StoreSettings();
  56. bool Config_RetrieveSettings();
  57. #else
  58. FORCE_INLINE void Config_StoreSettings() {}
  59. FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
  60. #endif
  61. inline uint8_t calibration_status() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS); }
  62. inline void calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); }
  63. inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); }
  64. #endif//CONFIG_STORE_H