From 8972fedb4151ad0bd5b36740043987aea82653dc Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Wed, 13 Mar 2024 01:03:37 +0300 Subject: [PATCH] max3185x: show device type --- firmware/hw_layer/sensors/max3185x.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/firmware/hw_layer/sensors/max3185x.cpp b/firmware/hw_layer/sensors/max3185x.cpp index b39ca9058d..90b4e21cab 100644 --- a/firmware/hw_layer/sensors/max3185x.cpp +++ b/firmware/hw_layer/sensors/max3185x.cpp @@ -67,6 +67,7 @@ public: auto& sensor = egtSensors[i]; m_cs[i] = Gpio::Invalid; + types[i] = UNKNOWN_TYPE; // If there's already another (CAN?) EGT sensor configured, // don't configure this one. @@ -152,7 +153,7 @@ public: float temp, refTemp; Max3185xState code = getMax3185xEgtValues(i, &temp, &refTemp); - efiPrintf("egt%d: code=%d (%s)", i + 1, code, getMax3185xErrorCodeName(code)); + efiPrintf("egt%d: type %s, code=%d (%s)", i + 1, getMax3185xTypeName(types[i]), code, getMax3185xErrorCodeName(code)); if (code == MAX3185X_OK) { efiPrintf(" temperature %.4f reference temperature %.2f", temp, refTemp); @@ -205,6 +206,17 @@ private: } } + const char *getMax3185xTypeName(Max3185xType type) { + switch (type) { + case MAX31855_TYPE: + return "max31855"; + case MAX31856_TYPE: + return "max31856"; + default: + return "unknown"; + } + } + int spi_txrx(size_t ch, uint8_t tx[], uint8_t rx[], size_t n) { brain_pin_e cs = m_cs[ch];