From 8151793ec73679558df33b11794a84b108416a04 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 2 Apr 2020 05:02:44 -0700 Subject: [PATCH] Improve tps error message (#1244) * improve error messages * fix Co-authored-by: Matthew Kennedy --- firmware/controllers/sensors/sensor.h | 6 ++++++ firmware/init/sensor/init_tps.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/firmware/controllers/sensors/sensor.h b/firmware/controllers/sensors/sensor.h index cda198a23f..b414a6cf35 100644 --- a/firmware/controllers/sensors/sensor.h +++ b/firmware/controllers/sensors/sensor.h @@ -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) diff --git a/firmware/init/sensor/init_tps.cpp b/firmware/init/sensor/init_tps.cpp index 70f64fef28..d353c97edd 100644 --- a/firmware/init/sensor/init_tps.cpp +++ b/firmware/init/sensor/init_tps.cpp @@ -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"); } }