settings.h 1.3 KB

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