[Taranis] Curve names
[Taranis] Menu system now allows hidden rows [Taranis] DEBUG menu removed [stock2561] First draft!
This commit is contained in:
+66
-4
@@ -50,7 +50,7 @@ DELAY = 5
|
||||
#----------- BUILD OPTIONS ---------------------------
|
||||
|
||||
# PCB version
|
||||
# Values: 9X, 9X128, 9XR, 9XR128, GRUVIN9X, MEGA2560, SKY9X, TARANIS
|
||||
# Values: 9X, 9X128, 9X2561, 9XR, 9XR128, 9XR2561, GRUVIN9X, MEGA2560, SKY9X, TARANIS
|
||||
# Old values STD and STD128 are mapped to 9X and 9X128 for compatibility
|
||||
PCB = 9X
|
||||
|
||||
@@ -232,7 +232,7 @@ SRC =
|
||||
CPPSRC =
|
||||
|
||||
# MCU name
|
||||
ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 GRUVIN9X MEGA2560 SKY9X TARANIS))
|
||||
ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 9X2561 9XR2561 GRUVIN9X MEGA2560 SKY9X TARANIS))
|
||||
$(error Sorry, the PCB $(PCB) is not supported yet in openTx)
|
||||
endif
|
||||
|
||||
@@ -240,6 +240,7 @@ GVARS_VARIANT = +1
|
||||
FRSKY_VARIANT = +2
|
||||
3POS_VARIANT = +4
|
||||
M128_VARIANT = +32768
|
||||
M2561_VARIANT = +16384
|
||||
EEPROM_VARIANT = 0
|
||||
|
||||
ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
@@ -298,7 +299,7 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
# 9x/9xr radio with Atmega 64 replaced by Atmega 128
|
||||
# 9X/9XR radio with ATmega64 replaced by ATmega128
|
||||
ARCH = AVR
|
||||
TRGT = avr-
|
||||
MCU = atmega128
|
||||
@@ -352,6 +353,61 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), $(filter $(PCB), 9X2561))
|
||||
# 9X/9XR radio with ATmega64 replaced by ATmega2561
|
||||
ARCH = AVR
|
||||
TRGT = avr-
|
||||
MCU = atmega2561
|
||||
OPT = 2
|
||||
SDCARD = NO
|
||||
THR_TRACE = YES
|
||||
EEPROM_VARIANT += ${M2561_VARIANT}
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM2561 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
|
||||
EXTRAINCDIRS = stock
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
EXTRABOARDSRC = stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
|
||||
ifeq ($(PCB), 9XR2561)
|
||||
CPPDEFS += -DPCB9XR2561
|
||||
else
|
||||
CPPDEFS += -DPCB9X2561
|
||||
endif
|
||||
|
||||
ifeq ($(AUDIO), YES)
|
||||
CPPDEFS += -DAUDIO
|
||||
CPPSRC += audio_avr.cpp
|
||||
else
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
CPPDEFS += -DVOICE
|
||||
CPPSRC += stock/voice.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(PWM_BACKLIGHT), YES)
|
||||
ifeq ($(VOICE), YES)
|
||||
$(error Sorry, PWM_BACKLIGHT doesnt work on stock board with VOICE mod)
|
||||
endif
|
||||
ifeq ($(AUDIO), YES)
|
||||
$(error Sorry, PWM_BACKLIGHT doesnt work on stock board with AUDIO mod)
|
||||
endif
|
||||
CPPDEFS += -DPWM_BACKLIGHT
|
||||
endif
|
||||
|
||||
ifeq ($(HAPTIC), YES)
|
||||
CPPDEFS += -DHAPTIC
|
||||
CPPSRC += haptic.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(SP22), YES)
|
||||
CPPDEFS += -DSP22
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), GRUVIN9X)
|
||||
# 9x radio with a gruvin9x replacement board
|
||||
ARCH = AVR
|
||||
@@ -636,7 +692,7 @@ ifeq ($(AUTOSOURCE), YES)
|
||||
endif
|
||||
|
||||
ifeq ($(DBLKEYS), YES)
|
||||
ifeq ($(PCB), $(filter $(PCB), 9XR 9XR128))
|
||||
ifeq ($(PCB), $(filter $(PCB), 9XR 9XR128 9XR2561))
|
||||
$(warning Sorry, DBLKEYS doesnt work on 9XR)
|
||||
else
|
||||
CPPDEFS += -DDBLKEYS
|
||||
@@ -952,6 +1008,12 @@ stock128-stamp:
|
||||
@echo "#define SVN_VERS \"opentx-r$(SVNREV)\"" >> stamp-opentx-stock128.txt
|
||||
@cat stamp-opentx-stock128.txt
|
||||
|
||||
stock2561-stamp:
|
||||
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-opentx-stock2561.txt
|
||||
@echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-opentx-stock2561.txt
|
||||
@echo "#define SVN_VERS \"opentx-r$(SVNREV)\"" >> stamp-opentx-stock2561.txt
|
||||
@cat stamp-opentx-stock2561.txt
|
||||
|
||||
v4-stamp:
|
||||
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-opentx-v4.txt
|
||||
@echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-opentx-v4.txt
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ inline void eeprom_write_byte()
|
||||
EEAR = eeprom_pointer;
|
||||
EEDR = *eeprom_buffer_data;
|
||||
// TODO add some define here
|
||||
#if defined (PCBGRUVIN9X)
|
||||
#if defined (PCBGRUVIN9X) || defined(CPUM2561)
|
||||
EECR |= 1<<EEMPE;
|
||||
EECR |= 1<<EEPE;
|
||||
#else
|
||||
@@ -73,7 +73,7 @@ ISR(EE_READY_vect)
|
||||
eeprom_write_byte();
|
||||
}
|
||||
else {
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
EECR &= ~(1<<EERIE);
|
||||
#else
|
||||
EECR &= ~(1<<EERIE);
|
||||
@@ -92,7 +92,7 @@ void eeWriteBlockCmp(const void *i_pointer_ram, uint16_t i_pointer_eeprom, size_
|
||||
|
||||
#if defined(SIMU)
|
||||
sem_post(eeprom_write_sem);
|
||||
#elif defined (PCBGRUVIN9X)
|
||||
#elif defined (PCBGRUVIN9X) || defined(CPUM2561)
|
||||
EECR |= (1<<EERIE);
|
||||
#else
|
||||
EECR |= (1<<EERIE);
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@
|
||||
#define EEFS_VERS 5
|
||||
#define MAXFILES 62
|
||||
#define BS 64
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define blkid_t uint8_t
|
||||
#define EESIZE 4096
|
||||
#define EEFS_VERS 5
|
||||
|
||||
@@ -73,8 +73,6 @@
|
||||
#define TIMER_10MS_COMPVAL OCR2A
|
||||
#define PAUSE_10MS_INTERRUPT() TIMSK2 &= ~(1<<OCIE2A)
|
||||
#define RESUME_10MS_INTERRUPT() TIMSK2 |= (1<<OCIE2A)
|
||||
#define PAUSE_PULSES_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
|
||||
#define RESUME_PULSES_INTERRUPT() TIMSK1 |= (1<<OCIE1A)
|
||||
#define PAUSE_PPMIN_INTERRUPT() TIMSK3 &= ~(1<<ICIE3)
|
||||
#define RESUME_PPMIN_INTERRUPT() TIMSK3 |= (1<<ICIE3)
|
||||
|
||||
|
||||
+143
@@ -964,6 +964,149 @@ void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, Lc
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY) || defined(CPUARM)
|
||||
void putsTelemetryValue(xcoord_t x, uint8_t y, lcdint_t val, uint8_t unit, uint8_t att)
|
||||
{
|
||||
convertUnit(val, unit);
|
||||
lcd_outdezAtt(x, y, val, att & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT) && unit != UNIT_RAW)
|
||||
lcd_putsiAtt(lcdLastPos/*+1*/, y, STR_VTELEMUNIT, unit, 0);
|
||||
}
|
||||
|
||||
const pm_uint8_t bchunit_ar[] PROGMEM = {
|
||||
UNIT_METERS, // Alt
|
||||
UNIT_RAW, // Rpm
|
||||
UNIT_PERCENT, // Fuel
|
||||
UNIT_DEGREES, // T1
|
||||
UNIT_DEGREES, // T2
|
||||
UNIT_KTS, // Speed
|
||||
UNIT_METERS, // Dist
|
||||
UNIT_METERS, // GPS Alt
|
||||
};
|
||||
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TM1-1:
|
||||
case TELEM_TM2-1:
|
||||
att &= ~NO_UNIT;
|
||||
putsTime(x, y, val, att, att);
|
||||
break;
|
||||
case TELEM_MIN_A1-1:
|
||||
case TELEM_MIN_A2-1:
|
||||
channel -= TELEM_MIN_A1-TELEM_A1;
|
||||
// no break
|
||||
case TELEM_A1-1:
|
||||
case TELEM_A2-1:
|
||||
channel -= TELEM_A1-1;
|
||||
// A1 and A2
|
||||
{
|
||||
lcdint_t converted_value = applyChannelRatio(channel, val);
|
||||
if (g_model.frsky.channels[channel].type >= UNIT_RAW) {
|
||||
converted_value /= 10;
|
||||
}
|
||||
else {
|
||||
#if !defined(PCBTARANIS)
|
||||
if (abs(converted_value) < 1000) {
|
||||
att |= PREC2;
|
||||
}
|
||||
else {
|
||||
converted_value /= 10;
|
||||
att |= PREC1;
|
||||
}
|
||||
#else
|
||||
att |= PREC2;
|
||||
#endif
|
||||
}
|
||||
putsTelemetryValue(x, y, converted_value, g_model.frsky.channels[channel].type, att);
|
||||
break;
|
||||
}
|
||||
|
||||
case TELEM_CELL-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_VOLTS, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
case TELEM_VFAS-1:
|
||||
case TELEM_CELLS_SUM-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_VOLTS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CURRENT-1:
|
||||
case TELEM_MAX_CURRENT-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_AMPS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CONSUMPTION-1:
|
||||
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:
|
||||
case TELEM_VSPD-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_RAW, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_RSSI_TX-1:
|
||||
case TELEM_RSSI_RX-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_RAW, att);
|
||||
break;
|
||||
|
||||
#if defined(FRSKY_SPORT)
|
||||
case TELEM_ALT-1:
|
||||
putsTelemetryValue(x, y, val/10, UNIT_METERS, att|PREC1);
|
||||
break;
|
||||
#elif defined(WS_HOW_HIGH)
|
||||
case TELEM_ALT-1:
|
||||
case TELEM_MIN_ALT-1:
|
||||
case TELEM_MAX_ALT-1:
|
||||
if (IS_IMPERIAL_ENABLE() && IS_USR_PROTO_WS_HOW_HIGH()) {
|
||||
putsTelemetryValue(x, y, val, UNIT_FEET, att);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
uint8_t unit = 1;
|
||||
if (channel >= TELEM_MAX_T1-1 && channel <= TELEM_MAX_DIST-1)
|
||||
channel -= TELEM_MAX_T1 - TELEM_T1;
|
||||
if (channel <= TELEM_GPSALT-1)
|
||||
unit = channel + 1 - TELEM_ALT;
|
||||
if (channel >= TELEM_MIN_ALT-1 && channel <= TELEM_MAX_ALT-1)
|
||||
unit = 0;
|
||||
if (channel == TELEM_HDG-1)
|
||||
unit = 3;
|
||||
putsTelemetryValue(x, y, val, pgm_read_byte(bchunit_ar+unit), att);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else // defined(FRSKY)
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TM1-1:
|
||||
case TELEM_TM2-1:
|
||||
att &= ~NO_UNIT;
|
||||
putsTime(x, y, val, att, att);
|
||||
break;
|
||||
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
lcd_outdezAtt(x, y, val, (att|PREC1) & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT))
|
||||
lcd_putc(lcdLastPos/*+1*/, y, 'v');
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdSetContrast()
|
||||
{
|
||||
lcdSetRefVolt(g_eeGeneral.contrast);
|
||||
|
||||
@@ -37,109 +37,102 @@
|
||||
#ifndef lcd_h
|
||||
#define lcd_h
|
||||
|
||||
#if defined(PCBACT)
|
||||
#define LCD_W 260
|
||||
#define LCD_H 75
|
||||
#define xcoord_t uint16_t
|
||||
#define CENTER "\015"
|
||||
#define CENTER_OFS (7*FW-FW/2)
|
||||
#elif defined(PCBTARANIS)
|
||||
#define LCD_W 212
|
||||
#define LCD_H 64
|
||||
#define xcoord_t uint16_t
|
||||
#define CENTER "\015"
|
||||
#define CENTER_OFS (7*FW-FW/2)
|
||||
#if defined(PCBTARANIS)
|
||||
#define LCD_W 212
|
||||
#define LCD_H 64
|
||||
#define xcoord_t uint16_t
|
||||
#define CENTER "\015"
|
||||
#define CENTER_OFS (7*FW-FW/2)
|
||||
#else
|
||||
#define LCD_W 128
|
||||
#define LCD_H 64
|
||||
#define xcoord_t uint8_t
|
||||
#define CENTER
|
||||
#define CENTER_OFS 0
|
||||
#define LCD_W 128
|
||||
#define LCD_H 64
|
||||
#define xcoord_t uint8_t
|
||||
#define CENTER
|
||||
#define CENTER_OFS 0
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define lcdint_t int32_t
|
||||
#define lcdint_t int32_t
|
||||
#else
|
||||
#define lcdint_t int16_t
|
||||
#define lcdint_t int16_t
|
||||
#endif
|
||||
|
||||
#if LCD_H > 64
|
||||
#define LCD_LINES 9
|
||||
#define LCD_LINES 9
|
||||
#else
|
||||
#define LCD_LINES 8
|
||||
#define LCD_LINES 8
|
||||
#endif
|
||||
|
||||
|
||||
#define FW 6
|
||||
#define FWNUM 5
|
||||
#define FH 8
|
||||
#define FW 6
|
||||
#define FWNUM 5
|
||||
#define FH 8
|
||||
|
||||
/* lcd common flags */
|
||||
#define BLINK 0x01
|
||||
#define BLINK 0x01
|
||||
|
||||
/* lcd text flags */
|
||||
#define INVERS 0x02
|
||||
#define DBLSIZE 0x04
|
||||
#define INVERS 0x02
|
||||
#define DBLSIZE 0x04
|
||||
#ifdef BOLD_FONT
|
||||
#define BOLD 0x40
|
||||
#define BOLD 0x40
|
||||
#else
|
||||
#define BOLD 0x00
|
||||
#define BOLD 0x00
|
||||
#endif
|
||||
|
||||
/* lcd putc flags */
|
||||
#define CONDENSED 0x08
|
||||
#define CONDENSED 0x08
|
||||
|
||||
/* lcd puts flags */
|
||||
/* no 0x80 here because of "GV"1 which is aligned LEFT */
|
||||
/* no 0x10 here because of "MODEL"01 which uses LEADING0 */
|
||||
#define BSS 0x20
|
||||
#define ZCHAR 0x80
|
||||
#define BSS 0x20
|
||||
#define ZCHAR 0x80
|
||||
|
||||
/* lcd outdez flags */
|
||||
#define UNSIGN 0x08
|
||||
#define LEADING0 0x10
|
||||
#define PREC1 0x20
|
||||
#define PREC2 0x30
|
||||
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
|
||||
#define LEFT 0x80 /* align left */
|
||||
#define UNSIGN 0x08
|
||||
#define LEADING0 0x10
|
||||
#define PREC1 0x20
|
||||
#define PREC2 0x30
|
||||
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
|
||||
#define LEFT 0x80 /* align left */
|
||||
|
||||
/* line, rect, square flags */
|
||||
#define FORCE 0x02
|
||||
#define ERASE 0x04
|
||||
#define ROUND 0x08
|
||||
#define FORCE 0x02
|
||||
#define ERASE 0x04
|
||||
#define ROUND 0x08
|
||||
#if defined(PCBTARANIS)
|
||||
#define FILL_WHITE 0x10
|
||||
#define FILL_WHITE 0x10
|
||||
#endif
|
||||
|
||||
/* switches flags */
|
||||
#define SWCONDENSED 0x20 /* means that THRm will be displayed as THR */
|
||||
#define SWCONDENSED 0x20 /* means that THRm will be displayed as THR */
|
||||
|
||||
/* telemetry flags */
|
||||
#define NO_UNIT 0x40
|
||||
#define NO_UNIT 0x40
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MIDSIZE 0x0100
|
||||
#define SMLSIZE 0x0200
|
||||
#define TINSIZE 0x0400
|
||||
#define MIDSIZE 0x0100
|
||||
#define SMLSIZE 0x0200
|
||||
#define TINSIZE 0x0400
|
||||
#else
|
||||
#define MIDSIZE DBLSIZE
|
||||
#define SMLSIZE 0x00
|
||||
#define TINSIZE 0x00
|
||||
#define MIDSIZE DBLSIZE
|
||||
#define SMLSIZE 0x00
|
||||
#define TINSIZE 0x00
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define GREY(x) ((x) * 0x1000)
|
||||
#define GREY_DEFAULT GREY(11)
|
||||
#define GREY_MASK(x) ((x) & 0xF000)
|
||||
#define GREY(x) ((x) * 0x1000)
|
||||
#define GREY_DEFAULT GREY(11)
|
||||
#define GREY_MASK(x) ((x) & 0xF000)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define LcdFlags uint32_t
|
||||
#define LcdFlags uint32_t
|
||||
#else
|
||||
#define LcdFlags uint8_t
|
||||
#define LcdFlags uint8_t
|
||||
#endif
|
||||
|
||||
#define DISPLAY_PLAN_SIZE (LCD_W*((LCD_H+7)/8))
|
||||
#define DISPLAY_PLAN_SIZE (LCD_W*((LCD_H+7)/8))
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define DISPLAY_BUF_SIZE (4*DISPLAY_PLAN_SIZE)
|
||||
@@ -151,71 +144,72 @@ extern uint8_t displayBuf[DISPLAY_BUF_SIZE];
|
||||
extern uint8_t lcdLastPos;
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
extern volatile uint8_t LcdLock ;
|
||||
extern volatile uint8_t LcdLock ;
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
extern volatile uint8_t lcdLock ;
|
||||
extern volatile uint32_t lcdInputs ;
|
||||
extern volatile uint8_t lcdLock ;
|
||||
extern volatile uint32_t lcdInputs ;
|
||||
#endif
|
||||
|
||||
extern void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c);
|
||||
extern void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags mode);
|
||||
extern void lcd_putsAtt(xcoord_t x, uint8_t y, const pm_char * s, LcdFlags mode);
|
||||
extern void lcd_putsiAtt(xcoord_t x, uint8_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
|
||||
extern void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s,unsigned char len, LcdFlags mode);
|
||||
extern void lcd_puts(xcoord_t x, uint8_t y, const pm_char * s);
|
||||
extern void lcd_putsn(xcoord_t x, uint8_t y, const pm_char * s, unsigned char len);
|
||||
extern void lcd_putsLeft(uint8_t y, const pm_char * s);
|
||||
void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c);
|
||||
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags mode);
|
||||
void lcd_putsAtt(xcoord_t x, uint8_t y, const pm_char * s, LcdFlags mode);
|
||||
void lcd_putsiAtt(xcoord_t x, uint8_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
|
||||
void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s,unsigned char len, LcdFlags mode);
|
||||
void lcd_puts(xcoord_t x, uint8_t y, const pm_char * s);
|
||||
void lcd_putsn(xcoord_t x, uint8_t y, const pm_char * s, unsigned char len);
|
||||
void lcd_putsLeft(uint8_t y, const pm_char * s);
|
||||
#define lcd_putsCenter(y, s) lcd_puts((LCD_W-sizeof(TR_##s)*FW+FW-2)/2, y, STR_##s)
|
||||
|
||||
extern void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val);
|
||||
extern void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0);
|
||||
extern void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
|
||||
extern void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val);
|
||||
void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val);
|
||||
void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0);
|
||||
void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
|
||||
void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val);
|
||||
|
||||
extern void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
|
||||
extern void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att);
|
||||
extern void putsSwitches(xcoord_t x, uint8_t y, int8_t swtch, LcdFlags att=0);
|
||||
extern void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att=0);
|
||||
extern void putsFlightPhase(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
|
||||
extern void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
|
||||
extern void putsTmrMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att);
|
||||
extern void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
|
||||
void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att);
|
||||
void putsSwitches(xcoord_t x, uint8_t y, int8_t swtch, LcdFlags att=0);
|
||||
void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att=0);
|
||||
void putsFlightPhase(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
|
||||
void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
|
||||
void putsTmrMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att);
|
||||
void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
#endif
|
||||
|
||||
#define putsChn(x, y, idx, att) putsMixerSource(x, y, MIXSRC_CH1+idx-1, att)
|
||||
extern void putsChnLetter(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags attr);
|
||||
void putsChnLetter(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags attr);
|
||||
|
||||
extern void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, LcdFlags att);
|
||||
extern void putsVBat(xcoord_t x, uint8_t y, LcdFlags att);
|
||||
void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, LcdFlags att);
|
||||
void putsVBat(xcoord_t x, uint8_t y, LcdFlags att);
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att);
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define putstime_t int32_t
|
||||
#define putstime_t int32_t
|
||||
#else
|
||||
#define putstime_t int16_t
|
||||
#define putstime_t int16_t
|
||||
#endif
|
||||
|
||||
extern void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
|
||||
void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
|
||||
|
||||
#define SOLID 0xff
|
||||
#define DOTTED 0x55
|
||||
|
||||
extern void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att=0);
|
||||
extern void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0);
|
||||
extern void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att=0);
|
||||
extern void lcd_vline(xcoord_t x, int8_t y, int8_t h);
|
||||
void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att=0);
|
||||
void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0);
|
||||
void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att=0);
|
||||
void lcd_vline(xcoord_t x, int8_t y, int8_t h);
|
||||
#if defined(CPUM64)
|
||||
extern void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat);
|
||||
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat);
|
||||
#else
|
||||
extern void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att=0);
|
||||
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
extern void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
extern void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
extern void lcd_invert_line(int8_t y);
|
||||
void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
void lcd_invert_line(int8_t y);
|
||||
#define lcd_status_line() lcd_invert_line(LCD_LINES-1)
|
||||
inline void lcd_square(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
|
||||
|
||||
@@ -237,25 +231,25 @@ void lcdDrawTelemetryTopBar();
|
||||
lcd_vline(x+4, y+8, 2); \
|
||||
lcd_vline(x+5, y+8, 2);
|
||||
|
||||
extern void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
extern void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset=0, uint8_t width=0);
|
||||
void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset=0, uint8_t width=0);
|
||||
#define LCD_ICON(x, y, icon) lcd_bmp(x, y, icons, icon)
|
||||
extern void lcdSetRefVolt(unsigned char val);
|
||||
extern void lcdInit();
|
||||
extern void lcd_clear();
|
||||
extern void lcdSetContrast();
|
||||
void lcdSetRefVolt(unsigned char val);
|
||||
void lcdInit();
|
||||
void lcd_clear();
|
||||
void lcdSetContrast();
|
||||
|
||||
extern void lcdRefresh();
|
||||
void lcdRefresh();
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const xcoord_t width, const uint8_t height);
|
||||
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const xcoord_t width, const uint8_t height);
|
||||
#endif
|
||||
|
||||
#define BLINK_ON_PHASE (g_blinkTmr10ms & (1<<6))
|
||||
|
||||
#ifdef SIMU
|
||||
extern bool lcd_refresh;
|
||||
extern uint8_t lcd_buf[DISPLAY_BUF_SIZE];
|
||||
extern bool lcd_refresh;
|
||||
extern uint8_t lcd_buf[DISPLAY_BUF_SIZE];
|
||||
#endif
|
||||
|
||||
#define LCD_BYTE_FILTER_PLAN(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(FRSKY) || defined(CPUARM)
|
||||
uint16_t getChannelRatio(uint8_t channel)
|
||||
{
|
||||
return (uint16_t)g_model.frsky.channels[channel].ratio << g_model.frsky.channels[channel].multiplier;
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#define TIMER_10MS_COMPVAL OCR2A
|
||||
#define PAUSE_10MS_INTERRUPT() TIMSK2 &= ~(1<<OCIE2A)
|
||||
#define RESUME_10MS_INTERRUPT() TIMSK2 |= (1<<OCIE2A)
|
||||
#define PAUSE_PULSES_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
|
||||
#define RESUME_PULSES_INTERRUPT() TIMSK1 |= (1<<OCIE1A)
|
||||
#define PAUSE_PPMIN_INTERRUPT() TIMSK3 &= ~(1<<ICIE3)
|
||||
#define RESUME_PPMIN_INTERRUPT() TIMSK3 |= (1<<ICIE3)
|
||||
#define SLAVE_MODE() (PING & (1<<INP_G_RF_POW))
|
||||
|
||||
+156
-41
@@ -890,14 +890,14 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
bool CURSOR_ON_CELL = (m_posHorz >= 0);
|
||||
#define IF_PORT1_ON(x) (g_model.moduleData[0].rfProtocol == RF_PROTO_OFF ? (uint8_t)-1 : (uint8_t)(x))
|
||||
#define IF_PORT2_ON(x) (g_model.externalModule == MODULE_TYPE_NONE ? (uint8_t)-1 : (uint8_t)(x))
|
||||
#define IF_PORT1_ON(x) (g_model.moduleData[0].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IF_PORT2_ON(x) (g_model.externalModule == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IF_PORT_ON(idx, x) (idx==0 ? IS_PORT1_ON(x) : IS_PORT2_ON(x))
|
||||
#define IF_PORT2_XJT(x) (IS_MODULE_XJT(1) ? (uint8_t)x : (uint8_t)-1)
|
||||
#define IF_PORT2_XJT(x) (IS_MODULE_XJT(1) ? (uint8_t)x : HIDDEN_ROW)
|
||||
#define PORT1_CHANNELS_ROWS() IF_PORT1_ON(1)
|
||||
#define PORT2_CHANNELS_ROWS() IF_PORT2_ON(g_model.externalModule == MODULE_TYPE_DJT ? (uint8_t)0 : (g_model.externalModule == MODULE_TYPE_DSM2 ? (uint8_t)0 : ((uint8_t)1)))
|
||||
#define PORT_CHANNELS_ROWS(x) (x==0 ? PORT1_CHANNELS_ROWS() : PORT2_CHANNELS_ROWS())
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, 1+ITEM_MODEL_SETUP_MAX, { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_PORT1_ON(1), IF_PORT1_ON(2), IF_PORT1_ON(g_model.moduleData[0].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0), LABEL(ExternalModule), g_model.externalModule==MODULE_TYPE_XJT ? (uint8_t)1 : (uint8_t)0, PORT2_CHANNELS_ROWS(), (IS_MODULE_PPM(1) || IS_MODULE_XJT(1) ? (uint8_t)2 : (uint8_t)-1), IF_PORT2_XJT(g_model.moduleData[1].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0), 0});
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, 1+ITEM_MODEL_SETUP_MAX, { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_PORT1_ON(1), IF_PORT1_ON(2), IF_PORT1_ON(g_model.moduleData[0].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0), LABEL(ExternalModule), g_model.externalModule==MODULE_TYPE_XJT ? (uint8_t)1 : (uint8_t)0, PORT2_CHANNELS_ROWS(), (IS_MODULE_PPM(1) || IS_MODULE_XJT(1) ? (uint8_t)2 : HIDDEN_ROW), IF_PORT2_XJT(g_model.moduleData[1].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0), 0});
|
||||
#elif defined(CPUM64)
|
||||
#define CURSOR_ON_CELL (true)
|
||||
uint8_t protocol = g_model.protocol;
|
||||
@@ -913,7 +913,15 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
uint8_t y = 1 + 1*FH + i*FH;
|
||||
|
||||
uint8_t k = i+s_pgOfs;
|
||||
#if defined(CPUARM)
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
||||
k++;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t blink = ((editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
|
||||
@@ -1008,13 +1016,13 @@ void menuModelSetup(uint8_t event)
|
||||
g_model.extendedTrims = onoffMenuItem(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, m_posHorz<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_RESET, m_posHorz>0 ? attr : 0);
|
||||
if (attr && m_posHorz>0) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
for (uint8_t i=0; i<MAX_PHASES; i++) {
|
||||
memclear(&g_model.phaseData[i], TRIMS_ARRAY_SIZE);
|
||||
}
|
||||
eeDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
eeDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2043,6 +2051,138 @@ bool moveCurve(uint8_t index, int8_t shift, int8_t custom=0)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void menuModelCurveOne(uint8_t event)
|
||||
{
|
||||
static uint8_t coordsOfs = 0;
|
||||
|
||||
TITLE(STR_MENUCURVE);
|
||||
lcd_outdezAtt(PSIZE(TR_MENUCURVE)*FW+1, 0, s_curveChan+1, INVERS|LEFT);
|
||||
DISPLAY_PROGRESS_BAR(20*FW+1);
|
||||
|
||||
CurveInfo crv = curveinfo(s_curveChan);
|
||||
|
||||
const uint8_t mstate_tab[] = { 0, 0, uint8_t(NAVIGATION_LINE_BY_LINE|(crv.points-1)), 0 };
|
||||
if (!check(event, 0, 0, 0, mstate_tab, 3, 3))
|
||||
return;
|
||||
|
||||
switch(event) {
|
||||
case EVT_ENTRY:
|
||||
m_posVert = 2;
|
||||
coordsOfs = 0;
|
||||
break;
|
||||
|
||||
case EVT_KEY_REPT(KEY_LEFT):
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
if (m_posVert == 0 && s_editMode > 0) {
|
||||
coordsOfs = 0;
|
||||
if (crv.custom) {
|
||||
moveCurve(s_curveChan, -crv.points+2);
|
||||
}
|
||||
else if (crv.points > MIN_POINTS) {
|
||||
moveCurve(s_curveChan, -1, (crv.points+1)/2);
|
||||
}
|
||||
else {
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_REPT(KEY_RIGHT):
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
if (m_posVert == 0 && s_editMode > 0) {
|
||||
coordsOfs = 0;
|
||||
if (!crv.custom) {
|
||||
moveCurve(s_curveChan, crv.points-2, crv.points);
|
||||
}
|
||||
else if (crv.points < MAX_POINTS) {
|
||||
if (moveCurve(s_curveChan, 1)) {
|
||||
for (int8_t i=crv.points+crv.points-2; i>=0; i--) {
|
||||
if (i%2)
|
||||
crv.crv[i] = (crv.crv[i/2] + crv.crv[1+i/2]) / 2;
|
||||
else
|
||||
crv.crv[i] = crv.crv[i/2];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
lcd_putsLeft(FH+1, STR_CURVE_TYPE);
|
||||
uint8_t attr = (m_posVert==0 ? (s_editMode <= 0 ? INVERS : INVERS|BLINK) : 0);
|
||||
lcd_outdezAtt(5*FW, FH+1, crv.points, LEFT|attr);
|
||||
lcd_putsAtt(lcdLastPos, FH+1, crv.custom ? PSTR("pt'") : PSTR("pt"), attr);
|
||||
|
||||
lcd_putsLeft(2*FH+1, STR_NAME);
|
||||
editName(5*FW, 2*FH+1, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==1 ? INVERS : 0);
|
||||
|
||||
lcd_putsAtt(0*FW, 3*FH+3, PSTR("[Edit]"), m_posVert==2 ? INVERS : 0);
|
||||
lcd_putsAtt(0*FW, 4*FH+3, PSTR("[Preset]"), m_posVert==3 ? INVERS : 0);
|
||||
if (m_posVert==3 && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
static int8_t presetIdx = 0;
|
||||
if (++presetIdx > 4)
|
||||
presetIdx = -4;
|
||||
for (uint8_t i=0; i<crv.points; i++)
|
||||
crv.crv[i] = (i-(crv.points/2)) * presetIdx * 50 / (crv.points-1);
|
||||
eeDirty(EE_MODEL);
|
||||
s_editMode = 0;
|
||||
}
|
||||
|
||||
DrawCurve(curveFn);
|
||||
|
||||
uint8_t posY = 3;
|
||||
for (uint8_t i=0; i<crv.points; i++) {
|
||||
uint8_t xx = X0-1-WCHART+i*WCHART/(crv.points/2);
|
||||
uint8_t yy = (LCD_H-1) - (100 + crv.crv[i]) * (LCD_H-1) / 200;
|
||||
if (crv.custom && i>0 && i<crv.points-1)
|
||||
xx = X0-1-WCHART + (100 + (100 + crv.crv[crv.points+i-1]) * (2*WCHART)) / 200;
|
||||
|
||||
lcd_filled_rect(xx, yy-1, 3, 3, SOLID, FORCE); // do markup square
|
||||
|
||||
if (i>=coordsOfs && i<=coordsOfs+5) {
|
||||
int8_t x = -100 + 200*i/(crv.points-1);
|
||||
if (crv.custom && i>0 && i<crv.points-1) x = crv.crv[crv.points+i-1];
|
||||
lcd_outdezAtt(7+13*FW, posY, x, LEFT|((m_posVert==2 && m_posHorz==i && s_editMode==2) ? BLINK|INVERS : 0));
|
||||
lcd_outdezAtt(7+17*FW, posY, crv.crv[i], LEFT|((m_posVert==2 && m_posHorz==i && s_editMode==3) ? BLINK|INVERS : 0));
|
||||
if (m_posVert==2 && m_posHorz == i) {
|
||||
lcd_rect(9+12*FW, posY-2, 9*FW-4, FH+3);
|
||||
}
|
||||
posY += FH+2;
|
||||
}
|
||||
|
||||
if (m_posVert==2 && m_posHorz==i) {
|
||||
// do selection square
|
||||
lcd_filled_rect(xx-1, yy-2, 5, 5, SOLID, FORCE);
|
||||
lcd_filled_rect(xx, yy-1, 3, 3, SOLID);
|
||||
if (s_editMode > 0) {
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (s_editMode == EDIT_MODIFY_FIELD)
|
||||
s_editMode = (crv.custom && m_posHorz>0 && m_posHorz<crv.points-1) ? 2 : 3;
|
||||
else if (s_editMode == 2)
|
||||
s_editMode = 3;
|
||||
else
|
||||
s_editMode = 0;
|
||||
}
|
||||
else if (event==EVT_KEY_FIRST(KEY_MINUS) || event==EVT_KEY_FIRST(KEY_PLUS) || event==EVT_KEY_REPT(KEY_MINUS) || event==EVT_KEY_REPT(KEY_PLUS)) {
|
||||
if (s_editMode == 2)
|
||||
CHECK_INCDEC_MODELVAR(event, crv.crv[crv.points+i-1], i==1 ? -99 : crv.crv[crv.points+i-2]+1, i==crv.points-2 ? 99 : crv.crv[crv.points+i]-1); // edit X
|
||||
else if (s_editMode == 3)
|
||||
CHECK_INCDEC_MODELVAR(event, crv.crv[i], -100, 100);
|
||||
}
|
||||
}
|
||||
if (m_posHorz < coordsOfs)
|
||||
coordsOfs = m_posHorz;
|
||||
else if (m_posHorz >= coordsOfs+6)
|
||||
coordsOfs = m_posHorz-5;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void menuModelCurveOne(uint8_t event)
|
||||
{
|
||||
TITLE(STR_MENUCURVE);
|
||||
@@ -2053,28 +2193,14 @@ void menuModelCurveOne(uint8_t event)
|
||||
|
||||
switch(event) {
|
||||
case EVT_ENTRY:
|
||||
#if defined(PCBTARANIS)
|
||||
m_posHorz = 0;
|
||||
#endif
|
||||
s_editMode = 1;
|
||||
break;
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(PCBTARANIS)
|
||||
if (s_editMode <= 0) {
|
||||
s_editMode = 1;
|
||||
m_posHorz = 0;
|
||||
}
|
||||
else if (s_editMode == 1)
|
||||
s_editMode = (crv.custom && m_posHorz>0 && m_posHorz<crv.points-1) ? 2 : 3;
|
||||
else if (s_editMode == 2)
|
||||
s_editMode = 3;
|
||||
#else
|
||||
if (s_editMode <= 0)
|
||||
m_posHorz = 0;
|
||||
if (s_editMode == 1 && crv.custom)
|
||||
s_editMode = 2;
|
||||
#endif
|
||||
else
|
||||
s_editMode = 1;
|
||||
break;
|
||||
@@ -2090,10 +2216,6 @@ void menuModelCurveOne(uint8_t event)
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (s_editMode > 0) {
|
||||
#if defined(PCBTARANIS)
|
||||
if (s_editMode == 3 && !(crv.custom && m_posHorz>0 && m_posHorz<crv.points-1))
|
||||
s_editMode = 2;
|
||||
#endif
|
||||
if (--s_editMode == 0)
|
||||
m_posHorz = 0;
|
||||
}
|
||||
@@ -2169,34 +2291,21 @@ void menuModelCurveOne(uint8_t event)
|
||||
|
||||
int8_t x = -100 + 200*i/(crv.points-1);
|
||||
if (crv.custom && i>0 && i<crv.points-1) x = crv.crv[crv.points+i-1];
|
||||
#if defined(PCBTARANIS)
|
||||
lcd_puts(7, 2*FH, PSTR("x=")); lcd_outdezAtt(7+2*FW, 2*FH, x, LEFT|(s_editMode==2 ? BLINK|INVERS : 0));
|
||||
lcd_puts(7, 3*FH, PSTR("y=")); lcd_outdezAtt(7+2*FW, 3*FH, crv.crv[i], LEFT|(s_editMode==3 ? BLINK|INVERS : 0));
|
||||
#else
|
||||
lcd_puts(7, 2*FH, PSTR("x=")); lcd_outdezAtt(7+2*FW, 2*FH, x, LEFT);
|
||||
lcd_puts(7, 3*FH, PSTR("y=")); lcd_outdezAtt(7+2*FW, 3*FH, crv.crv[i], LEFT);
|
||||
#endif
|
||||
lcd_rect(3, 1*FH+4, 7*FW-2, 3*FH-2);
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (event==EVT_KEY_FIRST(KEY_MINUS) || event==EVT_KEY_FIRST(KEY_PLUS) || event==EVT_KEY_REPT(KEY_MINUS) || event==EVT_KEY_REPT(KEY_PLUS)) {
|
||||
if (s_editMode == 2)
|
||||
CHECK_INCDEC_MODELVAR(event, crv.crv[crv.points+i-1], i==1 ? -99 : crv.crv[crv.points+i-2]+1, i==crv.points-2 ? 99 : crv.crv[crv.points+i]-1); // edit X
|
||||
else if (s_editMode == 3)
|
||||
CHECK_INCDEC_MODELVAR(event, crv.crv[i], -100, 100); // edit Y
|
||||
}
|
||||
#else
|
||||
if (p1valdiff || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP))
|
||||
CHECK_INCDEC_MODELVAR(event, crv.crv[i], -100, 100); // edit Y on up/down
|
||||
|
||||
|
||||
if (i>0 && i<crv.points-1 && s_editMode==2 && (event==EVT_KEY_FIRST(KEY_LEFT) || event==EVT_KEY_FIRST(KEY_RIGHT) || event==EVT_KEY_REPT(KEY_LEFT) || event==EVT_KEY_REPT(KEY_RIGHT)))
|
||||
CHECK_INCDEC_MODELVAR(event, crv.crv[crv.points+i-1], i==1 ? -99 : crv.crv[crv.points+i-2]+1, i==crv.points-2 ? 99 : crv.crv[crv.points+i]-1); // edit X on left/right
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint8_t getExpoMixCount(uint8_t expo)
|
||||
{
|
||||
@@ -3307,6 +3416,9 @@ void menuModelCurvesAll(uint8_t event)
|
||||
#if defined(GVARS) && defined(PCBSTD)
|
||||
if (k < MAX_CURVES) {
|
||||
putsStrIdx(0, y, STR_CV, k+1, attr);
|
||||
#if defined(PCBTARANIS)
|
||||
lcd_putsnAtt(5*FW, y, g_model.curveNames[k], sizeof(g_model.curveNames[k]), ZCHAR);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
putsStrIdx(0, y, STR_GV, k-MAX_CURVES+1);
|
||||
@@ -3318,6 +3430,9 @@ void menuModelCurvesAll(uint8_t event)
|
||||
}
|
||||
#else
|
||||
putsStrIdx(0, y, STR_CV, k+1, attr);
|
||||
#if defined(PCBTARANIS)
|
||||
lcd_putsnAtt(5*FW, y, g_model.curveNames[k], sizeof(g_model.curveNames[k]), ZCHAR);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3682,7 +3797,7 @@ void menuModelCustomSwitches(uint8_t event)
|
||||
}
|
||||
#else
|
||||
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
||||
putsTime(CSW_3RD_COLUMN, y, (int16_t)3 * (CS_STATE(cs->func)==CS_VOFS ? 128+cs->v2 : cs->v2), LEFT | (m_posHorz==2 ? attr : 0), LEFT | (m_posHorz==2 ? attr : 0));
|
||||
putsTelemetryChannel(CSW_3RD_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT | (m_posHorz==2 ? attr : 0));
|
||||
v2_min = -128; v2_max = 127;
|
||||
}
|
||||
else {
|
||||
|
||||
+38
-3
@@ -272,6 +272,12 @@ void title(const pm_char * s)
|
||||
#define SCROLL_TH 64
|
||||
#define SCROLL_POT1_TH 32
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
|
||||
#else
|
||||
#define CURSOR_NOT_ALLOWED_IN_ROW(row) (MAXCOL(row) == TITLE_ROW)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (uint8_t)-1 : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
|
||||
@@ -585,7 +591,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
#endif
|
||||
do {
|
||||
INC(l_posVert, POS_VERT_INIT, maxrow);
|
||||
} while (MAXCOL(l_posVert) == (uint8_t)-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBTARANIS)
|
||||
s_editMode = 0; // if we go down, we must be in this mode
|
||||
@@ -658,7 +664,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
|
||||
do {
|
||||
DEC(l_posVert, POS_VERT_INIT, maxrow);
|
||||
} while(MAXCOL(l_posVert) == (uint8_t)-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBTARANIS)
|
||||
s_editMode = 0; // if we go up, we must be in this mode
|
||||
@@ -675,17 +681,46 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (l_posVert<1) s_pgOfs=0;
|
||||
else if (menuTab && horTab) {
|
||||
vertpos_t realPosVert = l_posVert;
|
||||
vertpos_t realPgOfs = s_pgOfs;
|
||||
for (vertpos_t i=1; i<=maxrow; i++) {
|
||||
if (horTab[i] == HIDDEN_ROW) {
|
||||
if (i < l_posVert)
|
||||
realPosVert--;
|
||||
if (i < s_pgOfs)
|
||||
realPgOfs--;
|
||||
}
|
||||
}
|
||||
if (realPosVert>(LCD_LINES-1)+realPgOfs) realPgOfs = realPosVert-(LCD_LINES-1);
|
||||
else if (realPosVert<1+realPgOfs) realPgOfs = realPosVert-1;
|
||||
s_pgOfs = realPgOfs;
|
||||
for (vertpos_t i=1; i<=realPgOfs; i++) {
|
||||
if (horTab[i] == HIDDEN_ROW) {
|
||||
s_pgOfs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
|
||||
if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max;
|
||||
else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1;
|
||||
}
|
||||
#else
|
||||
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
|
||||
if (l_posVert<1) s_pgOfs=0;
|
||||
else if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max;
|
||||
else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1;
|
||||
#endif
|
||||
m_posVert = l_posVert;
|
||||
m_posHorz = l_posHorz;
|
||||
#if !defined(CPUM64)
|
||||
// cosmetics on 9x
|
||||
if (s_pgOfs > 0) {
|
||||
l_posVert--;
|
||||
if (l_posVert == s_pgOfs && MAXCOL(l_posVert) == (uint8_t)-1)
|
||||
if (l_posVert == s_pgOfs && CURSOR_NOT_ALLOWED_IN_ROW(l_posVert))
|
||||
s_pgOfs = l_posVert-1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -153,6 +153,11 @@ extern int8_t s_editMode; // global editmode
|
||||
#define NO_INCDEC_MARKS 0x04
|
||||
#define INCDEC_SWITCH 0x08
|
||||
#define INCDEC_SOURCE 0x10
|
||||
|
||||
// mawrow special values
|
||||
#define TITLE_ROW ((uint8_t)-1)
|
||||
#define HIDDEN_ROW ((uint8_t)-2)
|
||||
|
||||
int16_t checkIncDec(uint8_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags);
|
||||
|
||||
#if defined(CPUM64)
|
||||
|
||||
+47
-37
@@ -57,6 +57,8 @@
|
||||
#define EEPROM_VER 214
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define EEPROM_VER 214
|
||||
#elif defined(CPUM2561)
|
||||
#define EEPROM_VER 214
|
||||
#elif defined(CPUM128)
|
||||
#define EEPROM_VER 215
|
||||
#else
|
||||
@@ -83,6 +85,14 @@
|
||||
#define MAX_EXPOS 16
|
||||
#define NUM_CSW 15 // number of custom switches
|
||||
#define NUM_CFN 24 // number of functions assigned to switches
|
||||
#elif defined(CPUM2561)
|
||||
#define MAX_MODELS 30
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define MAX_PHASES 6
|
||||
#define MAX_MIXERS 32
|
||||
#define MAX_EXPOS 16
|
||||
#define NUM_CSW 15 // number of custom switches
|
||||
#define NUM_CFN 24 // number of functions assigned to switches
|
||||
#elif defined(CPUM128)
|
||||
#define MAX_MODELS 30
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
@@ -215,7 +225,7 @@ PACK(typedef struct t_ModuleData {
|
||||
}) ModuleData;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define MODELDATA_EXTRA char bitmap[10]; uint8_t externalModule; ModuleData moduleData[NUM_MODULES]; uint8_t trainerMode;
|
||||
#define MODELDATA_EXTRA char bitmap[10]; uint8_t externalModule; ModuleData moduleData[NUM_MODULES]; uint8_t trainerMode; char curveNames[MAX_CURVES][6];
|
||||
#define LIMITDATA_EXTRA char name[6];
|
||||
#define swstate_t uint16_t
|
||||
#elif defined(PCBSKY9X)
|
||||
@@ -314,17 +324,7 @@ PACK(typedef struct t_ExpoData {
|
||||
char name[LEN_EXPOMIX_NAME];
|
||||
int8_t curveParam;
|
||||
}) ExpoData;
|
||||
#elif defined(PCBSTD)
|
||||
PACK(typedef struct t_ExpoData {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
int8_t swtch:6;
|
||||
uint8_t chn:2;
|
||||
uint8_t phases:5;
|
||||
uint8_t curveMode:1;
|
||||
uint8_t weight; // One spare bit here (used for GVARS)
|
||||
int8_t curveParam;
|
||||
}) ExpoData;
|
||||
#else
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
PACK(typedef struct t_ExpoData {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn:2;
|
||||
@@ -335,6 +335,16 @@ PACK(typedef struct t_ExpoData {
|
||||
uint8_t weight;
|
||||
int8_t curveParam;
|
||||
}) ExpoData;
|
||||
#else
|
||||
PACK(typedef struct t_ExpoData {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
int8_t swtch:6;
|
||||
uint8_t chn:2;
|
||||
uint8_t phases:5;
|
||||
uint8_t curveMode:1;
|
||||
uint8_t weight; // One spare bit here (used for GVARS)
|
||||
int8_t curveParam;
|
||||
}) ExpoData;
|
||||
#endif
|
||||
|
||||
PACK(typedef struct t_LimitData {
|
||||
@@ -415,28 +425,7 @@ PACK( union u_int8int16_t {
|
||||
#define DELAY_MAX 15 /* 7.5 seconds */
|
||||
#define SLOW_MAX 15 /* 7.5 seconds */
|
||||
|
||||
#if defined(PCBSTD)
|
||||
PACK(typedef struct t_MixData {
|
||||
uint8_t destCh:4; // 0, 1..NUM_CHNOUT
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
uint8_t noExpo:1;
|
||||
uint8_t weightMode:1;
|
||||
uint8_t offsetMode:1;
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t phases:5;
|
||||
int8_t carryTrim:3;
|
||||
uint8_t srcRaw:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4;
|
||||
uint8_t speedDown:4;
|
||||
int8_t curveParam;
|
||||
int8_t offset;
|
||||
}) MixData;
|
||||
#else
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
PACK(typedef struct t_MixData {
|
||||
uint8_t destCh:4; // 0, 1..NUM_CHNOUT
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
@@ -458,6 +447,27 @@ PACK(typedef struct t_MixData {
|
||||
int8_t curveParam;
|
||||
int8_t offset;
|
||||
}) MixData;
|
||||
#else
|
||||
PACK(typedef struct t_MixData {
|
||||
uint8_t destCh:4; // 0, 1..NUM_CHNOUT
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
uint8_t noExpo:1;
|
||||
uint8_t weightMode:1;
|
||||
uint8_t offsetMode:1;
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t phases:5;
|
||||
int8_t carryTrim:3;
|
||||
uint8_t srcRaw:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4;
|
||||
uint8_t speedDown:4;
|
||||
int8_t curveParam;
|
||||
int8_t offset;
|
||||
}) MixData;
|
||||
#endif
|
||||
PACK( union u_gvarint_t {
|
||||
struct {
|
||||
@@ -1174,10 +1184,10 @@ enum FailsafeModes {
|
||||
FAILSAFE_LAST = FAILSAFE_NOPULSES
|
||||
};
|
||||
|
||||
#if defined(MAVLINK)
|
||||
#define TELEMETRY_DATA MavlinkData mavlink;
|
||||
#elif defined(FRSKY)
|
||||
#if defined(FRSKY) || !defined(PCBSTD)
|
||||
#define TELEMETRY_DATA FrSkyData frsky;
|
||||
#elif defined(MAVLINK)
|
||||
#define TELEMETRY_DATA MavlinkData mavlink;
|
||||
#else
|
||||
#define TELEMETRY_DATA
|
||||
#endif
|
||||
|
||||
+93
-10
@@ -1393,8 +1393,99 @@ void setGVarValue(uint8_t idx, int16_t value, int8_t phase)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
uint8_t maxTelemValue(uint8_t channel)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_FUEL:
|
||||
case TELEM_RSSI_TX:
|
||||
case TELEM_RSSI_RX:
|
||||
return 100;
|
||||
case TELEM_HDG:
|
||||
return 180;
|
||||
default:
|
||||
return 255;
|
||||
}
|
||||
}
|
||||
|
||||
getvalue_t convertTelemValue(uint8_t channel, uint8_t value)
|
||||
{
|
||||
getvalue_t result;
|
||||
switch (channel) {
|
||||
case TELEM_TM1:
|
||||
case TELEM_TM2:
|
||||
result = value * 3;
|
||||
break;
|
||||
case TELEM_ALT:
|
||||
#if defined(PCBTARANIS)
|
||||
result = value * 80 - 5000;
|
||||
break;
|
||||
#endif
|
||||
case TELEM_GPSALT:
|
||||
case TELEM_MAX_ALT:
|
||||
case TELEM_MIN_ALT:
|
||||
result = value * 8 - 500;
|
||||
break;
|
||||
case TELEM_RPM:
|
||||
case TELEM_MAX_RPM:
|
||||
result = value * 50;
|
||||
break;
|
||||
case TELEM_T1:
|
||||
case TELEM_T2:
|
||||
case TELEM_MAX_T1:
|
||||
case TELEM_MAX_T2:
|
||||
result = (getvalue_t)value - 30;
|
||||
break;
|
||||
case TELEM_CELL:
|
||||
case TELEM_HDG:
|
||||
result = value * 2;
|
||||
break;
|
||||
case TELEM_DIST:
|
||||
case TELEM_MAX_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;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
getvalue_t convertTelemValue(uint8_t channel, uint8_t value)
|
||||
{
|
||||
getvalue_t result;
|
||||
switch (channel) {
|
||||
case TELEM_TM1:
|
||||
case TELEM_TM2:
|
||||
result = value * 3;
|
||||
break;
|
||||
default:
|
||||
result = value;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
getvalue_t convertCswTelemValue(CustomSwData * cs)
|
||||
{
|
||||
getvalue_t val;
|
||||
if (CS_STATE(cs->func)==CS_VOFS)
|
||||
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2);
|
||||
else
|
||||
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2) - convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128);
|
||||
return val;
|
||||
}
|
||||
|
||||
#if defined(FRSKY) || defined(CPUARM)
|
||||
inline void convertUnit(getvalue_t & val, uint8_t & unit)
|
||||
FORCEINLINE void convertUnit(getvalue_t & val, uint8_t & unit)
|
||||
{
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DEGREES) {
|
||||
@@ -1421,14 +1512,6 @@ inline void convertUnit(getvalue_t & val, uint8_t & unit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void putsTelemetryValue(xcoord_t x, uint8_t y, lcdint_t val, uint8_t unit, uint8_t att)
|
||||
{
|
||||
convertUnit(val, unit);
|
||||
lcd_outdezAtt(x, y, val, att & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT) && unit != UNIT_RAW)
|
||||
lcd_putsiAtt(lcdLastPos/*+1*/, y, STR_VTELEMUNIT, unit, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define INAC_DEVISOR 512 // bypass splash screen with stick movement
|
||||
@@ -4150,7 +4233,7 @@ int main(void)
|
||||
// important to disable it before commencing with system initialisation (or
|
||||
// we could put a bunch more wdt_reset()s in. But I don't like that approach
|
||||
// during boot up.)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
uint8_t mcusr = MCUSR; // save the WDT (etc) flags
|
||||
MCUSR = 0; // must be zeroed before disabling the WDT
|
||||
#elif defined(PCBSTD)
|
||||
|
||||
+11
-4
@@ -1355,9 +1355,19 @@ extern uint8_t barsThresholds[THLD_MAX];
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
uint8_t maxTelemValue(uint8_t channel);
|
||||
uint8_t maxTelemValue(uint8_t channel);
|
||||
#else
|
||||
#define maxTelemValue(channel) 255
|
||||
#endif
|
||||
|
||||
getvalue_t convertTelemValue(uint8_t channel, uint8_t value);
|
||||
getvalue_t convertCswTelemValue(CustomSwData * cs);
|
||||
|
||||
#if defined(FRSKY) || defined(CPUARM)
|
||||
lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val);
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm);
|
||||
|
||||
extern const pm_uint8_t bchunit_ar[];
|
||||
@@ -1368,9 +1378,6 @@ extern const pm_uint8_t bchunit_ar[];
|
||||
#define FRSKY_MULTIPLIER_MAX 3
|
||||
#endif
|
||||
|
||||
lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val);
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att);
|
||||
|
||||
#define IS_BARS_SCREEN(screenIndex) (g_model.frsky.screensType & (1<<(screenIndex)))
|
||||
#endif
|
||||
|
||||
|
||||
+12
-18
@@ -757,7 +757,7 @@ void setupPulses()
|
||||
TCCR1B = 0; // Stop counter
|
||||
TCNT1 = 0;
|
||||
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
TIMSK1 &= ~0x2F; // All Timer1 interrupts off
|
||||
TIMSK1 &= ~(1<<OCIE1C); // COMPC1 off
|
||||
TIFR1 = 0x2F;
|
||||
@@ -778,7 +778,7 @@ void setupPulses()
|
||||
OCR1C = 200; // 100 uS
|
||||
TCNT1 = 300; // Past the OCR1C value
|
||||
ICR1 = 44000; // Next frame starts in 22 mS
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
TIMSK1 |= 0x28; // Enable Timer1 COMPC and CAPT interrupts
|
||||
TCCR1A = (0 << WGM10); // Set output waveform mode to normal, for now. Note that
|
||||
// WGM will be changed to toggle OCR1B pin on compare capture,
|
||||
@@ -797,7 +797,7 @@ void setupPulses()
|
||||
set_timer3_capture();
|
||||
OCR1B = 6000; // Next frame starts in 3 mS
|
||||
OCR1C = 4000; // Next frame setup in 2 mS
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
TIMSK1 |= (1<<OCIE1B); // Enable COMPB
|
||||
TIMSK1 |= (1<<OCIE1C); // Enable COMPC
|
||||
TCCR1A = (3 << COM1B0); // Connect OC1B for hardware PPM switching
|
||||
@@ -812,7 +812,7 @@ void setupPulses()
|
||||
|
||||
case PROTO_PPM16:
|
||||
OCR1A = 40000; // Next frame starts in 20 mS
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
TIMSK1 |= (1<<OCIE1A); // Enable COMPA
|
||||
TCCR1A = (3 << COM1B0); // Connect OC1B for hardware PPM switching
|
||||
#else
|
||||
@@ -827,7 +827,7 @@ void setupPulses()
|
||||
break;
|
||||
|
||||
case PROTO_PPMSIM:
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
TCCR1A = 0; // Disconnect OC1B for bit-bang PPM switching
|
||||
#endif
|
||||
setupPulsesPPM(PROTO_PPMSIM);
|
||||
@@ -853,7 +853,7 @@ void setupPulses()
|
||||
// and
|
||||
// PPM mode will dynamically adjust to the frame rate set in model SETUP menu,
|
||||
// from within setupPulsesPPM().
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(PCBGRUVIN9X) || defined(CPUM2561)
|
||||
TIMSK1 |= (1<<OCIE1A); // Enable COMPA
|
||||
TCCR1A = (3 << COM1B0); // Connect OC1B for hardware PPM switching. G: Not needed
|
||||
// for DSM2=SERIAL. But OK.
|
||||
@@ -1025,7 +1025,7 @@ ISR(TIMER1_COMPC_vect) // DSM2_PPM or PXX end of frame
|
||||
void set_timer3_capture()
|
||||
{
|
||||
#ifndef SIMU
|
||||
#if defined (PCBGRUVIN9X)
|
||||
#if defined (PCBGRUVIN9X) || defined(CPUM2561) // TODO TIMSK3 in #define!
|
||||
TIMSK3 &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
|
||||
#else
|
||||
ETIMSK &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
|
||||
@@ -1038,29 +1038,23 @@ void set_timer3_capture()
|
||||
TCCR3A = 0;
|
||||
// Noise Canceller enabled, neg. edge, clock at 16MHz / 8 (2MHz) (Correct for PCB V4.x+ also)
|
||||
TCCR3B = (1<<ICNC3) | (0b010 << CS30);
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 |= (1<<ICIE3);
|
||||
#else
|
||||
ETIMSK |= (1<<TICIE3);
|
||||
#endif
|
||||
|
||||
RESUME_PPMIN_INTERRUPT();
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_timer3_ppm()
|
||||
{
|
||||
#ifndef SIMU
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 &= ~(1<<ICIE3);
|
||||
#else
|
||||
ETIMSK &= ~(1<<TICIE3) ; // Stop capture interrupt
|
||||
#endif
|
||||
PAUSE_PPMIN_INTERRUPT();
|
||||
|
||||
DDRE |= 0x80; // Bit 7 output
|
||||
|
||||
TCCR3B = 0 ; // Stop counter
|
||||
TCCR3A = (0<<WGM10);
|
||||
TCCR3B = (1 << WGM12) | (2<<CS10); // CTC OCR1A, 16MHz / 8
|
||||
|
||||
#if defined (PCBGRUVIN9X)
|
||||
#if defined (PCBGRUVIN9X) || defined(CPUM2561)
|
||||
TIMSK3 |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
|
||||
#else
|
||||
ETIMSK |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
|
||||
|
||||
+13
-6
@@ -398,18 +398,25 @@ int main(int argc,char **argv)
|
||||
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
if (chan<NUM_STICKS)
|
||||
return th9xSim->sliders[chan]->getValue();
|
||||
else if (chan<NUM_STICKS+NUM_POTS)
|
||||
return th9xSim->knobs[chan-NUM_STICKS]->getValue();
|
||||
#if defined(PCBTARANIS)
|
||||
if (chan == 8)
|
||||
else if (chan == 8)
|
||||
return 1000;
|
||||
#elif defined(PCBSKY9X)
|
||||
else if (chan == 7)
|
||||
return 1500;
|
||||
else if (chan == 8)
|
||||
return 100;
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
if (chan == 7)
|
||||
else if (chan == 7)
|
||||
return 150;
|
||||
#else
|
||||
if (chan == 7)
|
||||
else if (chan == 7)
|
||||
return 1500;
|
||||
#endif
|
||||
else if (chan<NUM_STICKS)
|
||||
return th9xSim->sliders[chan]->getValue();
|
||||
else
|
||||
return th9xSim->knobs[chan-NUM_STICKS]->getValue();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ void DEBUG_UART_Stop();
|
||||
#define DEBUG_UART_Configure(...)
|
||||
#endif
|
||||
|
||||
uint16_t ResetReason;
|
||||
uint32_t Master_frequency ;
|
||||
volatile uint32_t Tenms ;
|
||||
volatile uint8_t lcdLock;
|
||||
@@ -532,6 +533,8 @@ void boardInit()
|
||||
{
|
||||
register Pio *pioptr ;
|
||||
|
||||
ResetReason = RSTC->RSTC_MR ;
|
||||
|
||||
MATRIX->CCFG_SYSIO |= 0x000000F0L ; // Disable syspins, enable B4,5,6,7
|
||||
|
||||
PMC->PMC_PCER0 = (1<<ID_PIOC)|(1<<ID_PIOB)|(1<<ID_PIOA)|(1<<ID_UART0) ; // Enable clocks to PIOB and PIOA and PIOC and UART0
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include "board.h"
|
||||
#include "audio_driver.h"
|
||||
|
||||
extern uint16_t ResetReason;
|
||||
|
||||
#if defined(REVA)
|
||||
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
|
||||
#define GPIO_BUTTON_EXIT PIOA->PIO_PDSR
|
||||
@@ -235,7 +237,7 @@ uint32_t pwrCheck();
|
||||
|
||||
// EEPROM driver
|
||||
void eepromInit();
|
||||
#define EEPROM_MASSSTORAGE() (0)
|
||||
#define EEPROM_MASSSTORAGE() (0)
|
||||
|
||||
// Rotary Encoder driver
|
||||
void rotencInit();
|
||||
|
||||
@@ -108,11 +108,17 @@ inline void boardInit()
|
||||
ADMUX = ADC_VREF_TYPE;
|
||||
ADCSRA = 0x85; // ADC enabled, pre-scaler division=32 (no interrupt, no auto-triggering)
|
||||
|
||||
#if defined(CPUM2561)
|
||||
TCCR2B = (0b111 << CS20); // Norm mode, clk/1024 (differs from ATmega64 chip)
|
||||
OCR2A = 156;
|
||||
TIMSK2 |= (1<<OCIE2A) | (1<<TOIE2); // Enable Output-Compare and Overflow interrrupts
|
||||
#else
|
||||
// TCNT0 10ms = 16MHz/1024/156 periodic timer (9.984ms)
|
||||
// (with 1:4 duty at 157 to average 10.0ms)
|
||||
// Timer overflows at about 61Hz or once every 16ms.
|
||||
TCCR0 = (0b111 << CS00); // Norm mode, clk/1024
|
||||
OCR0 = 156;
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO) || defined(VOICE)
|
||||
TCCR2 = (0b010 << CS00); // Norm mode, clk/8
|
||||
@@ -125,7 +131,9 @@ inline void boardInit()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM2561)
|
||||
TIMSK |= (1<<OCIE0) | (1<<TOIE0) | (1<<TOIE2); // Enable Output-Compare and Overflow interrrupts
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+19
-13
@@ -67,19 +67,25 @@
|
||||
#define PIN_TRIM_RV_DN (1<<INP_D_TRM_RV_DWN)
|
||||
#define PIN_TRIM_RH_R (1<<INP_D_TRM_RH_UP)
|
||||
|
||||
#define TIMER_16KHZ_VECT TIMER0_OVF_vect
|
||||
#define COUNTER_16KHZ TCNT0
|
||||
|
||||
#define TIMER_10MS_VECT TIMER0_COMP_vect
|
||||
#define TIMER_10MS_COMPVAL OCR0
|
||||
#define PAUSE_10MS_INTERRUPT() TIMSK &= ~(1<<OCIE0)
|
||||
#define RESUME_10MS_INTERRUPT() TIMSK |= (1<<OCIE0)
|
||||
|
||||
#define PAUSE_PULSES_INTERRUPT() TIMSK &= ~(1<<OCIE1A);
|
||||
#define RESUME_PULSES_INTERRUPT() TIMSK |= (1<<OCIE1A)
|
||||
|
||||
#define PAUSE_PPMIN_INTERRUPT() ETIMSK &= ~(1<<TICIE3)
|
||||
#define RESUME_PPMIN_INTERRUPT() ETIMSK |= (1<<TICIE3)
|
||||
#if defined(CPUM2561)
|
||||
#define TIMER_16KHZ_VECT TIMER2_OVF_vect
|
||||
#define COUNTER_16KHZ TCNT2
|
||||
#define TIMER_10MS_VECT TIMER2_COMPA_vect
|
||||
#define TIMER_10MS_COMPVAL OCR2A
|
||||
#define PAUSE_10MS_INTERRUPT() TIMSK2 &= ~(1<<OCIE2A)
|
||||
#define RESUME_10MS_INTERRUPT() TIMSK2 |= (1<<OCIE2A)
|
||||
#define PAUSE_PPMIN_INTERRUPT() TIMSK3 &= ~(1<<ICIE3)
|
||||
#define RESUME_PPMIN_INTERRUPT() TIMSK3 |= (1<<ICIE3)
|
||||
#else
|
||||
#define TIMER_16KHZ_VECT TIMER0_OVF_vect
|
||||
#define COUNTER_16KHZ TCNT0
|
||||
#define TIMER_10MS_VECT TIMER0_COMP_vect
|
||||
#define TIMER_10MS_COMPVAL OCR0
|
||||
#define PAUSE_10MS_INTERRUPT() TIMSK &= ~(1<<OCIE0)
|
||||
#define RESUME_10MS_INTERRUPT() TIMSK |= (1<<OCIE0)
|
||||
#define PAUSE_PPMIN_INTERRUPT() ETIMSK &= ~(1<<TICIE3)
|
||||
#define RESUME_PPMIN_INTERRUPT() ETIMSK |= (1<<TICIE3)
|
||||
#endif
|
||||
|
||||
// Power driver (none)
|
||||
#define pwrCheck() (e_power_on)
|
||||
|
||||
+11
-11
@@ -157,16 +157,16 @@ void pwrInit();
|
||||
uint32_t pwrCheck();
|
||||
void pwrOff();
|
||||
#define UNEXPECTED_SHUTDOWN() (g_eeGeneral.unexpectedShutdown)
|
||||
#define INTERNAL_RF_ON() GPIO_SetBits(GPIOPWR, PIN_INT_RF_PWR)
|
||||
#define INTERNAL_RF_OFF() GPIO_ResetBits(GPIOPWR, PIN_INT_RF_PWR)
|
||||
#define EXTERNAL_RF_ON() GPIO_SetBits(GPIOPWR, PIN_EXT_RF_PWR)
|
||||
#define EXTERNAL_RF_OFF() GPIO_ResetBits(GPIOPWR, PIN_EXT_RF_PWR)
|
||||
#define INTERNAL_RF_ON() GPIO_SetBits(GPIOPWR, PIN_INT_RF_PWR)
|
||||
#define INTERNAL_RF_OFF() GPIO_ResetBits(GPIOPWR, PIN_INT_RF_PWR)
|
||||
#define EXTERNAL_RF_ON() GPIO_SetBits(GPIOPWR, PIN_EXT_RF_PWR)
|
||||
#define EXTERNAL_RF_OFF() GPIO_ResetBits(GPIOPWR, PIN_EXT_RF_PWR)
|
||||
|
||||
// Backlight driver
|
||||
#define setBacklight(xx)
|
||||
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
|
||||
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
|
||||
|
||||
// USB driver
|
||||
void usbInit(void);
|
||||
@@ -174,13 +174,13 @@ extern uint8_t usb_connected;
|
||||
|
||||
// EEPROM driver
|
||||
#if !defined(SIMU)
|
||||
#define eepromInit() I2C_EE_Init()
|
||||
#define eeprom_read_block I2C_EE_BufferRead
|
||||
#define eeWriteBlockCmp I2C_EE_BufferWrite
|
||||
#define eepromInit() I2C_EE_Init()
|
||||
#define eeprom_read_block I2C_EE_BufferRead
|
||||
#define eeWriteBlockCmp I2C_EE_BufferWrite
|
||||
#else
|
||||
#define eepromInit()
|
||||
void eeWriteBlockCmp(const void *pointer_ram, uint16_t pointer_eeprom, size_t size);
|
||||
#endif
|
||||
#define EEPROM_MASSSTORAGE() (usb_connected)
|
||||
#define EEPROM_MASSSTORAGE() (usb_connected)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "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"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC""CSD""CSE""CSF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC"
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "PS1""PS2""PS3""PS4""PS5""PS6""PS7""PS8""PS9""PSA""PSB""PSC""PSD""PSE""PSF""PSG""PSH""PSI""PSJ""PSK""PSL""PSM""PSN""PSO""PSP""PSQ""PSR""PSS""PST""PSU""PSV""PSW"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "PS1""PS2""PS3""PS4""PS5""PS6""PS7""PS8""PS9""PSA""PSB""PSC""PSD""PSE""PSF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "PS1""PS2""PS3""PS4""PS5""PS6""PS7""PS8""PS9""PSA""PSB""PSC"
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "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"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC""CSD""CSE""CSF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC"
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "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"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC""CSD""CSE""CSF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "CS1""CS2""CS3""CS4""CS5""CS6""CS7""CS8""CS9""CSA""CSB""CSC"
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "IP1""IP2""IP3""IP4""IP5""IP6""IP7""IP8""IP9""IPA""IPB""IPC""IPD""IPE""IPF""IPG""IPH""IPI""IPJ""IPK""IPL""IPM""IPN""IPO""IPP""IPQ""IPR""IPS""IPT""IPU""IPV""IPW"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "IP1""IP2""IP3""IP4""IP5""IP6""IP7""IP8""IP9""IPA""IPB""IPC""IPD""IPE""IPF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "IP1""IP2""IP3""IP4""IP5""IP6""IP7""IP8""IP9""IPA""IPB""IPC"
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "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"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "SW1""SW2""SW3""SW4""SW5""SW6""SW7""SW8""SW9""SWA""SWB""SWC""SWD""SWE""SWF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "SW1""SW2""SW3""SW4""SW5""SW6""SW7""SW8""SW9""SWA""SWB""SWC"
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "CE1""CE2""CE3""CE4""CE5""CE6""CE7""CE8""CE9""CEA""CEB""CEC""CED""CEE""CEF""CEG""CEH""CEI""CEJ""CEK""CEL""CEM""CEN""CEO""CEP""CEQ""CER""CES""CET""CEU""CEV""CEW"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "CE1""CE2""CE3""CE4""CE5""CE6""CE7""CE8""CE9""CEA""CEB""CEC""CED""CEE""CEF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "CE1""CE2""CE3""CE4""CE5""CE6""CE7""CE8""CE9""CEA""CEB""CEC"
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "LB1""LB2""LB3""LB4""LB5""LB6""LB7""LB8""LB9""LBA""LBB""LBC""LBD""LBE""LBF""LBG""LBH""LBI""LBJ""LBK""LBL""LBM""LBN""LBO""LBP""LBQ""LBR""LBS""LBT""LBU""LBV""LBW"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "LB1""LB2""LB3""LB4""LB5""LB6""LB7""LB8""LB9""LBA""LBB""LBC""LBD""LBE""LBF"
|
||||
#else
|
||||
#define TR_CUSTOMSW "LB1""LB2""LB3""LB4""LB5""LB6""LB7""LB8""LB9""LBA""LBB""LBC"
|
||||
|
||||
@@ -43,8 +43,10 @@ void menuStatisticsView(uint8_t event)
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
#if !defined(PCBTARANIS) || defined(DEBUG)
|
||||
chainMenu(menuStatisticsDebug);
|
||||
return;
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
@@ -123,6 +125,15 @@ void menuStatisticsDebug(uint8_t event)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
if ((ResetReason&RSTC_SR_RSTTYP) == (2<<8)) {
|
||||
lcd_puts(LCD_W-8*FW, 0*FH, "WATCHDOG");
|
||||
}
|
||||
else if (unexpectedShutdown) {
|
||||
lcd_puts(LCD_W-13*FW, 0*FH, "UNEXP.SHTDOWN");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && !defined(REVA)
|
||||
lcd_putsLeft(1*FH, STR_CPU_CURRENT);
|
||||
putsTelemetryValue(MENU_DEBUG_COL_OFS, 1*FH, getCurrent(), UNIT_MILLIAMPS, 0);
|
||||
|
||||
@@ -41,196 +41,6 @@
|
||||
uint8_t barsThresholds[THLD_MAX];
|
||||
#endif
|
||||
|
||||
uint8_t maxTelemValue(uint8_t channel)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_FUEL:
|
||||
case TELEM_RSSI_TX:
|
||||
case TELEM_RSSI_RX:
|
||||
return 100;
|
||||
case TELEM_HDG:
|
||||
return 180;
|
||||
default:
|
||||
return 255;
|
||||
}
|
||||
}
|
||||
|
||||
getvalue_t convertTelemValue(uint8_t channel, uint8_t value)
|
||||
{
|
||||
getvalue_t result;
|
||||
switch (channel) {
|
||||
case TELEM_TM1:
|
||||
case TELEM_TM2:
|
||||
result = value * 3;
|
||||
break;
|
||||
case TELEM_ALT:
|
||||
#if defined(PCBTARANIS)
|
||||
result = value * 80 - 5000;
|
||||
break;
|
||||
#endif
|
||||
case TELEM_GPSALT:
|
||||
case TELEM_MAX_ALT:
|
||||
case TELEM_MIN_ALT:
|
||||
result = value * 8 - 500;
|
||||
break;
|
||||
case TELEM_RPM:
|
||||
case TELEM_MAX_RPM:
|
||||
result = value * 50;
|
||||
break;
|
||||
case TELEM_T1:
|
||||
case TELEM_T2:
|
||||
case TELEM_MAX_T1:
|
||||
case TELEM_MAX_T2:
|
||||
result = (getvalue_t)value - 30;
|
||||
break;
|
||||
case TELEM_CELL:
|
||||
case TELEM_HDG:
|
||||
result = value * 2;
|
||||
break;
|
||||
case TELEM_DIST:
|
||||
case TELEM_MAX_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;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
getvalue_t convertCswTelemValue(CustomSwData * cs)
|
||||
{
|
||||
getvalue_t val;
|
||||
if (CS_STATE(cs->func)==CS_VOFS)
|
||||
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2);
|
||||
else
|
||||
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2) - convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128);
|
||||
return val;
|
||||
}
|
||||
|
||||
const pm_uint8_t bchunit_ar[] PROGMEM = {
|
||||
UNIT_METERS, // Alt
|
||||
UNIT_RAW, // Rpm
|
||||
UNIT_PERCENT, // Fuel
|
||||
UNIT_DEGREES, // T1
|
||||
UNIT_DEGREES, // T2
|
||||
UNIT_KTS, // Speed
|
||||
UNIT_METERS, // Dist
|
||||
UNIT_METERS, // GPS Alt
|
||||
};
|
||||
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TM1-1:
|
||||
case TELEM_TM2-1:
|
||||
att &= ~NO_UNIT;
|
||||
putsTime(x, y, val, att, att);
|
||||
break;
|
||||
case TELEM_MIN_A1-1:
|
||||
case TELEM_MIN_A2-1:
|
||||
channel -= TELEM_MIN_A1-TELEM_A1;
|
||||
// no break
|
||||
case TELEM_A1-1:
|
||||
case TELEM_A2-1:
|
||||
channel -= TELEM_A1-1;
|
||||
// A1 and A2
|
||||
{
|
||||
lcdint_t converted_value = applyChannelRatio(channel, val);
|
||||
if (g_model.frsky.channels[channel].type >= UNIT_RAW) {
|
||||
converted_value /= 10;
|
||||
}
|
||||
else {
|
||||
#if !defined(PCBTARANIS)
|
||||
if (abs(converted_value) < 1000) {
|
||||
att |= PREC2;
|
||||
}
|
||||
else {
|
||||
converted_value /= 10;
|
||||
att |= PREC1;
|
||||
}
|
||||
#else
|
||||
att |= PREC2;
|
||||
#endif
|
||||
}
|
||||
putsTelemetryValue(x, y, converted_value, g_model.frsky.channels[channel].type, att);
|
||||
break;
|
||||
}
|
||||
|
||||
case TELEM_CELL-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_VOLTS, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
case TELEM_VFAS-1:
|
||||
case TELEM_CELLS_SUM-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_VOLTS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CURRENT-1:
|
||||
case TELEM_MAX_CURRENT-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_AMPS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CONSUMPTION-1:
|
||||
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:
|
||||
case TELEM_VSPD-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_RAW, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_RSSI_TX-1:
|
||||
case TELEM_RSSI_RX-1:
|
||||
putsTelemetryValue(x, y, val, UNIT_RAW, att);
|
||||
break;
|
||||
|
||||
#if defined(FRSKY_SPORT)
|
||||
case TELEM_ALT-1:
|
||||
putsTelemetryValue(x, y, val/10, UNIT_METERS, att|PREC1);
|
||||
break;
|
||||
#elif defined(WS_HOW_HIGH)
|
||||
case TELEM_ALT-1:
|
||||
case TELEM_MIN_ALT-1:
|
||||
case TELEM_MAX_ALT-1:
|
||||
if (IS_IMPERIAL_ENABLE() && IS_USR_PROTO_WS_HOW_HIGH()) {
|
||||
putsTelemetryValue(x, y, val, UNIT_FEET, att);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
uint8_t unit = 1;
|
||||
if (channel >= TELEM_MAX_T1-1 && channel <= TELEM_MAX_DIST-1)
|
||||
channel -= TELEM_MAX_T1 - TELEM_T1;
|
||||
if (channel <= TELEM_GPSALT-1)
|
||||
unit = channel + 1 - TELEM_ALT;
|
||||
if (channel >= TELEM_MIN_ALT-1 && channel <= TELEM_MAX_ALT-1)
|
||||
unit = 0;
|
||||
if (channel == TELEM_HDG-1)
|
||||
unit = 3;
|
||||
putsTelemetryValue(x, y, val, pgm_read_byte(bchunit_ar+unit), att);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum FrskyViews {
|
||||
e_frsky_custom_screen_1,
|
||||
e_frsky_custom_screen_2,
|
||||
|
||||
Reference in New Issue
Block a user