From 7372f6317d0d4b55e8d2366b7ac1693f23587b0a Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 25 Apr 2020 11:38:11 +0200 Subject: [PATCH] Implement ARRAY_SIZE macro (part 2) --- tasmota/tasmota_globals.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasmota/tasmota_globals.h b/tasmota/tasmota_globals.h index f16ec6d0e..cae92fe4c 100644 --- a/tasmota/tasmota_globals.h +++ b/tasmota/tasmota_globals.h @@ -323,6 +323,10 @@ const char kWebColors[] PROGMEM = #define STR(x) STR_HELPER(x) #endif +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif + #ifdef USE_DEVICE_GROUPS #define SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, ...) _SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, __VA_ARGS__, 0) #define SendLocalDeviceGroupMessage(REQUEST_TYPE, ...) _SendDeviceGroupMessage(0, REQUEST_TYPE, __VA_ARGS__, 0)