diff --git a/GpsTracker/Config.cpp b/GpsTracker/Config.cpp index b73ce02..7ff59e4 100644 --- a/GpsTracker/Config.cpp +++ b/GpsTracker/Config.cpp @@ -15,12 +15,12 @@ namespace config { VERBOSE("read"); hardware::i2c::powerOn(); hardware::i2c::eeprom.readBlock(CONFIG_ADDR, value); - if (!String(CONFIG_SEED).equals(value.seed)) reset(); + if (CONFIG_SEED != value.seed) reset(); hardware::i2c::powerOff(); } void write() { - VERBOSE_FORMAT("write", "%s, %s, %s, %d, %d", value.seed, value.version, value.apn, value.firstEntry, value.lastEntry); + VERBOSE_FORMAT("write", "%d, %s, %s, %d, %d", value.seed, value.version, value.firstEntry, value.lastEntry); hardware::i2c::powerOn(); int written = hardware::i2c::eeprom.writeBlock(CONFIG_ADDR, value); @@ -29,9 +29,9 @@ namespace config { } Config_t get() { - if (value.seed[0] == '\0') details::read(); + if (value.seed == 0) details::read(); - VERBOSE_FORMAT("get", "%s, %s, %s, %d, %d", value.seed, value.version, value.apn, value.firstEntry, value.lastEntry); + VERBOSE_FORMAT("get", "%d, %s, %s, %d, %d", value.seed, value.version, value.firstEntry, value.lastEntry); return value; } @@ -45,7 +45,6 @@ namespace config { Config_t config = { CONFIG_SEED, VERSION, - "Vodafone", //TODO : read from SD 0xFFFF, 0xFFFF, }; diff --git a/GpsTracker/Config.h b/GpsTracker/Config.h index 7805c2c..af74d10 100644 --- a/GpsTracker/Config.h +++ b/GpsTracker/Config.h @@ -3,11 +3,11 @@ #include <Arduino.h> #define BACKUP_ENABLE_SDCARD 0 -#define BACKUP_ENABLE_NETWORK 0 +#define BACKUP_ENABLE_NETWORK 1 #define CONFIG_ADDR 0 #define CONFIG_RESERVED_SIZE 128 -#define CONFIG_SEED "UIYA" +#define CONFIG_SEED 13 #define VERSION "1.00" #define SLEEP_DEFAULT_TIME_SECONDS 1800 @@ -21,9 +21,8 @@ struct sleepTimings_t { }; struct Config_t { - char seed[5]; + uint8_t seed; char version[5]; - char apn[20]; uint16_t firstEntry; uint16_t lastEntry; }; diff --git a/GpsTracker/Hardware.cpp b/GpsTracker/Hardware.cpp index 1f36283..316c69b 100644 --- a/GpsTracker/Hardware.cpp +++ b/GpsTracker/Hardware.cpp @@ -65,7 +65,7 @@ namespace hardware { VERBOSE("networkPowerOn"); powerOn(); device.setPhoneFunctionality(SIM808_PHONE_FUNCTIONALITY::FULL); - device.enableGprs(config::main::get().apn); + device.enableGprs("Vodafone"); //TODO : get from config } void networkPowerOff() { diff --git a/GpsTracker/NetworkPositionsConfig.h b/GpsTracker/NetworkPositionsConfig.h new file mode 100644 index 0000000..760d147 --- /dev/null +++ b/GpsTracker/NetworkPositionsConfig.h @@ -0,0 +1,4 @@ +#pragma once + + +#define POSITIONS_CONFIG_DEFAULT_SAVE_THRESHOLD 10 \ No newline at end of file