From fe618d0b854a200dec5ce670e24dc92587735464 Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Fri, 6 Oct 2023 19:11:11 +0100 Subject: [PATCH] Add getModeName() Add facility to get the name of the track mode --- .gitignore | 1 + TrackManager.cpp | 22 +++++++++++++++++++++- TrackManager.h | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6237359..482da70 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ myFilter.cpp my*.h !my*.example.h compile_commands.json +newcode.txt.old diff --git a/TrackManager.cpp b/TrackManager.cpp index bab202d..3ea9877 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -556,4 +556,24 @@ bool TrackManager::isProg(byte t) { if (track[t]->getMode()==TRACK_MODE_PROG) return true; return false; -} \ No newline at end of file +} + +byte TrackManager::returnMode(byte t) { + return (track[t]->getMode()); +} + +static const char* TrackManager::getModeName(byte Mode) { + + //DIAG(F("PowerMode %d"), Mode); + +switch (Mode) + { + case 1: return "NONE"; + case 2: return "MAIN"; + case 4: return "PROG"; + case 8: return "DC"; + case 16: return "DCX"; + case 32: return "EXT"; + default: return "----"; + } +} diff --git a/TrackManager.h b/TrackManager.h index 21b8d59..486057a 100644 --- a/TrackManager.h +++ b/TrackManager.h @@ -90,6 +90,8 @@ class TrackManager { static void streamTrackState(Print* stream, byte t); static bool isPowerOn(byte t); static bool isProg(byte t); + static byte returnMode(byte t); + static const char* getModeName(byte Mode); static int16_t joinRelay; static bool progTrackSyncMain; // true when prog track is a siding switched to main