move temperature correction factor
This commit is contained in:
parent
7a4017cfd8
commit
adf154db23
4 changed files with 13 additions and 13 deletions
|
@ -115,6 +115,11 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// e.g. PineTab outputs an integer in centi-centigrade
|
||||||
|
// Note that the formatter in the QML page, and the logger divide by 10 again!
|
||||||
|
if(temperatureFile->fileName().contains(QStringLiteral("xp20x-battery"))) {
|
||||||
|
tempCorrectionFactor = 10.0;
|
||||||
|
}
|
||||||
|
|
||||||
logL("Battery temperature file: " + (temperatureFile ? temperatureFile->fileName() : notFound));
|
logL("Battery temperature file: " + (temperatureFile ? temperatureFile->fileName() : notFound));
|
||||||
|
|
||||||
|
@ -243,12 +248,6 @@ void Battery::updateData()
|
||||||
healthFile->close();
|
healthFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// e.g. PineTab outputs an integer in centi-centigrade
|
|
||||||
// Note that the formatter in the QML page, and the logger divide by 10 again!
|
|
||||||
float tempCorrectionFactor = 1.0 ;
|
|
||||||
if(temperatureFile->fileName().contains(QStringLiteral("xp20x-battery"))) {
|
|
||||||
tempCorrectionFactor = 10.0 ;
|
|
||||||
}
|
|
||||||
if(temperatureFile && temperatureFile->open(QIODevice::ReadOnly)) {
|
if(temperatureFile && temperatureFile->open(QIODevice::ReadOnly)) {
|
||||||
nextTemperature = temperatureFile->readLine().trimmed().toInt() / tempCorrectionFactor;
|
nextTemperature = temperatureFile->readLine().trimmed().toInt() / tempCorrectionFactor;
|
||||||
if(nextTemperature != temperature) {
|
if(nextTemperature != temperature) {
|
||||||
|
|
|
@ -85,6 +85,7 @@ private:
|
||||||
|
|
||||||
QString health = "unknown"; // Good, warm, overheat. Might have Cold or Overvoltage depending on driver
|
QString health = "unknown"; // Good, warm, overheat. Might have Cold or Overvoltage depending on driver
|
||||||
int temperature = 0x7FFFFFFF; // This value means "unknown" (32-bit INT_MAX)
|
int temperature = 0x7FFFFFFF; // This value means "unknown" (32-bit INT_MAX)
|
||||||
|
float tempCorrectionFactor = 1.0; // PineTab outputs an integer in centi-centigrade
|
||||||
|
|
||||||
int enableChargingValue = 1;
|
int enableChargingValue = 1;
|
||||||
int disableChargingValue = 0;
|
int disableChargingValue = 0;
|
||||||
|
@ -99,7 +100,6 @@ private:
|
||||||
QString nextState = state;
|
QString nextState = state;
|
||||||
bool nextChargingEnabled = chargingEnabled;
|
bool nextChargingEnabled = chargingEnabled;
|
||||||
|
|
||||||
|
|
||||||
QString nextHealth = health;
|
QString nextHealth = health;
|
||||||
int nextTemperature = temperature;
|
int nextTemperature = temperature;
|
||||||
|
|
||||||
|
|
|
@ -168,6 +168,12 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// e.g. PineTab outputs an integer in centi-centigrade
|
||||||
|
// Note that the formatter in the QML page, and the logger divide by 10 again!
|
||||||
|
if(temperatureFile->fileName().contains(QStringLiteral("xp20x-battery"))) {
|
||||||
|
tempCorrectionFactor = 10.0;
|
||||||
|
}
|
||||||
|
|
||||||
logL("Battery temperature file: " + (temperatureFile ? temperatureFile->fileName() : notFound));
|
logL("Battery temperature file: " + (temperatureFile ? temperatureFile->fileName() : notFound));
|
||||||
|
|
||||||
// String: health state
|
// String: health state
|
||||||
|
@ -323,12 +329,6 @@ void Battery::updateData()
|
||||||
stateFile->close();
|
stateFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// e.g. PineTab outputs an integer in centi-centigrade
|
|
||||||
// Note that the formatter in the QML page, and the logger divide by 10 again!
|
|
||||||
float tempCorrectionFactor = 1.0 ;
|
|
||||||
if(temperatureFile->fileName().contains(QStringLiteral("xp20x-battery"))) {
|
|
||||||
tempCorrectionFactor = 10.0 ;
|
|
||||||
}
|
|
||||||
if(temperatureFile && temperatureFile->open(QIODevice::ReadOnly)) {
|
if(temperatureFile && temperatureFile->open(QIODevice::ReadOnly)) {
|
||||||
nextTemperature = temperatureFile->readLine().trimmed().toInt() / tempCorrectionFactor;
|
nextTemperature = temperatureFile->readLine().trimmed().toInt() / tempCorrectionFactor;
|
||||||
if(nextTemperature != temperature) {
|
if(nextTemperature != temperature) {
|
||||||
|
|
|
@ -121,6 +121,7 @@ private:
|
||||||
QString nextState = state;
|
QString nextState = state;
|
||||||
bool nextChargingEnabled = chargingEnabled;
|
bool nextChargingEnabled = chargingEnabled;
|
||||||
int nextTemperature = temperature;
|
int nextTemperature = temperature;
|
||||||
|
float tempCorrectionFactor = 1.0;
|
||||||
QString nextHealth = health;
|
QString nextHealth = health;
|
||||||
|
|
||||||
QFileDevice::Permissions originalPerms; // Updated in constructor
|
QFileDevice::Permissions originalPerms; // Updated in constructor
|
||||||
|
|
Loading…
Reference in a new issue