more string extraction. moved prompt_fm and prompt_dmr to string table as they are needed by the UI.

This commit is contained in:
vk7js 2022-05-10 17:43:42 +10:00 committed by Silvano Seva
parent fd5c5b4979
commit 2373d8374c
6 changed files with 30 additions and 13 deletions

View File

@ -113,8 +113,6 @@ PROMPT_WATTS, // Watts
PROMPT_RECEIVE, // Receive PROMPT_RECEIVE, // Receive
PROMPT_TRANSMIT, // Transmit PROMPT_TRANSMIT, // Transmit
PROMPT_MODE, // Mode PROMPT_MODE, // Mode
PROMPT_DMR, // D M R
PROMPT_FM, // F M
PROMPT_CHARACTER, // character PROMPT_CHARACTER, // character
PROMPT_SPACE, // space PROMPT_SPACE, // space
PROMPT_PERCENT, // Percent PROMPT_PERCENT, // Percent

View File

@ -35,7 +35,9 @@ const stringsTable_t englishStrings =
.about = "About", .about = "About",
.display = "Display", .display = "Display",
.timeAndDate = "Time & Date", .timeAndDate = "Time & Date",
.fm = "FM",
.m17 = "M17", .m17 = "M17",
.dmr = "DMR",
.defaultSettings = "Default Settings", .defaultSettings = "Default Settings",
.brightness = "Brightness", .brightness = "Brightness",
.contrast = "Contrast", .contrast = "Contrast",
@ -72,5 +74,11 @@ const stringsTable_t englishStrings =
.toRestoreFlashAnd = "to restore flash and", .toRestoreFlashAnd = "to restore flash and",
.openRTX = "OpenRTX", .openRTX = "OpenRTX",
.gpsSettings = "GPS Settings", .gpsSettings = "GPS Settings",
.m17settings = "M17 Settings",
.callsign = "Callsign:",
.resetToDefaults = "Reset to Defaults",
.toReset = "To reset:",
.pressEnterTwice = "Press Enter twice",
.macroMenu = "Macro Menu",
}; };
#endif //EnglishStrings_h_included #endif //EnglishStrings_h_included

View File

@ -40,7 +40,9 @@ typedef struct
const char* about; const char* about;
const char* display; const char* display;
const char* timeAndDate; const char* timeAndDate;
const char* fm;
const char* m17; const char* m17;
const char* dmr;
const char* defaultSettings; const char* defaultSettings;
const char* brightness; const char* brightness;
const char* contrast; const char* contrast;
@ -77,6 +79,12 @@ typedef struct
const char* toRestoreFlashAnd; const char* toRestoreFlashAnd;
const char* openRTX; const char* openRTX;
const char* gpsSettings; const char* gpsSettings;
const char* callsign;
const char* m17settings;
const char* resetToDefaults;
const char* toReset;
const char* pressEnterTwice;
const char* macroMenu;
} stringsTable_t; } stringsTable_t;
extern const stringsTable_t languages[]; extern const stringsTable_t languages[];

View File

@ -111,10 +111,10 @@ void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags)
switch(mode) switch(mode)
{ {
case OPMODE_DMR: case OPMODE_DMR:
vpQueuePrompt(PROMPT_DMR); vpQueueStringTableEntry(currentLanguage->dmr);
break; break;
case OPMODE_FM: case OPMODE_FM:
vpQueuePrompt(PROMPT_FM); vpQueueStringTableEntry(currentLanguage->fm);
break; break;
case OPMODE_M17: case OPMODE_M17:
vpQueueStringTableEntry(&currentLanguage->m17); vpQueueStringTableEntry(&currentLanguage->m17);

View File

@ -24,6 +24,7 @@
#include <stdint.h> #include <stdint.h>
#include <ui.h> #include <ui.h>
#include <string.h> #include <string.h>
#include "ui/UIStrings.h"
void _ui_drawMainBackground() void _ui_drawMainBackground()
{ {
@ -60,15 +61,15 @@ void _ui_drawMainTop()
{ {
case OPMODE_FM: case OPMODE_FM:
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, "FM"); color_white, currentLanguage->fm);
break; break;
case OPMODE_DMR: case OPMODE_DMR:
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, "DMR"); color_white, currentLanguage->dmr);
break; break;
case OPMODE_M17: case OPMODE_M17:
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, "M17"); color_white, currentLanguage->m17);
break; break;
} }
} }

View File

@ -611,10 +611,10 @@ void _ui_drawSettingsM17(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "M17 Settings" on top bar // Print "M17 Settings" on top bar
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, "M17 Settings"); color_white, currentLanguage->m17settings);
gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.menu_font, layout.horizontal_pad, layout.menu_font,
TEXT_ALIGN_LEFT, color_white, "Callsign:"); TEXT_ALIGN_LEFT, color_white, currentLanguage->callsign);
if(ui_state->edit_mode) if(ui_state->edit_mode)
{ {
uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2); uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2);
@ -645,29 +645,31 @@ void _ui_drawSettingsReset2Defaults(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, "Reset to Defaults"); color_white, currentLanguage->resetToDefaults);
// Make text flash yellow once every 1s // Make text flash yellow once every 1s
color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413; color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413;
gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.top_font, layout.horizontal_pad, layout.top_font,
TEXT_ALIGN_CENTER, textcolor, "To reset:"); TEXT_ALIGN_CENTER, textcolor, currentLanguage->toReset);
gfx_printLine(2, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(2, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.top_font, layout.horizontal_pad, layout.top_font,
TEXT_ALIGN_CENTER, textcolor, "Press Enter twice"); TEXT_ALIGN_CENTER, textcolor, currentLanguage->pressEnterTwice);
if((getTick() - lastDraw) > 1000) if((getTick() - lastDraw) > 1000)
{ {
drawcnt++; drawcnt++;
lastDraw = getTick(); lastDraw = getTick();
} }
drawcnt++;
} }
bool _ui_drawMacroMenu() bool _ui_drawMacroMenu()
{ {
// Header // Header
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, "Macro Menu"); color_white, currentLanguage->macroMenu);
// First row // First row
if (last_state.channel.mode == OPMODE_FM) if (last_state.channel.mode == OPMODE_FM)
{ {