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:
parent
a91d56c390
commit
9700b9f9e1
@ -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);
|
sprintf(line, "%.3f,%.3f,%.3f,%.3f,%.1f,%.1f\n", currentTime, entry.speed, entry.batteryVoltage, entry.batteryOutputCurrent, entry.temperature, entry.altitude);
|
||||||
file.print(line);
|
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;
|
lastEntry = entry;
|
||||||
lastLogTime = currentTime;
|
lastLogTime = currentTime;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ private:
|
|||||||
unsigned long lastTimeMilliseconds = -1;
|
unsigned long lastTimeMilliseconds = -1;
|
||||||
float currentTime = 0.0f;
|
float currentTime = 0.0f;
|
||||||
float lastLogTime = 0.0f;
|
float lastLogTime = 0.0f;
|
||||||
|
float lastFlushTime = 0.0f;
|
||||||
|
|
||||||
File file; // @suppress("Abstract class cannot be instantiated")
|
File file; // @suppress("Abstract class cannot be instantiated")
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@ Dps310 pressureSensor = Dps310();
|
|||||||
const int8_t speedSensorPin = 13;
|
const int8_t speedSensorPin = 13;
|
||||||
const int8_t debugLedPin = 2;
|
const int8_t debugLedPin = 2;
|
||||||
const int8_t I2C_SDA = 15;
|
const int8_t I2C_SDA = 15;
|
||||||
const int8_t I2C_SCL = 12;
|
const int8_t I2C_SCL = 4;
|
||||||
|
|
||||||
const float wheelDiameterInches = 20;
|
const float wheelDiameterInches = 20;
|
||||||
const int numImpulsesPerTurn = 2;
|
const int numImpulsesPerTurn = 2;
|
||||||
@ -383,6 +383,8 @@ void loop()
|
|||||||
entry.batteryVoltage = (float)batteryVoltage / 1000.0f;
|
entry.batteryVoltage = (float)batteryVoltage / 1000.0f;
|
||||||
entry.batteryOutputCurrent = (float)batteryOutputCurrent / 1000.0f;
|
entry.batteryOutputCurrent = (float)batteryOutputCurrent / 1000.0f;
|
||||||
entry.speed = getSpeed();
|
entry.speed = getSpeed();
|
||||||
|
entry.temperature = (float)temperature / 10.0f;
|
||||||
|
entry.altitude = (float)altitude / 1000.0f;
|
||||||
|
|
||||||
if(entry.speed > 0.0f)
|
if(entry.speed > 0.0f)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"board": {
|
"board": {
|
||||||
"active_layer": 0,
|
"active_layer": 0,
|
||||||
"active_layer_preset": "Toutes Couches",
|
"active_layer_preset": "All Layers",
|
||||||
"auto_track_width": true,
|
"auto_track_width": true,
|
||||||
"hidden_nets": [],
|
"hidden_nets": [],
|
||||||
"high_contrast_mode": 0,
|
"high_contrast_mode": 0,
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user