Starting to refactor UI to use a string table in preparation for adding voice prompt support.

md1702
vk7js 2022-05-04 10:02:32 +10:00 zatwierdzone przez Silvano Seva
rodzic bf8a257c2b
commit 7e660f2fe8
4 zmienionych plików z 49 dodań i 2 usunięć

Wyświetl plik

@ -84,6 +84,10 @@ OpenRTX was created by:
- Federico Amedeo Izzo IU2NUO <federico@izzo.pro>
- Frederik Saraci IU2NRO <frederik.saraci@gmail.com>
Our wholehearted thanks to the contributions from the community:
- Joseph Stephen VK7JS, which implemented voice prompts
All this was made possible by the huge reverse engineering effort of Travis Goodspeed and all the contributors of [md380tools](https://github.com/travisgoodspeed/md380tools).
A huge thank goes to Roger Clark, and his [OpenGD77](https://github.com/rogerclarkmelbourne/OpenGD77) which not only inspired this project, but as a precursor, provided a working code example for the GD77 radio family.

Wyświetl plik

@ -0,0 +1,41 @@
/***************************************************************************
* Copyright (C) 2022 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* Silvano Seva IU2KWO *
* Joseph Stephen VK7JS *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
/*
This string table's order must not be altered as voice prompts will be indexed in the same order as these strings.
*/
#define NUM_LANGUAGES 1
typedef struct
{
const char* languageName;
const char* off;
const char* on;
} stringsTable_t;
const stringsTable_t englishStrings =
{
.languageName="English",
.off = "OFF",
.on="ON",
};
const stringsTable_t languages[NUM_LANGUAGES]={englishStrings}; // add more languages here.
const stringsTable_t* currentLanguage=&languages[0]; // default to English.

Wyświetl plik

@ -28,6 +28,7 @@
#include <interfaces/platform.h>
#include <interfaces/delays.h>
#include <memory_profiling.h>
#include <ui/uiStrings.h>
/* UI main screen helper functions, their implementation is in "ui_main.c" */
extern void _ui_drawMainBottom();
@ -185,10 +186,10 @@ int _ui_getSettingsGPSValueName(char *buf, uint8_t max_len, uint8_t index)
switch(index)
{
case G_ENABLED:
snprintf(buf, max_len, "%s", (last_state.settings.gps_enabled) ? "ON" : "OFF");
snprintf(buf, max_len, "%s", (last_state.settings.gps_enabled) ? currentLanguage->on : currentLanguage->off);
break;
case G_SET_TIME:
snprintf(buf, max_len, "%s", (last_state.gps_set_time) ? "ON" : "OFF");
snprintf(buf, max_len, "%s", (last_state.gps_set_time) ? currentLanguage->on : currentLanguage->off);
break;
case G_TIMEZONE:
// Add + prefix to positive numbers

Wyświetl plik

@ -1,2 +1,3 @@
pyusb
meson
ffmpeg