From 199d4b38732d00380e40f8d2065a279b526398f5 Mon Sep 17 00:00:00 2001 From: you69man Date: Fri, 8 Dec 2023 15:49:12 +0100 Subject: [PATCH] use mChList[] instead of switch-case (cherry picked from commit fdaf80e964a6ecb2423b0c1d8d03bb0184904ab8) (cherry picked from commit 48c832be5eb05a96204fa1ec70fdf198e06ac94d) (cherry picked from commit effe05a616615d709455d32c46c2254c8cfe399e) --- src/hm/Heuristic.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/hm/Heuristic.h b/src/hm/Heuristic.h index cc42df4f..59c35aec 100644 --- a/src/hm/Heuristic.h +++ b/src/hm/Heuristic.h @@ -217,15 +217,12 @@ class Heuristic { } inline uint8_t id2Ch(uint8_t id) { - switch(id) { - case 0: return 3; - case 1: return 23; - case 2: return 40; - case 3: return 61; - case 4: return 75; - } - return 3; // standard + if (id < RF_MAX_CHANNEL_ID) + return mChList[id]; + else + return 3; // standard } + uint8_t mChList[RF_MAX_CHANNEL_ID] = {03, 23, 40, 61, 75}; };