Browse Source

Merge branch 'system-vs-user-config'

tags/v1.4.2
Bertrand Lemasle 6 years ago
parent
commit
851e44e5ea
19 changed files with 112 additions and 133 deletions
  1. +4
    -1
      .gitignore
  2. +18
    -18
      src/Config.cpp
  3. +9
    -9
      src/Core.cpp
  4. +1
    -1
      src/Debug.cpp
  5. +2
    -2
      src/Gps.cpp
  6. +4
    -4
      src/Network.cpp
  7. +4
    -4
      src/NetworkPositionsBackup.cpp
  8. +1
    -1
      src/Positions.cpp
  9. +2
    -2
      src/SdPositionsConfig.cpp
  10. +10
    -18
      src/config/Alerts.h
  11. +8
    -11
      src/config/BackupNetwork.h
  12. +2
    -2
      src/config/BackupSd.h
  13. +6
    -11
      src/config/Gps.h
  14. +2
    -2
      src/config/Hardware.h
  15. +6
    -14
      src/config/Main.h
  16. +4
    -4
      src/config/Network.h
  17. +8
    -8
      src/config/Sleeps.h
  18. +4
    -21
      src/config/System.h
  19. +17
    -0
      src/config/User.h

+ 4
- 1
.gitignore View File

@@ -2,4 +2,7 @@
[Bb]in/

#Visual Studio code
.vscode/
.vscode/

#Unversionned sensitive data configuration file
/src/config/Sensitive.h

+ 18
- 18
src/Config.cpp View File

@@ -4,24 +4,24 @@
#include "Flash.h"
const char VERSION_STRING[] PROGMEM = VERSION;
const config_t DEFAULT_CONFIG PROGMEM = {
const config_t CONFIG PROGMEM = {
CONFIG_SEED,
VERSION,
0xFFFF,
0xFFFF,
#if BACKUP_ENABLE_NETWORK
{
POSITIONS_CONFIG_NET_DEFAULT_SAVE_THRESHOLD,
POSITIONS_CONFIG_NET_SAVE_THRESHOLD,
0xFFFF,
POSITIONS_CONFIG_NET_DEFAULT_APN,
POSITIONS_CONFIG_NET_DEFAULT_URL
POSITIONS_CONFIG_NET_APN,
POSITIONS_CONFIG_NET_URL
},
#endif
CONFIG_DEFAULT_BATTERY_ALERT_LEVEL1,
CONFIG_DEFAULT_BATTERY_ALERT_LEVEL2,
CONFIG_DEFAULT_BATTERY_ALERT_CLEAR,
CONFIG_DEFAULT_ACTIVE_ALERTS,
CONFIG_DEFAULT_CONTACT_PHONE
CONFIG_BATTERY_ALERT_LEVEL1,
CONFIG_BATTERY_ALERT_LEVEL2,
CONFIG_BATTERY_ALERT_CLEAR,
CONFIG_ACTIVE_ALERTS,
CONFIG_CONTACT_PHONE
};
namespace config {
@@ -45,19 +45,19 @@ namespace config {
#if BACKUP_ENABLE_NETWORK
//networkConfig_t c = {
// POSITIONS_CONFIG_NET_DEFAULT_SAVE_THRESHOLD,
// POSITIONS_CONFIG_NET_SAVE_THRESHOLD,
// 0xFFFF,
// POSITIONS_CONFIG_NET_DEFAULT_APN,
// POSITIONS_CONFIG_NET_DEFAULT_URL,
// POSITIONS_CONFIG_NET_APN,
// POSITIONS_CONFIG_NET_URL,
//};
//value.network = c;
#endif
/*strcpy_P(value.version, VERSION_STRING);
value.alertBatteryLevel1 = CONFIG_DEFAULT_BATTERY_ALERT_LEVEL1;
value.alertBatteryLevel2 = CONFIG_DEFAULT_BATTERY_ALERT_LEVEL2;
value.alertBatteryLevelClear = CONFIG_DEFAULT_BATTERY_ALERT_CLEAR;
value.activeAlerts = CONFIG_DEFAULT_ACTIVE_ALERTS;
strcpy_P(config.contactPhone, PSTR(CONFIG_DEFAULT_CONTACT_PHONE));*/
value.alertBatteryLevel1 = CONFIG_BATTERY_ALERT_LEVEL1;
value.alertBatteryLevel2 = CONFIG_BATTERY_ALERT_LEVEL2;
value.alertBatteryLevelClear = CONFIG_BATTERY_ALERT_CLEAR;
value.activeAlerts = CONFIG_ACTIVE_ALERTS;
strcpy_P(config.contactPhone, PSTR(CONFIG_CONTACT_PHONE));*/
}
void write() {
@@ -88,7 +88,7 @@ namespace config {
#define CURRENT_LOGGER_FUNCTION "reset"
NOTICE;
utils::flash::read(&DEFAULT_CONFIG, value);
utils::flash::read(&CONFIG, value);
save();
}


+ 9
- 9
src/Core.cpp View File

@@ -16,8 +16,8 @@ using namespace utils;
namespace core {
#define CURRENT_LOGGER "core"
uint16_t sleepTime = SLEEP_DEFAULT_TIME_SECONDS;
uint8_t stoppedInARow = SLEEP_DEFAULT_STOPPED_THRESHOLD - 1;
uint16_t sleepTime = SLEEP_TIME_SECONDS;
uint8_t stoppedInARow = SLEEP_STOPPED_THRESHOLD - 1;
TRACKER_MOVING_STATE movingState = TRACKER_MOVING_STATE::MOVING;
namespace details {
@@ -78,7 +78,7 @@ namespace core {
if (!triggered) return NO_ALERTS_NOTIFIED;
network::powerOn();
networkStatus = network::waitForRegistered(NETWORK_DEFAULT_TOTAL_TIMEOUT_MS);
networkStatus = network::waitForRegistered(NETWORK_TOTAL_TIMEOUT_MS);
if (network::isAvailable(networkStatus)) {
strncpy_P(buffer, PSTR("Alerts !"), SMS_BUFFER_SIZE);
@@ -123,16 +123,16 @@ namespace core {
if (velocity < SLEEP_TIMING_MIN_MOVING_VELOCITY) {
float distance = gps::getDistanceFromPrevious(); //did we missed positions because we were sleeping ?
if (distance > GPS_DEFAULT_MISSED_POSITION_GAP_KM) stoppedInARow = 0;
else stoppedInARow = min(stoppedInARow + 1, SLEEP_DEFAULT_STOPPED_THRESHOLD + 1); //avoid overflow on REALLY long stops
if (distance > GPS_MISSED_POSITION_GAP_KM) stoppedInARow = 0;
else stoppedInARow = min(stoppedInARow + 1, SLEEP_STOPPED_THRESHOLD + 1); //avoid overflow on REALLY long stops
if (stoppedInARow < SLEEP_DEFAULT_STOPPED_THRESHOLD) {
sleepTime = SLEEP_DEFAULT_PAUSING_TIME_SECONDS;
state = stoppedInARow == SLEEP_DEFAULT_STOPPED_THRESHOLD - 1 ?
if (stoppedInARow < SLEEP_STOPPED_THRESHOLD) {
sleepTime = SLEEP_PAUSING_TIME_SECONDS;
state = stoppedInARow == SLEEP_STOPPED_THRESHOLD - 1 ?
TRACKER_MOVING_STATE::ABOUT_TO_STOP :
TRACKER_MOVING_STATE::PAUSED;
}
else if (stoppedInARow == SLEEP_DEFAULT_STOPPED_THRESHOLD) state = TRACKER_MOVING_STATE::STOPPED;
else if (stoppedInARow == SLEEP_STOPPED_THRESHOLD) state = TRACKER_MOVING_STATE::STOPPED;
else state = TRACKER_MOVING_STATE::STATIC;
}
else stoppedInARow = 0;


+ 1
- 1
src/Debug.cpp View File

@@ -163,7 +163,7 @@ namespace debug {
void getAndDisplayGpsPosition() {
#define CURRENT_LOGGER_FUNCTION "getAndDisplayGpsPosition"
SIM808_GPS_STATUS gpsStatus = gps::acquireCurrentPosition(GPS_DEFAULT_TOTAL_TIMEOUT_MS);
SIM808_GPS_STATUS gpsStatus = gps::acquireCurrentPosition(GPS_TOTAL_TIMEOUT_MS);
NOTICE_FORMAT("%d %s", gpsStatus, gps::lastPosition);
}


+ 2
- 2
src/Gps.cpp View File

@@ -42,8 +42,8 @@ namespace gps {
if (currentStatus > SIM808_GPS_STATUS::FIX) break; //if we have an accurate fix, break right now
NOTICE_FORMAT("%d", currentStatus);
mainunit::deepSleep(GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS / 1000);
timeout -= GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS;
mainunit::deepSleep(GPS_INTERMEDIATE_TIMEOUT_MS / 1000);
timeout -= GPS_INTERMEDIATE_TIMEOUT_MS;
} while (timeout > 1);
if (currentStatus > SIM808_GPS_STATUS::NO_FIX) {


+ 4
- 4
src/Network.cpp View File

@@ -44,15 +44,15 @@ namespace network {
if (isAvailable(currentStatus)) break;
details::print(currentStatus, report);
if (report.rssi < NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD) noReliableNetwork++;
if (report.rssi < NETWORK_NO_NETWORK_QUALITY_THRESHOLD) noReliableNetwork++;
else noReliableNetwork = 0;
if (noReliableNetwork > NETWORK_DEFAULT_NO_NETWORK_TRIES) {
if (noReliableNetwork > NETWORK_NO_NETWORK_TRIES) {
NOTICE_MSG("No reliable signal");
break; //after a while, no network really means no network. Bailing out
}
mainunit::deepSleep(NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS / 1000);
timeout -= NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS;
mainunit::deepSleep(NETWORK_INTERMEDIATE_TIMEOUT_MS / 1000);
timeout -= NETWORK_INTERMEDIATE_TIMEOUT_MS;
currentStatus = hardware::sim808::device.getNetworkRegistrationStatus();
report = hardware::sim808::device.getSignalQuality();


+ 4
- 4
src/NetworkPositionsBackup.cpp View File

@@ -53,7 +53,7 @@ namespace positions {
);
NOTICE_FORMAT("Response : %d", responseCode);
return responseCode == POSITIONS_CONFIG_NET_DEFAULT_EXPECTED_RESPONSE;
return responseCode == POSITIONS_CONFIG_NET_EXPECTED_RESPONSE;
}
void NetworkPositionsBackup::appendPositions() {
@@ -67,14 +67,14 @@ namespace positions {
if (!positions::count(config::main::value.network.lastSavedEntry)) return;
network::powerOn();
networkStatus = network::waitForRegistered(NETWORK_DEFAULT_TOTAL_TIMEOUT_MS);
networkStatus = network::waitForRegistered(NETWORK_TOTAL_TIMEOUT_MS);
if (networkStatus == SIM808_NETWORK_REGISTRATION_STATE::ERROR ||
(!network::isAvailable(networkStatus) || !network::enableGprs())) {
networkUnavailableInARow = min(networkUnavailableInARow + 1, POSITIONS_CONFIG_NET_DEFAULT_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD + 1); //avoid increment overflow
networkUnavailableInARow = min(networkUnavailableInARow + 1, POSITIONS_CONFIG_NET_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD + 1); //avoid increment overflow
NOTICE_MSG("network or gprs unavailable");
if (networkUnavailableInARow > POSITIONS_CONFIG_NET_DEFAULT_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD) {
if (networkUnavailableInARow > POSITIONS_CONFIG_NET_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD) {
networkUnavailablePostpone++;
}
}


+ 1
- 1
src/Positions.cpp View File

@@ -80,7 +80,7 @@ namespace positions {
gps::powerOn();
before = rtc::getTime();
SIM808_GPS_STATUS gpsStatus = gps::acquireCurrentPosition(GPS_DEFAULT_TOTAL_TIMEOUT_MS);
SIM808_GPS_STATUS gpsStatus = gps::acquireCurrentPosition(GPS_TOTAL_TIMEOUT_MS);
uint16_t timeToFix = rtc::getTime() - before;
SIM808ChargingStatus battery = hardware::sim808::device.getChargingState();
gps::powerOff();


+ 2
- 2
src/SdPositionsConfig.cpp View File

@@ -60,8 +60,8 @@ namespace config {
SdPositionConfig_t config = {
POSITIONS_CONFIG_SEED,
POSITIONS_CONFIG_DEFAULT_SAVE_THRESHOLD,
POSITIONS_CONFIG_DEFAULT_MAX_RECORDS_PER_FILE,
POSITIONS_CONFIG_SAVE_THRESHOLD,
POSITIONS_CONFIG_MAX_RECORDS_PER_FILE,
0xFFFF,
0,
0,


+ 10
- 18
src/config/Alerts.h View File

@@ -1,5 +1,7 @@
#pragma once
#include "User.h"
/**
* Configure the values used for alerts triggering.
* Note that the battery level percentage are quite high,
@@ -10,24 +12,14 @@
* between readings. Setting a clearance level much higher avoid
* clearing the levels and retriggering them the next time.
*/
#define CONFIG_DEFAULT_BATTERY_ALERT_LEVEL1 45 ///< Battery percentage at which to trigger the first low battery alert.
#define CONFIG_DEFAULT_BATTERY_ALERT_LEVEL2 38 ///< Battery percentage at which to trigger the final low battery alert.
#define CONFIG_DEFAULT_BATTERY_ALERT_CLEAR 60 ///< Battery percentage at which to clear all battery alerts.
#define CONFIG_DEFAULT_ACTIVE_ALERTS 0 ///< Default active alerts
#define CONFIG_DEFAULT_CONTACT_PHONE "+642568452" ///< Default phone number to send the alert SMS to.
#define ALERTS_ON_SERIAL _DEBUG ///< Display alerts on serial when connected rather than sending an SMS.
#define CONFIG_BATTERY_ALERT_LEVEL1 45 ///< Battery percentage at which to trigger the first low battery alert.
#define CONFIG_BATTERY_ALERT_LEVEL2 38 ///< Battery percentage at which to trigger the final low battery alert.
#define CONFIG_BATTERY_ALERT_CLEAR 60 ///< Battery percentage at which to clear all battery alerts.
#define CONFIG_ACTIVE_ALERTS 0 ///< Default active alerts
/**
\def ALERTS_ON_SERIAL
Display alerts on serial when connected rather than sending an SMS.
Useful for debugging purpose and avoid costs related to SMS sending.
*/
#define ALERTS_ON_SERIAL _DEBUG
/**
\def ALERT_SUSPICIOUS_RTC_TEMPERATURE
Temperature at which to consider the RTC module as failling.
When the backup battery is dead or nearly dead, the reading
of the temperature fails and returns 0.
*/
#define ALERT_SUSPICIOUS_RTC_TEMPERATURE 0
#define ALERT_SUSPICIOUS_RTC_TEMPERATURE 0 ///< Temperature at which to consider the RTC module as failling.
///< When the backup battery is dead or nearly dead, the reading
///< of the temperature fails and returns 0.

+ 8
- 11
src/config/BackupNetwork.h View File

@@ -4,17 +4,14 @@
#pragma once
#define POSITIONS_CONFIG_NET_DEFAULT_SAVE_THRESHOLD 30 ///< Determines how many positions will be saved before a network backup is needed (only when not moving though).
#define POSITIONS_CONFIG_NET_DEFAULT_APN "Vodafone" ///< APN used for GPRS context
#define POSITIONS_CONFIG_NET_DEFAULT_URL "http://yourserver.com/endpoint" ///< URL to which positions data will be send through an HTTP POST request
#define POSITIONS_CONFIG_NET_DEFAULT_EXPECTED_RESPONSE 201 ///< Expected response code from the server that indicates that the positions has been successfully backuped.
/**
\def POSITIONS_CONFIG_NET_DEFAULT_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD
Determines how many times to deal with an unreliable network before postponing the backup.
In an area where cell reception isn't good, this avoid to try to backup the positions
every single time, which would rapidly consumes all the batty.
*/
#define POSITIONS_CONFIG_NET_DEFAULT_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD 5
#include "User.h"
#define POSITIONS_CONFIG_NET_SAVE_THRESHOLD 30 ///< Determines how many positions will be saved before a network backup is needed (only when not moving though).
#define POSITIONS_CONFIG_NET_APN "Vodafone" ///< APN used for GPRS context
#define POSITIONS_CONFIG_NET_EXPECTED_RESPONSE 201 ///< Expected response code from the server that indicates that the positions has been successfully backuped.
#define POSITIONS_CONFIG_NET_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD 5 ///< Determines how many times to deal with an unreliable network before postponing the backup.
///< In an area where cell reception isn't good, this avoid to try to backup the positions
///< every single time, which would rapidly consumes all the battery.
struct networkConfig_t {
uint8_t saveThreshold; //sizeof = 1


+ 2
- 2
src/config/BackupSd.h View File

@@ -5,5 +5,5 @@
#define POSITIONS_FILENAME_LENGTH 19
#define POSITIONS_CONFIG_FILENAME "positions.config"
#define POSITIONS_CONFIG_SEED 45
#define POSITIONS_CONFIG_DEFAULT_SAVE_THRESHOLD 10
#define POSITIONS_CONFIG_DEFAULT_MAX_RECORDS_PER_FILE 5
#define POSITIONS_CONFIG_SAVE_THRESHOLD 10
#define POSITIONS_CONFIG_MAX_RECORDS_PER_FILE 5

+ 6
- 11
src/config/Gps.h View File

@@ -4,14 +4,9 @@
#pragma once
#define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000L ///< Time to sleeps between each GPS signal assessment.
#define GPS_DEFAULT_TOTAL_TIMEOUT_MS 80000L ///< Timeout after which to stop trying to get a GPS signal.
/**
\def GPS_DEFAULT_MISSED_POSITION_GAP_KM
Gap between the current and previous position above which to consider
that the tracker has moved. Even if stopped, this will trigger a whole
new "cycle" of positions acquisition, and will avoid missing positions
because while moving, the tracker woke up while stopped at a light traffic for instance.
*/
#define GPS_DEFAULT_MISSED_POSITION_GAP_KM 2
#define GPS_INTERMEDIATE_TIMEOUT_MS 10000L ///< Time to sleeps between each GPS signal assessment.
#define GPS_TOTAL_TIMEOUT_MS 80000L ///< Timeout after which to stop trying to get a GPS signal.
#define GPS_MISSED_POSITION_GAP_KM 2 ///< Gap between the current and previous position above which to consider
///< that the tracker has moved. Even if stopped, this will trigger a whole
///< new "cycle" of positions acquisition, and will avoid missing positions
///< because while moving, the tracker woke up while stopped at a light traffic for instance.

+ 2
- 2
src/config/Hardware.h View File

@@ -5,8 +5,8 @@
#include <E24.h>
#include <SoftwareSerial.h>
#define E24_ADDRESS E24_DEFAULT_ADDR ///< I2C address of the 24xxx chip
#define E24_SIZE E24Size_t::E24_512K ///< 24xxx chip size
#define E24_ADDRESS E24_DEFAULT_ADDR ///< I2C address of the 24xxx chip
#define E24_SIZE E24Size_t::E24_512K ///< 24xxx chip size
#define SIM808_BAUDRATE 4800 ///< Control the baudrate use to communicate with the SIM808 module
#define SIM_SERIAL_TYPE SoftwareSerial ///< Type of variable that holds the Serial communication with SIM808

+ 6
- 14
src/config/Main.h View File

@@ -7,23 +7,15 @@
#include "Sleeps.h"
#include "Alerts.h"
/**
\def BACKUP_ENABLE_SDCARD
Enable (1) or disable (0) the backup of positions using an sd card.
Note: This code has never been finished properly because of the lack of space
on the ATMega
*/
#define BACKUP_ENABLE_SDCARD 0
/**
\def BACKUP_ENABLE_NETWORK
Enable (1) or disable (0) the backup of positions using the network.
*/
#define BACKUP_ENABLE_NETWORK 1
#define BACKUP_ENABLE_SDCARD 0 ///< Enable (1) or disable (0) the backup of positions using an sd card.
///< Note: This code has never been finished properly because of the lack of space
///< on the ATMega
#define BACKUP_ENABLE_NETWORK 1 ///< Enable (1) or disable (0) the backup of positions using the network.
#if BACKUP_ENABLE_SDCARD
#include "BackupSd.h"
#include "BackupSd.h"
#endif
#if BACKUP_ENABLE_NETWORK
#include "BackupNetwork.h"
#include "BackupNetwork.h"
#endif

+ 4
- 4
src/config/Network.h View File

@@ -4,7 +4,7 @@
#pragma onces
#define NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD 8 ///< Minimum signal quality to consider the cellphone reception as reliable.
#define NETWORK_DEFAULT_NO_NETWORK_TRIES 5 ///< Maximum tries before considering an unreliable cellphone reception as no reception at all.
#define NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000L ///< Intermediate time to sleep between each cellphone reception assessment.
#define NETWORK_DEFAULT_TOTAL_TIMEOUT_MS 80000L ///< Timeout after which to stop trying to register to the network.
#define NETWORK_NO_NETWORK_QUALITY_THRESHOLD 8 ///< Minimum signal quality to consider the cellphone reception as reliable.
#define NETWORK_NO_NETWORK_TRIES 5 ///< Maximum tries before considering an unreliable cellphone reception as no reception at all.
#define NETWORK_INTERMEDIATE_TIMEOUT_MS 10000L ///< Intermediate time to sleep between each cellphone reception assessment.
#define NETWORK_TOTAL_TIMEOUT_MS 80000L ///< Timeout after which to stop trying to register to the network.

+ 8
- 8
src/config/Sleeps.h View File

@@ -6,10 +6,10 @@
#define SLEEP_TIMING_TIME(hours, minutes) hours * 60 + minutes
#define SLEEP_DEFAULT_TIME_SECONDS 1800 ///< Default sleep time
#define SLEEP_TIMING_MIN_MOVING_VELOCITY 5 ///< Speed under which to consider the tracker as not moving
#define SLEEP_DEFAULT_PAUSING_TIME_SECONDS 270 ///< Sleep time to use when not moving
#define SLEEP_DEFAULT_STOPPED_THRESHOLD 5 ///< Number of successive positions acquired as not moving before considering the tracker as stopped
#define SLEEP_TIME_SECONDS 1800 ///< Default sleep time
#define SLEEP_TIMING_MIN_MOVING_VELOCITY 5 ///< Speed under which to consider the tracker as not moving
#define SLEEP_PAUSING_TIME_SECONDS 270 ///< Sleep time to use when not moving
#define SLEEP_STOPPED_THRESHOLD 5 ///< Number of successive positions acquired as not moving before considering the tracker as stopped
#define SLEEP_TIMING_MIN SLEEP_TIMING_TIME(0, 0)
#define SLEEP_TIMING_MAX SLEEP_TIMING_TIME(23, 59)
@@ -35,10 +35,10 @@ namespace config {
*/
static const sleepTimings_t defaultSleepTimings[] PROGMEM = {
// Sleep timings when not moving
{ 0, SLEEP_TIMING_TIME(16, 00), SLEEP_TIMING_TIME(19, 59), 3600 }, ///< 1 hour between 16:00 and 20:00 UTC (04:00 to 08:00 UTC+12)
{ 0, SLEEP_TIMING_TIME(20, 00), SLEEP_TIMING_MAX, SLEEP_DEFAULT_TIME_SECONDS }, ///< default (30 minutes) between 20:00 and 00:00 UTC (08:00 to 12:00 UTC+12)
{ 0, SLEEP_TIMING_MIN, SLEEP_TIMING_TIME(8, 29), SLEEP_DEFAULT_TIME_SECONDS }, ///< default (30 minutes) between 00:00 and 8:30 UTC (12:00 to 20:30 UTC+12)
{ 0, SLEEP_TIMING_TIME(8, 30), SLEEP_TIMING_TIME(15, 59), 10800 }, ///< 3 hours between 20:30 and 16:00 UTC (20:30 to 04:00 UTC+12)
{ 0, SLEEP_TIMING_TIME(16, 00), SLEEP_TIMING_TIME(19, 59), 3600 }, ///< 1 hour between 16:00 and 20:00 UTC (04:00 to 08:00 UTC+12)
{ 0, SLEEP_TIMING_TIME(20, 00), SLEEP_TIMING_MAX, SLEEP_TIME_SECONDS }, ///< default (30 minutes) between 20:00 and 00:00 UTC (08:00 to 12:00 UTC+12)
{ 0, SLEEP_TIMING_MIN, SLEEP_TIMING_TIME(8, 29), SLEEP_TIME_SECONDS }, ///< default (30 minutes) between 00:00 and 8:30 UTC (12:00 to 20:30 UTC+12)
{ 0, SLEEP_TIMING_TIME(8, 30), SLEEP_TIMING_TIME(15, 59), 10800 }, ///< 3 hours between 20:30 and 16:00 UTC (20:30 to 04:00 UTC+12)
// Sleep timings while moving
{ SLEEP_TIMING_MIN_MOVING_VELOCITY, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 540 }, ///< 540 seconds when speed > SLEEP_TIMING_MIN_MOVING_VELOCITY (5km/h)


+ 4
- 21
src/config/System.h View File

@@ -1,26 +1,9 @@
#pragma once
/**
\def CONFIG_ADDR
Address of the config block in the I2C EEPROM chip.
*/
#define CONFIG_ADDR 0
/**
\def CONFIG_RESERVED_SIZE
Reserved size for the config block in the I2C EEPROM chip.
*/
#define CONFIG_RESERVED_SIZE 128
/**
\def CONFIG_SEED
Seed use to detect invalid or outdate configuration data.
Changing this value will reset the configuration block.
*/
#define CONFIG_SEED 14
/**
\def VERSION
Version string, only used for indicative purpose
*/
#define VERSION "1.41"
#define CONFIG_ADDR 0 ///< Address of the config block in the I2C EEPROM chip.
#define CONFIG_RESERVED_SIZE 128 ///< Reserved size for the config block in the I2C EEPROM chip.
#define CONFIG_SEED 14 ///< Seed use to detect invalid or outdate configuration data.
#define VERSION "1.42" /// Version string, only used for indicative purpose.
/**


+ 17
- 0
src/config/User.h View File

@@ -0,0 +1,17 @@
#pragma once
/**
* Holds all the sensitive data. Provided values are example only.
* Changes values according to your setup. This file changes are untracked so data
* will never go further than your local working copy.
*/
#include "Sensitive.h"
/**
* Copy and uncomment the following lines to a new User.h file. Edit the values according to your setup
*/
// #pragma once
// #define POSITIONS_CONFIG_NET_URL "http://yourserver.com/endpoint" ///< URL to which positions data will be send through an HTTP POST request.
// #define CONFIG_CONTACT_PHONE "+642568452" ///< Phone number to send the alert SMS to.

Loading…
Cancel
Save