From 63e734b0aa346e24b86ccd2aeaa8c9ef08e4a510 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 5 Feb 2023 10:58:32 +0100 Subject: [PATCH] in EMSESP_DEBUG only use EN language to save space --- src/common.h | 7 +++++++ src/system.cpp | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/common.h b/src/common.h index 5e649e487..8c036c4c2 100644 --- a/src/common.h +++ b/src/common.h @@ -46,7 +46,14 @@ using string_vector = std::vector; #define F_(string_name) (__pstr__##string_name) #define FL_(list_name) (__pstr__L_##list_name) + +#ifdef EMSESP_DEBUG +// In debug mode just take one language (en) to save Flash space +#define MAKE_PSTR_LIST(list_name, en, ...) static const char * const __pstr__L_##list_name[] = {en, nullptr}; +#else #define MAKE_PSTR_LIST(list_name, ...) static const char * const __pstr__L_##list_name[] = {__VA_ARGS__, nullptr}; +#endif + #define MAKE_PSTR_ENUM(enum_name, ...) static const char * const * __pstr__L_##enum_name[] = {__VA_ARGS__, nullptr}; // clang-format on diff --git a/src/system.cpp b/src/system.cpp index 9763b283d..51f32fca6 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -50,7 +50,12 @@ Adafruit_NeoPixel pixels(1, 7, NEO_GRB + NEO_KHZ800); namespace emsesp { // Languages supported. Note: the order is important and must match locale_translations.h +#ifdef EMSESP_DEBUG +// in Debug mode use one language (en) to save flash memory needed for the tests +const char * const languages[] = {EMSESP_LOCALE_EN}; +#else const char * const languages[] = {EMSESP_LOCALE_EN, EMSESP_LOCALE_DE, EMSESP_LOCALE_NL, EMSESP_LOCALE_SV, EMSESP_LOCALE_PL, EMSESP_LOCALE_NO, EMSESP_LOCALE_FR}; +#endif static constexpr uint8_t NUM_LANGUAGES = sizeof(languages) / sizeof(const char *);