Переглянути джерело

Adjusted log level : verbose is really in a case of a hard debugging session

tags/v1.2.0
Bertrand Lemasle 7 роки тому
джерело
коміт
f687c9d11a
9 змінених файлів з 20 додано та 25 видалено
  1. +2
    -0
      GpsTracker/Config.cpp
  2. +0
    -1
      GpsTracker/Core.cpp
  3. +1
    -1
      GpsTracker/Gps.cpp
  4. +2
    -5
      GpsTracker/Hardware.cpp
  5. +1
    -1
      GpsTracker/MainUnit.cpp
  6. +2
    -1
      GpsTracker/Network.cpp
  7. +9
    -10
      GpsTracker/NetworkPositionsBackup.cpp
  8. +2
    -5
      GpsTracker/Positions.cpp
  9. +1
    -1
      GpsTracker/Rtc.cpp

+ 2
- 0
GpsTracker/Config.cpp Переглянути файл

@@ -13,6 +13,7 @@ namespace config {

void read() {
VERBOSE("read");

hardware::i2c::powerOn();
hardware::i2c::eeprom.readBlock(CONFIG_ADDR, value);
if (CONFIG_SEED != value.seed) reset(); //todo : reset network if seed for network is not right
@@ -53,6 +54,7 @@ namespace config {

void reset() {
VERBOSE("reset");

config_t config = {
CONFIG_SEED,
VERSION,


+ 0
- 1
GpsTracker/Core.cpp Переглянути файл

@@ -11,7 +11,6 @@ namespace core {
uint8_t increaseInARow = 0;

void main() {
VERBOSE("main");

PositionEntryMetadata metadata;
if (positions::acquire(metadata)) {


+ 1
- 1
GpsTracker/Gps.cpp Переглянути файл

@@ -68,6 +68,6 @@ namespace gps {
time.Minute = details::parseSubstring(buffer, timeStr + TIME_MINUTE_OFFSET, 2);
time.Second = details::parseSubstring(buffer, timeStr + TIME_SECOND_OFFSET, 2);

VERBOSE_FORMAT("getTime", "%d/%d/%d %d:%d:%d", tmYearToCalendar(time.Year), time.Month, time.Day, time.Hour, time.Minute, time.Second);
NOTICE_FORMAT("getTime", "%d/%d/%d %d:%d:%d", tmYearToCalendar(time.Year), time.Month, time.Day, time.Hour, time.Minute, time.Second);
}
}

+ 2
- 5
GpsTracker/Hardware.cpp Переглянути файл

@@ -42,7 +42,7 @@ namespace hardware {
}

void setup() {
VERBOSE("setup");
NOTICE("setup");
simSerial.begin(SIM808_BAUDRATE);
device.begin(simSerial);
powerOff(); //ensure powerOff on start
@@ -55,7 +55,7 @@ namespace hardware {
}

void gpsPowerOff() {
VERBOSE("gpsPowerOff");
NOTICE("gpsPowerOff");
device.disableGps();
powerOffIfUnused();
}
@@ -80,11 +80,8 @@ namespace hardware {
namespace i2c {

E24 eeprom = E24(E24Size_t::E24_512K);

uint8_t poweredCount = 0;

//inline void powered() { digitalRead(I2C_PWR) == HIGH; } //TODO = replace enum with just reading the output pin ?

void powerOn() {
if (!poweredCount) {
VERBOSE("powerOn");


+ 1
- 1
GpsTracker/MainUnit.cpp Переглянути файл

@@ -17,7 +17,7 @@ namespace mainunit {
void wokeUp() {
tmElements_t wokeUpTime;
rtc::getTime(wokeUpTime);
NOTICE_FORMAT("wokeUp", "%d:%d:%d", wokeUpTime.Hour, wokeUpTime.Minute, wokeUpTime.Second);
VERBOSE_FORMAT("wokeUp", "%d:%d:%d", wokeUpTime.Hour, wokeUpTime.Minute, wokeUpTime.Second);

hardware::sim808::simSerial.listen();
}


+ 2
- 1
GpsTracker/Network.cpp Переглянути файл

@@ -26,7 +26,7 @@ namespace network {
if (report.ssri < NETWORK_DEFAULT_NO_NETWORK_QUALIRY_THRESHOLD) noReliableNetwork++;
else noReliableNetwork = 0;
if (noReliableNetwork > NETWORK_DEFAULT_NO_NETWORK_TRIES) {
VERBOSE_MSG("waitForRegistered", "No signal");
NOTICE_MSG("waitForRegistered", "No reliable signal");
break; //after a while, not network really means no network. Bailing out
}

@@ -34,6 +34,7 @@ namespace network {
timeout -= NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS;
} while (timeout > 1);

NOTICE_FORMAT("waitForRegistered", "%d, [%d %ddBm]", currentStatus.stat, report.ssri, report.attenuation);
return currentStatus;
}



+ 9
- 10
GpsTracker/NetworkPositionsBackup.cpp Переглянути файл

@@ -25,8 +25,6 @@ namespace positions {
}

bool appendPosition(PositionEntry &entry) {
VERBOSE("appendPosition");

char buffer[BUFFER_SIZE];
snprintf(buffer, BUFFER_SIZE, "%d,%d,%d,%d,%d,%d,",
debug::freeRam(),
@@ -38,18 +36,20 @@ namespace positions {

strcat(buffer, entry.position);

return hardware::sim808::device.httpPost(
NOTICE_FORMAT("appendPosition", "Sending : %s", buffer);
uint16_t responseCode = hardware::sim808::device.httpPost(
config::main::value.network.url,
F("text/csv"),
buffer,
buffer,
BUFFER_SIZE
) == POSITIONS_CONFIG_NET_DEFAULT_EXPECTED_RESPONSE;

NOTICE_FORMAT("appendPosition", "Response : %d", responseCode);
return responseCode;
}

void appendPositions() {
VERBOSE("appendPositions");

uint16_t currentEntryIndex = config::main::value.network.lastSavedEntry + 1;
PositionEntry currentEntry;
SIM808RegistrationStatus networkStatus;
@@ -57,13 +57,12 @@ namespace positions {
network::powerOn();
networkStatus = network::waitForRegistered(NETWORK_DEFAULT_TOTAL_TIMEOUT_MS);

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

if (!appendPosition(currentEntry)) break;

config::main::value.network.lastSavedEntry = currentEntryIndex;
@@ -79,11 +78,11 @@ namespace positions {
}

void NetworkPositionsBackup::setup() {
VERBOSE("setup");
NOTICE("setup");
}

void NetworkPositionsBackup::backup() {
VERBOSE("backup");
NOTICE("backup");

if (!details::isBackupNeeded()) return;
details::appendPositions();


+ 2
- 5
GpsTracker/Positions.cpp Переглянути файл

@@ -64,7 +64,7 @@ namespace positions {
SIM808ChargingStatus battery = hardware::sim808::device.getChargingState();
gps::powerOff();

NOTICE_FORMAT("acquire", "status : %d", gpsStatus);
NOTICE_FORMAT("acquire", "Status : %d", gpsStatus);

if (gpsStatus < SIM808_GPS_STATUS::FIX) return false;

@@ -124,7 +124,7 @@ namespace positions {
hardware::i2c::eeprom.readBlock(entryAddress, entry);
hardware::i2c::powerOff();

VERBOSE_FORMAT("get", "Read from EEPROM @ %X : [%d%% @ %dmV] [%f°C] [TTF : %d, Status : %d, Position : %s]", entryAddress, entry.metadata.batteryLevel, entry.metadata.batteryVoltage, entry.metadata.temperature, entry.metadata.timeToFix, entry.metadata.status, entry.position);
NOTICE_FORMAT("get", "Read from EEPROM @ %X : [%d%% @ %dmV] [%f°C] [TTF : %d, Status : %d, Position : %s]", entryAddress, entry.metadata.batteryLevel, entry.metadata.batteryVoltage, entry.metadata.temperature, entry.metadata.timeToFix, entry.metadata.status, entry.position);
return true;
}

@@ -146,10 +146,7 @@ namespace positions {

void doBackup() {
#ifdef BACKUPS_ENABLED
VERBOSE_FORMAT("doBackup", "%d backups enabled", BACKUPS_ENABLED);

for (int i = 0; i < BACKUPS_ENABLED; i++) {
VERBOSE_FORMAT("doBackup", "calling backup %d", i);
_backups[i]->backup();
}
#endif


+ 1
- 1
GpsTracker/Rtc.cpp Переглянути файл

@@ -80,7 +80,7 @@ namespace rtc {
RTC.control(DS3231_A1_INT_ENABLE, DS3231_ON); //Alarm 1 ON
RTC.control(DS3231_INT_ENABLE, DS3231_ON); //INTCN ON

VERBOSE_FORMAT("setAlarm", "Next alarm : %d:%d:%d", time.Hour, time.Minute, time.Second);
NOTICE_FORMAT("setAlarm", "Next alarm : %d:%d:%d", time.Hour, time.Minute, time.Second);

hardware::i2c::powerOff();
}


Завантаження…
Відмінити
Зберегти