Merge PR #6: Fix energy logs sometimes resetting to 0 on reboots
commit
a56776e0d3
|
|
@ -325,7 +325,7 @@ void EnergyLogger::sample()
|
||||||
medianAcquisition /= sampleStart.msecsTo(sampleEnd);
|
medianAcquisition /= sampleStart.msecsTo(sampleEnd);
|
||||||
medianStorage /= sampleStart.msecsTo(sampleEnd);
|
medianStorage /= sampleStart.msecsTo(sampleEnd);
|
||||||
|
|
||||||
PowerBalanceLogEntry newest = m_balanceLiveLog.count() > 0 ? m_balanceLiveLog.at(0) : PowerBalanceLogEntry();
|
PowerBalanceLogEntry newest = latestLogEntry(SampleRateAny);
|
||||||
double totalConsumption = newest.totalConsumption();
|
double totalConsumption = newest.totalConsumption();
|
||||||
double totalProduction = newest.totalProduction();
|
double totalProduction = newest.totalProduction();
|
||||||
double totalAcquisition = newest.totalAcquisition();
|
double totalAcquisition = newest.totalAcquisition();
|
||||||
|
|
@ -351,7 +351,7 @@ void EnergyLogger::sample()
|
||||||
}
|
}
|
||||||
medianPower /= sampleStart.msecsTo(sampleEnd);
|
medianPower /= sampleStart.msecsTo(sampleEnd);
|
||||||
|
|
||||||
ThingPowerLogEntry newest = entries.count() > 0 ? entries.first() : ThingPowerLogEntry();
|
ThingPowerLogEntry newest = latestLogEntry(SampleRateAny, thingId);
|
||||||
double totalConsumption = newest.totalConsumption();
|
double totalConsumption = newest.totalConsumption();
|
||||||
double totalProduction = newest.totalProduction();
|
double totalProduction = newest.totalProduction();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ EnergyManager::EnergyError EnergyManagerImpl::setRootMeter(const ThingId &rootMe
|
||||||
m_rootMeter = rootMeter;
|
m_rootMeter = rootMeter;
|
||||||
|
|
||||||
QSettings settings(NymeaSettings::settingsPath() + "/energy.conf", QSettings::IniFormat);
|
QSettings settings(NymeaSettings::settingsPath() + "/energy.conf", QSettings::IniFormat);
|
||||||
settings.setValue("rootMeterThingId", rootMeter->id());
|
settings.setValue("rootMeterThingId", rootMeter->id().toString());
|
||||||
|
|
||||||
emit rootMeterChanged();
|
emit rootMeterChanged();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue