From 73b6ca28f234f68c726a13cf8e2faee86a960abd Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sun, 26 Sep 2021 07:58:19 +1000 Subject: [PATCH] Generate power names --- Translations/make_translation.py | 18 ++++++++++++++++++ source/Core/Inc/Translation.h | 1 + 2 files changed, 19 insertions(+) diff --git a/Translations/make_translation.py b/Translations/make_translation.py index 77bb7b81..99145216 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -142,6 +142,14 @@ def get_accel_names_list() -> List[str]: ] +def get_power_source_list() -> List[str]: + return [ + "DC", + "QC", + "PD", + ] + + def get_letter_counts( defs: dict, lang: dict, build_version: str ) -> Tuple[List[str], Dict[str, int]]: @@ -202,6 +210,7 @@ def get_letter_counts( text_list.append(x[1]) text_list.extend(get_debug_menu()) text_list.extend(get_accel_names_list()) + text_list.extend(get_power_source_list()) # collapse all strings down into the composite letters and store totals for these @@ -971,6 +980,15 @@ def get_translation_common_text( ) translation_common_text += "};\n\n" + # power source types + translation_common_text += "const char* PowerSourceNames[] = {\n" + + for c in get_power_source_list(): + translation_common_text += ( + f'\t "{convert_string(symbol_conversion_table, c)}",//{c} \n' + ) + translation_common_text += "};\n\n" + return translation_common_text diff --git a/source/Core/Inc/Translation.h b/source/Core/Inc/Translation.h index 5012d0da..c9b9a259 100644 --- a/source/Core/Inc/Translation.h +++ b/source/Core/Inc/Translation.h @@ -27,6 +27,7 @@ extern const char *SymbolVersionNumber; extern const char *DebugMenu[]; extern const char *AccelTypeNames[]; +extern const char *PowerSourceNames[]; enum class SettingsItemIndex : uint8_t { DCInCutoff,