consolidate (#1728)

This commit is contained in:
Matthew Kennedy 2020-08-24 05:10:58 -07:00 committed by GitHub
parent 5f5a16867a
commit 3decf8241a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 19 deletions

View File

@ -25,9 +25,3 @@ SensorResult LinearFunc::convert(float inputValue) const {
return result;
}
void LinearFunc::showInfo(Logging* logger, float testRawValue) const {
scheduleMsg(logger, " Linear function slope: %.2f offset: %.2f min: %.1f max: %.1f", m_a, m_b, m_minOutput, m_maxOutput);
const auto [valid, value] = convert(testRawValue);
scheduleMsg(logger, " raw value %.2f converts to %.2f valid: %d", testRawValue, value, valid);
}

View File

@ -3,7 +3,6 @@
*/
#include "resistance_func.h"
#include "loggingcentral.h"
void ResistanceFunc::configure(float supplyVoltage, float pullupResistor) {
m_pullupResistor = pullupResistor;
@ -26,8 +25,3 @@ SensorResult ResistanceFunc::convert(float raw) const {
return resistance;
}
void ResistanceFunc::showInfo(Logging* logger, float testInputValue) const {
const auto result = convert(testInputValue);
scheduleMsg(logger, " %.2f volts -> %.1f ohms with supply voltage %.2f and pullup %.1f.", testInputValue, result.Value, m_supplyVoltage, m_pullupResistor);
}

View File

@ -6,7 +6,6 @@
#include "thermistors.h"
#include "loggingcentral.h"
#include <math.h>
SensorResult ThermistorFunc::convert(float ohms) const {
@ -46,8 +45,3 @@ void ThermistorFunc::configure(thermistor_conf_s &cfg) {
m_b = u2 - m_c * (l1 * l1 + l1 * l2 + l2 * l2);
m_a = y1 - (m_b + l1 * l1 * m_c) * l1;
}
void ThermistorFunc::showInfo(Logging* logger, float testInputValue) const {
const auto [valid, value] = convert(testInputValue);
scheduleMsg(logger, " %.1f ohms -> valid: %d. %.1f deg C", testInputValue, valid, value);
}

View File

@ -2,6 +2,9 @@
#include "proxy_sensor.h"
#include "functional_sensor.h"
#include "redundant_sensor.h"
#include "linear_func.h"
#include "resistance_func.h"
#include "thermistor_func.h"
#include "efilib.h"
#include "loggingcentral.h"
@ -29,5 +32,21 @@ void CanSensorBase::showInfo(Logging* logger, const char* sensorName) const {
#endif // EFI_CAN_SUPPORT
void RedundantSensor::showInfo(Logging* logger, const char* sensorName) const {
scheduleMsg(logger, "Redundant sensor \"%s\" combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second));
scheduleMsg(logger, "Sensor \"%s\" is redundant combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second));
}
void LinearFunc::showInfo(Logging* logger, float testRawValue) const {
scheduleMsg(logger, " Linear function slope: %.2f offset: %.2f min: %.1f max: %.1f", m_a, m_b, m_minOutput, m_maxOutput);
const auto [valid, value] = convert(testRawValue);
scheduleMsg(logger, " raw value %.2f converts to %.2f valid: %d", testRawValue, value, valid);
}
void ResistanceFunc::showInfo(Logging* logger, float testInputValue) const {
const auto result = convert(testInputValue);
scheduleMsg(logger, " %.2f volts -> %.1f ohms with supply voltage %.2f and pullup %.1f.", testInputValue, result.Value, m_supplyVoltage, m_pullupResistor);
}
void ThermistorFunc::showInfo(Logging* logger, float testInputValue) const {
const auto [valid, value] = convert(testInputValue);
scheduleMsg(logger, " %.1f ohms -> valid: %d. %.1f deg C", testInputValue, valid, value);
}