settings.h 1.6 KB

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