settings.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #include <avr/eeprom.h>
  3. #include "working_modes.h"
  4. /* u8 list - max 15 */
  5. #define CONF_U8_GNSS_MODE 0
  6. #define CONF_U8_SKIP_POINTS 1
  7. #define CONF_U8_AUTO_PAUSE_TIME 2
  8. #define CONF_U8_AUTO_PAUSE_DIST 3
  9. #define CONF_U8_LAST 3
  10. /* flags list - max 31 */
  11. #define CONFFLAG_DISABLE_FILTERS 0
  12. #define CONFFLAG_ENABLE_SBAS 1
  13. #define CONFFLAG_LOGGING_AFTER_BOOT 2
  14. #define CONFFLAG_AUTO_PAUSE 3
  15. #define CONFFLAG_LAST 3
  16. /* GNSS modes */
  17. #define GNSS_MODE_GPS_GLONASS_GALILEO 0
  18. #define GNSS_MODE_GPS 1
  19. #define GNSS_MODE_GPS_GALILEO 2
  20. #define GNSS_MODE_GALILEO 3
  21. #define GNSS_MODE_GPS_BEIDOU 4
  22. #define GNSS_MODE_BEIDOU 5
  23. struct config_s {
  24. union {
  25. unsigned char conf_u8[16];
  26. struct {
  27. unsigned char gnss_mode; // 0
  28. unsigned char skip_points; // 1
  29. unsigned char auto_pause_time; // 2
  30. unsigned char auto_pause_dist; // 3
  31. };
  32. };
  33. unsigned char flags[4];
  34. };
  35. extern const __flash unsigned char limits_max_u8[];
  36. extern const __flash unsigned char limits_min_u8[];
  37. extern __flash const char *gnss_names[];
  38. extern __flash const struct menu_struct settings_menu;
  39. unsigned char settings_load(void); /* 0 - ok, 1 - error */
  40. void settings_store(void);
  41. unsigned char check_config_data(void); /* 0 - ok, 1 - error */
  42. void settings_display_and_modify_bool(unsigned char mindex, unsigned char k);
  43. void settings_display_and_modify_u8(unsigned char mindex, unsigned char k);
  44. unsigned char get_flag(unsigned char index);
  45. void set_flag(unsigned char index, unsigned char val);
  46. void settings_bool_disp_default(unsigned char val);