Browse Source

Removed storage namespace

tags/v1.2.0
Bertrand Lemasle 7 years ago
parent
commit
61195dc635
3 changed files with 4 additions and 27 deletions
  1. +4
    -5
      GpsTracker/Positions.cpp
  2. +0
    -7
      GpsTracker/Storage.cpp
  3. +0
    -15
      GpsTracker/Storage.h

+ 4
- 5
GpsTracker/Positions.cpp View File

@@ -4,7 +4,6 @@
#include "Config.h" #include "Config.h"
#include "Gps.h" #include "Gps.h"
#include "Network.h" #include "Network.h"
#include "Storage.h"


#define LOGGER_NAME "Positions" #define LOGGER_NAME "Positions"


@@ -27,7 +26,7 @@ namespace positions {
PositionEntry entry = { battery, gpsStatus }; PositionEntry entry = { battery, gpsStatus };
strlcpy(entry.position, gps::lastPosition, POSITION_SIZE); strlcpy(entry.position, gps::lastPosition, POSITION_SIZE);


storage::powerOn();
hardware::i2c::powerOn();
Config config = config::get(); Config config = config::get();
config.lastEntry++; config.lastEntry++;
@@ -41,7 +40,7 @@ namespace positions {
VERBOSE_FORMAT("appendLast", "Written to EEPROM @ %X : [%d%% @ %dmV] [%d, %s]", entryAddress, battery.level, battery.voltage, gpsStatus, entry.position); VERBOSE_FORMAT("appendLast", "Written to EEPROM @ %X : [%d%% @ %dmV] [%d, %s]", entryAddress, battery.level, battery.voltage, gpsStatus, entry.position);
config::set(config); config::set(config);
storage::powerOff();
hardware::i2c::powerOff();
} }


bool get(uint16_t index, PositionEntry &entry) { bool get(uint16_t index, PositionEntry &entry) {
@@ -50,9 +49,9 @@ namespace positions {


VERBOSE_FORMAT("get", "Reading entry n°%d @ %X", index, entryAddress); VERBOSE_FORMAT("get", "Reading entry n°%d @ %X", index, entryAddress);


storage::powerOn();
hardware::i2c::powerOn();
hardware::i2c::eeprom.readBlock(entryAddress, entry); hardware::i2c::eeprom.readBlock(entryAddress, entry);
storage::powerOff();
hardware::i2c::powerOff();


VERBOSE_FORMAT("get", "Read from EEPROM @ %X : [%d%% @ %dmV] [%d, %s]", entryAddress, entry.battery.level, entry.battery.voltage, entry.status, entry.position); VERBOSE_FORMAT("get", "Read from EEPROM @ %X : [%d%% @ %dmV] [%d, %s]", entryAddress, entry.battery.level, entry.battery.voltage, entry.status, entry.position);
return true; return true;


+ 0
- 7
GpsTracker/Storage.cpp View File

@@ -1,7 +0,0 @@
#include "Storage.h"
#include "Gps.h"

#define LOGGER_NAME "Storage"

namespace storage {
}

+ 0
- 15
GpsTracker/Storage.h View File

@@ -1,15 +0,0 @@
#pragma once

#include "Hardware.h"

namespace storage {
inline void powerOn() {
hardware::i2c::powerOn();
}

inline void powerOff() {
hardware::i2c::powerOff();
}


}

Loading…
Cancel
Save