settings.h 1.6 KB

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