Next round of changes to add literals to string table and voice prompt wordlists.

This commit is contained in:
vk7js 2022-05-09 17:59:47 +10:00 committed by Silvano Seva
parent bc5289453e
commit 901db10c87
4 changed files with 60 additions and 30 deletions

View File

@ -52,6 +52,7 @@ openrtx_src = ['openrtx/src/core/state.c',
'openrtx/src/core/data_conversion.c', 'openrtx/src/core/data_conversion.c',
'openrtx/src/core/memory_profiling.cpp', 'openrtx/src/core/memory_profiling.cpp',
'openrtx/src/ui/ui.c', 'openrtx/src/ui/ui.c',
'openrtx/src/ui/UIStrings.c',
'openrtx/src/ui/ui_main.c', 'openrtx/src/ui/ui_main.c',
'openrtx/src/ui/ui_menu.c', 'openrtx/src/ui/ui_menu.c',
'openrtx/src/rtx/rtx.cpp', 'openrtx/src/rtx/rtx.cpp',

View File

@ -58,5 +58,19 @@ const stringsTable_t englishStrings =
.Federico = "Federico IU2NUO", .Federico = "Federico IU2NUO",
.Fred = "Fred IU2NRO", .Fred = "Fred IU2NRO",
.Joseph = "Joseph VK7JS", .Joseph = "Joseph VK7JS",
.allChannels = "All channels",
.menu= "Menu",
.gpsOff = "GPS OFF",
.noFix = "No Fix",
.fixLost = "Fix Lost",
.error = "ERROR",
.flashBackup = "Flash Backup",
.connectToRTXTool = "Connect to RTXTool",
.toBackupFlashAnd = "to backup flash and",
.pressPTTToStart = "press PTT to start.",
.flashRestore = "Flash Restore",
.toRestoreFlashAnd = "to restore flash and",
.openRTX = "OpenRTX",
.gpsSettings = "GPS Settings",
}; };
#endif //EnglishStrings_h_included #endif //EnglishStrings_h_included

View File

@ -19,6 +19,7 @@
***************************************************************************/ ***************************************************************************/
/* /*
This string table's order must not be altered as voice prompts will be indexed in the same order as these strings. This string table's order must not be altered as voice prompts will be indexed in the same order as these strings.
Also, menus may be printed using string table offsets.
*/ */
#ifndef UIStrings_h_included #ifndef UIStrings_h_included
#define UIStrings_h_included #define UIStrings_h_included
@ -62,6 +63,20 @@ typedef struct
const char* Federico; const char* Federico;
const char* Fred; const char* Fred;
const char* Joseph; const char* Joseph;
const char* allChannels;
const char* menu;
const char* gpsOff;
const char* noFix;
const char* fixLost;
const char* error;
const char* flashBackup;
const char* connectToRTXTool;
const char* toBackupFlashAnd;
const char* pressPTTToStart;
const char* flashRestore;
const char* toRestoreFlashAnd;
const char* openRTX;
const char* gpsSettings;
} stringsTable_t; } stringsTable_t;
extern const stringsTable_t languages[]; extern const stringsTable_t languages[];

View File

@ -245,7 +245,7 @@ int _ui_getInfoValueName(char *buf, uint8_t max_len, uint8_t index)
snprintf(buf, max_len, "%dB", getHeapSize() - getCurrentFreeHeap()); snprintf(buf, max_len, "%dB", getHeapSize() - getCurrentFreeHeap());
break; break;
case 5: // Band case 5: // Band
snprintf(buf, max_len, "%s %s", hwinfo->vhf_band ? "VHF" : "", hwinfo->uhf_band ? "UHF" : ""); snprintf(buf, max_len, "%s %s", hwinfo->vhf_band ? currentLanguage->VHF : "", hwinfo->uhf_band ? currentLanguage->UHF : "");
break; break;
case 6: // VHF case 6: // VHF
snprintf(buf, max_len, "%d - %d", hwinfo->vhf_minFreq, hwinfo->vhf_maxFreq); snprintf(buf, max_len, "%d - %d", hwinfo->vhf_minFreq, hwinfo->vhf_maxFreq);
@ -266,7 +266,7 @@ int _ui_getBankName(char *buf, uint8_t max_len, uint8_t index)
// First bank "All channels" is not read from flash // First bank "All channels" is not read from flash
if(index == 0) if(index == 0)
{ {
snprintf(buf, max_len, "All channels"); snprintf(buf, max_len, currentLanguage->allChannels);
} }
else else
{ {
@ -301,7 +301,7 @@ void _ui_drawMenuTop(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Menu" on top bar // Print "Menu" 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, "Menu"); color_white, currentLanguage->menu);
// Print menu entries // Print menu entries
_ui_drawMenuList(ui_state->menu_selected, _ui_getMenuTopEntryName); _ui_drawMenuList(ui_state->menu_selected, _ui_getMenuTopEntryName);
} }
@ -311,7 +311,7 @@ void _ui_drawMenuBank(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Bank" on top bar // Print "Bank" 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, "Bank"); color_white, currentLanguage->banks);
// Print bank entries // Print bank entries
_ui_drawMenuList(ui_state->menu_selected, _ui_getBankName); _ui_drawMenuList(ui_state->menu_selected, _ui_getBankName);
} }
@ -321,7 +321,7 @@ void _ui_drawMenuChannel(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Channel" on top bar // Print "Channel" 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, "Channels"); color_white, currentLanguage->channels);
// Print channel entries // Print channel entries
_ui_drawMenuList(ui_state->menu_selected, _ui_getChannelName); _ui_drawMenuList(ui_state->menu_selected, _ui_getChannelName);
} }
@ -331,7 +331,7 @@ void _ui_drawMenuContacts(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Contacts" on top bar // Print "Contacts" 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, "Contacts"); color_white, currentLanguage->contacts);
// Print contact entries // Print contact entries
_ui_drawMenuList(ui_state->menu_selected, _ui_getContactName); _ui_drawMenuList(ui_state->menu_selected, _ui_getContactName);
} }
@ -343,18 +343,18 @@ void _ui_drawMenuGPS()
gfx_clearScreen(); gfx_clearScreen();
// Print "GPS" on top bar // Print "GPS" 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, "GPS"); color_white, currentLanguage->gps);
point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5}; point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5};
// Print GPS status, if no fix, hide details // Print GPS status, if no fix, hide details
if(!last_state.settings.gps_enabled) if(!last_state.settings.gps_enabled)
gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER,
color_white, "GPS OFF"); color_white, currentLanguage->gpsOff);
else if (last_state.gps_data.fix_quality == 0) else if (last_state.gps_data.fix_quality == 0)
gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER,
color_white, "No Fix"); color_white, currentLanguage->noFix);
else if (last_state.gps_data.fix_quality == 6) else if (last_state.gps_data.fix_quality == 6)
gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER,
color_white, "Fix Lost"); color_white, currentLanguage->fixLost);
else else
{ {
switch(last_state.gps_data.fix_quality) switch(last_state.gps_data.fix_quality)
@ -369,7 +369,7 @@ void _ui_drawMenuGPS()
fix_buf = "PPS"; fix_buf = "PPS";
break; break;
default: default:
fix_buf = "ERROR"; fix_buf = currentLanguage->error;
break; break;
} }
@ -385,7 +385,7 @@ void _ui_drawMenuGPS()
type_buf = "3D"; type_buf = "3D";
break; break;
default: default:
type_buf = "ERROR"; type_buf = currentLanguage->error;
break; break;
} }
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
@ -431,7 +431,7 @@ void _ui_drawMenuSettings(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Settings" on top bar // Print "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, "Settings"); color_white, currentLanguage->settings);
// Print menu entries // Print menu entries
_ui_drawMenuList(ui_state->menu_selected, _ui_getSettingsEntryName); _ui_drawMenuList(ui_state->menu_selected, _ui_getSettingsEntryName);
} }
@ -441,7 +441,7 @@ void _ui_drawMenuBackupRestore(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Backup & Restore" on top bar // Print "Backup & Restore" 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, "Backup & Restore"); color_white, currentLanguage->backupAndRestore);
// Print menu entries // Print menu entries
_ui_drawMenuList(ui_state->menu_selected, _ui_getBackupRestoreEntryName); _ui_drawMenuList(ui_state->menu_selected, _ui_getBackupRestoreEntryName);
} }
@ -453,17 +453,17 @@ void _ui_drawMenuBackup(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Flash Backup" on top bar // Print "Flash Backup" 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, "Flash Backup"); color_white, currentLanguage->flashBackup);
// Print backup message // Print backup message
point_t line = layout.line2_pos; point_t line = layout.line2_pos;
gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER, gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER,
color_white, "Connect to RTXTool"); color_white, currentLanguage->connectToRTXTool);
line.y += 18; line.y += 18;
gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER, gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER,
color_white, "to backup flash and"); color_white, currentLanguage->toBackupFlashAnd);
line.y += 18; line.y += 18;
gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER, gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER,
color_white, "press PTT to start."); color_white, currentLanguage->pressPTTToStart);
state.devStatus = DATATRANSFER; state.devStatus = DATATRANSFER;
state.backup_eflash = true; state.backup_eflash = true;
@ -474,19 +474,19 @@ void _ui_drawMenuRestore(ui_state_t* ui_state)
(void) ui_state; (void) ui_state;
gfx_clearScreen(); gfx_clearScreen();
// Print "Flash Backup" on top bar // Print "Flash Restore" 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, "Flash Restore"); color_white, currentLanguage->flashRestore);
// Print backup message // Print backup message
point_t line = layout.line2_pos; point_t line = layout.line2_pos;
gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER, gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER,
color_white, "Connect to RTXTool"); color_white, currentLanguage->connectToRTXTool);
line.y += 18; line.y += 18;
gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER, gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER,
color_white, "to restore flash and"); color_white, currentLanguage->toRestoreFlashAnd);
line.y += 18; line.y += 18;
gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER, gfx_print(line, FONT_SIZE_8PT, TEXT_ALIGN_CENTER,
color_white, "press PTT to start."); color_white, currentLanguage->pressPTTToStart);
state.devStatus = DATATRANSFER; state.devStatus = DATATRANSFER;
state.restore_eflash = true; state.restore_eflash = true;
@ -497,7 +497,7 @@ void _ui_drawMenuInfo(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Info" on top bar // Print "Info" 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, "Info"); color_white, currentLanguage->info);
// Print menu entries // Print menu entries
_ui_drawMenuListValue(ui_state, ui_state->menu_selected, _ui_getInfoEntryName, _ui_drawMenuListValue(ui_state, ui_state->menu_selected, _ui_getInfoEntryName,
_ui_getInfoValueName); _ui_getInfoValueName);
@ -511,13 +511,13 @@ void _ui_drawMenuAbout()
ui_drawSplashScreen(false); ui_drawSplashScreen(false);
else else
gfx_print(openrtx_pos, layout.line3_font, TEXT_ALIGN_CENTER, gfx_print(openrtx_pos, layout.line3_font, TEXT_ALIGN_CENTER,
color_white, "OpenRTX"); color_white, currentLanguage->openRTX);
uint8_t line_h = layout.menu_h; uint8_t line_h = layout.menu_h;
point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5};
for(int author = 0; author < author_num; author++) for(int author = 0; author < author_num; author++)
{ {
gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, "%s", authors[author]); color_white, "%s", *(&currentLanguage->Niccolo + author));
pos.y += line_h; pos.y += line_h;
} }
} }
@ -527,7 +527,7 @@ void _ui_drawSettingsDisplay(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Display" on top bar // Print "Display" 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, "Display"); color_white, currentLanguage->display);
// Print display settings entries // Print display settings entries
_ui_drawMenuListValue(ui_state, ui_state->menu_selected, _ui_getDisplayEntryName, _ui_drawMenuListValue(ui_state, ui_state->menu_selected, _ui_getDisplayEntryName,
_ui_getDisplayValueName); _ui_getDisplayValueName);
@ -539,7 +539,7 @@ void _ui_drawSettingsGPS(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "GPS Settings" on top bar // Print "GPS 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, "GPS Settings"); color_white, currentLanguage->gpsSettings);
// Print display settings entries // Print display settings entries
_ui_drawMenuListValue(ui_state, ui_state->menu_selected, _ui_drawMenuListValue(ui_state, ui_state->menu_selected,
_ui_getSettingsGPSEntryName, _ui_getSettingsGPSEntryName,
@ -555,7 +555,7 @@ void _ui_drawSettingsTimeDate()
last_state.settings.utc_timezone); last_state.settings.utc_timezone);
// Print "Time&Date" on top bar // Print "Time&Date" 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, "Time&Date"); color_white, currentLanguage->timeAndDate);
// Print current time and date // Print current time and date
gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER, gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, "%02d/%02d/%02d", color_white, "%02d/%02d/%02d",
@ -572,7 +572,7 @@ void _ui_drawSettingsTimeDateSet(ui_state_t* ui_state)
gfx_clearScreen(); gfx_clearScreen();
// Print "Time&Date" on top bar // Print "Time&Date" 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, "Time&Date"); color_white, currentLanguage->timeAndDate);
if(ui_state->input_position <= 0) if(ui_state->input_position <= 0)
{ {
strcpy(ui_state->new_date_buf, "__/__/__"); strcpy(ui_state->new_date_buf, "__/__/__");