diff --git a/pt2001/include/rusefi/pt2001.h b/pt2001/include/rusefi/pt2001.h index 7743061..61fcb63 100644 --- a/pt2001/include/rusefi/pt2001.h +++ b/pt2001/include/rusefi/pt2001.h @@ -26,6 +26,8 @@ enum class McFault : uint8_t UnderVoltage7 = 7, }; +const char * mcFaultToString(McFault fault); + class Pt2001Base { public: // Reinitialize the PT2001 chip, returns true if successful diff --git a/pt2001/src/pt2001.cpp b/pt2001/src/pt2001.cpp index 64f54b1..fe3d8c0 100644 --- a/pt2001/src/pt2001.cpp +++ b/pt2001/src/pt2001.cpp @@ -411,6 +411,18 @@ void Pt2001Base::downloadRegister(int r_target) { // initMc33816IfNeeded(); // } +const char * mcFaultToString(McFault fault) { + switch (fault) { + case McFault::NoComm: + return "NoComm"; + case McFault::UnderVoltageAfter: + return "UnderVoltageAfter"; + default: + return "TODO"; + } + return "TODO"; +} + void Pt2001Base::shutdown() { setDriveEN(false); // ensure HV is off setResetB(false); // turn off the chip