diff --git a/src/Makefile b/src/Makefile index 941b5b418..b74232c13 100644 --- a/src/Makefile +++ b/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 diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 12e9260f9..8616dcd15 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -79,7 +79,7 @@ void menuProcSetup(uint8_t event) uint8_t subN = 1; if(s_pgOfs7*FH) return; }subN++; @@ -111,7 +111,7 @@ void menuProcSetup(uint8_t event) if(s_pgOfs7*FH) return; }subN++; @@ -124,41 +124,42 @@ void menuProcSetup(uint8_t event) }subN++; if(s_pgOfs7*FH) return; }subN++; if(s_pgOfs7*FH) return; }subN++; if(s_pgOfs7*FH) return; }subN++; if(s_pgOfs7*FH) return; }subN++; if(s_pgOfs7*FH) return; }subN++; @@ -190,16 +191,15 @@ void menuProcSetup(uint8_t event) }subN++; if(s_pgOfs7*FH) return; }subN++; if(s_pgOfsmode, 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) { diff --git a/src/gruvin9x.h b/src/gruvin9x.h index d85019ceb..d23962c0d 100644 --- a/src/gruvin9x.h +++ b/src/gruvin9x.h @@ -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; diff --git a/src/menus.cpp b/src/menus.cpp index d184073d1..c22771988 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -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) diff --git a/src/model_menus.cpp b/src/model_menus.cpp index ea0ef0ac3..d1a58721b 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -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)); } diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp new file mode 100644 index 000000000..da6016f06 --- /dev/null +++ b/src/o9xstrings.cpp @@ -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; diff --git a/src/o9xstrings.h b/src/o9xstrings.h new file mode 100644 index 000000000..4f514b484 --- /dev/null +++ b/src/o9xstrings.h @@ -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 diff --git a/src/translations/en.h b/src/translations/en.h new file mode 100644 index 000000000..f30b8f039 --- /dev/null +++ b/src/translations/en.h @@ -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]"; +