mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
Translations mechanism
This commit is contained in:
parent
a8c3125f00
commit
e92ed21627
8 changed files with 144 additions and 29 deletions
12
src/Makefile
12
src/Makefile
|
@ -115,6 +115,10 @@ CTP1009 = NO
|
|||
# SOMO-14D module
|
||||
SOMO = NO
|
||||
|
||||
# TRANSLATIONS
|
||||
# Values = en,
|
||||
TRANSLATIONS = EN
|
||||
|
||||
#------- END BUILD OPTIONS ---------------------------
|
||||
|
||||
# MCU name
|
||||
|
@ -141,7 +145,7 @@ TARGET = gruvin9x
|
|||
OBJDIR = obj
|
||||
|
||||
# List C++ source files here. (C dependencies are automatically generated.)
|
||||
CPPSRC = gruvin9x.cpp pulses.cpp stamp.cpp menus.cpp model_menus.cpp general_menus.cpp main_views.cpp statistics_views.cpp pers.cpp file.cpp lcd.cpp drivers.cpp
|
||||
CPPSRC = gruvin9x.cpp pulses.cpp stamp.cpp menus.cpp model_menus.cpp general_menus.cpp main_views.cpp statistics_views.cpp pers.cpp file.cpp lcd.cpp drivers.cpp o9xstrings.cpp
|
||||
|
||||
ifeq ($(EXT), JETI)
|
||||
CPPSRC += jeti.cpp
|
||||
|
@ -182,7 +186,7 @@ DEBUG = dwarf-2
|
|||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRAINCDIRS =
|
||||
EXTRAINCDIRS = translations
|
||||
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
|
@ -205,6 +209,8 @@ CPPDEFS = -DF_CPU=$(F_CPU)UL
|
|||
# NOTE: PCB version now overrides all the earlier individual settings
|
||||
# These individual settings work only for PCB=STD
|
||||
|
||||
CPPDEFS += -DTRANSLATIONS_$(TRANSLATIONS)
|
||||
|
||||
# If POT1/POTS/RE1 is used for fields modification
|
||||
ifeq ($(NAVIGATION), POT1)
|
||||
CPPDEFS += -DNAVIGATION_POT1
|
||||
|
@ -642,6 +648,8 @@ lib: $(LIBNAME)
|
|||
# Build stamp-file
|
||||
stamp:
|
||||
@echo
|
||||
@echo $(CPPSRC)
|
||||
|
||||
@echo "Generate Version-stamp:"
|
||||
@echo "//Automatically generated file (Makefile) - do not edit" > stamp-gruvin9x.h
|
||||
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" >> stamp-gruvin9x.h
|
||||
|
|
|
@ -79,7 +79,7 @@ void menuProcSetup(uint8_t event)
|
|||
uint8_t subN = 1;
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Beeper"));
|
||||
lcd_putsnAtt(PARAM_OFS - FW, y, PSTR("Quiet""NoKey""Norm ""Long ""xLong")+5*g_eeGeneral.beeperVal,5,(sub==subN ? INVERS:0));
|
||||
lcd_putsnAtt(PARAM_OFS - FW, y, STR_BEEPER+LEN_BEEPER*g_eeGeneral.beeperVal, LEN_BEEPER, (sub==subN ? INVERS:0));
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.beeperVal, 0, 4);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
@ -111,7 +111,7 @@ void menuProcSetup(uint8_t event)
|
|||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Filter ADC"));
|
||||
lcd_putsnAtt(PARAM_OFS, y, PSTR("SINGOSMPFILT")+4*g_eeGeneral.filterInput,4,(sub==subN ? INVERS:0));
|
||||
lcd_putsnAtt(PARAM_OFS, y, STR_ADCFILTER+LEN_ADCFILTER*g_eeGeneral.filterInput, LEN_ADCFILTER, (sub==subN ? INVERS:0));
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.filterInput, 0, 2);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
@ -124,41 +124,42 @@ void menuProcSetup(uint8_t event)
|
|||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Minute beep"));
|
||||
lcd_puts_P(0, y, PSTR("Minute beep"));
|
||||
menu_lcd_onoff( PARAM_OFS, y, g_eeGeneral.minuteBeep, sub==subN ) ;
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.minuteBeep, 0, 1);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Beep countdown"));
|
||||
lcd_puts_P(0, y, PSTR("Beep countdown"));
|
||||
menu_lcd_onoff( PARAM_OFS, y, g_eeGeneral.preBeep, sub==subN ) ;
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.preBeep, 0, 1);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Flash on beep"));
|
||||
lcd_puts_P(0, y, PSTR("Flash on beep"));
|
||||
menu_lcd_onoff( PARAM_OFS, y, g_eeGeneral.flashBeep, sub==subN ) ;
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.flashBeep, 0, 1);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Light switch"));
|
||||
lcd_puts_P(0, y, PSTR("Light switch"));
|
||||
putsSwitches(PARAM_OFS,y,g_eeGeneral.lightSw,sub==subN ? INVERS : 0);
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightSw, -MAX_SWITCH, MAX_SWITCH);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Light off after"));
|
||||
lcd_puts_P(0, y, PSTR("Light off after"));
|
||||
if(g_eeGeneral.lightAutoOff) {
|
||||
lcd_outdezAtt(PARAM_OFS, y, g_eeGeneral.lightAutoOff*5,LEFT|(sub==subN ? INVERS : 0));
|
||||
lcd_putc(lcd_lastPos, y, 's');
|
||||
}
|
||||
else
|
||||
lcd_putsnAtt(PARAM_OFS, y, PSTR("OFF"),3,(sub==subN ? INVERS:0));
|
||||
else {
|
||||
lcd_putsnAtt(PARAM_OFS, y, STR_OFFON, LEN_OFFON,(sub==subN ? INVERS:0));
|
||||
}
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
@ -190,16 +191,15 @@ void menuProcSetup(uint8_t event)
|
|||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts_P(0, y,PSTR("Switch Warning"));
|
||||
lcd_putsnAtt(PARAM_OFS, y, PSTR("Down""OFF ""Up ")+4*(1+g_eeGeneral.switchWarning),4,(sub==subN ? INVERS:0));
|
||||
if(sub==subN)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchWarning, -1, 1);
|
||||
lcd_puts_P(0, y, PSTR("Switch Warning"));
|
||||
lcd_putsnAtt(PARAM_OFS, y, STR_WARNSW+LEN_WARNSW*(1+g_eeGeneral.switchWarning), LEN_WARNSW, (sub==subN ? INVERS:0));
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchWarning, -1, 1);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t b = 1-g_eeGeneral.disableMemoryWarning;
|
||||
lcd_puts_P(0, y,PSTR("Memory Warning"));
|
||||
lcd_puts_P(0, y, PSTR("Memory Warning"));
|
||||
menu_lcd_onoff( PARAM_OFS, y, b, sub==subN ) ;
|
||||
if(sub==subN)
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ void menuProcTime(uint8_t event)
|
|||
{
|
||||
uint8_t y=(i*2+2)*FH;
|
||||
|
||||
lcd_putsnAtt(0, y, PSTR("DATE:""TIME:")+i*5, 5, 0);
|
||||
lcd_putsnAtt(0, y, STR_DATETIME+LEN_DATETIME*i, LEN_DATETIME, 0);
|
||||
|
||||
for(uint8_t j=0; j<3;j++) // 3 settings each for date and time (YMD and HMS)
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ void menuProcTrainer(uint8_t event)
|
|||
putsChnRaw(0, y, chan, 0);
|
||||
|
||||
edit = (sub==i && subSub==0);
|
||||
lcd_putsnAtt(4*FW, y, PSTR("off += :=")+3*td->mode, 3, edit ? blink : 0);
|
||||
lcd_putsnAtt(4*FW, y, STR_TRNMODE+LEN_TRNMODE*td->mode, LEN_TRNMODE, edit ? blink : 0);
|
||||
if (edit && s_editMode>0)
|
||||
CHECK_INCDEC_GENVAR(event, td->mode, 0, 2);
|
||||
|
||||
|
@ -391,7 +391,7 @@ void menuProcTrainer(uint8_t event)
|
|||
CHECK_INCDEC_GENVAR(event, td->studWeight, -100, 100);
|
||||
|
||||
edit = (sub==i && subSub==2);
|
||||
lcd_putsnAtt(12*FW, y, PSTR("ch1ch2ch3ch4")+3*td->srcChn, 3, edit ? blink : 0);
|
||||
lcd_putsnAtt(12*FW, y, STR_TRNCHN+LEN_TRNCHN*td->srcChn, LEN_TRNCHN, edit ? blink : 0);
|
||||
if (edit && s_editMode>0)
|
||||
CHECK_INCDEC_GENVAR(event, td->srcChn, 0, 3);
|
||||
|
||||
|
@ -506,7 +506,7 @@ void menuProcDiagAna(uint8_t event)
|
|||
|
||||
}
|
||||
|
||||
const prog_char APM menuWhenDone[] = " [MENU] WHEN DONE " ;
|
||||
const prog_char APM menuWhenDone[] = " [MENU] WHEN DONE ";
|
||||
|
||||
void menuProcDiagCalib(uint8_t event)
|
||||
{
|
||||
|
@ -546,13 +546,13 @@ void menuProcDiagCalib(uint8_t event)
|
|||
case 0:
|
||||
// START CALIBRATION
|
||||
// [MENU]
|
||||
lcd_putsnAtt(2*FW, 3*FH, PSTR(" [MENU] TO START "), 18, 0);
|
||||
lcd_putsAtt(2*FW, 3*FH, PSTR(" [MENU] TO START "), 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// SET MIDPOINT
|
||||
// [MENU]
|
||||
lcd_putsnAtt(2*FW, 2*FH, PSTR(" SET MIDPOINT "), 18, s_noScroll ? INVERS : 0);
|
||||
lcd_putsAtt(2*FW, 2*FH, PSTR(" SET MIDPOINT "), s_noScroll ? INVERS : 0);
|
||||
lcd_putsnAtt(2*FW, 3*FH, menuWhenDone, 18, 0);
|
||||
|
||||
for (uint8_t i=0; i<7; i++) {
|
||||
|
@ -565,8 +565,8 @@ void menuProcDiagCalib(uint8_t event)
|
|||
case 2:
|
||||
// MOVE STICKS/POTS
|
||||
// [MENU]
|
||||
lcd_putsnAtt(2*FW, 2*FH, PSTR(" MOVE STICKS/POTS "), 18, s_noScroll ? INVERS : 0);
|
||||
lcd_putsnAtt(2*FW, 3*FH, menuWhenDone, 18, 0);
|
||||
lcd_putsAtt(2*FW, 2*FH, PSTR(" MOVE STICKS/POTS "), s_noScroll ? INVERS : 0);
|
||||
lcd_putsAtt(2*FW, 3*FH, menuWhenDone, 0);
|
||||
|
||||
for (uint8_t i=0; i<7; i++) {
|
||||
if (abs(loVals[i]-hiVals[i])>50) {
|
||||
|
|
|
@ -652,6 +652,9 @@ extern volatile uint8_t g_blinkTmr10ms;
|
|||
extern uint8_t g_beepCnt;
|
||||
extern uint8_t g_beepVal[5];
|
||||
extern const PROGMEM char modi12x3[];
|
||||
|
||||
#include "o9xstrings.h"
|
||||
|
||||
extern int16_t g_ppmIns[8];
|
||||
extern int16_t g_chans512[NUM_CHNOUT];
|
||||
extern volatile uint8_t tick10ms;
|
||||
|
|
|
@ -33,14 +33,15 @@ uint8_t s_noScroll;
|
|||
|
||||
int16_t g_chans512[NUM_CHNOUT]; // TODO not here!
|
||||
|
||||
// TODO does it save flash now?
|
||||
void menu_lcd_onoff( uint8_t x,uint8_t y, uint8_t value, uint8_t mode )
|
||||
{
|
||||
lcd_putsnAtt( x, y, PSTR("OFFON ")+3*value,3,mode ? INVERS:0) ;
|
||||
lcd_putsnAtt(x, y, STR_OFFON+LEN_OFFON*value, LEN_OFFON, mode ? INVERS:0) ;
|
||||
}
|
||||
|
||||
void menu_lcd_HYPHINV( uint8_t x,uint8_t y, uint8_t value, uint8_t mode )
|
||||
{
|
||||
lcd_putsnAtt( x, y, PSTR("---INV")+3*value,3,mode ? INVERS:0) ;
|
||||
lcd_putsnAtt( x, y, STR_MMMINV+LEN_MMMINV*value, LEN_MMMINV, mode ? INVERS:0) ;
|
||||
}
|
||||
|
||||
void DisplayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||
|
|
|
@ -117,7 +117,7 @@ void displayWarning(uint8_t event)
|
|||
{
|
||||
if (s_warning) {
|
||||
displayBox();
|
||||
lcd_puts_P(16, 5*FH, PSTR("[EXIT]"));
|
||||
lcd_puts_P(16, 5*FH, STR_POPUPS+10);
|
||||
switch(event) {
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
killEvents(event);
|
||||
|
@ -133,7 +133,7 @@ void displayConfirmation(uint8_t event)
|
|||
displayBox();
|
||||
if (s_warning_info)
|
||||
lcd_putsnAtt(16, 4*FH, s_warning_info, s_warning_info_len, ZCHAR);
|
||||
lcd_puts_P(16, 5*FH, PSTR("[MENU] [EXIT]"));
|
||||
lcd_puts_P(16, 5*FH, STR_POPUPS);
|
||||
|
||||
switch(event) {
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
|
@ -492,7 +492,7 @@ void menuProcModel(uint8_t event)
|
|||
lcd_putsnAtt(PARAM_OFS, y, PSTR(PROT_STR)+PROT_STR_LEN*g_model.protocol,PROT_STR_LEN,
|
||||
(sub==subN && m_posHorz==0 ? (s_editMode>0 ? BLINK : INVERS):0));
|
||||
if(!g_model.protocol) {
|
||||
lcd_putsnAtt(PARAM_OFS+4*FW, y, PSTR("4CH 6CH 8CH 10CH12CH14CH16CH")+4*(g_model.ppmNCH+2), 4, ((sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK : INVERS) : 0));
|
||||
lcd_putsnAtt(PARAM_OFS+4*FW, y, STR_NCHANNELS+LEN_NCHANNELS*(g_model.ppmNCH+2), LEN_NCHANNELS, ((sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK : INVERS) : 0));
|
||||
lcd_putsAtt(PARAM_OFS+11*FW, y, PSTR("u"),0);
|
||||
lcd_outdezAtt(PARAM_OFS+11*FW, y, (g_model.ppmDelay*50)+300, ((sub==subN && m_posHorz==2) ? ((s_editMode>0) ? BLINK : INVERS) : 0));
|
||||
}
|
||||
|
|
26
src/o9xstrings.cpp
Normal file
26
src/o9xstrings.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "gruvin9x.h"
|
||||
|
||||
#ifdef TRANSLATIONS_FR
|
||||
#include "translations/fr.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#include "translations/en.h"
|
||||
|
||||
// The non-0-terminated-strings
|
||||
const prog_char APM STR_OPEN9X[] =
|
||||
TR_OFFON
|
||||
TR_MMMINV
|
||||
TR_NCHANNELS
|
||||
TR_BEEPER
|
||||
TR_ADCFILTER
|
||||
TR_WARNSW
|
||||
TR_TRNMODE
|
||||
TR_TRNCHN
|
||||
#if defined(PCBV3)
|
||||
TR_DATETIME
|
||||
#endif
|
||||
;
|
||||
|
||||
// The 0-terminated-strings
|
||||
const prog_char APM STR_POPUPS[] = TR_POPUPS;
|
46
src/o9xstrings.h
Normal file
46
src/o9xstrings.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#ifndef o9xstrings_h
|
||||
#define o9xstrings_h
|
||||
|
||||
#ifdef TRANSLATIONS_FR
|
||||
#include "translations/fr.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#include "translations/en.h"
|
||||
|
||||
#define PSIZE(x) ( sizeof(x) - 1 )
|
||||
|
||||
// The non-0-terminated-strings
|
||||
|
||||
extern const PROGMEM char STR_OPEN9X[];
|
||||
|
||||
#define OFS_OFFON 0
|
||||
#define OFS_MMMINV (OFS_OFFON + PSIZE(TR_OFFON))
|
||||
#define OFS_NCHANNELS (OFS_MMMINV + PSIZE(TR_MMMINV))
|
||||
#define OFS_BEEPER (OFS_NCHANNELS + PSIZE(TR_NCHANNELS))
|
||||
#define OFS_ADCFILTER (OFS_BEEPER + PSIZE(TR_BEEPER))
|
||||
#define OFS_WARNSW (OFS_ADCFILTER + PSIZE(TR_ADCFILTER))
|
||||
#define OFS_TRNMODE (OFS_WARNSW + PSIZE(TR_WARNSW))
|
||||
#define OFS_TRNCHN (OFS_TRNMODE + PSIZE(TR_TRNMODE))
|
||||
#if defined(PCBV3)
|
||||
#define OFS_DATETIME (OFS_TRNCHN + PSIZE(TR_TRNCHN))
|
||||
#endif
|
||||
|
||||
#define STR_OFFON (STR_OPEN9X + OFS_OFFON)
|
||||
#define STR_MMMINV (STR_OPEN9X + OFS_MMMINV)
|
||||
#define STR_NCHANNELS (STR_OPEN9X + OFS_NCHANNELS)
|
||||
#define STR_BEEPER (STR_OPEN9X + OFS_BEEPER)
|
||||
#define STR_ADCFILTER (STR_OPEN9X + OFS_ADCFILTER)
|
||||
#define STR_WARNSW (STR_OPEN9X + OFS_WARNSW)
|
||||
#define STR_TRNMODE (STR_OPEN9X + OFS_TRNMODE)
|
||||
#define STR_TRNCHN (STR_OPEN9X + OFS_TRNCHN)
|
||||
|
||||
#if defined(PCBV3)
|
||||
#define STR_DATETIME (STR_OPEN9X + OFS_DATETIME)
|
||||
#endif
|
||||
|
||||
// The 0-terminated-strings
|
||||
|
||||
extern const PROGMEM char STR_POPUPS[];
|
||||
|
||||
#endif
|
31
src/translations/en.h
Normal file
31
src/translations/en.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
// NON ZERO TERMINATED STRINGS
|
||||
#define LEN_OFFON 3
|
||||
#define TR_OFFON "OFF""ON "
|
||||
|
||||
#define LEN_MMMINV 3
|
||||
#define TR_MMMINV "---""INV"
|
||||
|
||||
#define LEN_NCHANNELS 4
|
||||
#define TR_NCHANNELS "4CH 6CH 8CH 10CH12CH14CH16CH"
|
||||
|
||||
#define LEN_BEEPER 5
|
||||
#define TR_BEEPER "Quiet""NoKey""Norm ""Long ""xLong"
|
||||
|
||||
#define LEN_ADCFILTER 4
|
||||
#define TR_ADCFILTER "SING""OSMP""FILT"
|
||||
|
||||
#define LEN_WARNSW 4
|
||||
#define TR_WARNSW "Down""OFF ""Up "
|
||||
|
||||
#define LEN_TRNMODE 3
|
||||
#define TR_TRNMODE "off"" +="" :="
|
||||
|
||||
#define LEN_TRNCHN 3
|
||||
#define TR_TRNCHN "ch1ch2ch3ch4"
|
||||
|
||||
#define LEN_DATETIME 5
|
||||
#define TR_DATETIME "DATE:""TIME:"
|
||||
|
||||
// ZERO TERMINATED STRINGS
|
||||
#define TR_POPUPS "[MENU] [EXIT]";
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue