Skip to content

Commit

Permalink
max3185x: show device type
Browse files Browse the repository at this point in the history
  • Loading branch information
dron0gus committed Mar 12, 2024
1 parent 05d744b commit a65ce5f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion firmware/hw_layer/sensors/max3185x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class Max3185xRead final : public ThreadController<UTILITY_THREAD_STACK_SIZE> {
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.
Expand Down Expand Up @@ -152,7 +153,7 @@ class Max3185xRead final : public ThreadController<UTILITY_THREAD_STACK_SIZE> {
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);
Expand Down Expand Up @@ -205,6 +206,17 @@ class Max3185xRead final : public ThreadController<UTILITY_THREAD_STACK_SIZE> {
}
}

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];
Expand Down

0 comments on commit a65ce5f

Please sign in to comment.