[all] PPM_UNIT instead of PPM_LIMITS_UNIT and DECIMALS Makefile options
[sky9x] Aurora gimbals support (untested) [arm] Start of implementation for sounds associated to Mix/FP/Switches in SD directories
This commit is contained in:
+36
-31
@@ -126,13 +126,9 @@ PPM_CENTER_ADJUSTABLE = NO
|
||||
# Values = YES, NO
|
||||
PPM_LIMITS_SYMETRICAL = NO
|
||||
|
||||
# Limits display in the LIMITS
|
||||
# Values = PERCENT, US
|
||||
PPM_LIMITS_UNIT = PERCENT
|
||||
|
||||
# Decimals display in the main view / PPM calibration,
|
||||
# Values = YES, NO
|
||||
DECIMALS = YES
|
||||
# PPM display unit
|
||||
# Values = PERCENT_PREC1, PERCENT_PREC0, US
|
||||
PPM_UNIT = PERCENT_PREC1
|
||||
|
||||
# FrSky Hub
|
||||
# Values = YES, NO
|
||||
@@ -218,6 +214,7 @@ CPPDEFS =
|
||||
|
||||
# MCU name
|
||||
ifeq ($(PCB), STD)
|
||||
ARCH = AVR
|
||||
TRGT = avr-
|
||||
MCU = atmega64
|
||||
CPPDEFS += -DF_CPU=$(F_CPU)UL
|
||||
@@ -225,12 +222,14 @@ ifeq ($(PCB), STD)
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), STD128)
|
||||
ARCH = AVR
|
||||
TRGT = avr-
|
||||
MCU = atmega128
|
||||
CPPDEFS += -DF_CPU=$(F_CPU)UL
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), GRUVIN9X)
|
||||
ARCH = AVR
|
||||
ifeq ($(PCBREV), REV0)
|
||||
CPPDEFS += -DREV0
|
||||
else
|
||||
@@ -242,6 +241,7 @@ ifeq ($(PCB), GRUVIN9X)
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), SKY9X)
|
||||
ARCH = ARM
|
||||
ifeq ($(PCBREV), REVA)
|
||||
CPPDEFS += -DREVA
|
||||
LDSCRIPT = sky9x/sam3s2c_flash.ld
|
||||
@@ -257,9 +257,10 @@ ifeq ($(PCB), SKY9X)
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), X9D)
|
||||
ARCH = ARM
|
||||
LDSCRIPT = sky9x/sam3s4c_flash.ld
|
||||
TRGT = arm-none-eabi-
|
||||
MCU = cortex-m4
|
||||
MCU = cortex-m3
|
||||
endif
|
||||
|
||||
CC = $(TRGT)gcc
|
||||
@@ -628,12 +629,16 @@ ifeq ($(PPM_LIMITS_SYMETRICAL), YES)
|
||||
CPPDEFS += -DPPM_LIMITS_SYMETRICAL
|
||||
endif
|
||||
|
||||
ifeq ($(PPM_LIMITS_UNIT), US)
|
||||
CPPDEFS += -DPPM_LIMITS_UNIT_US
|
||||
ifeq ($(PPM_UNIT), US)
|
||||
CPPDEFS += -DPPM_UNIT_US
|
||||
endif
|
||||
|
||||
ifeq ($(DECIMALS), YES)
|
||||
CPPDEFS += -DDECIMALS_DISPLAYED
|
||||
ifeq ($(PPM_UNIT), PERCENT_PREC1)
|
||||
CPPDEFS += -DPPM_UNIT_PERCENT_PREC1
|
||||
endif
|
||||
|
||||
ifeq ($(PPM_UNIT), PERCENT_PREC0)
|
||||
CPPDEFS += -DPPM_UNIT_PERCENT_PREC0
|
||||
endif
|
||||
|
||||
ifeq ($(HELI), YES)
|
||||
@@ -719,7 +724,7 @@ MSG_CLEANING = Cleaning project:
|
||||
ARMCPPFLAGS = -c -mcpu=$(MCU) -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=open9x.lst -Dat91sam3s4 -DRUN_FROM_FLASH=1 -O$(OPT) $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
AVRCPPFLAGS = -mmcu=$(MCU) -I. -x c++ -O$(OPT) $(CPPFLAGS) $(GENDEPFLAGS) -fwhole-program
|
||||
|
||||
ifneq ($(PCB), SKY9X)
|
||||
ifeq ($(ARCH), AVR)
|
||||
GCCVERSIONGTE462 := $(shell expr 4.6.2 \<= `$(CC) -dumpversion`)
|
||||
ifeq ($(GCCVERSIONGTE462),1)
|
||||
CPPFLAGS += -flto
|
||||
@@ -740,10 +745,10 @@ MIN_VER = ${shell sh -c "grep \"MIN_VERS\" open9x.h | cut -d\ -f3"}
|
||||
all: begin gccversion sizebefore build sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
ifeq ($(PCB), SKY9X)
|
||||
build: stamp_header lbm allsrc.cpp elf remallsrc bin lss
|
||||
else
|
||||
ifeq ($(ARCH), AVR)
|
||||
build: stamp_header lbm allsrc.cpp elf remallsrc hex eep lss sym
|
||||
else
|
||||
build: stamp_header lbm allsrc.cpp elf remallsrc bin lss
|
||||
endif
|
||||
|
||||
elf: $(TARGET).elf
|
||||
@@ -860,12 +865,12 @@ end:
|
||||
@echo
|
||||
|
||||
# Display size of file.
|
||||
ifeq ($(PCB), SKY9X)
|
||||
ELFSIZE = $(SIZE) $(TARGET).elf
|
||||
else
|
||||
ifeq ($(ARCH), AVR)
|
||||
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
|
||||
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
|
||||
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
|
||||
else
|
||||
ELFSIZE = $(SIZE) $(TARGET).elf
|
||||
endif
|
||||
|
||||
sizebefore:
|
||||
@@ -896,16 +901,16 @@ eeprom.bin:
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
ifeq ($(PCB), SKY9X)
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O ihex open9x.elf open9x.hex
|
||||
else
|
||||
ifeq ($(ARCH), AVR)
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||
else
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O ihex open9x.elf open9x.hex
|
||||
endif
|
||||
|
||||
%.bin: %.elf
|
||||
@@ -940,7 +945,12 @@ remallsrc:
|
||||
$(REMOVE) allsrc.cpp
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
ifeq ($(PCB), SKY9X)
|
||||
ifeq ($(ARCH), AVR)
|
||||
%.elf: allsrc.cpp
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $@
|
||||
$(CC) $(AVRCPPFLAGS) $< --output $@ $(LDFLAGS)
|
||||
else
|
||||
%.o: %.c
|
||||
$(CC) $(ARMCPPFLAGS) $< -o $@
|
||||
OBJS = $(SRC:.c=.o)
|
||||
@@ -949,11 +959,6 @@ OBJS = $(SRC:.c=.o)
|
||||
@echo $(MSG_COMPILING) $@
|
||||
$(CC) $(ARMCPPFLAGS) $< -o allsrc.o
|
||||
$(CC) $(OBJS) allsrc.o -mcpu=cortex-m3 -mthumb -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch -o $@
|
||||
else
|
||||
%.elf: allsrc.cpp
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $@
|
||||
$(CC) $(AVRCPPFLAGS) $< --output $@ $(LDFLAGS)
|
||||
endif
|
||||
|
||||
# Target: clean project.
|
||||
|
||||
+46
-1
@@ -1176,7 +1176,7 @@ uint16_t getCurrent()
|
||||
static uint32_t Current_sum ;
|
||||
static uint8_t Current_count ;
|
||||
|
||||
Current_sum += anaIn(NUMBER_ANALOG-1);
|
||||
Current_sum += anaIn(NUMBER_ANALOG-1); // TODO enum
|
||||
if (++Current_count >= 50) {
|
||||
Current = Current_sum / 5 ;
|
||||
Current_sum = 0 ;
|
||||
@@ -1193,3 +1193,48 @@ uint8_t getTemperature()
|
||||
return temperature + g_eeGeneral.temperatureCalib;
|
||||
}
|
||||
|
||||
#define STICK_LV_GAIN 0x01
|
||||
#define STICK_LH_GAIN 0x02
|
||||
#define STICK_RV_GAIN 0x04
|
||||
#define STICK_RH_GAIN 0x08
|
||||
|
||||
#define GAIN_LV 0x00080000
|
||||
#define GAIN_LH 0x00000020
|
||||
#define GAIN_RV 0x20000000
|
||||
#define GAIN_RH 0x00000008
|
||||
|
||||
#define OFF_LV 0x00000200
|
||||
#define OFF_LH 0x00000004
|
||||
#define OFF_RV 0x00004000
|
||||
#define OFF_RH 0x00000002
|
||||
|
||||
void setSticksGain(uint8_t gains)
|
||||
{
|
||||
register Adc *padc ;
|
||||
uint32_t gain ;
|
||||
uint32_t offset ;
|
||||
|
||||
gain = 0 ;
|
||||
offset = 0 ;
|
||||
padc = ADC ;
|
||||
|
||||
if ( gains & STICK_LV_GAIN ) {
|
||||
gain |= GAIN_LV ;
|
||||
offset |= OFF_LV ;
|
||||
}
|
||||
if ( gains & STICK_LH_GAIN ) {
|
||||
gain |= GAIN_LH ;
|
||||
offset |= OFF_LH ;
|
||||
}
|
||||
if ( gains & STICK_RV_GAIN ) {
|
||||
gain |= GAIN_RV ;
|
||||
offset |= OFF_RV ;
|
||||
}
|
||||
if ( gains & STICK_RH_GAIN ) {
|
||||
gain |= GAIN_RH ;
|
||||
offset |= OFF_RH ;
|
||||
}
|
||||
|
||||
padc->ADC_CGR = gain;
|
||||
padc->ADC_COR = offset;
|
||||
}
|
||||
|
||||
@@ -109,4 +109,6 @@ extern uint16_t sessionTimer;
|
||||
#define JACK_PPM_OUT() PIOC->PIO_PDR = PIO_PC22
|
||||
#define JACK_PPM_IN() PIOC->PIO_PER = PIO_PC22
|
||||
|
||||
void setSticksGain(uint8_t gains);
|
||||
|
||||
#endif
|
||||
|
||||
+3
-26
@@ -513,6 +513,8 @@ void eeLoadModel(uint8_t id)
|
||||
FRSKY_setModelAlarms();
|
||||
#endif
|
||||
|
||||
refreshModelAudioFiles();
|
||||
|
||||
LOAD_MODEL_BITMAP();
|
||||
}
|
||||
}
|
||||
@@ -944,32 +946,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
|
||||
}
|
||||
|
||||
buf[sizeof(MODELS_PATH)-1] = '/';
|
||||
memcpy(&buf[sizeof(MODELS_PATH)], ModelNames[i_fileSrc], sizeof(g_model.name));
|
||||
buf[sizeof(MODELS_PATH)+sizeof(g_model.name)] = '\0';
|
||||
|
||||
uint8_t i = sizeof(MODELS_PATH)+sizeof(g_model.name)-1;
|
||||
uint8_t len = 0;
|
||||
while (i>sizeof(MODELS_PATH)-1) {
|
||||
if (!len && buf[i])
|
||||
len = i+1;
|
||||
if (len) {
|
||||
if (buf[i])
|
||||
buf[i] = idx2char(buf[i]);
|
||||
else
|
||||
buf[i] = '_';
|
||||
}
|
||||
i--;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
uint8_t num = i_fileSrc + 1;
|
||||
strcpy(&buf[sizeof(MODELS_PATH)], STR_MODEL);
|
||||
buf[sizeof(MODELS_PATH) + PSIZE(TR_MODEL)] = (char)((num / 10) + '0');
|
||||
buf[sizeof(MODELS_PATH) + PSIZE(TR_MODEL) + 1] = (char)((num % 10) + '0');
|
||||
len = sizeof(MODELS_PATH) + PSIZE(TR_MODEL) + 2;
|
||||
}
|
||||
|
||||
strcpy(&buf[len], STR_MODELS_EXT);
|
||||
strcpy(strcat_modelname(&buf[sizeof(MODELS_PATH)], i_fileSrc), STR_MODELS_EXT);
|
||||
|
||||
result = f_open(&archiveFile, buf, FA_CREATE_ALWAYS | FA_WRITE);
|
||||
if (result != FR_OK) {
|
||||
|
||||
+31
-2
@@ -765,7 +765,7 @@ void menuGeneralTrainer(uint8_t event)
|
||||
lcd_putsAtt(0*FW, 7*FH, STR_CAL, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
uint8_t x = (i*8+16)*FW/2;
|
||||
#if defined (DECIMALS_DISPLAYED)
|
||||
#if defined (PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(x, 7*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
|
||||
#else
|
||||
lcd_outdezAtt(x, 7*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0);
|
||||
@@ -908,6 +908,11 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
#if defined(PCBSKY9X)
|
||||
enum menuGeneralHwItems {
|
||||
ITEM_SETUP_HW_OPTREX_DISPLAY,
|
||||
ITEM_SETUP_HW_STICKS_GAINS_LABELS,
|
||||
ITEM_SETUP_HW_STICK_LV_GAIN,
|
||||
ITEM_SETUP_HW_STICK_LH_GAIN,
|
||||
ITEM_SETUP_HW_STICK_RV_GAIN,
|
||||
ITEM_SETUP_HW_STICK_RH_GAIN,
|
||||
IF_BLUETOOTH(ITEM_SETUP_HW_BT_BAUDRATE)
|
||||
ITEM_SETUP_HW_MAX
|
||||
};
|
||||
@@ -915,7 +920,7 @@ enum menuGeneralHwItems {
|
||||
#define GENERAL_HW_PARAM_OFS (2+(15*FW))
|
||||
void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0, IF_BLUETOOTH(0)});
|
||||
MENU(STR_HARDWARE, menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, 0, IF_BLUETOOTH(0)});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
@@ -930,6 +935,30 @@ void menuGeneralHardware(uint8_t event)
|
||||
g_eeGeneral.optrexDisplay = selectMenuItem(GENERAL_HW_PARAM_OFS, y, STR_LCD, STR_VLCD, g_eeGeneral.optrexDisplay, 0, 1, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_HW_STICKS_GAINS_LABELS:
|
||||
lcd_putsLeft(y, PSTR("Sticks"));
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_HW_STICK_LV_GAIN:
|
||||
case ITEM_SETUP_HW_STICK_LH_GAIN:
|
||||
case ITEM_SETUP_HW_STICK_RV_GAIN:
|
||||
case ITEM_SETUP_HW_STICK_RH_GAIN:
|
||||
{
|
||||
lcd_putsiAtt(INDENT_WIDTH, y, PSTR("\002LVLHRVRH"), k-ITEM_SETUP_HW_STICK_LV_GAIN, 0);
|
||||
lcd_puts(INDENT_WIDTH+3*FW, y, PSTR("Gain"));
|
||||
uint8_t mask = (1<<(k-ITEM_SETUP_HW_STICK_LV_GAIN));
|
||||
uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0);
|
||||
lcd_putcAtt(15*FW, y, val ? '2' : '1', attr);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, val, 0, 1);
|
||||
if (checkIncDec_Ret) {
|
||||
g_eeGeneral.sticksGain ^= mask;
|
||||
setSticksGain(g_eeGeneral.sticksGain);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
case ITEM_SETUP_HW_BT_BAUDRATE:
|
||||
g_eeGeneral.btBaudrate = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event);
|
||||
|
||||
+5
-3
@@ -494,10 +494,12 @@ void menuMainView(uint8_t event)
|
||||
case VIEW_OUTPUTS_VALUES:
|
||||
x0 = (i%4*9+3)*FW/2;
|
||||
y0 = i/4*FH+40;
|
||||
#if defined (DECIMALS_DISPLAYED)
|
||||
lcd_outdezAtt( x0+4*FW , y0, calcRESXto1000(val), PREC1);
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcd_outdezAtt(x0+4*FW , y0, PPM_CENTER+calcRESXto1000(val)/5*64/25, 0);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(x0+4*FW , y0, calcRESXto1000(val), PREC1);
|
||||
#else
|
||||
lcd_outdezAtt( x0+4*FW , y0, calcRESXto1000(val)/10, 0); // G: Don't like the decimal part*
|
||||
lcd_outdezAtt(x0+4*FW , y0, calcRESXto1000(val)/10, 0); // G: Don't like the decimal part*
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
+3
-3
@@ -2371,7 +2371,7 @@ void menuModelLimits(uint8_t event)
|
||||
switch(j)
|
||||
{
|
||||
case ITEM_LIMITS_OFFSET:
|
||||
#if defined(PPM_LIMITS_UNIT_US)
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcd_outdezAtt( 8*FW, y, ((int32_t)ld->offset*128) / 25, attr|PREC1);
|
||||
#else
|
||||
lcd_outdezAtt( 8*FW, y, ld->offset, attr|PREC1);
|
||||
@@ -2397,7 +2397,7 @@ void menuModelLimits(uint8_t event)
|
||||
}
|
||||
break;
|
||||
case ITEM_LIMITS_MIN:
|
||||
#if defined(PPM_LIMITS_UNIT_US)
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcd_outdezAtt(12*FW+1, y, (((int16_t)ld->min-100)*128) / 25, attr);
|
||||
#else
|
||||
lcd_outdezAtt(12*FW, y, (int8_t)(ld->min-100), attr);
|
||||
@@ -2405,7 +2405,7 @@ void menuModelLimits(uint8_t event)
|
||||
if (active) ld->min = 100 + checkIncDecModel(event, ld->min-100, -limit, 25);
|
||||
break;
|
||||
case ITEM_LIMITS_MAX:
|
||||
#if defined(PPM_LIMITS_UNIT_US)
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcd_outdezAtt(LIMITS_MAX_POS, y, (((int16_t)ld->max+100)*128) / 25, attr);
|
||||
#else
|
||||
lcd_outdezAtt(LIMITS_MAX_POS, y, (int8_t)(ld->max+100), attr);
|
||||
|
||||
+2
-1
@@ -112,7 +112,8 @@ enum BeeperMode {
|
||||
uint32_t globalTimer; \
|
||||
int8_t temperatureCalib; \
|
||||
uint8_t btBaudrate; \
|
||||
uint8_t optrexDisplay;
|
||||
uint8_t optrexDisplay; \
|
||||
uint8_t sticksGain;
|
||||
#else
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
int8_t speakerVolume
|
||||
|
||||
+43
-11
@@ -179,6 +179,35 @@ uint8_t zlen(const char *str, uint8_t size)
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultName, uint8_t defaultNameSize, uint8_t defaultIdx)
|
||||
{
|
||||
memcpy(dest, name, size);
|
||||
dest[size] = '\0';
|
||||
|
||||
int8_t i = size-1;
|
||||
int8_t len = 0;
|
||||
while (i>=0) {
|
||||
if (!len && dest[i])
|
||||
len = i+1;
|
||||
if (len) {
|
||||
if (dest[i])
|
||||
dest[i] = idx2char(dest[i]);
|
||||
else
|
||||
dest[i] = '_';
|
||||
}
|
||||
i--;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
strcpy(dest, defaultName);
|
||||
dest[defaultNameSize] = (char)((defaultIdx / 10) + '0');
|
||||
dest[defaultNameSize + 1] = (char)((defaultIdx % 10) + '0');
|
||||
len = defaultNameSize + 2;
|
||||
}
|
||||
|
||||
return &dest[len];
|
||||
}
|
||||
#endif
|
||||
|
||||
volatile tmr10ms_t g_tmr10ms;
|
||||
@@ -1503,7 +1532,7 @@ uint16_t anaIn(uint8_t chan)
|
||||
#if defined(CPUARM)
|
||||
static const uint8_t crossAna[]={1,5,7,0,4,6,2,3,8};
|
||||
#if !defined(REVA)
|
||||
if ( chan == 8 ) {
|
||||
if (chan == 8) {
|
||||
return Current_analogue ;
|
||||
}
|
||||
#endif
|
||||
@@ -2251,7 +2280,7 @@ void perOut(uint8_t mode, uint8_t tick10ms)
|
||||
|
||||
uint8_t k = md->srcRaw - 1;
|
||||
|
||||
if (!(dirtyChannels & ((bitfield_channels_t) 1 << md->destCh))) continue;
|
||||
if (!(dirtyChannels & ((bitfield_channels_t)1 << md->destCh))) continue;
|
||||
|
||||
if (md->phases & (1 << s_perout_flight_phase)) continue;
|
||||
|
||||
@@ -2413,26 +2442,24 @@ void perOut(uint8_t mode, uint8_t tick10ms)
|
||||
|
||||
//========== DIFFERENTIAL =========
|
||||
if (md->curveMode == MODE_DIFFERENTIAL) {
|
||||
int8_t curveParam =
|
||||
GET_GVAR(md->curveParam, -100, 100, s_perout_flight_phase);
|
||||
int8_t curveParam = GET_GVAR(md->curveParam, -100, 100, s_perout_flight_phase);
|
||||
if (curveParam > 0 && dv < 0)
|
||||
dv = (dv * (100 - curveParam)) / 100;
|
||||
else if (curveParam < 0 && dv > 0) dv = (dv * (100 + curveParam)) / 100;
|
||||
else if (curveParam < 0 && dv > 0)
|
||||
dv = (dv * (100 + curveParam)) / 100;
|
||||
}
|
||||
|
||||
int32_t *ptr = &chans[md->destCh]; // Save calculating address several times
|
||||
|
||||
if (i == 0 || md->destCh != (md - 1)->destCh) {
|
||||
if (i == 0 || md->destCh != (md - 1)->destCh)
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
switch (md->mltpx) {
|
||||
case MLTPX_REP:
|
||||
*ptr = dv;
|
||||
#ifdef BOLD_FONT
|
||||
for (uint8_t m = i - 1;
|
||||
m < MAX_MIXERS && mixaddress(m)->destCh == md->destCh; m--)
|
||||
activeMixes &= ~((ACTIVE_MIXES_TYPE) 1 << m);
|
||||
for (uint8_t m=i-1; m<MAX_MIXERS && mixaddress(m)->destCh==md->destCh; m--)
|
||||
activeMixes &= ~((ACTIVE_MIXES_TYPE)1 << m);
|
||||
#endif
|
||||
break;
|
||||
case MLTPX_MUL:
|
||||
@@ -2489,7 +2516,7 @@ FORCEINLINE void doMixerCalculations()
|
||||
getADC();
|
||||
|
||||
#if defined(CPUARM) && !defined(REVA) && !defined(SIMU)
|
||||
Current_analogue = ( Current_analogue * 31 + s_anaFilt[8] ) >> 5 ;
|
||||
Current_analogue = (Current_analogue*31 + s_anaFilt[8] ) >> 5 ;
|
||||
if (Current_analogue > Current_max)
|
||||
Current_max = Current_analogue ;
|
||||
#elif defined(PCBGRUVIN9X) && !defined(SIMU)
|
||||
@@ -3319,6 +3346,11 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
||||
SET_VOLUME(g_eeGeneral.speakerVolume+7);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
// Set ADC gains here
|
||||
setSticksGain(g_eeGeneral.sticksGain);
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
btInit();
|
||||
#endif
|
||||
|
||||
@@ -1341,6 +1341,10 @@ void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t zlen(const char *str, uint8_t size);
|
||||
char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultName, uint8_t defaultNameSize, uint8_t defaultIdx);
|
||||
#define strcat_modelname(dest, idx) strcat_zchar(dest, ModelNames[idx], sizeof(g_model.name), STR_MODEL, PSIZE(TR_MODEL), idx+1)
|
||||
#define strcat_phasename(dest, idx) strcat_zchar(dest, g_model.phaseData[idx].name, sizeof(PhaseData), STR_FP, PSIZE(TR_FP), idx+1)
|
||||
#define strcat_mixername(dest, idx) strcat_zchar(dest, g_model.mixData[idx].name, sizeof(MixData), STR_MIX, PSIZE(TR_MIX), idx+1)
|
||||
#define ZLEN(s) zlen(s, sizeof(s))
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@
|
||||
#define MODELS_PATH "/9XMODELS"
|
||||
#define LOGS_PATH "/9XLOGS" // no trailing slash = important
|
||||
#define SOUNDS_PATH "/9XSOUNDS" // no trailing slash = important
|
||||
#define SYSTEM_SOUNDS_PATH "/9XSOUNDS/SYSTEM" // no trailing slash = important
|
||||
#define SYSTEM_SOUNDS_PATH SOUNDS_PATH "/SYSTEM" // no trailing slash = important
|
||||
#define BITMAPS_PATH MODELS_PATH
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ Pwm pwm;
|
||||
Twi Twio;
|
||||
Usart Usart0;
|
||||
Dacc dacc;
|
||||
Adc Adc0;
|
||||
uint32_t eeprom_pointer;
|
||||
char* eeprom_buffer_data;
|
||||
volatile int32_t eeprom_buffer_size;
|
||||
|
||||
@@ -101,6 +101,9 @@ extern Pio Pioa, Piob, Pioc;
|
||||
extern Twi Twio;
|
||||
extern Dacc dacc;
|
||||
extern Usart Usart0;
|
||||
extern Adc Adc0;
|
||||
#undef ADC
|
||||
#define ADC (&Adc0)
|
||||
#undef USART0
|
||||
#define USART0 (&Usart0)
|
||||
#undef PIOA
|
||||
|
||||
+59
-12
@@ -64,9 +64,12 @@ const char * audioFilenames[] = {
|
||||
"timer30"
|
||||
};
|
||||
|
||||
uint32_t sdAvailableAudioFiles = 0;
|
||||
|
||||
void retrieveAvailableAudioFiles()
|
||||
uint32_t sdAvailableSystemAudioFiles = 0;
|
||||
uint8_t sdAvailablePhaseAudioFiles[MAX_PHASES] = { 0 };
|
||||
uint8_t sdAvailableMixerAudioFiles[MAX_MIXERS] = { 0 };
|
||||
|
||||
void refreshSystemAudioFiles()
|
||||
{
|
||||
FILINFO info;
|
||||
#if _USE_LFN
|
||||
@@ -78,7 +81,7 @@ void retrieveAvailableAudioFiles()
|
||||
char filename[32] = SYSTEM_SOUNDS_PATH "/";
|
||||
|
||||
assert(sizeof(audioFilenames)==AU_FRSKY_FIRST*sizeof(char *));
|
||||
assert(sizeof(sdAvailableAudioFiles)*8 > AU_FRSKY_FIRST);
|
||||
assert(sizeof(sdAvailableSystemAudioFiles)*8 > AU_FRSKY_FIRST);
|
||||
|
||||
uint32_t availableAudioFiles = 0;
|
||||
|
||||
@@ -89,18 +92,62 @@ void retrieveAvailableAudioFiles()
|
||||
availableAudioFiles |= ((uint32_t)1 << i);
|
||||
}
|
||||
|
||||
sdAvailableAudioFiles = availableAudioFiles;
|
||||
sdAvailableSystemAudioFiles = availableAudioFiles;
|
||||
}
|
||||
|
||||
inline bool isAudioFileAvailable(uint8_t i, char * filename)
|
||||
inline uint8_t getAvailableFiles(char *prefix, FILINFO &info, char *filename)
|
||||
{
|
||||
if (sdAvailableAudioFiles & ((uint32_t)1 << i)) {
|
||||
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH), audioFilenames[i]);
|
||||
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH), SOUNDS_EXT);
|
||||
return true;
|
||||
const char * suffixes[] = { "-ON", "-OFF", NULL };
|
||||
uint8_t result = 0;
|
||||
|
||||
for (uint8_t i=0; suffixes[i]; i++) {
|
||||
strcpy(prefix, suffixes[i]);
|
||||
strcat(prefix, SOUNDS_EXT);
|
||||
if (f_stat(filename, &info) == FR_OK)
|
||||
result |= ((uint8_t)1 << i);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void refreshModelAudioFiles()
|
||||
{
|
||||
FILINFO info;
|
||||
#if _USE_LFN
|
||||
TCHAR lfn[_MAX_LFN + 1];
|
||||
info.lfname = lfn;
|
||||
info.lfsize = sizeof(lfn);
|
||||
#endif
|
||||
|
||||
char filename[32] = SOUNDS_PATH "/";
|
||||
char *buf = strcat_modelname(&filename[sizeof(SOUNDS_PATH)], g_eeGeneral.currModel);
|
||||
*buf++ = '/';
|
||||
|
||||
for (uint32_t i=0; i<MAX_PHASES; i++)
|
||||
sdAvailablePhaseAudioFiles[i] = getAvailableFiles(strcat_phasename(buf, i), info, filename);
|
||||
|
||||
for (uint32_t i=0; i<MAX_MIXERS; i++)
|
||||
sdAvailableMixerAudioFiles[i] = getAvailableFiles(strcat_mixername(buf, i), info, filename);
|
||||
}
|
||||
|
||||
#define SYSTEM_AUDIO_CATEGORY 0
|
||||
#define MODEL_AUDIO_CATEGORY 1
|
||||
#define PHASE_AUDIO_CATEGORY 2
|
||||
#define MIXER_AUDIO_CATEGORY 3
|
||||
|
||||
inline bool isAudioFileAvailable(uint32_t i, char * filename)
|
||||
{
|
||||
uint8_t category = (i >> 24);
|
||||
|
||||
if (category == SYSTEM_AUDIO_CATEGORY) {
|
||||
if (sdAvailableSystemAudioFiles & ((uint32_t)1 << i)) {
|
||||
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH), audioFilenames[i]);
|
||||
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH), SOUNDS_EXT);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -561,7 +608,7 @@ void AudioQueue::stopPlay(uint8_t id)
|
||||
|
||||
void AudioQueue::stopSD()
|
||||
{
|
||||
sdAvailableAudioFiles = 0;
|
||||
sdAvailableSystemAudioFiles = 0;
|
||||
reset();
|
||||
play(0, 0, 100, PLAY_NOW); // insert a 100ms pause
|
||||
}
|
||||
|
||||
@@ -182,4 +182,7 @@ extern void pushPrompt(uint16_t prompt, uint8_t id=0);
|
||||
#define STOP_PLAY(id) audioQueue.stopPlay((id))
|
||||
#define AUDIO_RESET() audioQueue.reset()
|
||||
|
||||
extern void refreshSystemAudioFiles();
|
||||
extern void refreshModelAudioFiles();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -954,8 +954,6 @@ void sdInit()
|
||||
uint8_t sdErrorCount = 0;
|
||||
FATFS g_FATFS_Obj = { 0 };
|
||||
|
||||
extern void retrieveAvailableAudioFiles();
|
||||
|
||||
void sdMountPoll()
|
||||
{
|
||||
if (!Card_initialized)
|
||||
@@ -1012,7 +1010,7 @@ void sdMountPoll()
|
||||
|
||||
case SD_ST_DATA:
|
||||
if (!usbPlugged() && f_mount(0, &g_FATFS_Obj) == FR_OK) {
|
||||
retrieveAvailableAudioFiles();
|
||||
refreshSystemAudioFiles();
|
||||
Card_state = SD_ST_MOUNTED;
|
||||
}
|
||||
break;
|
||||
@@ -1079,7 +1077,7 @@ void sdInit()
|
||||
Card_state = SD_ST_DATA;
|
||||
|
||||
if (f_mount(0, &g_FATFS_Obj) == FR_OK) {
|
||||
retrieveAvailableAudioFiles();
|
||||
refreshSystemAudioFiles();
|
||||
Card_state = SD_ST_MOUNTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ const pm_char STR_PPM[] PROGMEM = TR_PPM;
|
||||
const pm_char STR_CH[] PROGMEM = TR_CH;
|
||||
const pm_char STR_MODEL[] PROGMEM = TR_MODEL;
|
||||
const pm_char STR_FP[] PROGMEM = TR_FP;
|
||||
const pm_char STR_MIX[] PROGMEM = TR_MIX;
|
||||
const pm_char STR_EEPROMLOWMEM[] PROGMEM = TR_EEPROMLOWMEM;
|
||||
const pm_char STR_ALERT[] PROGMEM = TR_ALERT;
|
||||
const pm_char STR_PRESSANYKEYTOSKIP[] PROGMEM = TR_PRESSANYKEYTOSKIP;
|
||||
|
||||
@@ -329,6 +329,9 @@ extern const pm_char STR_PPM[];
|
||||
extern const pm_char STR_CH[];
|
||||
extern const pm_char STR_MODEL[];
|
||||
extern const pm_char STR_FP[];
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_MIX[];
|
||||
#endif
|
||||
extern const pm_char STR_EEPROMLOWMEM[];
|
||||
extern const pm_char STR_ALERT[];
|
||||
extern const pm_char STR_PRESSANYKEYTOSKIP[];
|
||||
|
||||
@@ -350,6 +350,7 @@
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FP"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "Doch\200z\204 EEPROM"
|
||||
#define TR_ALERT "\006(!)POZOR"
|
||||
#define TR_PRESSANYKEYTOSKIP "Kl\200vesa >>> p\206esko\201it"
|
||||
|
||||
@@ -351,6 +351,7 @@
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELL"
|
||||
#define TR_FP "FP"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM voll"
|
||||
#define TR_ALERT "WARNUNG"
|
||||
#define TR_PRESSANYKEYTOSKIP "Taste dr\205cken"
|
||||
|
||||
@@ -362,6 +362,7 @@
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FP"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM low mem"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
#define TR_PRESSANYKEYTOSKIP CENTER"Press any key to skip"
|
||||
|
||||
@@ -345,6 +345,7 @@
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELO"
|
||||
#define TR_FP "FP"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM Baja mem"
|
||||
#define TR_ALERT "\016ALERTA"
|
||||
#define TR_PRESSANYKEYTOSKIP "Pulsa tecla x omitir"
|
||||
|
||||
@@ -351,6 +351,7 @@
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELE"
|
||||
#define TR_FP "PV"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM pleine!"
|
||||
#define TR_ALERT "\014ALERTE"
|
||||
#define TR_PRESSANYKEYTOSKIP "Touche pour ignorer"
|
||||
|
||||
@@ -349,6 +349,7 @@
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELLO"
|
||||
#define TR_FP "FV"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM quasi piena!"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
#define TR_PRESSANYKEYTOSKIP "\010Premi un tasto"
|
||||
|
||||
@@ -351,6 +351,7 @@
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FP"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM BX Memoria"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
#define TR_PRESSANYKEYTOSKIP "Pulsar Tecla p/ sair"
|
||||
|
||||
@@ -354,6 +354,7 @@
|
||||
#define TR_CH "KN"
|
||||
#define TR_MODEL "Modell"
|
||||
#define TR_FP "FF"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM low mem"
|
||||
#define TR_ALERT "\016OBS"
|
||||
#define TR_PRESSANYKEYTOSKIP "Tryck ned en knapp"
|
||||
|
||||
Reference in New Issue
Block a user