@@ -2,7 +2,18 @@ | |||||
#include <Arduino.h> | #include <Arduino.h> | ||||
//#define BACKUP_ENABLE_SDCARD 1 | |||||
#define BACKUP_ENABLE_SDCARD 0 | |||||
#define BACKUP_ENABLE_NETWORK 0 | |||||
#define CONFIG_ADDR 0 | |||||
#define CONFIG_RESERVED_SIZE 128 | |||||
#define CONFIG_SEED "UIYA" | |||||
#define VERSION "1.00" | |||||
#define SLEEP_DEFAULT_TIME_SECONDS 1800 | |||||
#define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000 | |||||
#define GPS_DEFAULT_TOTAL_TIMEOUT_MS 180000 | |||||
struct sleepTimings_t { | struct sleepTimings_t { | ||||
uint8_t speed; | uint8_t speed; | ||||
@@ -17,19 +28,10 @@ struct Config_t { | |||||
uint16_t lastEntry; | uint16_t lastEntry; | ||||
}; | }; | ||||
#define CONFIG_ADDR 0 | |||||
#define CONFIG_SEED "UIYA" | |||||
#define VERSION "1.00" | |||||
#define SLEEP_DEFAULT_TIME_SECONDS 1800 | |||||
#define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000 | |||||
#define GPS_DEFAULT_TOTAL_TIMEOUT_MS 180000 | |||||
namespace config { | namespace config { | ||||
static const sleepTimings_t defaultSleepTimings[] PROGMEM = { | static const sleepTimings_t defaultSleepTimings[] PROGMEM = { | ||||
{ 5, SLEEP_DEFAULT_TIME_SECONDS }, | |||||
{ 5, SLEEP_DEFAULT_TIME_SECONDS }, | |||||
{ 10, 1200 }, | { 10, 1200 }, | ||||
{ 20, 600 }, | { 20, 600 }, | ||||
{ 30, 540 }, | { 30, 540 }, | ||||
@@ -0,0 +1,3 @@ | |||||
#pragma once | |||||
#include "PositionsBackup.h" |
@@ -1,22 +1,24 @@ | |||||
#include "Config.h" | #include "Config.h" | ||||
#include "Debug.h" | |||||
#include "Positions.h" | #include "Positions.h" | ||||
#include "Gps.h" | |||||
#if defined(BACKUP_ENABLE_SDCARD) | |||||
#define BACKUPS_ENABLED BACKUP_ENABLE_SDCARD | |||||
#if BACKUP_ENABLE_SDCARD || BACKUP_ENABLE_NETWORK | |||||
#define BACKUPS_ENABLED BACKUP_ENABLE_SDCARD + BACKUP_ENABLE_NETWORK | |||||
#endif | #endif | ||||
#ifdef BACKUP_ENABLE_SDCARD | |||||
#if BACKUP_ENABLE_SDCARD | |||||
#include "SdPositionsBackup.h" | #include "SdPositionsBackup.h" | ||||
#endif | #endif | ||||
#include "Debug.h" | |||||
#include "Gps.h" | |||||
#include "Network.h" | |||||
#if BACKUP_ENABLE_NETWORK | |||||
#include "NetworkPositionsBackup.h" | |||||
#endif | |||||
#define LOGGER_NAME "Positions" | #define LOGGER_NAME "Positions" | ||||
#define ENTRY_RESERVED_SIZE 128 | #define ENTRY_RESERVED_SIZE 128 | ||||
#define ENTRIES_ADDR ENTRY_RESERVED_SIZE | |||||
#define ENTRIES_ADDR CONFIG_RESERVED_SIZE | |||||
namespace positions { | namespace positions { | ||||
#ifdef BACKUPS_ENABLED | #ifdef BACKUPS_ENABLED | ||||
@@ -33,12 +35,11 @@ namespace positions { | |||||
} | } | ||||
void setup() { | void setup() { | ||||
//TODO : enable/disable based on config | |||||
#ifdef BACKUPS_ENABLED | #ifdef BACKUPS_ENABLED | ||||
uint8_t backupIdx = 0; | uint8_t backupIdx = 0; | ||||
_backups = new backup::PositionsBackup*[BACKUPS_ENABLED]; | _backups = new backup::PositionsBackup*[BACKUPS_ENABLED]; | ||||
#ifdef BACKUP_ENABLE_SDCARD | |||||
#if BACKUP_ENABLE_SDCARD | |||||
_backups[backupIdx] = new backup::sd::SdPositionsBackup(); | _backups[backupIdx] = new backup::sd::SdPositionsBackup(); | ||||
_backups[backupIdx++]->setup(); | _backups[backupIdx++]->setup(); | ||||
#endif | #endif | ||||
@@ -1,6 +1,6 @@ | |||||
#include "Config.h" | #include "Config.h" | ||||
#ifdef BACKUP_ENABLE_SDCARD | |||||
#if BACKUP_ENABLE_SDCARD | |||||
#include "SdCard.h" | #include "SdCard.h" | ||||
namespace hardware { | namespace hardware { | ||||
@@ -8,7 +8,7 @@ | |||||
#define LOGGER_NAME "Positions::backup::sd" | #define LOGGER_NAME "Positions::backup::sd" | ||||
#ifdef BACKUP_ENABLE_SDCARD | |||||
#if BACKUP_ENABLE_SDCARD | |||||
namespace positions { | namespace positions { | ||||
namespace backup { | namespace backup { | ||||
namespace sd { | namespace sd { | ||||
@@ -4,7 +4,7 @@ | |||||
#define LOGGER_NAME "Config::backup::sd" | #define LOGGER_NAME "Config::backup::sd" | ||||
#ifdef BACKUP_ENABLE_SDCARD | |||||
#if BACKUP_ENABLE_SDCARD | |||||
namespace config { | namespace config { | ||||
namespace backup { | namespace backup { | ||||
namespace sd { | namespace sd { | ||||