From e596fc5a479750a5383d557e34f1629c25866a81 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 18 Jun 2024 02:24:42 +0200 Subject: [PATCH] fix: customisable switch custom name not displayed (#5193) --- radio/src/switches.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index 384d2dcd02e..cf475f8b067 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -316,7 +316,12 @@ void switchSetCustomName(uint8_t idx, const char* str, size_t len) const char* switchGetCustomName(uint8_t idx) { - return _switchNames[idx]; +#if defined(FUNCTION_SWITCHES) + if (idx >= switchGetMaxSwitches()) // Switch is a customisable switch + return g_model.switchNames[idx - switchGetMaxSwitches()]; + else +#endif + return _switchNames[idx]; } bool switchHasCustomName(uint8_t idx)