From 7189d09d73ed18977437c2f5d6569a73be2981aa Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 30 Jan 2026 11:02:00 +0800 Subject: [PATCH] App: clean up duplicate ARRAY_SIZE macros --- App/app/fm.c | 4 ---- App/app/menu.c | 3 --- App/dcs.c | 5 +---- App/driver/bk1080.c | 4 ---- App/driver/bk4819.c | 5 +---- App/driver/bk4829.c | 6 +----- App/ui/helper.c | 3 --- 7 files changed, 3 insertions(+), 27 deletions(-) diff --git a/App/app/fm.c b/App/app/fm.c index 6ae37ebc..8bae8712 100644 --- a/App/app/fm.c +++ b/App/app/fm.c @@ -32,10 +32,6 @@ #include "ui/inputbox.h" #include "ui/ui.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - uint16_t gFM_Channels[FM_CHANNELS_MAX]; bool gFmRadioMode; uint8_t gFmRadioCountdown_500ms; diff --git a/App/app/menu.c b/App/app/menu.c index 453bc9c2..c5bad9e4 100644 --- a/App/app/menu.c +++ b/App/app/menu.c @@ -42,9 +42,6 @@ #include "ui/menu.h" #include "ui/ui.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif uint8_t gUnlockAllTxConfCnt; diff --git a/App/dcs.c b/App/dcs.c index ba668e81..655bbcb9 100644 --- a/App/dcs.c +++ b/App/dcs.c @@ -15,10 +15,7 @@ */ #include "dcs.h" - -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif +#include "misc.h" // CTCSS Hz * 10 const uint16_t CTCSS_Options[50] = { diff --git a/App/driver/bk1080.c b/App/driver/bk1080.c index 9f8376b1..13113494 100644 --- a/App/driver/bk1080.c +++ b/App/driver/bk1080.c @@ -20,10 +20,6 @@ #include "driver/system.h" #include "misc.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -#endif - static const uint16_t BK1080_RegisterTable[] = { 0x0008, 0x1080, 0x0201, 0x0000, 0x40C0, 0x0A1F, 0x002E, 0x02FF, diff --git a/App/driver/bk4819.c b/App/driver/bk4819.c index 89bf3df2..9cf50f90 100644 --- a/App/driver/bk4819.c +++ b/App/driver/bk4819.c @@ -19,6 +19,7 @@ #include #include "settings.h" +#include "misc.h" #include "audio.h" @@ -28,10 +29,6 @@ #include "driver/systick.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - #define PIN_CSN GPIO_MAKE_PIN(GPIOF, LL_GPIO_PIN_9) #define PIN_SCL GPIO_MAKE_PIN(GPIOB, LL_GPIO_PIN_8) #define PIN_SDA GPIO_MAKE_PIN(GPIOB, LL_GPIO_PIN_9) diff --git a/App/driver/bk4829.c b/App/driver/bk4829.c index 1af43bce..f0a3d72b 100644 --- a/App/driver/bk4829.c +++ b/App/driver/bk4829.c @@ -19,6 +19,7 @@ #include #include "settings.h" +#include "misc.h" #include "audio.h" @@ -27,11 +28,6 @@ #include "driver/system.h" #include "driver/systick.h" - -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - #define PIN_CSN GPIO_MAKE_PIN(GPIOF, LL_GPIO_PIN_9) #define PIN_SCL GPIO_MAKE_PIN(GPIOB, LL_GPIO_PIN_8) #define PIN_SDA GPIO_MAKE_PIN(GPIOB, LL_GPIO_PIN_9) diff --git a/App/ui/helper.c b/App/ui/helper.c index f2ef032b..408673cd 100644 --- a/App/ui/helper.c +++ b/App/ui/helper.c @@ -23,9 +23,6 @@ #include "ui/inputbox.h" #include "misc.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0])) -#endif void UI_GenerateChannelString(char *pString, const uint16_t Channel) {