From b848a819b4fc95483d55f7ff5b6747f9805ecf99 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Thu, 28 Jul 2022 09:46:19 -0400 Subject: [PATCH] HOW to configure CAN-based accelerator pedal #4369 --- firmware/init/sensor/init_tps.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/firmware/init/sensor/init_tps.cpp b/firmware/init/sensor/init_tps.cpp index 93fe3f6d5d..f163d472cd 100644 --- a/firmware/init/sensor/init_tps.cpp +++ b/firmware/init/sensor/init_tps.cpp @@ -91,6 +91,12 @@ public: } void init(bool isFordTps, RedundantFordTps* fordTps, const TpsConfig& primary, const TpsConfig& secondary) { + bool hasFirst = m_pri.init(primary); + if (!hasFirst) { + // no input if we have no first channel + return; + } + { // Check that the primary and secondary aren't too close together - if so, the user may have done // an unsafe thing where they wired a single sensor to both inputs. Don't do that! @@ -104,8 +110,6 @@ public: } } - m_pri.init(primary); - bool hasSecond = m_sec.init(secondary); if (isFordTps && fordTps) {