From 6b6c945f5923b2c54f621e9db4479403c967346c Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 29 Jun 2012 17:17:48 +0000 Subject: [PATCH] Bold introduced in many menus PlayTrack for ersky9x Volume for ersky9x Names for Mixes and Expos --- src/Makefile | 5 +- src/board_ersky9x.cpp | 53 ++---- src/board_ersky9x.h | 2 +- src/eeprom_avr.cpp | 16 +- src/ersky9x/audio.cpp | 84 +++++++- src/ersky9x/audio.h | 1 + src/ersky9x/diskio.c | 5 +- src/ersky9x/sound_driver.cpp | 55 +++--- src/ersky9x/sound_driver.h | 2 +- src/frsky.cpp | 48 ++++- src/frsky.h | 2 + src/general_menus.cpp | 16 +- src/gruvin9x/sdcard.h | 14 +- src/lcd.cpp | 45 +++-- src/lcd.h | 4 +- src/menus.cpp | 50 +++-- src/menus.h | 2 +- src/model_menus.cpp | 249 +++++++++++++++--------- src/myeeprom.h | 84 ++++++-- src/open9x.cpp | 359 ++++++++++++++++++++--------------- src/open9x.h | 27 ++- src/simpgmspace.cpp | 4 + src/translations.cpp | 1 + src/translations.h | 1 + src/translations/cz.h | 33 +++- src/translations/de.h | 42 ++-- src/translations/en.h | 43 +++-- src/translations/fr.h | 33 +++- src/translations/it.h | 33 +++- src/translations/se.h | 33 +++- 30 files changed, 890 insertions(+), 456 deletions(-) diff --git a/src/Makefile b/src/Makefile index 16dbbc3b6..353a6c79b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -334,11 +334,14 @@ ifeq ($(PCB), ARM) BOARDSRC = board_ersky9x.cpp SRC += ersky9x/core_cm3.c ersky9x/board_lowlevel.c ersky9x/crt.c ersky9x/vectors_sam3s.c SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c - SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c ersky9x/diskio.c EEPROMSRC = eeprom_arm.cpp PULSESSRC = pulses_arm.cpp CPPSRC += ersky9x/audio.cpp haptic.cpp CPPSRC += ersky9x/sound_driver.cpp ersky9x/haptic_driver.cpp ersky9x/sdcard_driver.cpp + + ifeq ($(SDCARD), YES) + SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c ersky9x/diskio.c + endif endif ifeq ($(PCB), V4) diff --git a/src/board_ersky9x.cpp b/src/board_ersky9x.cpp index 8fdbe762e..2f2dc21c4 100644 --- a/src/board_ersky9x.cpp +++ b/src/board_ersky9x.cpp @@ -754,45 +754,28 @@ uint32_t read_keys() x <<= 1; #ifdef REVB - y = x & 0x00000020; // RIGHT - if ( x & 0x00000004 ) - { - y |= 0x00000010; // UP - } - if ( x & 0x00000010 ) - { - y |= 0x00000040; // LEFT - } - if ( x & 0x00000040 ) - { - y |= 0x00000008; // DOWN - } -#else - - y = x & 0x00000060; - if (x & 0x00000008) { - y |= 0x00000010; - } - if (x & 0x00000010) { - y |= 0x00000008; - } -#endif -#ifdef REVB - if ( PIOC->PIO_PDSR & 0x01000000 ) + y = (x & 0x00000020); // RIGHT + if (x & 0x00000004) + y |= 0x10; // UP + if (x & 0x00000010) + y |= 0x40; // LEFT + if (x & 0x00000040) + y |= 0x08; // DOWN + if (x & 0x02000000) + y |= 0x04; // EXIT + if (PIOB->PIO_PDSR & 0x000000020) + y |= 0x02; // MENU #else + y = (x & 0x00000060); + if (x & 0x00000008) + y |= 0x10; + if (x & 0x00000010) + y |= 0x08; if (PIOA->PIO_PDSR & 0x80000000) -#endif - { - y |= 4; // EXIT - } -#ifdef REVB - if ( PIOB->PIO_PDSR & 0x000000020 ) -#else + y |= 0x04; // EXIT if (PIOB->PIO_PDSR & 0x000000040) + y |= 0x02; // MENU #endif - { - y |= 2; // MENU - } return y ; } diff --git a/src/board_ersky9x.h b/src/board_ersky9x.h index 4464209af..e5de85e56 100644 --- a/src/board_ersky9x.h +++ b/src/board_ersky9x.h @@ -40,7 +40,7 @@ extern "C" { extern void init_SDcard(); -extern void sd_poll_10mS(); +extern void sdPoll10mS(); } #define PIN_ENABLE 0x001 diff --git a/src/eeprom_avr.cpp b/src/eeprom_avr.cpp index 5b39b5749..a560906c8 100644 --- a/src/eeprom_avr.cpp +++ b/src/eeprom_avr.cpp @@ -538,17 +538,10 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc) DIR archiveFolder; UINT written; -#ifndef SIMU - FRESULT result = f_mount(0, &g_FATFS_Obj); - if (result != FR_OK) { - return SDCARD_ERROR(result); - } -#endif - // check and create folder here strcpy_P(buf, STR_MODELS_PATH); #ifndef SIMU - result = f_opendir(&archiveFolder, buf); + FRESULT result = f_opendir(&archiveFolder, buf); if (result != FR_OK) { if (result == FR_NO_PATH) result = f_mkdir(buf); @@ -620,17 +613,12 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name) FIL restoreFile; UINT read; - FRESULT result = f_mount(0, &g_FATFS_Obj); - if (result != FR_OK) { - return SDCARD_ERROR(result); - } - strcpy_P(buf, STR_MODELS_PATH); buf[sizeof(MODELS_PATH)-1] = '/'; strcpy(&buf[sizeof(MODELS_PATH)], model_name); strcpy_P(&buf[strlen(buf)], STR_MODELS_EXT); - result = f_open(&restoreFile, buf, FA_OPEN_EXISTING | FA_READ); + FRESULT result = f_open(&restoreFile, buf, FA_OPEN_EXISTING | FA_READ); if (result != FR_OK) { return SDCARD_ERROR(result); } diff --git a/src/ersky9x/audio.cpp b/src/ersky9x/audio.cpp index c984fb040..af5c55899 100644 --- a/src/ersky9x/audio.cpp +++ b/src/ersky9x/audio.cpp @@ -33,6 +33,83 @@ #include "../open9x.h" +const char * audioFilenames[] = { + "inactiv", + "lowbatt", + "error", + "keyup", + "keydown", + "menus", + "trim", + "warning1", + "warning2", + "warning3", + "midtrim", + "tada", + "midpot", + "mixwarn1", + "mixwarn2", + "mixwarn3", + "timerlt3", + "timer10", + "timer20", + "timer30" +#if 0 + AU_FRSKY_WARN1 = AU_FRSKY_FIRST, + AU_FRSKY_WARN2, + AU_FRSKY_CHEEP, + AU_FRSKY_RING, + AU_FRSKY_SCIFI, + AU_FRSKY_ROBOT, + AU_FRSKY_CHIRP, + AU_FRSKY_TADA, + AU_FRSKY_CRICKET, + AU_FRSKY_SIREN, + AU_FRSKY_ALARMC, + AU_FRSKY_RATATA, + AU_FRSKY_TICK, +#endif +}; + +uint32_t sdAvailableAudioFiles; + +#define AUDIO_FILENAME_PATTERN "/9XSOUNDS/xxxxxxxx.wav" + +#if defined(SDCARD) +void retrieveAvailableAudioFiles() +{ + FILINFO info; + char filename[] = AUDIO_FILENAME_PATTERN; + + assert(sizeof(audioFilenames)==AU_FRSKY_FIRST*sizeof(char *)); + assert(sizeof(sdAvailableAudioFiles)*8 > AU_FRSKY_FIRST); + + sdAvailableAudioFiles = 0; + + for (uint32_t i=0; i0 || (g_eeGeneral.beeperMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR)) { - if (e < AU_FRSKY_FIRST || !audioBusy()) { + if (e < AU_FRSKY_FIRST && isAudioFileAvailable(e, filename)) { + playFile(filename); + } + else if (e < AU_FRSKY_FIRST || !audioBusy()) { switch (e) { // inactivity timer alert case AU_INACTIVITY: diff --git a/src/ersky9x/audio.h b/src/ersky9x/audio.h index efca63275..dd604ed8d 100644 --- a/src/ersky9x/audio.h +++ b/src/ersky9x/audio.h @@ -65,6 +65,7 @@ extern uint8_t queueTonePause[AUDIO_QUEUE_LENGTH]; extern uint8_t queueToneRepeat[AUDIO_QUEUE_LENGTH]; void initAudio(); +extern "C" void retrieveAvailableAudioFiles(); void play(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tFlags=0, int8_t tFreqIncr=0); void playFile(const char *filename); diff --git a/src/ersky9x/diskio.c b/src/ersky9x/diskio.c index 37a97c527..fb3cb81fc 100644 --- a/src/ersky9x/diskio.c +++ b/src/ersky9x/diskio.c @@ -85,7 +85,7 @@ uint32_t Sd_128_resp[4] ; uint32_t Sd_rca ; uint32_t Cmd_8_resp ; uint32_t Cmd_A41_resp ; -uint8_t cardType; +uint8_t cardType; /** * Configure the MCI CLKDIV in the MCI_MR register. The max. for MCI clock is @@ -808,7 +808,7 @@ void sdInit() extern FATFS g_FATFS_Obj; -void sd_poll_10mS() +void sdPoll10mS() { if (!CardIsConnected()) { Card_state = SD_ST_EMPTY; @@ -857,6 +857,7 @@ void sd_poll_10mS() sdAcmd6(); // Set bus width to 4 bits, and speed to 9 MHz // Should check the card can do this **** f_mount(0, &g_FATFS_Obj); + retrieveAvailableAudioFiles(); break; } } diff --git a/src/ersky9x/sound_driver.cpp b/src/ersky9x/sound_driver.cpp index c7c53df5f..1deb7a693 100644 --- a/src/ersky9x/sound_driver.cpp +++ b/src/ersky9x/sound_driver.cpp @@ -225,53 +225,48 @@ void init_twi() TWI0->TWI_CR = TWI_CR_MSEN | TWI_CR_SVDIS ; // Master mode enable TWI0->TWI_MMR = 0x002F0000 ; // Device 5E (>>1) and master is writing NVIC_EnableIRQ(TWI0_IRQn) ; - set_volume( 2 ) ; + setVolume(2) ; } -static int16_t Volume_required ; +static int16_t volumeRequiredIrq ; static const uint8_t Volume_scale[NUM_VOL_LEVELS] = { 0, 2, 4, 6, 8, 10, 13, 17, 22, 27, 33, 40, 64, 82, 96, 105, 112, 117, 120, 122, 124, 125, 126, 127 } ; -void set_volume( register uint8_t volume ) +void setVolume( register uint8_t volume ) { // PMC->PMC_PCER0 |= 0x00080000L ; // Enable peripheral clock to TWI0 - if ( volume >= NUM_VOL_LEVELS ) - { - volume = NUM_VOL_LEVELS - 1 ; - } - volume = Volume_scale[volume] ; + if (volume >= NUM_VOL_LEVELS) { + volume = NUM_VOL_LEVELS - 1 ; + } - __disable_irq() ; - if ( TWI0->TWI_IMR & TWI_IMR_TXCOMP ) - { - Volume_required = volume ; - } - else - { - TWI0->TWI_THR = volume ; // Send data - TWI0->TWI_CR = TWI_CR_STOP ; // Stop Tx - TWI0->TWI_IER = TWI_IER_TXCOMP ; + volume = Volume_scale[volume] ; - } - __enable_irq() ; + __disable_irq() ; + if ( TWI0->TWI_IMR & TWI_IMR_TXCOMP ) { + volumeRequiredIrq = volume ; + } + else { + TWI0->TWI_THR = volume ; // Send data + TWI0->TWI_CR = TWI_CR_STOP ; // Stop Tx + TWI0->TWI_IER = TWI_IER_TXCOMP ; + } + __enable_irq() ; } extern "C" void TWI0_IRQHandler() { - if ( Volume_required >= 0 ) - { - TWI0->TWI_THR = Volume_required ; // Send data - Volume_required = -1 ; - TWI0->TWI_CR = TWI_CR_STOP ; // Stop Tx - } - else - { - TWI0->TWI_IDR = TWI_IDR_TXCOMP ; - } + if ( volumeRequiredIrq >= 0 ) { + TWI0->TWI_THR = volumeRequiredIrq ; // Send data + volumeRequiredIrq = -1 ; + TWI0->TWI_CR = TWI_CR_STOP ; // Stop Tx + } + else { + TWI0->TWI_IDR = TWI_IDR_TXCOMP ; + } } diff --git a/src/ersky9x/sound_driver.h b/src/ersky9x/sound_driver.h index b1de80d96..81d7fa276 100644 --- a/src/ersky9x/sound_driver.h +++ b/src/ersky9x/sound_driver.h @@ -64,7 +64,7 @@ inline void toneStop() extern volatile uint8_t Buzzer_count ; extern void init_twi( void ) ; -extern void set_volume( register uint8_t volume ) ; +extern void setVolume( register uint8_t volume ) ; extern "C" void TWI0_IRQHandler (void) ; #endif diff --git a/src/frsky.cpp b/src/frsky.cpp index fd0118fb1..3ae924ffd 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -630,8 +630,23 @@ void check_frsky() } #endif - - frskyData.currentPrescale += (g_model.frsky.currentSource == 0 ? frskyData.hub.current : frskyData.analog[g_model.frsky.currentSource-1].value); + uint16_t current = frskyData.hub.current; + if (g_model.frsky.currentSource >= FRSKY_SOURCE_A1) { + uint8_t channel = g_model.frsky.currentSource - FRSKY_SOURCE_A1; + current = applyChannelRatio(channel, frskyData.analog[channel].value); + } + frskyData.currentPrescale += current; + uint16_t voltage = 0; + if (g_model.frsky.voltsSource >= FRSKY_SOURCE_A1) { + uint8_t channel = g_model.frsky.voltsSource - FRSKY_SOURCE_A1; + voltage = applyChannelRatio(channel, frskyData.analog[channel].value); + } + else { + for (uint8_t i=0; i= currentConsumptionBoundary) { frskyData.currentConsumption += 1; frskyData.currentPrescale -= currentConsumptionBoundary; @@ -792,8 +807,8 @@ void FrskyValueWithMinMax::set(uint8_t value, uint8_t unit) void frskyEvalCurrentConsumptionBoundary() { currentConsumptionBoundary = 3600; - if (g_model.frsky.currentSource > CURRENT_SOURCE_HUB) { - uint16_t divider = (g_model.frsky.channels[g_model.frsky.currentSource-1].ratio << g_model.frsky.channels[g_model.frsky.currentSource-1].multiplier); + if (g_model.frsky.currentSource > FRSKY_SOURCE_HUB) { + uint16_t divider = (g_model.frsky.channels[g_model.frsky.currentSource-FRSKY_SOURCE_A1].ratio << g_model.frsky.channels[g_model.frsky.currentSource-FRSKY_SOURCE_A1].multiplier); if (divider > 5) { currentConsumptionBoundary = 360000L / divider; } @@ -886,6 +901,13 @@ int16_t convertTelemValue(uint8_t channel, uint8_t value) case TELEM_DIST: result = value * 8; break; + case TELEM_CURRENT: + case TELEM_POWER: + result = value * 5; + break; + case TELEM_CONSUMPTION: + result = value * 20; + break; default: result = value; break; @@ -950,6 +972,10 @@ void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, int16_t val, ui putsTelemetryValue(x, y, val, UNIT_MAH, att); break; + case TELEM_POWER-1: + putsTelemetryValue(x, y, val, UNIT_WATTS, att); + break; + case TELEM_ACCx-1: case TELEM_ACCy-1: case TELEM_ACCz-1: @@ -1066,9 +1092,13 @@ void displayGpsCoord(uint8_t y, char direction, int16_t bp, int16_t ap) uint8_t getTelemCustomField(uint8_t line, uint8_t col) { +#if defined(PCBARM) + return g_model.frsky.lines[2*line+col]; +#else uint8_t result = (col==0 ? (g_model.frskyLines[line] & 0x0f) : ((g_model.frskyLines[line] & 0xf0) / 16)); result += (((g_model.frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16); return result; +#endif } NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm) @@ -1222,16 +1252,16 @@ void menuProcFrsky(uint8_t event) putsTelemetryChannel(3*FW+6*FW+4, y, i+MAX_TIMERS, frskyData.analog[i].value, blink|DBLSIZE); lcd_putc(12*FW-1, y-FH, '<'); putsTelemetryChannel(17*FW, y-FH, i+MAX_TIMERS, frskyData.analog[i].min, NO_UNIT); lcd_putc(12*FW, y, '>'); putsTelemetryChannel(17*FW, y, i+MAX_TIMERS, frskyData.analog[i].max, NO_UNIT); - y += (frskyData.currentConsumption > 0) ? 2*FH : 3*FH; + y += (g_model.frsky.currentSource == FRSKY_SOURCE_NONE) ? 3*FH : 2*FH; } else if (i > 0) { y += FH; } } - if (frskyData.currentConsumption > 0) { - lcd_putsLeft(y, PSTR("Cur")); - if (g_model.frsky.currentSource == CURRENT_SOURCE_HUB) - putsTelemetryChannel(3*FW+4+FW, y, TELEM_CURRENT-1, frskyData.hub.current, LEFT|DBLSIZE); + if (g_model.frsky.currentSource != FRSKY_SOURCE_NONE) { + if (g_model.frsky.currentSource == FRSKY_SOURCE_HUB) + putsTelemetryChannel(2, y, TELEM_CURRENT-1, frskyData.hub.current, LEFT|DBLSIZE); + putsTelemetryChannel(3*FW+4+4*FW+FW, y, TELEM_POWER-1, frskyData.power, DBLSIZE); putsTelemetryChannel(3*FW+4+4*FW+6*FW+FW, y, TELEM_CONSUMPTION-1, frskyData.currentConsumption, DBLSIZE); } #ifdef FRSKY_HUB diff --git a/src/frsky.h b/src/frsky.h index ac7e51a05..9f464dedc 100644 --- a/src/frsky.h +++ b/src/frsky.h @@ -158,6 +158,8 @@ struct FrskyData { #endif uint16_t currentConsumption; uint16_t currentPrescale; + uint16_t voltage; + uint16_t power; }; #if defined(FRSKY_HUB) || defined(WS_HOW_HIGH) diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 1862757ad..9755eca84 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -215,14 +215,10 @@ void menuProcSetup(uint8_t event) #if defined(PCBARM) case ITEM_SETUP_SPEAKER_VOLUME: { - uint8_t current_volume = g_eeGeneral.speakerVolume; lcd_putsLeft(y, PSTR("Speaker Volume")); // TODO translations - lcd_outdezAtt(GENERAL_PARAM_OFS, y, current_volume, attr|LEFT); - if(attr) { - CHECK_INCDEC_GENVAR(event, current_volume, 0, NUM_VOL_LEVELS-1); - if (current_volume != g_eeGeneral.speakerVolume) { - set_volume(g_eeGeneral.speakerVolume = current_volume); - } + lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.speakerVolume, attr|LEFT); + if (attr) { + CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerVolume, 0, NUM_VOL_LEVELS-1); } break; } @@ -538,7 +534,7 @@ void menuProcSd(uint8_t event) fno.lfname = lfn; fno.lfsize = sizeof(lfn); #else - char lfn[32]; + char lfn[SD_SCREEN_FILE_LENGTH]; #endif uint8_t _event = event; @@ -552,10 +548,6 @@ void menuProcSd(uint8_t event) switch(event) { case EVT_ENTRY: -#if defined(PCBV4) - // TODO as ARM - f_mount(0, &g_FATFS_Obj); -#endif f_chdir("/"); reusableBuffer.sd.offset = 255; break; diff --git a/src/gruvin9x/sdcard.h b/src/gruvin9x/sdcard.h index f266428b3..d1e5b0f0f 100644 --- a/src/gruvin9x/sdcard.h +++ b/src/gruvin9x/sdcard.h @@ -42,10 +42,20 @@ #include "rtc.h" #endif -#define LOGS_PATH "/9XLOGS" // no trailing slash = important -#define LOGS_EXT ".CSV" + +#ifdef SIMU +#define MODELS_PATH "." +#define LOGS_PATH "." +#define SOUNDS_PATH "." +#else #define MODELS_PATH "/9XMODELS" +#define LOGS_PATH "/9XLOGS" // no trailing slash = important +#define SOUNDS_PATH "/9XSOUNDS" // no trailing slash = important +#endif + #define MODELS_EXT ".bin" +#define LOGS_EXT ".csv" +#define SOUNDS_EXT ".wav" extern char g_logFilename[21]; // "/9XLOGS/M00_000.CSV\0" max required length = 21 extern FATFS g_FATFS_Obj; diff --git a/src/lcd.cpp b/src/lcd.cpp index c78fed734..97339ec3a 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -69,14 +69,14 @@ uint8_t lcdLastPos; #if defined(PCBARM) uint8_t lcdLock; -uint8_t lcdInputs; +uint32_t lcdInputs; #endif void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode) { uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ]; - const pm_uchar *q = &font_5x8_x20_x7f[ (c-0x20)*5]; + const pm_uchar *q = &font_5x8_x20_x7f[(c-0x20)*5+4]; bool inv = false; if (mode & BLINK) { @@ -91,8 +91,7 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode) inv = true; } - if(mode & DBLSIZE) - { + if (mode & DBLSIZE) { /* each letter consists of ten top bytes followed by * by ten bottom bytes (20 bytes per * char) */ q = &font_10x16_x20_x7f[((uint16_t)c-0x20)*20]; @@ -118,24 +117,32 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode) uint8_t condense=0; if (mode & CONDENSED) { - *p++ = inv ? ~0 : 0; - condense=1; + *p++ = inv ? ~0 : 0; + condense=1; } uint8_t ym8 = (y % 8); + p += 5; for (int8_t i=5; i>=0; i--) { - uint8_t b = (i>0 ? pgm_read_byte(q++) : 0); - if (inv) b = ~b; - - if (condense && i==4) { - /*condense the letter by skipping column 4 */ - continue; - } - if (p> (8-ym8)))) + (b >> (8-ym8)); } - p++; + uint8_t b = (i!=5 ? pgm_read_byte(q--) : 0); + if (inv) b = ~b; + + if (condense && i==4) { + /*condense the letter by skipping column 4 */ + continue; + } + if (p> (8-ym8)))) + (b >> (8-ym8)); } + if (mode & BOLD) { + if (inv) + *(p+1) &= (b << ym8); + else + *(p+1) |= (b << ym8); + } + } + p--; } } } @@ -321,7 +328,8 @@ void lcd_outdezNAtt(uint8_t x, uint8_t y, int16_t val, uint8_t flags, uint8_t le if (neg) lcd_putcAtt(x, y, '-', flags); #if defined(ROTARY_ENCODERS) - if (flags & SURROUNDED) { + // TODO review it! + if (flags & BOLD) { xn = lcdLastPos - x + 2; if (!neg) { x+=FW; xn-=FW; } lcd_rect(x-1, y-1, xn, 9, BLINK_ON_PHASE ? DOTTED : ~DOTTED); @@ -460,6 +468,7 @@ void putsStrIdx(uint8_t x, uint8_t y, const pm_char *str, uint8_t idx, uint8_t a { lcd_putsAtt(x, y, str, att & ~BSS); // TODO use something else than BSS for LEADING0 lcd_outdezNAtt(lcdLastPos, y, idx, att|LEFT, 2); + lcd_putsAtt(x, y, str, att & ~BSS); // TODO use something else than BSS for LEADING0 if (att&TWO_DOTS) lcd_putc(lcdLastPos, y, ':'); } diff --git a/src/lcd.h b/src/lcd.h index e079a022b..c7454ac6f 100644 --- a/src/lcd.h +++ b/src/lcd.h @@ -42,11 +42,11 @@ /* lcd common flags */ #define BLINK 0x01 -#define SURROUNDED 0x40 /* lcd text flags */ #define INVERS 0x02 #define DBLSIZE 0x04 +#define BOLD 0x40 /* lcd putc flags */ #define CONDENSED 0x08 @@ -83,7 +83,7 @@ extern uint8_t lcdLastPos; #if defined(PCBARM) extern uint8_t lcdLock ; -extern uint8_t lcdInputs ; +extern uint32_t lcdInputs ; #endif extern void lcd_putc(uint8_t x,uint8_t y,const unsigned char c); diff --git a/src/menus.cpp b/src/menus.cpp index 841cfbb02..93ba42767 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -72,29 +72,51 @@ int8_t checkIncDec_Ret; int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, uint8_t i_flags) { int16_t newval = val; - uint8_t kpl=KEY_RIGHT, kmi=KEY_LEFT, kother = -1; - - if (event & _MSK_KEY_DBL) { - uint8_t hlp=kpl; - kpl=kmi; - kmi=hlp; - event=EVT_KEY_FIRST(EVT_KEY_MASK & event); + +#if 1 + uint8_t kother = -1; +#else + if (keyState(KEY_RIGHT) && keyState(KEY_LEFT)) { + newval = -val; + killEvents(KEY_LEFT); + killEvents(KEY_RIGHT); } - if (event==EVT_KEY_FIRST(kpl) || event== EVT_KEY_REPT(kpl) || (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_UP) || event== EVT_KEY_REPT(KEY_UP))) ) { + else if (s_editMode && keyState(KEY_RIGHT) && keyState(KEY_UP)) { + newval = i_max; + killEvents(KEY_RIGHT); + killEvents(KEY_UP); + } + else if (s_editMode && keyState(KEY_LEFT) && keyState(KEY_DOWN)) { + newval = i_min; + killEvents(KEY_LEFT); + killEvents(KEY_DOWN); + } + else if (s_editMode && keyState(KEY_UP) && keyState(KEY_DOWN)) { + newval = (i_min + i_max) / 2; + killEvents(KEY_UP); + killEvents(KEY_DOWN); + } + else +#endif + + if (event==EVT_KEY_FIRST(KEY_RIGHT) || event==EVT_KEY_REPT(KEY_RIGHT) || (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)))) { newval++; AUDIO_KEYPAD_UP(); - kother=kmi; + kother = KEY_LEFT; } - else if (event==EVT_KEY_FIRST(kmi) || event== EVT_KEY_REPT(kmi) || (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_DOWN) || event== EVT_KEY_REPT(KEY_DOWN))) ) { + else if (event==EVT_KEY_FIRST(KEY_LEFT) || event==EVT_KEY_REPT(KEY_LEFT) || (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN)))) { newval--; AUDIO_KEYPAD_DOWN(); - kother=kpl; + kother = KEY_RIGHT; } + +#if 1 if ((kother != (uint8_t)-1) && keyState((EnumKeys)kother)) { - newval=-val; - killEvents(kmi); - killEvents(kpl); + newval = -val; + killEvents(KEY_RIGHT); + killEvents(KEY_LEFT); } +#endif if (i_min==0 && i_max==1 && event==EVT_KEY_FIRST(KEY_MENU)) { s_editMode = 0; newval=!val; diff --git a/src/menus.h b/src/menus.h index d07db8931..fe39a0cd3 100644 --- a/src/menus.h +++ b/src/menus.h @@ -127,7 +127,7 @@ extern int8_t s_inflight_max; extern int8_t s_inflight_shift; extern uint8_t s_inflight_bitshift; #define PREPARE_INFLIGHT_BITFIELD(a) int8_t *bitfield = (a) -#define INFLIGHT(val) (s_inflight_value==&val ? SURROUNDED : 0) +#define INFLIGHT(val) (s_inflight_value==&val ? BOLD : 0) void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t i_max, int8_t i_shift, const pm_char *label, uint8_t bitshift=0); #define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, imin, imax, ishift, label) \ checkInFlightIncDecModel(event, &var, imin, imax, ishift, label) diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 6b99e4581..ccfe3e967 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -126,7 +126,7 @@ inline uint8_t eeFindEmptyModel(uint8_t id, bool down) // TODO to be elsewhere if common to many menus const pm_char * s_sdcard_error = NULL; -bool listSDcardModels() +bool listSdFiles(const char *path, const char *extension) { FILINFO fno; DIR dir; @@ -142,25 +142,21 @@ bool listSDcardModels() s_menu_flags = BSS; uint8_t offset = 0; -#if defined(PCBV4) - // TODO as ARM - FRESULT result = f_mount(0, &g_FATFS_Obj); - if (result != FR_OK) { - return SDCARD_ERROR(result); - } -#endif - - FRESULT res = f_opendir(&dir, MODELS_PATH); /* Open the directory */ + FRESULT res = f_opendir(&dir, path); /* Open the directory */ if (res == FR_OK) { for (;;) { res = f_readdir(&dir, &fno); /* Read a directory item */ if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */ - if (fno.fname[0] == '.') continue; /* Ignore dot entry */ + #if _USE_LFN fn = *fno.lfname ? fno.lfname : fno.fname; #else fn = fno.fname; #endif + + uint8_t len = strlen(fn); + if (len < 5 || strcmp(fn+len-4, extension)) continue; + if (~fno.fattrib & AM_DIR) { /* It is a file. */ if (offset < s_menu_offset) { offset++; @@ -479,7 +475,7 @@ void menuProcModelSelect(uint8_t event) s_sdcard_error = eeBackupModel(sub); } else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) { - if (!listSDcardModels()) { + if (!listSdFiles(MODELS_PATH, MODELS_EXT)) { s_sdcard_error = PSTR("No Models on SD"); s_menu_flags = 0; } @@ -944,9 +940,9 @@ void menuProcPhasesAll(uint8_t event) att = i==sub ? INVERS : 0; PhaseData *p = phaseaddress(i); #if defined(EXTRA_ROTARY_ENCODERS) - putsFlightPhase(0, y, i+1, att|CONDENSED); + putsFlightPhase(0, y, i+1, att|CONDENSED|(getFlightPhase()==i ? BOLD : 0)); #else //EXTRA_ROTARY_ENCODERS - putsFlightPhase(0, y, i+1, att); + putsFlightPhase(0, y, i+1, att|(getFlightPhase()==i ? BOLD : 0)); #endif //EXTRA_ROTARY_ENCODERS #if defined PCBV4 #if defined(EXTRA_ROTARY_ENCODERS) @@ -965,7 +961,7 @@ void menuProcPhasesAll(uint8_t event) #define SWITCH_OFS (FW/2) #define TRIMS_OFS (FW/2) #endif - lcd_putsnAtt(4*FW+NAME_OFS, y, p->name, 6, ZCHAR); + lcd_putsnAtt(4*FW+NAME_OFS, y, p->name, sizeof(p->name), ZCHAR); if (i == 0) { lcd_puts(11*FW+SWITCH_OFS, y, STR_DEFAULT); } @@ -1097,7 +1093,6 @@ void menuProcCurveOne(uint8_t event) uint8_t points; int8_t *crv; static int8_t dfltCrv; - static uint8_t autoThrStep; TITLE(STR_MENUCURVE); lcd_outdezAtt(5*FW+1, 0, s_curveChan+1, INVERS|LEFT); @@ -1115,7 +1110,6 @@ void menuProcCurveOne(uint8_t event) switch(event) { case EVT_ENTRY: dfltCrv = 0; - autoThrStep = 0; #if defined(ROTARY_ENCODERS) s_editMode = -1; #endif @@ -1138,20 +1132,12 @@ void menuProcCurveOne(uint8_t event) for (uint8_t i=0; i0) { + if (s_editMode>0) { m_posHorz = 0; s_editMode = 0; } @@ -1161,11 +1147,11 @@ void menuProcCurveOne(uint8_t event) break; case EVT_KEY_REPT(KEY_LEFT): case EVT_KEY_FIRST(KEY_LEFT): - if (!autoThrStep && m_posHorz>0) m_posHorz--; + if (m_posHorz>0) m_posHorz--; break; case EVT_KEY_REPT(KEY_RIGHT): case EVT_KEY_FIRST(KEY_RIGHT): - if (!autoThrStep && m_posHorz<((s_editMode>0) ? points-1 : ((g_menuStack[g_menuStackPtr-1] == menuProcExpoOne && expoaddress(s_currIdx)->chn == THR_STICK) ? 2 : 1))) m_posHorz++; + if (m_posHorz<((s_editMode>0) ? points-1 : 1)) m_posHorz++; break; } @@ -1182,18 +1168,14 @@ void menuProcCurveOne(uint8_t event) } lcd_putsLeft(7*FH, STR_MODE); - lcd_putsiAtt(5*FW-2, 7*FH, STR_CURVMODES, (s_editMode<=0)*m_posHorz, s_editMode>0 || autoThrStep ? 0 : INVERS); + lcd_putsiAtt(5*FW-2, 7*FH, STR_CURVMODES, (s_editMode<=0)*m_posHorz, s_editMode>0 ? 0 : INVERS); - if (s_editMode>0 || autoThrStep) { + if (s_editMode>0) { for (uint8_t i=0; ichn+1,0); - SIMPLE_SUBMENU(STR_MENUDREXPO, EXPO_ONE_LINES_COUNT); + SIMPLE_SUBMENU(STR_MENUDREXPO, EXPO_FIELD_MAX); int8_t sub = m_posVert; uint8_t y = FH; - for (uint8_t i=0; i0 ? BLINK|INVERS : INVERS) : 0); switch(i) { +#if defined(PCBARM) + case EXPO_FIELD_NAME: + EditName(6*FW+5, y, ed->name, sizeof(ed->name), event, attr, m_posHorz); + break; +#endif + case EXPO_FIELD_WIDTH: { PREPARE_INFLIGHT_BITFIELD(&ed->expo - 1); @@ -1495,6 +1481,9 @@ void menuProcExpoOne(uint8_t event) } enum MixFields { +#if defined(PCBARM) + MIX_FIELD_NAME, +#endif MIX_FIELD_SOURCE, MIX_FIELD_WEIGHT, MIX_FIELD_DIFFERENTIAL, @@ -1529,6 +1518,12 @@ void menuProcMixOne(uint8_t event) uint8_t i = k + s_pgOfs; uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0); switch(i) { +#if defined(PCBARM) + case MIX_FIELD_NAME: + lcd_putsLeft(y, STR_NAME); + EditName(MIXES_2ND_COLUMN, y, md2->name, sizeof(md2->name), event, attr, m_posHorz); + break; +#endif case MIX_FIELD_SOURCE: lcd_putsLeft(y, STR_SOURCE); putsMixerSource(MIXES_2ND_COLUMN, y, md2->srcRaw, attr); @@ -1805,45 +1800,63 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_) uint8_t y = (cur-s_pgOfs)*FH; uint8_t attr = ((s_copyMode || sub != cur) ? 0 : INVERS); if (expo) { - lcd_outdezAtt(EXPO_LINE_WEIGHT_POS, y, ed->weight, attr); + lcd_outdezAtt(EXPO_LINE_WEIGHT_POS, y, ed->weight, attr | (isExpoActive(i) ? BOLD : 0)); if (attr != 0) CHECK_INCDEC_MODELVAR(_event, ed->weight, 0, 100); lcd_outdezAtt(EXPO_LINE_EXPO_POS, y, ed->expo, 0); + +#if defined(PCBARM) + if (ed->name[0]) { + putsSwitches(11*FW, y, ed->swtch, 0); + lcd_putsnAtt(15*FW+2, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0)); + } + else +#endif + { #if defined(FLIGHT_PHASES) #if defined(PCBARM) - putsFlightPhase(EXPO_LINE_PHASE_POS, y, ed->phase); + putsFlightPhase(EXPO_LINE_PHASE_POS, y, ed->phase); #else - putsFlightPhase(EXPO_LINE_PHASE_POS, y, ed->negPhase ? -ed->phase : +ed->phase); + putsFlightPhase(EXPO_LINE_PHASE_POS, y, ed->negPhase ? -ed->phase : +ed->phase); #endif #endif - putsSwitches(EXPO_LINE_SWITCH_POS, y, ed->swtch, 0); // normal switches - if (ed->mode!=3) lcd_putc(17*FW, y, ed->mode == 2 ? 126 : 127);//'|' : (stkVal[i] ? '<' : '>'),0);*/ - if (ed->curve) putsCurve(18*FW+2, y, ed->curve+(ed->curve >= CURVE_BASE+4 ? 4 : 0)); + putsSwitches(EXPO_LINE_SWITCH_POS, y, ed->swtch, 0); // normal switches + if (ed->mode!=3) lcd_putc(17*FW, y, ed->mode == 2 ? 126 : 127);//'|' : (stkVal[i] ? '<' : '>'),0);*/ + if (ed->curve) putsCurve(18*FW+2, y, ed->curve+(ed->curve >= CURVE_BASE+4 ? 4 : 0)); + } } else { if (mixCnt > 0) lcd_putsiAtt(1*FW+0, y, STR_VMLTPX2, md->mltpx, 0); - putsMixerSource(4*FW+0, y, md->srcRaw, 0); + putsMixerSource(4*FW+0, y, md->srcRaw, isMixActive(i) ? BOLD : 0); lcd_outdezAtt(11*FW+3, y, md->weight, attr); if (attr != 0) CHECK_INCDEC_MODELVAR(_event, md->weight, -125, 125); - if (md->curve) putsCurve(12*FW+2, y, md->curve); - if (md->swtch) putsSwitches(15*FW+5, y, md->swtch); +#if defined(PCBARM) + if (md->name[0]) { + lcd_putsnAtt(15*FW+2, y, md->name, sizeof(md->name), ZCHAR | (isMixActive(i) ? BOLD : 0)); + } + else +#endif + { + if (md->curve) putsCurve(12*FW+2, y, md->curve); + if (md->swtch) putsSwitches(15*FW+5, y, md->swtch); - char cs = ' '; - if (md->speedDown || md->speedUp) - cs = 'S'; - if ((md->delayUp || md->delayDown)) - cs = (cs =='S' ? '*' : 'D'); - lcd_putcAtt(18*FW+7, y, cs, 0); + char cs = ' '; + if (md->speedDown || md->speedUp) + cs = 'S'; + if ((md->delayUp || md->delayDown)) + cs = (cs =='S' ? '*' : 'D'); + lcd_putcAtt(18*FW+7, y, cs, 0); #ifdef FLIGHT_PHASES - if (md->phase) - putsFlightPhase(20*FW+2, y, md->phase, CONDENSED); + if (md->phase) + putsFlightPhase(20*FW+2, y, md->phase, CONDENSED); #endif + } } if (s_copyMode) { if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) { @@ -2121,20 +2134,20 @@ void menuProcCustomSwitches(uint8_t event) uint8_t y = 0; uint8_t k = 0; - int8_t sub = m_posVert - 1; + int8_t sub = m_posVert - 1; - for(uint8_t i=0; i<7; i++) { - y=(i+1)*FH; - k=i+s_pgOfs; + for (uint8_t i=0; i<7; i++) { + y = (i+1)*FH; + k = i+s_pgOfs; uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); CustomSwData &cs = g_model.customSw[k]; // CSW name uint8_t sw = DSW_SW1+k; - putsSwitches(0, y, sw, getSwitch(sw, 0) ? INVERS : 0); + putsSwitches(0, y, sw, getSwitch(sw, 0) ? BOLD : 0); // CSW func - lcd_putsiAtt(4*FW - 1, y, STR_VCSWFUNC, cs.func, m_posHorz==0 ? attr : 0); + lcd_putsiAtt(4*FW - 2, y, STR_VCSWFUNC, cs.func, m_posHorz==0 ? attr : 0); // CSW params uint8_t cstate = CS_STATE(cs.func); @@ -2142,11 +2155,11 @@ void menuProcCustomSwitches(uint8_t event) if (cstate == CS_VOFS) { - putsChnRaw(12*FW-2, y, cs.v1, (m_posHorz==1 ? attr : 0)); + putsChnRaw(12*FW-6, y, cs.v1, (m_posHorz==1 ? attr : 0)); #if defined(FRSKY) if (cs.v1 > NUM_XCHNCSW-NUM_TELEMETRY) { - putsTelemetryChannel(20*FW, y, cs.v1 - (NUM_XCHNCSW-NUM_TELEMETRY+1), convertTelemValue(cs.v1 - (NUM_XCHNCSW-NUM_TELEMETRY), 128+cs.v2), m_posHorz==2 ? attr : 0); + putsTelemetryChannel(19*FW, y, cs.v1 - (NUM_XCHNCSW-NUM_TELEMETRY+1), convertTelemValue(cs.v1 - (NUM_XCHNCSW-NUM_TELEMETRY), 128+cs.v2), m_posHorz==2 ? attr : 0); v2_min = -128; v2_max = maxTelemValue(cs.v1 - (NUM_XCHNCSW-NUM_TELEMETRY)) - 128; if (cs.v2 > v2_max) { cs.v2 = v2_max; @@ -2156,20 +2169,20 @@ void menuProcCustomSwitches(uint8_t event) else #endif { - lcd_outdezAtt(20*FW, y, cs.v2, m_posHorz==2 ? attr : 0); + lcd_outdezAtt(19*FW, y, cs.v2, m_posHorz==2 ? attr : 0); v2_min = -125; v2_max = 125; } } else if (cstate == CS_VBOOL) { - putsSwitches(12*FW-2, y, cs.v1, m_posHorz==1 ? attr : 0); + putsSwitches(12*FW-6, y, cs.v1, m_posHorz==1 ? attr : 0); putsSwitches(17*FW, y, cs.v2, m_posHorz==2 ? attr : 0); v1_min = SWITCH_OFF; v1_max = SWITCH_ON; v2_min = SWITCH_OFF; v2_max = SWITCH_ON; } else // cstate == CS_COMP { - putsChnRaw(12*FW-2, y, cs.v1, m_posHorz==1 ? attr : 0); + putsChnRaw(12*FW-6, y, cs.v1, m_posHorz==1 ? attr : 0); putsChnRaw(17*FW, y, cs.v2, m_posHorz==2 ? attr : 0); } @@ -2195,11 +2208,18 @@ void menuProcCustomSwitches(uint8_t event) void menuProcFunctionSwitches(uint8_t event) { +#if defined(SDCARD) + uint8_t _event = event; + if (s_warning || s_menu_count) { + event = 0; + } +#endif + MENU(STR_MENUFUNCSWITCHES, menuTabModel, e_FunctionSwitches, NUM_FSW+1, {0, 3/*repeated*/}); uint8_t y = 0; uint8_t k = 0; - int8_t sub = m_posVert - 1; + int8_t sub = m_posVert - 1; for (uint8_t i=0; i<7; i++) { y=(i+1)*FH; @@ -2211,7 +2231,7 @@ void menuProcFunctionSwitches(uint8_t event) uint8_t active = (attr && (s_editMode>0 || p1valdiff)); switch (j) { case 0: - putsSwitches(3, y, sd->swtch, attr); + putsSwitches(3, y, sd->swtch, attr | (getSwitch(sd->swtch, 0) ? BOLD : 0)); if (active) { CHECK_INCDEC_MODELSWITCH( event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH); } @@ -2241,7 +2261,7 @@ void menuProcFunctionSwitches(uint8_t event) break; case 2: if (sd->swtch) { - int16_t val_displayed = sd->param; + int16_t val_displayed = FSW_PARAM(sd); int16_t val_min = 0; int16_t val_max = 255; if (sd->func == FUNC_PLAY_SOUND) { @@ -2258,6 +2278,25 @@ void menuProcFunctionSwitches(uint8_t event) lcd_outdezAtt(21*FW, y, val_displayed, attr); } #endif +#if defined(PCBARM) && defined(SDCARD) + else if (sd->func == FUNC_PLAY_TRACK) { + lcd_putsnAtt(15*FW, y, sd->param.name, sizeof(sd->param.name), attr); + if (active && event==EVT_KEY_BREAK(KEY_MENU)) { + s_editMode = 0; + if (!listSdFiles(SOUNDS_PATH, SOUNDS_EXT)) { + s_warning = PSTR("No Sounds on SD"); + s_menu_flags = 0; + } + } + break; + } +#endif +#if defined(PCBARM) + else if (sd->func == FUNC_VOLUME) { + val_max = NUM_XCHNRAW-1; + putsChnRaw(17*FW, y, val_displayed+1, attr); + } +#endif #if defined(SOMO) else if (sd->func == FUNC_PLAY_TRACK) { lcd_outdezAtt(21*FW, y, val_displayed, attr); @@ -2269,12 +2308,12 @@ void menuProcFunctionSwitches(uint8_t event) #endif else if (sd->func == FUNC_RESET) { val_max = 3; - lcd_putsiAtt(15*FW, y, STR_VFSWRESET, sd->param, attr); + lcd_putsiAtt(15*FW, y, STR_VFSWRESET, FSW_PARAM(sd), attr); } else if (sd->func <= FUNC_SAFETY_CH16) { - int8_t value = ((int8_t)sd->param >> 1); + int8_t value = ((int8_t)FSW_PARAM(sd) >> 1); lcd_outdezAtt(18*FW, y, limit((int8_t)-125, (int8_t)(value * 2), (int8_t)125), attr); - if (active) sd->param = (sd->param & 1) + (checkIncDecModel(event, value, -63, 63) << 1); + if (active) FSW_PARAM(sd) = (FSW_PARAM(sd) & 1) + (checkIncDecModel(event, value, -63, 63) << 1); break; } else { @@ -2283,7 +2322,7 @@ void menuProcFunctionSwitches(uint8_t event) } if (active) { - sd->param = checkIncDec(event, val_displayed, val_min, val_max, EE_MODEL); + FSW_PARAM(sd) = checkIncDec(event, val_displayed, val_min, val_max, EE_MODEL); } } else if (attr) { @@ -2293,12 +2332,12 @@ void menuProcFunctionSwitches(uint8_t event) case 3: if (sd->swtch && sd->func <= FUNC_SAFETY_CH16) { - #if defined(GRAPHICS) - menu_lcd_onoff(20*FW, y, (sd->param & 1), attr ) ; - #else - menu_lcd_onoff(18*FW+2, y, (sd->param & 1), attr ) ; - #endif - if (active) sd->param = (sd->param & 0xfe) + checkIncDecModel(event,sd->param & 1, 0, 1); +#if defined(GRAPHICS) + menu_lcd_onoff(20*FW, y, (FSW_PARAM(sd) & 1), attr ) ; +#else + menu_lcd_onoff(18*FW+2, y, (FSW_PARAM(sd) & 1), attr ) ; +#endif + if (active) FSW_PARAM(sd) = (FSW_PARAM(sd) & 0xfe) + checkIncDecModel(event, FSW_PARAM(sd) & 1, 0, 1); } else if (attr) { m_posHorz = 0; @@ -2307,6 +2346,29 @@ void menuProcFunctionSwitches(uint8_t event) } } } + +#if defined(PCBARM) && defined(SDCARD) + if (s_warning) { + displayConfirmation(_event); + } + + if (s_menu_count) { + const char * result = displayMenu(_event); + if (result) { + if (result == STR_UPDATE_LIST) { + if (!listSdFiles(SOUNDS_PATH, SOUNDS_EXT)) { + s_warning = PSTR("No Sounds on SD"); + s_menu_flags = 0; + } + } + else { + // The user choosed a wav file in the list + memcpy(g_model.funcSw[sub].param.name, result, sizeof(g_model.funcSw[sub].param.name)); + eeDirty(EE_MODEL); + } + } + } +#endif } enum menuProcTelemetryItems { @@ -2328,6 +2390,7 @@ enum menuProcTelemetryItems { ITEM_TELEMETRY_USR_PROTO, ITEM_TELEMETRY_USR_BLADES, #endif + ITEM_TELEMETRY_USR_VOLTAGE_SOURCE, ITEM_TELEMETRY_USR_CURRENT_SOURCE, #if defined(VARIO) ITEM_TELEMETRY_VARIO_LABEL, @@ -2359,10 +2422,10 @@ enum menuProcTelemetryItems { #endif #ifdef FRSKY -#define TELEM_COL2 (8*FW-1) +#define TELEM_COL2 (8*FW) void menuProcTelemetry(uint8_t event) { - MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, USRDATA_LINES 0, VARIO_LINES (uint8_t)-1, 1, 1, 1, 1, (uint8_t)-1, 2, 2, 2, 2}); + MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, USRDATA_LINES 0, 0, VARIO_LINES (uint8_t)-1, 1, 1, 1, 1, (uint8_t)-1, 2, 2, 2, 2}); uint8_t sub = m_posVert - 1; @@ -2501,10 +2564,16 @@ void menuProcTelemetry(uint8_t event) break; #endif + case ITEM_TELEMETRY_USR_VOLTAGE_SOURCE: + lcd_puts(4, y, STR_VOLTAGE); + lcd_putsiAtt(TELEM_COL2, y, STR_CURRENTSRC, g_model.frsky.voltsSource, attr); + if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.voltsSource, 0, 3); + break; + case ITEM_TELEMETRY_USR_CURRENT_SOURCE: lcd_puts(4, y, STR_CURRENT); lcd_putsiAtt(TELEM_COL2, y, STR_CURRENTSRC, g_model.frsky.currentSource, attr); - if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.currentSource, 0, 2); + if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.currentSource, 0, 3); break; #if defined(VARIO) @@ -2554,11 +2623,15 @@ void menuProcTelemetry(uint8_t event) if (attr && m_posHorz==c && (s_editMode>0 || p1valdiff)) { CHECK_INCDEC_MODELVAR(event, value, 0, (j==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX); if (checkIncDec_Ret) { +#if defined (PCBARM) + g_model.frsky.lines[2*j+c] = value; +#else g_model.frskyLines[j] = (c==0 ? ((g_model.frskyLines[j] & 0xf0) + (value & 0x0f)) : (g_model.frskyLines[j] & 0x0f) + ((value & 0x0f) << 4)); uint16_t mask = 0x3 << (4*j+2*c); g_model.frskyLinesXtra &= ~mask; mask = (value / 16) << (4*j+2*c); g_model.frskyLinesXtra |= mask; +#endif } } } diff --git a/src/myeeprom.h b/src/myeeprom.h index e070718e8..9fcebe3ce 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -31,8 +31,8 @@ * */ -#ifndef eeprom_h -#define eeprom_h +#ifndef myeeprom_h +#define myeeprom_h #include @@ -49,7 +49,7 @@ #define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 ) #if defined(PCBARM) -#define EEPROM_VER 209 +#define EEPROM_VER 210 #elif defined(PCBV4) #define EEPROM_VER 209 #else @@ -163,6 +163,8 @@ PACK(typedef struct t_ExpoData { int8_t phase; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4 uint8_t weight; int8_t expo; + char name[6]; + uint8_t spare[4]; }) ExpoData; #else PACK(typedef struct t_ExpoData { @@ -262,6 +264,8 @@ PACK(typedef struct t_MixData { int8_t differential; int8_t carryTrim; int8_t sOffset; + char name[6]; + uint8_t spare[4]; }) MixData; #else #define MAX_DELAY 15 /* 7.5 seconds */ @@ -304,24 +308,38 @@ enum Functions { FUNC_HAPTIC, FUNC_RESET, FUNC_VARIO, -#if defined(SOMO) +#if !defined(PCBSTD) FUNC_PLAY_TRACK, FUNC_PLAY_VALUE, -#endif -#if defined(PCBV4) FUNC_LOGS, #endif +#if defined(PCBARM) + FUNC_VOLUME, +#endif #if defined(DEBUG) FUNC_TEST, // should remain the last before MAX as not added in companion9x #endif FUNC_MAX }; +#if defined(PCBARM) +PACK(typedef struct t_FuncSwData { // Function Switches data + int8_t swtch; //input + uint8_t func; + union { + uint32_t value; + char name[6]; + } param; +}) FuncSwData; +#define FSW_PARAM(p) ((p)->param.value) +#else PACK(typedef struct t_FuncSwData { // Function Switches data int8_t swtch; //input uint8_t func; uint8_t param; }) FuncSwData; +#define FSW_PARAM(p) ((p)->param) +#endif enum TelemetryUnit { UNIT_VOLTS, @@ -334,6 +352,7 @@ enum TelemetryUnit { UNIT_PERCENT, UNIT_MILLIAMPS, UNIT_MAH, + UNIT_WATTS, UNIT_MAX, UNIT_FEET, UNIT_KTS @@ -366,8 +385,10 @@ enum TelemetrySource { TELEM_DIST, TELEM_GPSALT, TELEM_CELL, + TELEM_VOLTAGE, TELEM_CURRENT, TELEM_CONSUMPTION, + TELEM_POWER, TELEM_ACCx, TELEM_ACCy, TELEM_ACCz, @@ -387,7 +408,7 @@ enum TelemetrySource { TELEM_GPS_TIME, TELEM_BAR_MAX = TELEM_CELL, TELEM_NOUSR_BAR_MAX = TELEM_RSSI_RX, - TELEM_CSW_MAX = TELEM_CONSUMPTION, + TELEM_CSW_MAX = TELEM_POWER, TELEM_NOUSR_CSW_MAX = TELEM_RSSI_RX, TELEM_DISPLAY_MAX = TELEM_MAX_CURRENT, TELEM_STATUS_MAX = TELEM_GPS_TIME @@ -402,11 +423,19 @@ enum VarioSource { VARIO_SOURCE_LAST }; +#if defined(PCBARM) PACK(typedef struct t_FrSkyBarData { - uint16_t source:4; // TODO modification in next EEPROM + uint8_t source; + uint8_t barMin; // minimum for bar display + uint8_t barMax; // ditto for max display (would usually = ratio) +}) FrSkyBarData; +#else +PACK(typedef struct t_FrSkyBarData { + uint16_t source:4; // TODO modification in next EEPROM uint16_t barMin:6; // minimum for bar display uint16_t barMax:6; // ditto for max display (would usually = ratio) }) FrSkyBarData; +#endif enum FrskyUsrProtocols { USR_PROTO_NONE, @@ -414,20 +443,32 @@ enum FrskyUsrProtocols { USR_PROTO_WS_HOW_HIGH }; -enum CurrentSource { - CURRENT_SOURCE_HUB, - CURRENT_SOURCE_A1, - CURRENT_SOURCE_A2 +enum FrskySource { + FRSKY_SOURCE_NONE, + FRSKY_SOURCE_HUB, + FRSKY_SOURCE_A1, + FRSKY_SOURCE_A2 }; +#if defined(PCBARM) +#define CUSTOM_TELEMETRY_VIEW \ + uint8_t lines[4*2*2]; \ + uint8_t spare[4] +#else +#define CUSTOM_TELEMETRY_VIEW +#endif + PACK(typedef struct t_FrSkyData { FrSkyChannelData channels[2]; - uint8_t usrProto:3; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh - uint8_t imperial:1; + uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh + uint8_t voltsSource:2; uint8_t blades:2; // How many blades for RPMs, 0=2 blades, 1=3 blades uint8_t currentSource:2; FrSkyBarData bars[4]; FrSkyRSSIAlarm rssiAlarms[2]; + + CUSTOM_TELEMETRY_VIEW; + }) FrSkyData; #ifdef MAVLINK @@ -574,6 +615,15 @@ enum Dsm2Variants { #define BeepANACenter uint8_t #endif +#if !defined(PCBARM) +// TODO modification in next EEPROM +#define TEMP_CUSTOM_TELEMETRY_VIEW \ + uint8_t frskyLines[4]; \ + uint16_t frskyLinesXtra +#else +#define TEMP_CUSTOM_TELEMETRY_VIEW +#endif + PACK(typedef struct t_ModelData { char name[10]; // must be first for eeLoadModelName TimerData timers[MAX_TIMERS]; @@ -603,8 +653,9 @@ PACK(typedef struct t_ModelData { int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5ms increments uint8_t thrTraceSrc; uint8_t modelId; - uint8_t frskyLines[4]; // TODO modification in next EEPROM - uint16_t frskyLinesXtra; + + TEMP_CUSTOM_TELEMETRY_VIEW; + int8_t servoCenter[NUM_CHNOUT]; // TODO:temporary place, need to move to frskydata @@ -613,6 +664,7 @@ PACK(typedef struct t_ModelData { uint8_t varioSpeedDownMin; uint8_t switchWarningStates; + ROTARY_ENCODER_ARRAY_EXTRA; }) ModelData; diff --git a/src/open9x.cpp b/src/open9x.cpp index 35b0b01f6..fa484fe47 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -240,16 +240,19 @@ int16_t intpol(int16_t x, uint8_t idx) // -100, -75, -50, -25, 0 ,25 ,50, 75, 10 int16_t erg; x+=RESXu; - if(x < 0) { + if (x < 0) { erg = (int16_t)crv[0] * (RESX/4); - } else if(x >= (RESX*2)) { + } + else if (x >= (RESX*2)) { erg = (int16_t)crv[(cv9 ? 8 : 4)] * (RESX/4); - } else { + } + else { int16_t a,dx; - if(cv9){ + if (cv9) { a = (uint16_t)x / D9; dx =((uint16_t)x % D9) * 2; - } else { + } + else { a = (uint16_t)x / D5; dx = (uint16_t)x % D5; } @@ -302,16 +305,17 @@ uint16_t expou(uint16_t x, uint16_t k) int16_t expo(int16_t x, int16_t k) { - if(k == 0) return x; - int16_t y; - bool neg = x < 0; - if(neg) x = -x; - if(k<0){ - y = RESXu-expou(RESXu-x,-k); - }else{ - y = expou(x,k); + if (k == 0) return x; + int16_t y; + bool neg = x < 0; + if (neg) x = -x; + if (k<0) { + y = RESXu-expou(RESXu-x, -k); } - return neg? -y:y; + else { + y = expou(x, k); + } + return neg? -y : y; } #ifdef EXTENDED_EXPO @@ -350,6 +354,7 @@ int16_t Expo::expo(int16_t x) } #endif +ACTIVE_EXPOS_TYPE activeExpos; void applyExpos(int16_t *anas) { @@ -358,6 +363,7 @@ void applyExpos(int16_t *anas) uint8_t phase = s_perout_flight_phase + 1; int8_t cur_chn = -1; + activeExpos = 0; for (uint8_t i=0; i=0 && ed.mode&2)) { cur_chn = ed.chn; @@ -472,8 +479,10 @@ int16_t getValue(uint8_t i) else if(i e_power_trainer) return; // Usb on or power off + if (check_soft_power() > e_power_trainer) return; // Usb on or power off #if !defined(PCBSTD) - if (curTime < get_tmr10ms()) { - curTime += 6; - if (contrast < g_eeGeneral.contrast) { - contrast += 1; - lcdSetRefVolt(contrast); - } + if (curTime < get_tmr10ms()) { + curTime += 6; + if (contrast < g_eeGeneral.contrast) { + contrast += 1; + lcdSetRefVolt(contrast); } + } #endif - checkBacklight(); - } + checkBacklight(); } + } } +#else +#define doSplash() #endif #if !defined(PCBARM) @@ -903,8 +924,8 @@ void checkTHR() #ifdef SIMU int16_t lowLim = THRCHK_DEADBAND - 1024 ; #else - int16_t lowLim = THRCHK_DEADBAND + g_eeGeneral.calibMid[thrchn] - g_eeGeneral.calibSpanNeg[thrchn]; getADC_single(); // if thr is down - do not display warning at all + int16_t lowLim = THRCHK_DEADBAND + g_eeGeneral.calibMid[thrchn] - g_eeGeneral.calibSpanNeg[thrchn]; #endif int16_t v = anaIn(thrchn); if (g_eeGeneral.throttleReversed) v = - v; @@ -925,12 +946,8 @@ void checkTHR() int16_t v = anaIn(thrchn); if (g_eeGeneral.throttleReversed) v = - v; - if (check_soft_power() > e_power_trainer) return; // Usb on or power off - - if(v<=lowLim || keyDown()) { - clearKeyEvents(); - return; - } + if (check_soft_power() > e_power_trainer || v<=lowLim || keyDown()) + break; checkBacklight(); @@ -1512,7 +1529,7 @@ void testFunc() #define MASK_FSW_TYPE uint16_t // current max = 16 function switches #endif -uint16_t active_functions = 0; +uint16_t activeFunctions = 0; MASK_FSW_TYPE active_switches = 0; #if defined(SOMO) @@ -1594,9 +1611,14 @@ void playValue(uint8_t idx) } #endif +#if defined(PCBARM) +static uint8_t currentSpeakerVolume = 255; +uint8_t requiredSpeakerVolume; +#endif + void evalFunctions() { - assert((int)(sizeof(active_functions)*8) > (int)(FUNC_MAX-NUM_CHNOUT)); + assert((int)(sizeof(activeFunctions)*8) > (int)(FUNC_MAX-NUM_CHNOUT)); for (uint8_t i=0; ifunc < FUNC_TRAINER && (sd->param & 1)) { - safetyCh[sd->func] = limit((int8_t)-125, (int8_t)(((int8_t)sd->param >> 1) * 2), (int8_t)125); + if (sd->func < FUNC_TRAINER && (FSW_PARAM(sd) & 1)) { + safetyCh[sd->func] = limit((int8_t)-125, (int8_t)(((int8_t)FSW_PARAM(sd) >> 1) * 2), (int8_t)125); } - if (~active_functions & function_mask) { + if (~activeFunctions & function_mask) { if (sd->func == FUNC_INSTANT_TRIM) { if (g_menuStack[0] == menuMainView #if defined(FRSKY) @@ -1634,10 +1656,10 @@ void evalFunctions() if (~active_switches & switch_mask) { if (sd->func == FUNC_RESET) { - switch (sd->param) { + switch (FSW_PARAM(sd)) { case 0: case 1: - resetTimer(sd->param); + resetTimer(FSW_PARAM(sd)); break; case 2: resetAll(); @@ -1653,17 +1675,29 @@ void evalFunctions() if ((!momentary) || (~active_switches & switch_mask)) { if (sd->func == FUNC_PLAY_SOUND) { - AUDIO_PLAY(AU_FRSKY_FIRST+sd->param); + AUDIO_PLAY(AU_FRSKY_FIRST+FSW_PARAM(sd)); } #if defined(HAPTIC) if (sd->func == FUNC_HAPTIC) { - haptic.event(AU_FRSKY_LAST+sd->param); + haptic.event(AU_FRSKY_LAST+FSW_PARAM(sd)); } #endif -#if defined(SOMO) - if (sd->func == FUNC_PLAY_TRACK || sd->func == FUNC_PLAY_VALUE) { +#if defined(PCBARM) && defined(SDCARD) + else if (sd->func == FUNC_PLAY_TRACK) { + if (!audioBusy()) { + char lfn[32] = SOUNDS_PATH "/"; + strcat(lfn, sd->param.name); + strcat(lfn, SOUNDS_EXT); + playFile(lfn); + } + } + else if (sd->func == FUNC_VOLUME) { + requiredSpeakerVolume = ((1024 + getValue(sd->param.value)) * NUM_VOL_LEVELS) / 2048; + } +#elif defined(SOMO) + else if (sd->func == FUNC_PLAY_TRACK || sd->func == FUNC_PLAY_VALUE) { if (!isPlaying()) { static uint16_t s_last_play = 0; uint16_t tmr10ms = get_tmr10ms(); @@ -1685,11 +1719,11 @@ void evalFunctions() #endif } - active_functions |= function_mask; + activeFunctions |= function_mask; active_switches |= switch_mask; } else { - active_functions &= (~function_mask); + activeFunctions &= (~function_mask); active_switches &= (~switch_mask); } } @@ -1873,6 +1907,8 @@ void perOut(uint8_t tick10ms) } } + activeMixes |= ((ACTIVE_MIXES_TYPE)1 << i); + //========== OFFSET =============== if (apply_offset && md->sOffset) v += calc100toRESX(md->sOffset); @@ -1960,9 +1996,12 @@ char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE]; #define TIME_TO_WRITE s_eeDirtyMsk #endif +ACTIVE_MIXES_TYPE activeMixes; int32_t sum_chans512[NUM_CHNOUT] = {0}; inline void doMixerCalculations(uint16_t tmr10ms, uint8_t tick10ms) { + activeMixes = 0; + if (g_eeGeneral.filterInput == 1) { getADC_filt() ; } @@ -2231,9 +2270,19 @@ inline void doMixerCalculations(uint16_t tmr10ms, uint8_t tick10ms) } } } - + +#if defined(PCBARM) + requiredSpeakerVolume = g_eeGeneral.speakerVolume; +#endif + evalFunctions(); +#if defined(PCBARM) + if (currentSpeakerVolume != requiredSpeakerVolume) { + setVolume(requiredSpeakerVolume); + currentSpeakerVolume = requiredSpeakerVolume; + } +#endif } void perMain() @@ -2255,8 +2304,8 @@ void perMain() ee32_process(); else if (TIME_TO_WRITE) eeCheck(); -#if !defined(SIMU) - sd_poll_10mS(); +#if defined(SDCARD) && !defined(SIMU) + sdPoll10mS(); #endif } #else @@ -2782,33 +2831,92 @@ uint16_t stack_free() #endif +#if defined(PCBV4) +#define UNEXPECTED_SHUTDOWN() ((mcusr & (1 << WDRF)) || g_eeGeneral.unexpectedShutdown) +#define OPEN9X_INIT_ARGS const uint8_t mcusr +#elif defined(PCBSTD) +#define UNEXPECTED_SHUTDOWN() (mcusr & (1 << WDRF)) +#define OPEN9X_INIT_ARGS const uint8_t mcusr +#else +#define UNEXPECTED_SHUTDOWN() (g_eeGeneral.unexpectedShutdown) +#define OPEN9X_INIT_ARGS +#endif + +inline void open9xInit(OPEN9X_INIT_ARGS) +{ + eeReadAll(); + +#if defined(PCBARM) + setVolume(g_eeGeneral.speakerVolume); + PWM->PWM_CH_NUM[0].PWM_CDTYUPD = g_eeGeneral.backlightBright; +#endif + + if (!UNEXPECTED_SHUTDOWN()) { + doSplash(); + +#if !defined(PCBARM) + checkLowEEPROM(); +#endif + + checkTHR(); + checkSwitches(); + checkAlarm(); + } + +#if defined(PCBARM) || defined(PCBV4) + if (!g_eeGeneral.unexpectedShutdown) { + g_eeGeneral.unexpectedShutdown = 1; + eeDirty(EE_GENERAL); + } +#endif + + clearKeyEvents(); //make sure no keys are down before proceeding + + lcdSetRefVolt(g_eeGeneral.contrast); + g_LightOffCounter = g_eeGeneral.lightAutoOff*500; //turn on light for x seconds - no need to press key Issue 152 + +#if defined(PCBARM) + + start_ppm_capture(); + // TODO inside startPulses? +#endif + + startPulses(); + + if (check_soft_power() <= e_power_trainer) { + wdt_enable(WDTO_500MS); + } +} + #if defined(PCBARM) void mixerTask(void * pdata) { while(1) { - uint16_t t0 = getTmr2MHz(); + if (!s_pulses_paused) { + uint16_t t0 = getTmr2MHz(); - static uint16_t lastTMR; - uint16_t tmr10ms = get_tmr10ms(); - uint8_t tick10ms = (tmr10ms - lastTMR); - lastTMR = tmr10ms; + static uint16_t lastTMR; + uint16_t tmr10ms = get_tmr10ms(); + uint8_t tick10ms = (tmr10ms - lastTMR); + lastTMR = tmr10ms; - if (s_current_protocol < PROTO_NONE) { - checkTrims(); - doMixerCalculations(tmr10ms, tick10ms); + if (s_current_protocol < PROTO_NONE) { + checkTrims(); + doMixerCalculations(tmr10ms, tick10ms); + } + + heartbeat |= HEART_TIMER10ms; + + if (heartbeat == HEART_TIMER_PULSES+HEART_TIMER10ms) { + wdt_reset(); + heartbeat = 0; + } + + t0 = getTmr2MHz() - t0; + if (t0 > g_timeMainMax) g_timeMainMax = t0 ; } - heartbeat |= HEART_TIMER10ms; - - if (heartbeat == HEART_TIMER_PULSES+HEART_TIMER10ms) { - wdt_reset(); - heartbeat = 0; - } - - t0 = getTmr2MHz() - t0; - if (t0 > g_timeMainMax) g_timeMainMax = t0 ; - CoTickDelay(1); // 2ms for now } } @@ -2823,6 +2931,8 @@ void menusTask(void * pdata) { register uint32_t shutdown_state = 0; + open9xInit(); + while (1) { shutdown_state = check_soft_power(); #if 0 @@ -2899,10 +3009,10 @@ int main(void) // we could put a bunch more wdt_reset()s in. But I don't like that approach // during boot up.) #if defined(PCBV4) - uint8_t mcusr_mirror = MCUSR; // save the WDT (etc) flags + uint8_t mcusr = MCUSR; // save the WDT (etc) flags MCUSR = 0; // must be zeroed before disabling the WDT #elif defined(PCBSTD) - uint8_t mcusr_mirror = MCUCSR; + uint8_t mcusr = MCUCSR; MCUCSR = 0; #endif @@ -2967,66 +3077,10 @@ int main(void) init_rotary_sw(); #endif - eeReadAll(); - - uint8_t cModel = g_eeGeneral.currModel; - -#if defined(PCBARM) - set_volume(g_eeGeneral.speakerVolume); - PWM->PWM_CH_NUM[0].PWM_CDTYUPD = g_eeGeneral.backlightBright; +#ifndef PCBARM + open9xInit(mcusr); #endif -#if defined(PCBV4) - if ((~mcusr_mirror & (1 << WDRF)) && !g_eeGeneral.unexpectedShutdown) -#elif defined(PCBSTD) - if (~mcusr_mirror & (1 << WDRF)) -#else - if (!g_eeGeneral.unexpectedShutdown) -#endif - { -#ifdef SPLASH -#ifdef DSM2 - // TODO rather use another Model Parameter - if (g_model.protocol != PROTO_DSM2) -#endif - doSplash(); -#endif - -#if !defined(PCBARM) - checkLowEEPROM(); -#endif - - getADC_single(); - checkTHR(); - checkSwitches(); - checkAlarm(); - } - -#if defined(PCBARM) || defined(PCBV4) - if (!g_eeGeneral.unexpectedShutdown) { - g_eeGeneral.unexpectedShutdown = 1; - eeDirty(EE_GENERAL); - } -#endif - - clearKeyEvents(); //make sure no keys are down before proceeding - - lcdSetRefVolt(g_eeGeneral.contrast); - g_LightOffCounter = g_eeGeneral.lightAutoOff*500; //turn on light for x seconds - no need to press key Issue 152 - - if(cModel!=g_eeGeneral.currModel) eeDirty(EE_GENERAL); // if model was quick-selected, make sure it sticks - -#if defined(PCBARM) - start_ppm_capture(); - // TODO inside startPulses? -#endif - - startPulses(); - - if (check_soft_power() <= e_power_trainer) { - wdt_enable(WDTO_500MS); - } - #if defined(PCBARM) CoInitOS(); @@ -3062,8 +3116,7 @@ int main(void) perMain(); #if defined(PCBSTD) - if(heartbeat == 0x3) - { + if(heartbeat == HEART_TIMER_PULSES+HEART_TIMER10ms) { wdt_reset(); heartbeat = 0; } diff --git a/src/open9x.h b/src/open9x.h index a78938e53..8c9f7f1b0 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -448,7 +448,6 @@ extern Key keys[NUM_KEYS]; #define TRM_BASE TRM_LH_DWN -#define _MSK_KEY_DBL 0x10 #define _MSK_KEY_BREAK 0x20 #define _MSK_KEY_REPT 0x40 #define _MSK_KEY_LONG 0x80 @@ -457,7 +456,6 @@ extern Key keys[NUM_KEYS]; #define EVT_KEY_FIRST(key) ((key)|_MSK_KEY_REPT|0x20) #define EVT_KEY_REPT(key) ((key)|_MSK_KEY_REPT) #define EVT_KEY_LONG(key) ((key)|_MSK_KEY_LONG) -#define EVT_KEY_DBL(key) ((key)|_MSK_KEY_DBL) #define EVT_ENTRY (0xff - _MSK_KEY_REPT) #define EVT_ENTRY_UP (0xfe - _MSK_KEY_REPT) #define EVT_KEY_MASK (0x0f) @@ -790,10 +788,31 @@ extern void incSubtrim(uint8_t idx, int16_t inc); extern void instantTrim(); extern void moveTrimsToOffsets(); -extern uint16_t active_functions; +#if defined(PCBARM) +#define ACTIVE_EXPOS_TYPE uint32_t +#define ACTIVE_MIXES_TYPE uint64_t +#else +#define ACTIVE_EXPOS_TYPE uint16_t +#define ACTIVE_MIXES_TYPE uint32_t +#endif + +extern ACTIVE_EXPOS_TYPE activeExpos; +extern ACTIVE_MIXES_TYPE activeMixes; +extern uint16_t activeFunctions; + +inline bool isExpoActive(uint8_t expo) +{ + return activeExpos & ((ACTIVE_EXPOS_TYPE)1 << expo); +} + +inline bool isMixActive(uint8_t mix) +{ + return activeMixes & ((ACTIVE_MIXES_TYPE)1 << mix); +} + inline bool isFunctionActive(uint8_t func) { - return active_functions & (1 << (func-FUNC_TRAINER)); + return activeFunctions & (1 << (func-FUNC_TRAINER)); } #ifdef DISPLAY_USER_DATA diff --git a/src/simpgmspace.cpp b/src/simpgmspace.cpp index 68175d469..bb04fec8e 100644 --- a/src/simpgmspace.cpp +++ b/src/simpgmspace.cpp @@ -278,6 +278,10 @@ namespace simu { #include } #include "FatFs/ff.h" +FRESULT f_stat (const TCHAR*, FILINFO*) +{ + return FR_OK; +} FRESULT f_mount (BYTE, FATFS*) { diff --git a/src/translations.cpp b/src/translations.cpp index 937a180b9..eb8450473 100644 --- a/src/translations.cpp +++ b/src/translations.cpp @@ -304,6 +304,7 @@ const pm_char STR_SHUTDOWN[] PROGMEM = TR_SHUTDOWN; const pm_char STR_BATT_CALIB[] PROGMEM = TR_BATT_CALIB; #if defined(PCBARM) || defined(FRSKY) +const pm_char STR_VOLTAGE[] PROGMEM = TR_VOLTAGE; const pm_char STR_CURRENT[] PROGMEM = TR_CURRENT; #endif diff --git a/src/translations.h b/src/translations.h index 5ef64647f..d3105356e 100644 --- a/src/translations.h +++ b/src/translations.h @@ -376,6 +376,7 @@ extern const pm_char STR_SHUTDOWN[]; extern const pm_char STR_BATT_CALIB[]; #if defined(PCBARM) || defined(FRSKY) +extern const pm_char STR_VOLTAGE[]; extern const pm_char STR_CURRENT[]; #endif diff --git a/src/translations/cz.h b/src/translations/cz.h index 67f716da2..d7dda74af 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -68,15 +68,20 @@ #define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|" #define LEN_CURVMODES "\005" -#define TR_CURVMODES "EDIT ""PRSET""A.THR" +#define TR_CURVMODES "EDIT ""PRSET" #define LEN_EXPLABELS "\006" +#ifdef PCBARM +#define TR_EXPLABEL_NAME "Name " +#else +#define TR_EXPLABEL_NAME +#endif #ifdef FLIGHT_PHASES #define TR_EXPLABEL_FP "F\200ze " #else #define TR_EXPLABEL_FP #endif -#define TR_EXPLABELS "V\200ha ""Expo ""K\206ivka" TR_EXPLABEL_FP "Sp\204na\201""Strana""\0" +#define TR_EXPLABELS TR_EXPLABEL_NAME "V\200ha ""Expo ""K\206ivka" TR_EXPLABEL_FP "Sp\204na\201""Strana""\0" #define LEN_VMLTPX "\010" #define TR_VMLTPX "Se\201\204st ""N\200sobit ""Zam\203nit " @@ -106,7 +111,18 @@ #else #define TR_HAPTIC "[Vibrovat]\0 " #endif -#if defined(PCBV4) +#if defined(PCBARM) +#if defined(SDCARD) +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "Play Track\0 " +#define TR_PLAY_VALUE "[Play Value]\0" +#else +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "[Play Track]\0" +#define TR_PLAY_VALUE "[Play Value]\0" +#endif +#define TR_FSW_VOLUME "Volume\0 " +#elif defined(PCBV4) #if defined(SDCARD) #define TR_SDCLOGS "SDCARD Logs " #else @@ -119,17 +135,19 @@ #define TR_PLAY_TRACK "[Hr\200t Stopu]\0" #define TR_PLAY_VALUE "Hr\200t Hodnotu\0" #endif +#define TR_FSW_VOLUME #else #define TR_SDCLOGS #define TR_PLAY_TRACK #define TR_PLAY_VALUE +#define TR_FSW_VOLUME #endif #ifdef DEBUG #define TR_TEST "Test\0 " #else #define TR_TEST #endif -#define TR_VFSWFUNC "Bezpe\201\0 ""Tren\202r\0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Bezpe\201\0 ""Tren\202r\0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""Vse ""Telem." @@ -138,7 +156,7 @@ #define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick " #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Curr""Cnsp""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time" +#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Volt""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time" #ifdef IMPERIAL_UNITS #define LENGTH_UNIT "ft\0" @@ -149,7 +167,7 @@ #endif #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh" +#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh""W\0 " #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -169,7 +187,7 @@ #endif #define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "Hub""A1\0""A2\0" +#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" @@ -390,6 +408,7 @@ #define TR_SHUTDOWN "VYP\214N\213\N\204.." #define TR_BATT_CALIB "Kalibrace Bat" #define TR_CURRENT_CALIB "Kalib.Proudu" +#define TR_VOLTAGE "Voltage" #define TR_CURRENT "Proud" #define TR_SELECT_MODEL "Vyber Model" #define TR_CREATE_MODEL "Vytvo\206 Model" diff --git a/src/translations/de.h b/src/translations/de.h index 83cf6768e..0d50a089e 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -68,15 +68,20 @@ #define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|" #define LEN_CURVMODES "\005" -#define TR_CURVMODES "EDIT ""PRSET""A.THR" +#define TR_CURVMODES "EDIT ""PRSET" -#define LEN_EXPLABELS "\006" +#define LEN_EXPLABELS "\006" +#ifdef PCBARM +#define TR_EXPLABEL_NAME "Name " +#else +#define TR_EXPLABEL_NAME +#endif #ifdef FLIGHT_PHASES #define TR_EXPLABEL_FP "Phase " #else #define TR_EXPLABEL_FP #endif -#define TR_EXPLABELS "Gew. ""Expo ""Kurve " TR_EXPLABEL_FP "Switch""Seite ""\0" +#define TR_EXPLABELS TR_EXPLABEL_NAME "Gew. ""Expo ""Kurve " TR_EXPLABEL_FP "Switch""Seite ""\0" #define LEN_VMLTPX "\010" #define TR_VMLTPX "Add ""Multiply""Replace " @@ -105,8 +110,19 @@ #define TR_HAPTIC "Haptic\0 " #else #define TR_HAPTIC "[Haptic]\0 " -#endif -#if defined(PCBV4) +#endif +#if defined(PCBARM) +#if defined(SDCARD) +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "Play Track\0 " +#define TR_PLAY_VALUE "[Play Value]\0" +#else +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "[Play Track]\0" +#define TR_PLAY_VALUE "[Play Value]\0" +#endif +#define TR_FSW_VOLUME "Volume\0 " +#elif defined(PCBV4) #if defined(SDCARD) #define TR_SDCLOGS "SDcard Logs " #else @@ -118,19 +134,20 @@ #else #define TR_PLAY_TRACK "[Play Track]\0" #define TR_PLAY_VALUE "[Play Value]\0" -#endif +#endif +#define TR_FSW_VOLUME #else #define TR_SDCLOGS #define TR_PLAY_TRACK #define TR_PLAY_VALUE - +#define TR_FSW_VOLUME #endif #ifdef DEBUG #define TR_TEST "Test\0 " #else #define TR_TEST #endif -#define TR_VFSWFUNC "Safety\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Safety\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""Alle ""Telem." @@ -139,7 +156,7 @@ #define TR_FUNCSOUNDS "Warn 1""Warn 2""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick " #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Curr""Cnsp""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time" +#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Volt""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time" #ifdef IMPERIAL_UNITS #define LENGTH_UNIT "ft\0" @@ -150,7 +167,7 @@ #endif #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh" +#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh""W\0 " #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -170,7 +187,7 @@ #endif #define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "Hub""A1\0""A2\0" +#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" @@ -390,7 +407,8 @@ #define TR_VARIO "Vario" #define TR_SHUTDOWN "SHUTTING DOWN" #define TR_BATT_CALIB "Batt. Kalib." -#define TR_CURRENT_CALIB "Strom Kalib." +#define TR_CURRENT_CALIB "Strom Kalib." +#define TR_VOLTAGE "Voltage" #define TR_CURRENT "Strom" #define TR_SELECT_MODEL "Modell W\201hlen" #define TR_CREATE_MODEL "Modell Neu" diff --git a/src/translations/en.h b/src/translations/en.h index dbccfe17e..010a3e89e 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -68,15 +68,20 @@ #define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|" #define LEN_CURVMODES "\005" -#define TR_CURVMODES "EDIT ""PRSET""A.THR" +#define TR_CURVMODES "EDIT ""PRSET" #define LEN_EXPLABELS "\006" +#ifdef PCBARM +#define TR_EXPLABEL_NAME "Name " +#else +#define TR_EXPLABEL_NAME +#endif #ifdef FLIGHT_PHASES #define TR_EXPLABEL_FP "Phase " #else #define TR_EXPLABEL_FP #endif -#define TR_EXPLABELS "Weight""Expo ""Curve " TR_EXPLABEL_FP "Swtch ""Side\0 ""\0" +#define TR_EXPLABELS TR_EXPLABEL_NAME "Weight""Expo ""Curve " TR_EXPLABEL_FP "Swtch ""Side\0 ""\0" #define LEN_VMLTPX "\010" #define TR_VMLTPX "Add ""Multiply""Replace " @@ -88,13 +93,13 @@ #define TR_VMIXTRIMS "OFF""ON ""Rud""Ele""Thr""Ail" #define LEN_VCSWFUNC "\007" -#define TR_VCSWFUNC "----\0 ""v>ofs ""vofs""|v|v2 ""v1=v2 ""v1<=v2 " +#define TR_VCSWFUNC "----\0 ""v>ofs\0 ""vofs""|v|v2 ""v1=v2 ""v1<=v2 " #define LEN_VFSWFUNC "\015" #if defined(VARIO) -#define TR_VVARIO "Vario " +#define TR_VVARIO "Vario " #else -#define TR_VVARIO "[Vario] " +#define TR_VVARIO "[Vario] " #endif #if defined(AUDIO) #define TR_SOUND "Play Sound\0 " @@ -106,7 +111,18 @@ #else #define TR_HAPTIC "[Haptic]\0 " #endif -#if defined(PCBV4) +#if defined(PCBARM) +#if defined(SDCARD) +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "Play Track\0 " +#define TR_PLAY_VALUE "[Play Value]\0" +#else +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "[Play Track]\0" +#define TR_PLAY_VALUE "[Play Value]\0" +#endif +#define TR_FSW_VOLUME "Volume\0 " +#elif defined(PCBV4) #if defined(SDCARD) #define TR_SDCLOGS "SDCARD Logs " #else @@ -119,10 +135,12 @@ #define TR_PLAY_TRACK "[Play Track]\0" #define TR_PLAY_VALUE "[Play Value]\0" #endif +#define TR_FSW_VOLUME #else #define TR_SDCLOGS #define TR_PLAY_TRACK #define TR_PLAY_VALUE +#define TR_FSW_VOLUME #endif #ifdef DEBUG @@ -130,7 +148,7 @@ #else #define TR_TEST #endif -#define TR_VFSWFUNC "Safety\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Safety\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""All ""Telem." @@ -139,7 +157,7 @@ #define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick " #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Curr""Cnsp""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time" +#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Volt""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time" #ifdef IMPERIAL_UNITS #define LENGTH_UNIT "ft\0" @@ -150,7 +168,7 @@ #endif #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh" +#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh""W\0 " #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -170,7 +188,7 @@ #endif #define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "Hub""A1\0""A2\0" +#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" @@ -193,9 +211,9 @@ #define LEN_VSWITCHES "\003" #if defined(PCBARM) -#define TR_VSWITCHES "THR""RUD""ELE""ID0""ID1""ID2""AIL""GEA""TRN""SW1""SW2""SW3""SW4""SW5""SW6""SW7""SW8""SW9""SWA""SWB""SWC""SWD""SWE""SWF""SWG""SWH""SWI""SWJ""SWK""SWL""SWM""SWN""SWO""SWP""SWQ""SWR""SWS""SWT""SWU""SWV""SWW" +#define TR_VSWITCHES "THR""RUD""ELE""ID0""ID1""ID2""AIL""GEA""TRN""CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC""CSD""CSE""CSF""CSG""CSH""CSI""CSJ""CSK""CSL""CSM""CSN""CSO""CSP""CSQ""CSR""CSS""CST""CSU""CSV""CSW" #else -#define TR_VSWITCHES "THR""RUD""ELE""ID0""ID1""ID2""AIL""GEA""TRN""SW1""SW2""SW3""SW4""SW5""SW6""SW7""SW8""SW9""SWA""SWB""SWC" +#define TR_VSWITCHES "THR""RUD""ELE""ID0""ID1""ID2""AIL""GEA""TRN""CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC" #endif #define LEN_VSRCRAW "\004" @@ -391,6 +409,7 @@ #define TR_SHUTDOWN "SHUTTING DOWN" #define TR_BATT_CALIB "Battery Calib" #define TR_CURRENT_CALIB "Current Calib" +#define TR_VOLTAGE "Voltage" #define TR_CURRENT "Current" #define TR_SELECT_MODEL "Select Model" #define TR_CREATE_MODEL "Create Model" diff --git a/src/translations/fr.h b/src/translations/fr.h index 250bc16b7..b44450687 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -63,15 +63,20 @@ #define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|" #define LEN_CURVMODES "\005" -#define TR_CURVMODES "EDIT ""PRSET""A.GAZ" +#define TR_CURVMODES "EDIT ""PRSET" #define LEN_EXPLABELS "\006" +#ifdef PCBARM +#define TR_EXPLABEL_NAME "Name " +#else +#define TR_EXPLABEL_NAME +#endif #ifdef FLIGHT_PHASES #define TR_EXPLABEL_FP "Phase " #else #define TR_EXPLABEL_FP #endif -#define TR_EXPLABELS "Ratio ""Expo ""Courbe" TR_EXPLABEL_FP "Inter ""Mode ""\0" +#define TR_EXPLABELS TR_EXPLABEL_NAME "Ratio ""Expo ""Courbe" TR_EXPLABEL_FP "Inter ""Mode ""\0" #define LEN_VMLTPX "\010" #define TR_VMLTPX "Ajoute ""Multipl.""Remplace" @@ -101,7 +106,18 @@ #else #define TR_HAPTIC "[Vibreur]\0 " #endif -#if defined(PCBV4) +#if defined(PCBARM) +#if defined(SDCARD) +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "Play Track\0 " +#define TR_PLAY_VALUE "[Play Value]\0" +#else +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "[Play Track]\0" +#define TR_PLAY_VALUE "[Play Value]\0" +#endif +#define TR_FSW_VOLUME "Volume\0 " +#elif defined(PCBV4) #if defined(SDCARD) #define TR_SDCLOGS "Logs carte SD" #else @@ -114,17 +130,19 @@ #define TR_PLAY_TRACK "[Jouer fich.]" #define TR_PLAY_VALUE "[Jouer val.] " #endif +#define TR_FSW_VOLUME #else #define TR_SDCLOGS #define TR_PLAY_TRACK #define TR_PLAY_VALUE +#define TR_FSW_VOLUME #endif #ifdef DEBUG #define TR_TEST "Test\0 " #else #define TR_TEST #endif -#define TR_VFSWFUNC "S\200cur.\0 ""Ecolage \0 ""Trim instant." TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "S\200cur.\0 ""Ecolage \0 ""Trim instant." TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""Tout ""T\200l\200m." @@ -133,7 +151,7 @@ #define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick " #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""Chr1""Chr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Carb""T1\0 ""T2\0 ""Vit\0""Dist""AltG""Elem""Cour""Cnsm""AccX""AccY""AccZ""Cap\0""VitV""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Vit+""Dst+""Cur+""Acc\0""Time" +#define TR_VTELEMCHNS "---\0""Chr1""Chr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Carb""T1\0 ""T2\0 ""Vit\0""Dist""AltG""Elem""Volt""Cour""Cnsm""Powr""AccX""AccY""AccZ""Cap\0""VitV""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Vit+""Dst+""Cur+""Acc\0""Time" #ifdef IMPERIAL_UNITS #define LENGTH_UNIT "ft\0" @@ -144,7 +162,7 @@ #endif #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh" +#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh""W\0 " #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -164,7 +182,7 @@ #endif #define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "Hub""A1\0""A2\0" +#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" @@ -389,6 +407,7 @@ #define TR_SHUTDOWN "ARRET EN COURS" #define TR_BATT_CALIB "Calib. Batterie" #define TR_CURRENT_CALIB "Calib. Courant" +#define TR_VOLTAGE "Voltage" #define TR_CURRENT "Courant" #define TR_SELECT_MODEL "S\200lect Mod\201le" #define TR_CREATE_MODEL "Cr\200er Mod\201le" diff --git a/src/translations/it.h b/src/translations/it.h index 641abbf38..a3876185b 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -68,15 +68,20 @@ #define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|" #define LEN_CURVMODES "\005" -#define TR_CURVMODES "PERS.""PRSET""A.THR" +#define TR_CURVMODES "PERS.""PRSET" #define LEN_EXPLABELS "\006" +#ifdef PCBARM +#define TR_EXPLABEL_NAME "Name " +#else +#define TR_EXPLABEL_NAME +#endif #ifdef FLIGHT_PHASES #define TR_EXPLABEL_FP "Fase " #else #define TR_EXPLABEL_FP #endif -#define TR_EXPLABELS "Peso ""Expo ""Curva " TR_EXPLABEL_FP "Switch""Lato ""\0" +#define TR_EXPLABELS TR_EXPLABEL_NAME "Peso ""Expo ""Curva " TR_EXPLABEL_FP "Switch""Lato ""\0" #define LEN_VMLTPX "\010" #define TR_VMLTPX "Aggiungi""Moltipl.""Riscrivi" @@ -106,7 +111,18 @@ #else #define TR_HAPTIC "[Vibrazione]\0" #endif -#if defined(PCBV4) +#if defined(PCBARM) +#if defined(SDCARD) +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "Play Track\0 " +#define TR_PLAY_VALUE "[Play Value]\0" +#else +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "[Play Track]\0" +#define TR_PLAY_VALUE "[Play Value]\0" +#endif +#define TR_FSW_VOLUME "Volume\0 " +#elif defined(PCBV4) #if defined(SDCARD) #define TR_SDCLOGS "SDCARD Logs " #else @@ -119,17 +135,19 @@ #define TR_PLAY_TRACK "[Brano]\0 " #define TR_PLAY_VALUE "[Play Value]\0" #endif +#define TR_FSW_VOLUME #else #define TR_SDCLOGS #define TR_PLAY_TRACK #define TR_PLAY_VALUE +#define TR_FSW_VOLUME #endif #ifdef DEBUG #define TR_TEST "Test\0 " #else #define TR_TEST #endif -#define TR_VFSWFUNC "Blocco\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Blocco\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""Tutto ""Telem." @@ -138,7 +156,7 @@ #define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick " #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Carb""T1\0 ""T2\0 ""Vel\0""Dist""GAlt""Cell""Curr""Cnsp""AccX""AccY""AccZ""Dir\0""VelV""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Vel+""Dst+""Cur+""Acc\0""Time" +#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Carb""T1\0 ""T2\0 ""Vel\0""Dist""GAlt""Cell""Volt""Curr""Cnsm""Powr""AccX""AccY""AccZ""Dir\0""VelV""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Vel+""Dst+""Cur+""Acc\0""Time" #ifdef IMPERIAL_UNITS #define LENGTH_UNIT "ft\0" @@ -149,7 +167,7 @@ #endif #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh" +#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh""W\0 " #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -169,7 +187,7 @@ #endif #define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "Hub""A1\0""A2\0" +#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" @@ -390,6 +408,7 @@ #define TR_SHUTDOWN "ARRESTO.." #define TR_BATT_CALIB "Calibra batt." #define TR_CURRENT_CALIB "Calibra corr." +#define TR_VOLTAGE "Voltage" #define TR_CURRENT "Corr." #define TR_SELECT_MODEL "Scegli Memo." #define TR_CREATE_MODEL "Crea Modello" diff --git a/src/translations/se.h b/src/translations/se.h index 65953e848..df6f4bd2c 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -63,15 +63,20 @@ #define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|" #define LEN_CURVMODES "\005" -#define TR_CURVMODES "EDIT ""PRSET""A.THR" +#define TR_CURVMODES "EDIT ""PRSET" #define LEN_EXPLABELS "\006" +#ifdef PCBARM +#define TR_EXPLABEL_NAME "Name " +#else +#define TR_EXPLABEL_NAME +#endif #ifdef FLIGHT_PHASES #define TR_EXPLABEL_FP "Fas " #else #define TR_EXPLABEL_FP #endif -#define TR_EXPLABELS "Vikt ""Expo ""Kurva " TR_EXPLABEL_FP "Brytar""N\201r ""\0" +#define TR_EXPLABELS TR_EXPLABEL_NAME "Vikt ""Expo ""Kurva " TR_EXPLABEL_FP "Brytar""N\201r ""\0" #define LEN_VMLTPX "\010" #define TR_VMLTPX "Addera ""F\202rst\201rk""Ers\201tt\0" @@ -101,7 +106,18 @@ #else #define TR_HAPTIC "[Vibrator]\0 " #endif -#if defined(PCBV4) +#if defined(PCBARM) +#if defined(SDCARD) +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "Play Track\0 " +#define TR_PLAY_VALUE "[Play Value]\0" +#else +#define TR_SDCLOGS "[SDCARD Logs]" +#define TR_PLAY_TRACK "[Play Track]\0" +#define TR_PLAY_VALUE "[Play Value]\0" +#endif +#define TR_FSW_VOLUME "Volume\0 " +#elif defined(PCBV4) #if defined(SDCARD) #define TR_SDCLOGS "SDCARD Loggar" #else @@ -114,17 +130,19 @@ #define TR_PLAY_TRACK "[Spela Sp\200r]\0" #define TR_PLAY_VALUE "[Spela V\201rde]\0" #endif +#define TR_FSW_VOLUME #else #define TR_SDCLOGS #define TR_PLAY_TRACK #define TR_PLAY_VALUE +#define TR_FSW_VOLUME #endif #ifdef DEBUG #define TR_TEST "Test\0 " #else #define TR_TEST #endif -#define TR_VFSWFUNC "S\201kra\0 ""Trainer\0 ""S\201tt Trim " TR_SOUND TR_HAPTIC "Nollst\201ll " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "S\201kra\0 ""Trainer\0 ""S\201tt Trim " TR_SOUND TR_HAPTIC "Nollst\201ll " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""Allt ""Telem." @@ -133,7 +151,7 @@ #define TR_FUNCSOUNDS "Varn1 ""Varn2 ""F\200r ""Ring ""SciFi ""Robot ""Pip ""Tada ""Syrsa ""Siren ""Alarm ""Ratata""Tick " #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""H\202jd""Varv""Tank""T1\0 ""T2\0 ""Fart""Avst""GHjd""Batt""Curr""Cnsp""AccX""AccY""AccZ""Hdg\0""VFrt""A1-\0""A2-\0""Hjd-""Hjd+""Rpm+""T1+\0""T2+\0""Frt+""Avs+""Cur+""Acc\0""Tid\0" +#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""H\202jd""Varv""Tank""T1\0 ""T2\0 ""Fart""Avst""GHjd""Batt""Volt""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VFrt""A1-\0""A2-\0""Hjd-""Hjd+""Rpm+""T1+\0""T2+\0""Frt+""Avs+""Cur+""Acc\0""Tid\0" #ifdef IMPERIAL_UNITS #define LENGTH_UNIT "fot" @@ -144,7 +162,7 @@ #endif #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh" +#define TR_VTELEMUNIT "v\0 ""A\0 ""m/s""-\0 " SPEED_UNIT LENGTH_UNIT "@\0 ""%\0 ""mA\0""mAh""W\0 " #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -164,7 +182,7 @@ #endif #define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "Hub""A1\0""A2\0" +#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1 ""A2\0" @@ -388,6 +406,7 @@ #define TR_SHUTDOWN "ST\204NGER AV" #define TR_BATT_CALIB "Kalib. Batteri" #define TR_CURRENT_CALIB "Kalib. Sp\201nning" +#define TR_VOLTAGE "Voltage" #define TR_CURRENT "Sp\201nning" #define TR_SELECT_MODEL "V\201lj Modell" #define TR_CREATE_MODEL "Skapa Modell"