Quellcode durchsuchen

Improved gprs activation in NetworkPositionsBackup

tags/v1.2.0
Bertrand Lemasle vor 7 Jahren
Ursprung
Commit
7a9987c78a
4 geänderte Dateien mit 18 neuen und 24 gelöschten Zeilen
  1. +2
    -2
      GpsTracker/Config.h
  2. +12
    -17
      GpsTracker/NetworkPositionsBackup.cpp
  3. +3
    -4
      GpsTracker/Positions.cpp
  4. +1
    -1
      GpsTracker/Rtc.cpp

+ 2
- 2
GpsTracker/Config.h Datei anzeigen

@@ -21,8 +21,8 @@
#define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000
#define GPS_DEFAULT_TOTAL_TIMEOUT_MS 180000

#define NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 2000
#define NETWORK_DEFAULT_TOTAL_TIMEOUT_MS 60000
#define NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 6000
#define NETWORK_DEFAULT_TOTAL_TIMEOUT_MS 1800000

struct sleepTimings_t {
uint8_t speed;


+ 12
- 17
GpsTracker/NetworkPositionsBackup.cpp Datei anzeigen

@@ -48,30 +48,25 @@ namespace positions {
PositionEntry currentEntry;
SIM808RegistrationStatus networkStatus;

hardware::i2c::powerOn();
network::powerOn();
networkStatus = network::waitForRegistered(NETWORK_DEFAULT_TOTAL_TIMEOUT_MS);

if (!network::isAvailable(networkStatus.stat)) {
VERBOSE_MSG("appendPositions", "network unavailable");
return;
}

if (!network::enableGprs()) {
VERBOSE_MSG("appendPositions", "gprs unavailable");
return;
}
if (!network::isAvailable(networkStatus.stat)) VERBOSE_MSG("appendPositions", "network unavailable");
else if (!network::enableGprs()) VERBOSE_MSG("appendPositions", "gprs unavailable");
else {
/*hardware::i2c::powerOn();
do {
if (!positions::get(currentEntryIndex, currentEntry)) break;
if (!appendPosition(config, currentEntry)) break;

do {
if (!positions::get(currentEntryIndex, currentEntry)) break;
if (!appendPosition(config, currentEntry)) break;
config.network.lastSavedEntry = currentEntryIndex;
config::main::set(config);

config.network.lastSavedEntry = currentEntryIndex;
config::main::set(config);
} while (positions::moveNext(currentEntryIndex));
hardware::i2c::powerOff(); */
}

} while (positions::moveNext(currentEntryIndex));
network::powerOff();
hardware::i2c::powerOff();
}

}


+ 3
- 4
GpsTracker/Positions.cpp Datei anzeigen

@@ -41,14 +41,13 @@ namespace positions {

#if BACKUP_ENABLE_SDCARD
_backups[backupIdx] = new backup::sd::SdPositionsBackup();
_backups[backupIdx++]->setup();
_backups[backupIdx]->setup();
backupIdx++;
#endif
#if BACKUP_ENABLE_NETWORK
_backups[backupIdx] = new backup::net::NetworkPositionsBackup();
_backups[backupIdx]->setup();
//_backups[backupIdx]->backup();
backupIdx++;

#endif
#endif
}
@@ -140,7 +139,7 @@ namespace positions {
void doBackup() {
#ifdef BACKUPS_ENABLED
VERBOSE_FORMAT("doBackup", "%d backups enabled", BACKUPS_ENABLED);
Serial.println((unsigned int)_backups[0], HEX);
_backups[0]->backup();

/*for (int i = 0; i < BACKUPS_ENABLED; i++) {


+ 1
- 1
GpsTracker/Rtc.cpp Datei anzeigen

@@ -17,7 +17,7 @@ namespace rtc {
hardware::i2c::powerOn();
RTC.control(DS3231_12H, DS3231_OFF); //24 hours clock
RTC.control(DS3231_A1_INT_ENABLE, DS3231_OFF); //Alarm 1 OFF
RTC.control(DS3231_INT_ENABLE, DS3231_ON); //INTCN OFF
RTC.control(DS3231_INT_ENABLE, DS3231_ON); //INTCN ON
hardware::i2c::powerOff();

//TODO : check wether the osc has been halted (meaning the battery could be dead)


Laden…
Abbrechen
Speichern