Moved SCL to GPIO4 because boot fails if it's connected to GPIO12

Added temperature and altitude to data logger
Added periodic log flush to avoid data loss
This commit is contained in:
Youen Toupin 2022-03-31 22:06:38 +02:00
parent a91d56c390
commit 9700b9f9e1
7 changed files with 86293 additions and 86282 deletions

View File

@ -72,6 +72,13 @@ void DataLogger::log(unsigned long timeMilliseconds, const Entry& entry)
sprintf(line, "%.3f,%.3f,%.3f,%.3f,%.1f,%.1f\n", currentTime, entry.speed, entry.batteryVoltage, entry.batteryOutputCurrent, entry.temperature, entry.altitude);
file.print(line);
if(currentTime >= lastFlushTime + 10.0f)
{
// we need to flush often enough, because the system is typically powered off right after arrival to destination
file.flush();
lastFlushTime = currentTime;
}
lastEntry = entry;
lastLogTime = currentTime;
}

View File

@ -44,6 +44,7 @@ private:
unsigned long lastTimeMilliseconds = -1;
float currentTime = 0.0f;
float lastLogTime = 0.0f;
float lastFlushTime = 0.0f;
File file; // @suppress("Abstract class cannot be instantiated")
};

View File

@ -27,7 +27,7 @@ Dps310 pressureSensor = Dps310();
const int8_t speedSensorPin = 13;
const int8_t debugLedPin = 2;
const int8_t I2C_SDA = 15;
const int8_t I2C_SCL = 12;
const int8_t I2C_SCL = 4;
const float wheelDiameterInches = 20;
const int numImpulsesPerTurn = 2;
@ -383,6 +383,8 @@ void loop()
entry.batteryVoltage = (float)batteryVoltage / 1000.0f;
entry.batteryOutputCurrent = (float)batteryOutputCurrent / 1000.0f;
entry.speed = getSpeed();
entry.temperature = (float)temperature / 10.0f;
entry.altitude = (float)altitude / 1000.0f;
if(entry.speed > 0.0f)
{

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "Toutes Couches",
"active_layer_preset": "All Layers",
"auto_track_width": true,
"hidden_nets": [],
"high_contrast_mode": 0,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff