From c732810543217af5c3f4fb1cf3a8c11f97a49351 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 25 Aug 2024 16:44:28 -0400 Subject: [PATCH] mcFaultToString --- pt2001/include/rusefi/pt2001.h | 2 ++ pt2001/src/pt2001.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) 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