#include #include "main.h" #include "settings.h" #include "display.h" #include "xprintf.h" #include "working_modes.h" #include "nmea.h" #include "menu.h" EEMEM struct config_s config_eep; EEMEM unsigned char config_crc; const __flash unsigned char limits_max_u8[] = { [CONF_U8_GNSS_MODE] = 5, [CONF_U8_SKIP_POINTS] = 120, }; unsigned char settings_load(void) { /* 0 - ok, 1 - error */ unsigned char crc=0, rcrc, i; unsigned char *cptr = (unsigned char *)&System.conf; unsigned char ret; eeprom_read_block(cptr, &config_eep, sizeof(struct config_s)); for (i=0; i limits_max_u8[i]) { ret = 1; System.conf.conf_u8[i] = 0; } } return ret; } void settings_store(void) { unsigned char i, crc=0; unsigned char *cptr = (unsigned char *)&System.conf; eeprom_update_block(cptr, &config_eep, sizeof(struct config_s)); for (i=0; i