浏览代码

Updated GpsTracker with recent changes from sim808

(cherry picked from commit 275bc46688)
tags/v1.4.0^2
Bertrand Lemasle 6 年前
父节点
当前提交
816301be51
共有 9 个文件被更改,包括 17 次插入17 次删除
  1. +2
    -2
      src/Core.cpp
  2. +2
    -2
      src/Gps.cpp
  3. +1
    -1
      src/Gps.h
  4. +2
    -2
      src/Hardware.cpp
  5. +5
    -5
      src/Network.cpp
  6. +1
    -1
      src/Network.h
  7. +2
    -2
      src/NetworkPositionsBackup.cpp
  8. +1
    -1
      src/Positions.h
  9. +1
    -1
      src/config/System.h

+ 2
- 2
src/Core.cpp 查看文件

@@ -61,7 +61,7 @@ namespace core {
}
uint8_t notifyFailures(PositionEntryMetadata &metadata) {
SIM808RegistrationStatus networkStatus;
SIM808_NETWORK_REGISTRATION_STATE networkStatus;
char buffer[SMS_BUFFER_SIZE];
const __FlashStringHelper * backupFailureString = F(" Backup battery failure ?");
bool notified = false;
@@ -74,7 +74,7 @@ namespace core {
network::powerOn();
networkStatus = network::waitForRegistered(NETWORK_DEFAULT_TOTAL_TIMEOUT_MS);
if (network::isAvailable(networkStatus.stat)) {
if (network::isAvailable(networkStatus)) {
strncpy_P(buffer, PSTR("Alerts !"), SMS_BUFFER_SIZE);
if (bitRead(triggered, ALERT_BATTERY_LEVEL_1) || bitRead(triggered, ALERT_BATTERY_LEVEL_2)) {
details::appendToSmsBuffer(buffer, PSTR("\n- Battery at %d%%."), metadata.batteryLevel);


+ 2
- 2
src/Gps.cpp 查看文件

@@ -35,7 +35,7 @@ namespace gps {
SIM808_GPS_STATUS currentStatus = SIM808_GPS_STATUS::OFF;
do {
currentStatus = hardware::sim808::device.getGpsStatus(lastPosition);
currentStatus = hardware::sim808::device.getGpsStatus(lastPosition, GPS_POSITION_SIZE);
if (currentStatus > SIM808_GPS_STATUS::FIX) break; //if we have an accurate fix, break right now
NOTICE_FORMAT("acquireCurrentPosition", "%d", currentStatus);
@@ -90,7 +90,7 @@ namespace gps {
}
uint8_t getVelocity() {
uint8_t velocity;
int16_t velocity;
if (!hardware::sim808::device.getGpsField(lastPosition, SIM808_GPS_FIELD::SPEED, &velocity)) velocity = 0;
VERBOSE_FORMAT("getVelocity", "%d", velocity);


+ 1
- 1
src/Gps.h 查看文件

@@ -1,7 +1,7 @@
#pragma once
#include <Arduino.h>
#include <SIM808_Types.h>
#include <SIM808.Types.h>
#include "Hardware.h"
#include "Time2.h"


+ 2
- 2
src/Hardware.cpp 查看文件

@@ -59,7 +59,7 @@ namespace hardware {
//SIM808 turns phone on by default but we don't need it for gps only
device.setPhoneFunctionality(SIM808_PHONE_FUNCTIONALITY::MINIMUM);
}
device.enableGps();
device.powerOnOffGps(true);
}
void gpsPowerOff() {
@@ -74,7 +74,7 @@ namespace hardware {
}
VERBOSE("gpsPowerOff");
device.disableGps();
device.powerOnOffGps(false);
powerOffIfUnused();
}


+ 5
- 5
src/Network.cpp 查看文件

@@ -22,9 +22,9 @@ namespace network {
}
__attribute__((__optimize__("O2")))
SIM808RegistrationStatus waitForRegistered(uint32_t timeout, bool relativeToPowerOnTime = true) {
SIM808_NETWORK_REGISTRATION_STATE waitForRegistered(uint32_t timeout, bool relativeToPowerOnTime = true) {
SIM808RegistrationStatus currentStatus;
SIM808_NETWORK_REGISTRATION_STATE currentStatus;
SIM808SignalQualityReport report;
uint8_t noReliableNetwork = 0;
@@ -34,9 +34,9 @@ namespace network {
report = hardware::sim808::device.getSignalQuality();
do {
if (isAvailable(currentStatus.stat)) break;
if (isAvailable(currentStatus)) break;
NOTICE_FORMAT("waitForRegistered", "%d, [%d %ddBm]", currentStatus.stat, report.rssi, report.attenuation);
NOTICE_FORMAT("waitForRegistered", "%d, [%d %ddBm]", currentStatus, report.rssi, report.attenuation);
if (report.rssi < NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD) noReliableNetwork++;
else noReliableNetwork = 0;
@@ -52,7 +52,7 @@ namespace network {
report = hardware::sim808::device.getSignalQuality();
} while (timeout > 1);
NOTICE_FORMAT("waitForRegistered", "%d, [%d %ddBm]", currentStatus.stat, report.rssi, report.attenuation);
NOTICE_FORMAT("waitForRegistered", "%d, [%d %ddBm]", currentStatus, report.rssi, report.attenuation);
return currentStatus;
}


+ 1
- 1
src/Network.h 查看文件

@@ -8,7 +8,7 @@ namespace network {
void powerOn();
void powerOff();
SIM808RegistrationStatus waitForRegistered(uint32_t timeout, bool relativeToPowerOnTime = true);
SIM808_NETWORK_REGISTRATION_STATE waitForRegistered(uint32_t timeout, bool relativeToPowerOnTime = true);
bool isAvailable(SIM808_NETWORK_REGISTRATION_STATE state);
#if BACKUP_ENABLE_NETWORK
bool enableGprs();


+ 2
- 2
src/NetworkPositionsBackup.cpp 查看文件

@@ -57,7 +57,7 @@ namespace positions {
void NetworkPositionsBackup::appendPositions() {
uint16_t currentEntryIndex = config::main::value.network.lastSavedEntry + 1;
PositionEntry currentEntry;
SIM808RegistrationStatus networkStatus;
SIM808_NETWORK_REGISTRATION_STATE networkStatus;
//avoid edge case where if 0, whole set of positions will be sent again
if (!positions::count(config::main::value.network.lastSavedEntry)) return;
@@ -65,7 +65,7 @@ namespace positions {
network::powerOn();
networkStatus = network::waitForRegistered(NETWORK_DEFAULT_TOTAL_TIMEOUT_MS);
if (!network::isAvailable(networkStatus.stat) || !network::enableGprs()) {
if (!network::isAvailable(networkStatus) || !network::enableGprs()) {
networkUnavailableInARow = min(networkUnavailableInARow + 1, POSITIONS_CONFIG_NET_DEFAULT_UNAVAILABLE_NETWORK_POSTPONE_THRESHOLD + 1); //avoid increment overflow
NOTICE_MSG("appendPositions", "network or gprs unavailable");


+ 1
- 1
src/Positions.h 查看文件

@@ -1,7 +1,7 @@
#pragma once
#include <Arduino.h>
#include <SIM808_Types.h>
#include <SIM808.Types.h>
#define POSITION_SIZE 115


+ 1
- 1
src/config/System.h 查看文件

@@ -20,7 +20,7 @@
\def VERSION
Version string, only used for indicative purpose
*/
#define VERSION "1.30"
#define VERSION "1.40"
/**


正在加载...
取消
保存