Improve tps error message (#1244)

* improve error messages

* fix

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-04-02 05:02:44 -07:00 committed by GitHub
parent 0edb791cff
commit 8151793ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -123,6 +123,12 @@ public:
*/
static void resetAllMocks();
/*
* Get a friendly name for the sensor.
* For example, CLT, IAT, Throttle Position 2, etc.
*/
const char* getSensorName() { return getSensorName(m_type); }
protected:
// Protected constructor - only subclasses call this
explicit Sensor(SensorType type)

View File

@ -47,7 +47,7 @@ static void initTpsFunc(LinearFunc& func, FunctionalSensor& sensor, adc_channel_
AdcSubscription::SubscribeSensor(sensor, channel);
if (!sensor.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate TPS registration for TPS sensor");
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for sensor \"%s\"", sensor.getSensorName());
}
}
@ -64,7 +64,7 @@ void initTps() {
}
if (!driverIntent.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate TPS registration for TPS sensor");
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for driver acc intent sensor");
}
}