Merge branch 'master' into kilrah/ar9x
This commit is contained in:
+37
-11
@@ -273,6 +273,10 @@ SHUTDOWN_CONFIRMATION = NO
|
||||
# Values = YES, NO
|
||||
DEBUG = NO
|
||||
|
||||
# Activate Command Line Interpreter
|
||||
# Values = NO, YES
|
||||
CLI = NO
|
||||
|
||||
# Activate writing of SPORT telemetry received data to sport.log file
|
||||
# Values = YES, NO
|
||||
SPORT_FILE_LOG = NO
|
||||
@@ -306,9 +310,10 @@ LUA = NO
|
||||
MENUS_LOCK = NO
|
||||
|
||||
# USB options in the main image
|
||||
# Values = JOYSTICK, MASSSTORAGE
|
||||
# Values = JOYSTICK, MASSSTORAGE, SERIAL
|
||||
# JOYSTICK: The TX will appear as a joystick
|
||||
# MASSSTORAGE: The TX will appear as a drive
|
||||
# SERIAL: The TX will appear as a serial port
|
||||
USB = JOYSTICK
|
||||
|
||||
# Mixers monitor view added to Channels monitor one
|
||||
@@ -366,6 +371,10 @@ SIMU_DISKIO = NO
|
||||
# Values = NO, YES
|
||||
SIMU_AUDIO = NO
|
||||
|
||||
# Enable Watchdog test (DANGEROUS)
|
||||
# Values = NO, YES
|
||||
WATCHDOG_TEST = NO
|
||||
|
||||
#------- END BUILD OPTIONS ---------------------------
|
||||
|
||||
# Define programs and commands.
|
||||
@@ -811,7 +820,7 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X))
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp eeprom_conversions.cpp
|
||||
PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp pulses/dsm2_arm.cpp
|
||||
CPPSRC += tasks_arm.cpp audio_arm.cpp haptic.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp telemetry/telemetry.cpp
|
||||
CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/second_serial_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
|
||||
CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/serial2_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
|
||||
CPPSRC += loadboot.cpp debug.cpp
|
||||
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
|
||||
ifeq ($(SDCARD), YES)
|
||||
@@ -928,17 +937,20 @@ ifeq ($(PCB), TARANIS)
|
||||
LDSCRIPT = targets/taranis/stm32f2_flash.ld
|
||||
endif
|
||||
STM32USBPATH = $(THIRDPARTY)/STM32_USB-Host-Device_Lib_V2.1.0/Libraries
|
||||
INCDIRS += $(STM32USBPATH)/STM32_USB_OTG_Driver/inc $(STM32USBPATH)/STM32_USB_Device_Library/Core/inc
|
||||
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/inc $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
|
||||
INCDIRS += $(STM32USBPATH)/STM32_USB_OTG_Driver/inc
|
||||
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Core/inc
|
||||
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/inc
|
||||
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
|
||||
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/inc
|
||||
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_hardware.cpp
|
||||
BOARDSRC = main_arm.cpp targets/taranis/board_taranis.cpp
|
||||
EXTRABOARDSRC += targets/taranis/configure_pins.cpp targets/taranis/lcd_driver.cpp targets/taranis/flash_driver.cpp targets/taranis/i2c_driver.cpp targets/taranis/aspi.c targets/taranis/delays.c
|
||||
EXTRABOARDSRC += targets/taranis/configure_pins.cpp targets/taranis/lcd_driver.cpp targets/taranis/flash_driver.cpp targets/taranis/i2c_driver.cpp targets/taranis/aspi.c targets/taranis/delays.c serial.cpp
|
||||
SRC += $(COOSDIR)/kernel/core.c $(COOSDIR)/kernel/hook.c $(COOSDIR)/kernel/task.c $(COOSDIR)/kernel/event.c $(COOSDIR)/kernel/time.c $(COOSDIR)/kernel/timer.c $(COOSDIR)/kernel/flag.c $(COOSDIR)/kernel/mutex.c $(COOSDIR)/kernel/serviceReq.c $(COOSDIR)/portable/GCC/port.c $(COOSDIR)/portable/arch.c
|
||||
SRC += targets/taranis/pwr_driver.c targets/taranis/usb_driver.c
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp eeprom_conversions.cpp
|
||||
PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp
|
||||
CPPSRC += tasks_arm.cpp audio_arm.cpp sbus.cpp telemetry/telemetry.cpp
|
||||
CPPSRC += targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/uart3_driver.cpp targets/taranis/telemetry_driver.cpp
|
||||
CPPSRC += targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/serial2_driver.cpp targets/taranis/telemetry_driver.cpp
|
||||
CPPSRC += bmp.cpp gui/$(GUIDIRECTORY)/view_channels.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp debug.cpp
|
||||
CPPSRC += loadboot.cpp
|
||||
ifeq ($(PCBREV), REV9E)
|
||||
@@ -981,6 +993,10 @@ ifeq ($(PCB), TARANIS)
|
||||
ifeq ($(USB), JOYSTICK)
|
||||
CPPDEFS += -DUSB_JOYSTICK
|
||||
SRC += targets/taranis/usbd_hid_joystick.c
|
||||
else ifeq ($(USB), SERIAL)
|
||||
CPPDEFS += -DUSB_SERIAL
|
||||
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
|
||||
EXTRABOARDSRC += targets/taranis/usbd_cdc.cpp
|
||||
else
|
||||
CPPDEFS += -DUSB_MASS_STORAGE
|
||||
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
|
||||
@@ -1036,6 +1052,9 @@ ifeq ($(PCB), TARANIS)
|
||||
ifeq ($(MIXERS_MONITOR), YES)
|
||||
CPPDEFS += -DMIXERS_MONITOR
|
||||
endif
|
||||
ifeq ($(WATCHDOG_TEST), YES)
|
||||
CPPDEFS += -DWATCHDOG_TEST
|
||||
endif
|
||||
endif
|
||||
|
||||
CC = $(TRGT)gcc
|
||||
@@ -1253,10 +1272,10 @@ ifeq ($(EXT), JETI)
|
||||
endif
|
||||
|
||||
ifeq ($(EXT), MAVLINK)
|
||||
CPPDEFS += -DMAVLINK
|
||||
INCDIRS += thirdparty
|
||||
CPPSRC += telemetry/mavlink.cpp gui/$(GUIDIRECTORY)/view_mavlink.cpp serial.cpp
|
||||
EEPROM_VARIANT += ${MAVLINK_VARIANT}
|
||||
CPPDEFS += -DMAVLINK
|
||||
INCDIRS += thirdparty
|
||||
CPPSRC += telemetry/mavlink.cpp gui/$(GUIDIRECTORY)/view_mavlink.cpp targets/common_avr/serial_driver.cpp
|
||||
EEPROM_VARIANT += ${MAVLINK_VARIANT}
|
||||
endif
|
||||
|
||||
ifeq ($(EXT), TELEMETREZ)
|
||||
@@ -1297,8 +1316,15 @@ ifeq ($(EXT), $(filter $(EXT), FRSKY FRSKY_SPORT TELEMETREZ))
|
||||
EEPROM_VARIANT += ${FRSKY_VARIANT}
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), YES)
|
||||
ifeq ($(SIMU), YES)
|
||||
CPPDEFS += -DDEBUG
|
||||
CPPSRC += dump.cpp
|
||||
else ifeq ($(CLI), YES)
|
||||
CPPDEFS += -DCLI -DDEBUG
|
||||
CPPSRC += cli.cpp dump.cpp
|
||||
else ifeq ($(DEBUG), YES)
|
||||
CPPDEFS += -DDEBUG
|
||||
CPPSRC += dump.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(EEPROM_PROGRESS_BAR), YES)
|
||||
|
||||
+20
-16
@@ -305,24 +305,28 @@ void getPhaseAudioFile(char * filename, int index, unsigned int event)
|
||||
void getSwitchAudioFile(char * filename, int index)
|
||||
{
|
||||
char * str = getModelAudioPath(filename);
|
||||
int len = STR_VSWITCHES[0];
|
||||
strncpy(str, &STR_VSWITCHES[1+len*(index+1)], len);
|
||||
str += len-1;
|
||||
if (*str == '\300') {
|
||||
strcpy(str, "-up");
|
||||
str += 3;
|
||||
}
|
||||
else if (*str == '-') {
|
||||
strcpy(str, "-mid");
|
||||
str += 4;
|
||||
}
|
||||
else if (*str == '\301') {
|
||||
strcpy(str, "-down");
|
||||
str += 5;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (index <= SWSRC_LAST_SWITCH) {
|
||||
div_t swinfo = switchInfo(index);
|
||||
*str++ = 'S';
|
||||
*str++ = 'A' + swinfo.quot;
|
||||
const char * positions[] = { "-up", "-mid", "-down" };
|
||||
strcpy(str, positions[swinfo.rem]);
|
||||
}
|
||||
else {
|
||||
*(str+1) = 0;
|
||||
div_t swinfo = div(index - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
|
||||
*str++ = 'S';
|
||||
*str++ = '1' + swinfo.quot;
|
||||
*str++ = '1' + swinfo.rem;
|
||||
*str = '\0';
|
||||
}
|
||||
#else
|
||||
int len = STR_VSWITCHES[0];
|
||||
strncpy(str, &STR_VSWITCHES[1+(len*index)], len);
|
||||
str += len;
|
||||
*str = '\0';
|
||||
#endif
|
||||
strcat(str, SOUNDS_EXT);
|
||||
}
|
||||
|
||||
@@ -381,7 +385,7 @@ void referenceModelAudioFiles()
|
||||
}
|
||||
|
||||
// Switches Audio Files <switchname>-[up|mid|down].wav
|
||||
for (int i=0; i<SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT && !found; i++) {
|
||||
for (int i=SWSRC_FIRST_SWITCH; i<=SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT && !found; i++) {
|
||||
getSwitchAudioFile(path, i);
|
||||
// TRACE("referenceModelAudioFiles(): searching for %s in %s", filename, fn);
|
||||
if (!strcasecmp(filename, fn)) {
|
||||
|
||||
@@ -306,8 +306,15 @@ void audioStart();
|
||||
#define AUDIO_ERROR() AUDIO_BUZZER(audioEvent(AU_ERROR), beep(4))
|
||||
#define AUDIO_TIMER_30() AUDIO_BUZZER(audioEvent(AU_TIMER_30), { beepAgain=2; beep(2); })
|
||||
#define AUDIO_TIMER_20() AUDIO_BUZZER(audioEvent(AU_TIMER_20), { beepAgain=1; beep(2); })
|
||||
|
||||
#if defined(HAPTIC)
|
||||
#define AUDIO_TIMER_LT10(m, x) do { if (m==COUNTDOWN_VOICE) playNumber(x, 0, 0, 0); else if (m==COUNTDOWN_HAPTIC) haptic.event(AU_TIMER_LT10); else AUDIO_BUZZER(audioEvent(AU_TIMER_LT10), beep(2)); } while(0)
|
||||
#define AUDIO_TIMER_00(m) do { if (m==COUNTDOWN_VOICE) playNumber(0, 0, 0, 0); else if (m==COUNTDOWN_HAPTIC) haptic.event(AU_TIMER_00); else AUDIO_BUZZER(audioEvent(AU_TIMER_00), beep(3)); } while(0)
|
||||
#else
|
||||
#define AUDIO_TIMER_LT10(m, x) do { if (m==COUNTDOWN_VOICE) playNumber(x, 0, 0, 0); else AUDIO_BUZZER(audioEvent(AU_TIMER_LT10), beep(2)); } while(0)
|
||||
#define AUDIO_TIMER_00(m) do { if (m==COUNTDOWN_VOICE) playNumber(0, 0, 0, 0); else AUDIO_BUZZER(audioEvent(AU_TIMER_00), beep(3)); } while(0)
|
||||
#endif
|
||||
|
||||
#define AUDIO_INACTIVITY() AUDIO_BUZZER(audioEvent(AU_INACTIVITY), beep(3))
|
||||
#define AUDIO_MIX_WARNING(x) AUDIO_BUZZER(audioEvent(AU_MIX_WARNING_1+x-1), beep(1))
|
||||
#define AUDIO_POT_MIDDLE(x) AUDIO_BUZZER(audioEvent(AU_STICK1_MIDDLE+x), beep(2))
|
||||
|
||||
@@ -62,7 +62,7 @@ void audioQueue::heartbeat()
|
||||
else {
|
||||
#if defined(CPUM2560)
|
||||
if (toneFreq) {
|
||||
OCR0A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||
OCR4A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||
speakerOn();
|
||||
}
|
||||
#endif
|
||||
@@ -88,7 +88,7 @@ void audioQueue::heartbeat()
|
||||
if (tone2TimeLeft > 0) {
|
||||
#if defined(CPUM2560)
|
||||
if (tone2Freq) {
|
||||
OCR0A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||
OCR4A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||
speakerOn();
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -39,11 +39,11 @@ void * bin_realloc(void * ptr, size_t size)
|
||||
// if it fits in current slot, return it
|
||||
// TODO if new size is smaller, try to relocate in smaller slot
|
||||
if ( slots1.can_fit(ptr, size) ) {
|
||||
// TRACE("OUR realloc %p[%lu] fits in slot1", ptr, size); FLUSH();
|
||||
// TRACE("OUR realloc %p[%lu] fits in slot1", ptr, size);
|
||||
return ptr;
|
||||
}
|
||||
if ( slots2.can_fit(ptr, size) ) {
|
||||
// TRACE("OUR realloc %p[%lu] fits in slot2", ptr, size); FLUSH();
|
||||
// TRACE("OUR realloc %p[%lu] fits in slot2", ptr, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ void * bin_realloc(void * ptr, size_t size)
|
||||
void * res = bin_malloc(size);
|
||||
if (res == 0) {
|
||||
// we don't have the space, use libc malloc
|
||||
// TRACE("bin_malloc [%lu] FAILURE", size); FLUSH();
|
||||
// TRACE("bin_malloc [%lu] FAILURE", size);
|
||||
res = malloc(size);
|
||||
if (res == 0) {
|
||||
TRACE("libc malloc [%lu] FAILURE", size); FLUSH();
|
||||
TRACE("libc malloc [%lu] FAILURE", size);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ void *bin_l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
|
||||
if (ptr) { // avoid a bunch of NULL pointer free calls
|
||||
if (!bin_free(ptr)) {
|
||||
// not our range, use libc allocator
|
||||
// TRACE("libc free %p", ptr); FLUSH();
|
||||
// TRACE("libc free %p", ptr);
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
@@ -89,18 +89,18 @@ void *bin_l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
|
||||
}
|
||||
if ( SimulateMallocFailure > 0) {
|
||||
// simulate one malloc failure
|
||||
TRACE("bin_l_alloc(): simulating malloc failure at %p[%lu]", ptr, nsize); FLUSH();
|
||||
TRACE("bin_l_alloc(): simulating malloc failure at %p[%lu]", ptr, nsize);
|
||||
return 0;
|
||||
}
|
||||
#endif // #if defined(DEBUG)
|
||||
// try our allocator, if it fails use libc allocator
|
||||
void * res = bin_realloc(ptr, nsize);
|
||||
if (res && ptr) {
|
||||
// TRACE("OUR realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize); FLUSH();
|
||||
// TRACE("OUR realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize);
|
||||
}
|
||||
if (res == 0) {
|
||||
res = realloc(ptr, nsize);
|
||||
// TRACE("libc realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize); FLUSH();
|
||||
// TRACE("libc realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize);
|
||||
// if (res == 0 ){
|
||||
// TRACE("realloc FAILURE %lu", nsize);
|
||||
// dumpFreeMemory();
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
if (ptr == Bins[n].data) {
|
||||
Bins[n].Used = false;
|
||||
--NoUsedBins;
|
||||
// TRACE("\tBinAllocator<%d> free %lu ------", SIZE_SLOT, n); FLUSH();
|
||||
// TRACE("\tBinAllocator<%d> free %lu ------", SIZE_SLOT, n);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -31,22 +31,22 @@ public:
|
||||
}
|
||||
void * malloc(size_t size) {
|
||||
if (size > SIZE_SLOT) {
|
||||
// TRACE("BinAllocator<%d> malloc [%lu] size > SIZE_SLOT", SIZE_SLOT, size); FLUSH();
|
||||
// TRACE("BinAllocator<%d> malloc [%lu] size > SIZE_SLOT", SIZE_SLOT, size);
|
||||
return 0;
|
||||
}
|
||||
if (NoUsedBins >= NUM_BINS) {
|
||||
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT, size); FLUSH();
|
||||
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT, size);
|
||||
return 0;
|
||||
}
|
||||
for (size_t n = 0; n < NUM_BINS; ++n) {
|
||||
if (!Bins[n].Used) {
|
||||
Bins[n].Used = true;
|
||||
++NoUsedBins;
|
||||
// TRACE("\tBinAllocator<%d> malloc %lu[%lu]", SIZE_SLOT, n, size); FLUSH();
|
||||
// TRACE("\tBinAllocator<%d> malloc %lu[%lu]", SIZE_SLOT, n, size);
|
||||
return Bins[n].data;
|
||||
}
|
||||
}
|
||||
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT , size); FLUSH();
|
||||
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT , size);
|
||||
return 0;
|
||||
}
|
||||
size_t size(void * ptr) {
|
||||
|
||||
@@ -0,0 +1,353 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#define CLI_COMMAND_MAX_ARGS 8
|
||||
#define CLI_COMMAND_MAX_LEN 256
|
||||
|
||||
OS_TID cliTaskId;
|
||||
TaskStack<CLI_STACK_SIZE> cliStack;
|
||||
Fifo<256> cliRxFifo;
|
||||
uint8_t cliTracesEnabled = false;
|
||||
|
||||
typedef int (* CliFunction) (const char ** args);
|
||||
|
||||
struct CliCommand
|
||||
{
|
||||
const char * name;
|
||||
CliFunction func;
|
||||
const char * args;
|
||||
};
|
||||
|
||||
struct MemArea
|
||||
{
|
||||
const char * name;
|
||||
void * start;
|
||||
int size;
|
||||
};
|
||||
|
||||
void cliPrompt()
|
||||
{
|
||||
serialPutc('>');
|
||||
}
|
||||
|
||||
int toInt(const char ** argv, int index, int * val)
|
||||
{
|
||||
if (*argv[index] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
int base = 10;
|
||||
const char * s = argv[index];
|
||||
if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x') {
|
||||
base = 16;
|
||||
s = &argv[index][2];
|
||||
}
|
||||
char * endptr = NULL;
|
||||
*val = strtol(s, &endptr, base);
|
||||
if (*endptr == '\0')
|
||||
return 1;
|
||||
else {
|
||||
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[index]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cliBeep(const char ** argv)
|
||||
{
|
||||
int freq = BEEP_DEFAULT_FREQ;
|
||||
int duration = 100;
|
||||
if (toInt(argv, 1, &freq) >= 0 && toInt(argv, 2, &duration) >= 0) {
|
||||
audioQueue.playTone(freq, duration, 20, PLAY_NOW);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cliPlay(const char ** argv)
|
||||
{
|
||||
audioQueue.playFile(argv[1], PLAY_NOW);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cliLs(const char ** argv)
|
||||
{
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
char *fn; /* This function is assuming non-Unicode cfg. */
|
||||
#if _USE_LFN
|
||||
TCHAR lfn[_MAX_LFN + 1];
|
||||
fno.lfname = lfn;
|
||||
fno.lfsize = sizeof(lfn);
|
||||
#endif
|
||||
|
||||
FRESULT res = f_opendir(&dir, argv[1]); /* Open the directory */
|
||||
if (res == FR_OK) {
|
||||
for (;;) {
|
||||
res = f_readdir(&dir, &fno); /* Read a directory item */
|
||||
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
|
||||
|
||||
#if _USE_LFN
|
||||
fn = *fno.lfname ? fno.lfname : fno.fname;
|
||||
#else
|
||||
fn = fno.fname;
|
||||
#endif
|
||||
serialPrint(fn);
|
||||
}
|
||||
}
|
||||
else {
|
||||
serialPrint("%s: Invalid directory \"%s\"", argv[0], argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cliTrace(const char ** argv)
|
||||
{
|
||||
if (!strcmp(argv[1], "on")) {
|
||||
cliTracesEnabled = true;
|
||||
}
|
||||
else if (!strcmp(argv[1], "off")) {
|
||||
cliTracesEnabled = false;
|
||||
}
|
||||
else {
|
||||
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cliStackInfo(const char ** argv)
|
||||
{
|
||||
int tid = 0;
|
||||
if (toInt(argv, 1, &tid) > 0) {
|
||||
int available = 0;
|
||||
int total = 0;
|
||||
switch(tid) {
|
||||
case MENU_TASK_INDEX:
|
||||
total = menusStack.size();
|
||||
available = menusStack.available();
|
||||
break;
|
||||
case MIXER_TASK_INDEX:
|
||||
total = mixerStack.size();
|
||||
available = mixerStack.available();
|
||||
break;
|
||||
case AUDIO_TASK_INDEX:
|
||||
total = audioStack.size();
|
||||
available = audioStack.available();
|
||||
break;
|
||||
case CLI_TASK_INDEX:
|
||||
total = cliStack.size();
|
||||
available = cliStack.available();
|
||||
break;
|
||||
case MAIN_TASK_INDEX:
|
||||
total = stackAvailable();
|
||||
available = stackSize();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
serialPrint("%d available (%d total)", available, total);
|
||||
}
|
||||
else {
|
||||
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cliVolume(const char ** argv)
|
||||
{
|
||||
int level = 0;
|
||||
if (toInt(argv, 1, &level) > 0) {
|
||||
setVolume(level);
|
||||
}
|
||||
else {
|
||||
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const MemArea memAreas[] = {
|
||||
{ "RCC", RCC, sizeof(RCC_TypeDef) },
|
||||
{ "GPIOA", GPIOA, sizeof(GPIO_TypeDef) },
|
||||
{ "GPIOB", GPIOB, sizeof(GPIO_TypeDef) },
|
||||
{ "GPIOC", GPIOC, sizeof(GPIO_TypeDef) },
|
||||
{ "GPIOD", GPIOD, sizeof(GPIO_TypeDef) },
|
||||
{ "GPIOE", GPIOE, sizeof(GPIO_TypeDef) },
|
||||
{ "GPIOF", GPIOF, sizeof(GPIO_TypeDef) },
|
||||
{ "GPIOG", GPIOG, sizeof(GPIO_TypeDef) },
|
||||
{ "USART1", USART1, sizeof(USART_TypeDef) },
|
||||
{ "USART3", USART3, sizeof(USART_TypeDef) },
|
||||
{ NULL, NULL, 0 },
|
||||
};
|
||||
|
||||
int cliDisplay(const char ** argv)
|
||||
{
|
||||
int address = 0;
|
||||
|
||||
for (const MemArea * area = memAreas; area->name != NULL; area++) {
|
||||
if (!strcmp(area->name, argv[1])) {
|
||||
dump((uint8_t *)area->start, area->size);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "adc")) {
|
||||
for (int i=0; i<NUMBER_ANALOG; i++) {
|
||||
serialPrint("adc[%d] = %04X", i, Analog_values[i]);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[1], "outputs")) {
|
||||
for (int i=0; i<NUM_CHNOUT; i++) {
|
||||
serialPrint("outputs[%d] = %04X", i, channelOutputs[i]);
|
||||
}
|
||||
}
|
||||
else if (toInt(argv, 1, &address) > 0) {
|
||||
int size = 256;
|
||||
if (toInt(argv, 2, &size) >= 0) {
|
||||
dump((uint8_t *)address, size);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cliHelp(const char ** argv);
|
||||
|
||||
const CliCommand cliCommands[] = {
|
||||
{ "beep", cliBeep, "[<frequency>] [<duration>]" },
|
||||
{ "ls", cliLs, "<directory>" },
|
||||
{ "play", cliPlay, "<filename>" },
|
||||
{ "print", cliDisplay, "<address> [<size>] | <what>" },
|
||||
{ "stackinfo", cliStackInfo, "<tid>" },
|
||||
{ "trace", cliTrace, "on | off" },
|
||||
{ "volume", cliVolume, "<level>" },
|
||||
{ "help", cliHelp, "[<command>]" },
|
||||
{ NULL, NULL, NULL } /* sentinel */
|
||||
};
|
||||
|
||||
int cliHelp(const char ** argv)
|
||||
{
|
||||
for (const CliCommand * command = cliCommands; command->name != NULL; command++) {
|
||||
if (argv[1][0] == '\0' || !strcmp(command->name, argv[0])) {
|
||||
serialPrint("%s %s", command->name, command->args);
|
||||
if (argv[1][0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argv[1][0] != '\0') {
|
||||
serialPrint("Invalid command \"%s\"", argv[0]);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cliExecCommand(const char ** argv)
|
||||
{
|
||||
if (argv[0][0] == '\0')
|
||||
return 0;
|
||||
|
||||
for (const CliCommand * command = cliCommands; command->name != NULL; command++) {
|
||||
if (!strcmp(command->name, argv[0])) {
|
||||
return command->func(argv);
|
||||
}
|
||||
}
|
||||
serialPrint("Invalid command \"%s\"", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cliExecLine(char * line)
|
||||
{
|
||||
int len = strlen(line);
|
||||
const char * argv[CLI_COMMAND_MAX_ARGS];
|
||||
memset(argv, 0, sizeof(argv));
|
||||
int argc = 1;
|
||||
argv[0] = line;
|
||||
for (int i=0; i<len; i++) {
|
||||
if (line[i] == ' ') {
|
||||
line[i] = '\0';
|
||||
if (argc < CLI_COMMAND_MAX_ARGS) {
|
||||
argv[argc++] = &line[i+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return cliExecCommand(argv);
|
||||
}
|
||||
|
||||
void cliTask(void * pdata)
|
||||
{
|
||||
char line[CLI_COMMAND_MAX_LEN+1];
|
||||
int pos = 0;
|
||||
|
||||
cliPrompt();
|
||||
|
||||
for (;;) {
|
||||
uint8_t c;
|
||||
|
||||
while (!cliRxFifo.pop(c)) {
|
||||
CoTickDelay(10); // 20ms
|
||||
}
|
||||
|
||||
if (c == 12) {
|
||||
// clear screen
|
||||
serialPrint("\033[2J\033[1;1H");
|
||||
cliPrompt();
|
||||
}
|
||||
else if (c == 127) {
|
||||
// backspace
|
||||
if (pos) {
|
||||
line[--pos] = '\0';
|
||||
serialPutc(c);
|
||||
}
|
||||
}
|
||||
else if (c == '\r' || c == '\n') {
|
||||
// enter
|
||||
serialCrlf();
|
||||
line[pos] = '\0';
|
||||
cliExecLine(line);
|
||||
pos = 0;
|
||||
cliPrompt();
|
||||
}
|
||||
else if (isascii(c) && pos < CLI_COMMAND_MAX_LEN) {
|
||||
line[pos++] = c;
|
||||
serialPutc(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cliStart()
|
||||
{
|
||||
cliTaskId = CoCreateTaskEx(cliTask, NULL, 10, &cliStack.stack[CLI_STACK_SIZE-1], CLI_STACK_SIZE, 1, false);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CLI_H_
|
||||
#define _CLI_H_
|
||||
|
||||
#include "serial.h"
|
||||
|
||||
extern uint8_t cliTracesEnabled;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "fifo.h"
|
||||
extern Fifo<256> cliRxFifo;
|
||||
#include "tasks_arm.h"
|
||||
#define CLI_STACK_SIZE 1000
|
||||
extern TaskStack<CLI_STACK_SIZE> cliStack;
|
||||
#endif
|
||||
|
||||
void cliStart();
|
||||
|
||||
#endif // _CLI_H_
|
||||
+6
-199
@@ -34,225 +34,34 @@
|
||||
*
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
}
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(SIMU)
|
||||
traceCallbackFunc traceCallback = 0;
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
#define PRINTF_BUFFER_SIZE 1024
|
||||
#else
|
||||
#define PRINTF_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
// Outputs a string to the UART
|
||||
void debugPuts(const char *format, ...)
|
||||
#define PRINTF_BUFFER_SIZE 1024
|
||||
void debugPrintf(const char * format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
char tmp[PRINTF_BUFFER_SIZE];
|
||||
|
||||
|
||||
va_start(arglist, format);
|
||||
vsnprintf(tmp, PRINTF_BUFFER_SIZE, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
#if defined(SIMU)
|
||||
fputs(tmp, stdout);
|
||||
fflush(stdout);
|
||||
if (traceCallback) {
|
||||
traceCallback(tmp);
|
||||
}
|
||||
#else
|
||||
const char *t = tmp;
|
||||
while (*t) {
|
||||
debugPutc(*t++);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void dump(unsigned char *data, unsigned int size)
|
||||
{
|
||||
debugPuts("DUMP %d bytes ...\n\r", size);
|
||||
unsigned int i = 0, j=0;
|
||||
while (i*32+j < size) {
|
||||
debugPuts("%.2X ", data[i*32+j]);
|
||||
j++;
|
||||
if (j==32) {
|
||||
i++; j=0;
|
||||
debugPuts("\n\r");
|
||||
}
|
||||
}
|
||||
debugPuts("\n\r");
|
||||
}
|
||||
|
||||
|
||||
#if !defined(SIMU)
|
||||
|
||||
uint32_t Mem_address ;
|
||||
uint32_t Next_mem_address ;
|
||||
uint32_t Memaddmode ;
|
||||
Fifo<512> debugRxFifo;
|
||||
|
||||
void crlf()
|
||||
{
|
||||
debugPutc( 13 ) ;
|
||||
debugPutc( 10 ) ;
|
||||
}
|
||||
|
||||
// Send a single 4 bit value to the RS232 port as a hex digit
|
||||
void hex_digit_send( unsigned char c )
|
||||
{
|
||||
c &= 0x0F ;
|
||||
if ( c > 9 )
|
||||
{
|
||||
c += 7 ;
|
||||
}
|
||||
c += '0' ;
|
||||
debugPutc( c ) ;
|
||||
}
|
||||
|
||||
// Send the 8 bit value to the RS232 port as 2 hex digits
|
||||
void p2hex( unsigned char c )
|
||||
{
|
||||
// asm("swap %c") ;
|
||||
hex_digit_send( c >> 4 ) ;
|
||||
// asm("swap %c") ;
|
||||
hex_digit_send( c ) ;
|
||||
}
|
||||
|
||||
// Send the 16 bit value to the RS232 port as 4 hex digits
|
||||
void p4hex( uint16_t value )
|
||||
{
|
||||
p2hex( value >> 8 ) ;
|
||||
p2hex( value ) ;
|
||||
}
|
||||
|
||||
// Send the 32 bit value to the RS232 port as 8 hex digits
|
||||
void p8hex( uint32_t value )
|
||||
{
|
||||
p4hex( value >> 16 ) ;
|
||||
p4hex( value ) ;
|
||||
}
|
||||
|
||||
|
||||
static void dispw_256( register uint32_t address, register uint32_t lines )
|
||||
{
|
||||
register uint32_t i ;
|
||||
register uint32_t j ;
|
||||
address &= 0xFFFFFFFC ;
|
||||
for ( i = 0 ; i < lines ; i += 1 )
|
||||
{
|
||||
p8hex( address ) ;
|
||||
for ( j = 0 ; j < 4 ; j += 1 )
|
||||
{
|
||||
debugPutc(' ') ;
|
||||
p8hex( *( (uint32_t *)address ) ) ;
|
||||
address += 4 ;
|
||||
}
|
||||
crlf() ;
|
||||
}
|
||||
}
|
||||
|
||||
extern Fifo<512> uart3TxFifo;
|
||||
|
||||
void debugFlush()
|
||||
{
|
||||
uart3TxFifo.flush();
|
||||
}
|
||||
|
||||
void debugTask(void* pdata)
|
||||
{
|
||||
uint8_t rxchar ;
|
||||
|
||||
TRACE("DEBUG Task started");
|
||||
|
||||
crlf() ;
|
||||
dispw_256( (uint32_t)USART3, 4 ) ;
|
||||
|
||||
for (;;) {
|
||||
|
||||
while ( (USART3->SR & USART_SR_RXNE) == 0 )
|
||||
CoTickDelay(5); // 10ms
|
||||
|
||||
rxchar = USART3->DR;
|
||||
|
||||
if ( Memaddmode )
|
||||
{
|
||||
if ( ( rxchar >= 'a' ) && ( rxchar <= 'f' ) )
|
||||
{
|
||||
rxchar -= 0x20; // toupper!
|
||||
}
|
||||
if ( ( ( rxchar >= '0' ) && ( rxchar <= '9' ) ) || ( ( rxchar >= 'A' ) && ( rxchar <= 'F' ) ) )
|
||||
{
|
||||
debugPutc( rxchar );
|
||||
rxchar -= '0';
|
||||
if ( rxchar > 9 )
|
||||
{
|
||||
rxchar -= 7;
|
||||
}
|
||||
Mem_address <<= 4;
|
||||
Mem_address |= rxchar;
|
||||
}
|
||||
else if ( rxchar == 13 )
|
||||
{
|
||||
crlf();
|
||||
if ( Mem_address == 0 )
|
||||
{
|
||||
Mem_address = Next_mem_address;
|
||||
}
|
||||
dispw_256( Mem_address, 4 );
|
||||
Next_mem_address = Mem_address + 64;
|
||||
Memaddmode = 0;
|
||||
}
|
||||
else if ( rxchar == 8 )
|
||||
{
|
||||
debugPutc( rxchar );
|
||||
debugPutc( rxchar );
|
||||
debugPutc( rxchar );
|
||||
Mem_address >>= 4;
|
||||
}
|
||||
else if ( rxchar == 27 )
|
||||
{
|
||||
crlf();
|
||||
Memaddmode = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( rxchar == '?' )
|
||||
{
|
||||
Memaddmode = 1;
|
||||
Mem_address = 0;
|
||||
debugPutc( '>' );
|
||||
}
|
||||
|
||||
if ( rxchar == 'm' )
|
||||
{
|
||||
crlf();
|
||||
p8hex( (uint32_t) &g_model.moduleData[0] );
|
||||
debugPutc( ' ' );
|
||||
p8hex( (uint32_t) &g_model.moduleData[1] );
|
||||
crlf();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif // #if !defined(SIMU)
|
||||
#endif // #if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
|
||||
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
static struct TraceElement traceBuffer[TRACE_BUFFER_LEN];
|
||||
static uint8_t traceBufferPos;
|
||||
extern Fifo<512> uart3TxFifo;
|
||||
gtime_t filltm(gtime_t *t, struct gtm *tp);
|
||||
|
||||
void trace_event(enum TraceEvent event, uint32_t data)
|
||||
@@ -298,13 +107,11 @@ void dumpTraceBuffer()
|
||||
TRACE(" %03d 0x%08x", traceBuffer[n].event, traceBuffer[n].data);
|
||||
if (traceBuffer[n].time == 0 && traceBuffer[n].time_ms == 0) break;
|
||||
if ((n % 5) == 0) {
|
||||
while (!uart3TxFifo.empty()) {
|
||||
while (!serial2TxFifo.empty()) {
|
||||
CoTickDelay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
TRACE("End of Trace Buffer dump");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+26
-42
@@ -39,58 +39,42 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "rtc.h"
|
||||
#include "dump.h"
|
||||
#if defined(CLI)
|
||||
#include "cli.h"
|
||||
#endif
|
||||
|
||||
#if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
uint8_t serial2TracesEnabled();
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
typedef void (*traceCallbackFunc)(const char * text);
|
||||
extern traceCallbackFunc traceCallback;
|
||||
void debugPrintf(const char * format, ...);
|
||||
#elif defined(DEBUG) && defined(CLI) && defined(USB_SERIAL)
|
||||
#define debugPrintf(...) do { if (cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
|
||||
#elif defined(DEBUG) && defined(CLI)
|
||||
#define debugPrintf(...) do { if (serial2TracesEnabled() && cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
|
||||
#elif defined(DEBUG) && defined(CPUARM)
|
||||
#define debugPrintf(...) do { if (serial2TracesEnabled()) serialPrintf(__VA_ARGS__); } while(0)
|
||||
#else
|
||||
#define debugPrintf(...)
|
||||
#endif
|
||||
|
||||
void debugPuts(const char *string, ...);
|
||||
void dump(unsigned char *data, unsigned int size);
|
||||
void debugFlush();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define TRACE(...) do { debugPuts(__VA_ARGS__); debugPuts("\r\n"); } while(0)
|
||||
#define TRACE(...) do { debugPrintf(__VA_ARGS__); debugPrintf("\r\n"); } while(0)
|
||||
#define DUMP(data, size) dump(data, size)
|
||||
#define TRACE_DEBUG(...) debugPuts("-D- " __VA_ARGS__)
|
||||
#define TRACE_DEBUG_WP(...) debugPuts(__VA_ARGS__)
|
||||
#define TRACE_INFO(...) debugPuts("-I- " __VA_ARGS__)
|
||||
#define TRACE_INFO_WP(...) debugPuts(__VA_ARGS__)
|
||||
#define TRACE_WARNING(...) debugPuts("-W- " __VA_ARGS__)
|
||||
#define TRACE_WARNING_WP(...) debugPuts(__VA_ARGS__)
|
||||
#define TRACE_ERROR(...) debugPuts("-E- " __VA_ARGS__)
|
||||
|
||||
#if !defined(SIMU)
|
||||
#define FLUSH() debugFlush();
|
||||
void debugTask(void* pdata);
|
||||
#else
|
||||
#define FLUSH()
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define TRACE(...) { }
|
||||
#define DUMP(...) { }
|
||||
#define TRACE_DEBUG(...) { }
|
||||
#define TRACE_DEBUG_WP(...) { }
|
||||
#define TRACE_INFO(...) { }
|
||||
#define TRACE_INFO_WP(...) { }
|
||||
#define TRACE_WARNING(...) { }
|
||||
#define TRACE_WARNING_WP(...) { }
|
||||
#define TRACE_ERROR(...) { }
|
||||
#define FLUSH()
|
||||
|
||||
#endif
|
||||
|
||||
#define TRACE_DEBUG(...) debugPrintf("-D- " __VA_ARGS__)
|
||||
#define TRACE_DEBUG_WP(...) debugPrintf(__VA_ARGS__)
|
||||
#define TRACE_INFO(...) debugPrintf("-I- " __VA_ARGS__)
|
||||
#define TRACE_INFO_WP(...) debugPrintf(__VA_ARGS__)
|
||||
#define TRACE_WARNING(...) debugPrintf("-W- " __VA_ARGS__)
|
||||
#define TRACE_WARNING_WP(...) debugPrintf(__VA_ARGS__)
|
||||
#define TRACE_ERROR(...) debugPrintf("-E- " __VA_ARGS__)
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(SIMU)
|
||||
#define dumpPrintf(...) debugPrintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dumpPrintf(...) serialPrintf(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
uint8_t dumpPosition;
|
||||
|
||||
void dumpStart(unsigned int size)
|
||||
{
|
||||
dumpPrintf("DUMP %d bytes ...\n\r", size);
|
||||
dumpPosition = 0;
|
||||
}
|
||||
|
||||
void dumpBody(const uint8_t *data, unsigned int size)
|
||||
{
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
dumpPrintf("%.2X ", data[i]);
|
||||
dumpPosition++;
|
||||
if ((dumpPosition & (32-1)) == 0) {
|
||||
dumpPrintf("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dumpEnd()
|
||||
{
|
||||
dumpPrintf("\r\n");
|
||||
}
|
||||
|
||||
void dump(const uint8_t *data, unsigned int size)
|
||||
{
|
||||
dumpStart(size);
|
||||
dumpBody(data, size);
|
||||
dumpEnd();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef _DUMP_H_
|
||||
#define _DUMP_H_
|
||||
|
||||
#if defined(DEBUG) || defined(CLI)
|
||||
void dumpStart(unsigned int size);
|
||||
void dumpBody(const uint8_t * data, unsigned int size);
|
||||
void dumpEnd();
|
||||
void dump(const uint8_t * data, unsigned int size);
|
||||
#else
|
||||
#define dump(data, size)
|
||||
#endif
|
||||
|
||||
#endif // _DUMP_H_
|
||||
@@ -626,7 +626,7 @@ PACK(typedef struct {
|
||||
int8_t currModel;
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t vBatCalib;
|
||||
int8_t txVoltageCalibration;
|
||||
int8_t backlightMode;
|
||||
TrainerData trainer;
|
||||
uint8_t view; // index of view in main screen
|
||||
@@ -659,7 +659,7 @@ PACK(typedef struct {
|
||||
int8_t vBatMin;
|
||||
int8_t vBatMax;
|
||||
uint8_t backlightBright;
|
||||
int8_t currentCalib;
|
||||
int8_t txCurrentCalibration;
|
||||
int8_t temperatureWarn;
|
||||
uint8_t mAhWarn;
|
||||
uint16_t mAhUsed;
|
||||
@@ -908,7 +908,7 @@ void ConvertModel_216_to_217(ModelData &model)
|
||||
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
|
||||
timer.mode = TMRMODE_COUNT + ConvertSwitch_216_to_217(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
|
||||
else
|
||||
timer.mode = oldModel.timers[i].mode;
|
||||
timer.mode = ConvertSwitch_216_to_217(oldModel.timers[i].mode);
|
||||
timer.start = oldModel.timers[i].start;
|
||||
timer.countdownBeep = oldModel.timers[i].countdownBeep;
|
||||
timer.minuteBeep = oldModel.timers[i].minuteBeep;
|
||||
|
||||
@@ -370,6 +370,17 @@ void eeLoadModel(uint8_t id)
|
||||
|
||||
restoreTimers();
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED && sensor.persistent) {
|
||||
telemetryItems[i].value = sensor.persistentValue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LOAD_MODEL_CURVES();
|
||||
|
||||
resumeMixerCalculations();
|
||||
// TODO pulses should be started after mixer calculations ...
|
||||
|
||||
|
||||
+9
-4
@@ -56,7 +56,7 @@ class Fifo
|
||||
}
|
||||
|
||||
bool pop(uint8_t & byte) {
|
||||
if (empty()) {
|
||||
if (isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
@@ -66,12 +66,17 @@ class Fifo
|
||||
}
|
||||
}
|
||||
|
||||
bool empty() {
|
||||
bool isEmpty() {
|
||||
return (ridx == widx);
|
||||
}
|
||||
|
||||
bool isFull() {
|
||||
uint32_t next = (widx+1) & (N-1);
|
||||
return (next == ridx);
|
||||
}
|
||||
|
||||
void flush() {
|
||||
while (!empty()) {};
|
||||
while (!isEmpty()) {};
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -80,4 +85,4 @@ class Fifo
|
||||
volatile uint32_t ridx;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _FIFO_H_
|
||||
|
||||
@@ -284,10 +284,10 @@ void evalFunctions()
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<NUM_CFN; i++) {
|
||||
const CustomFunctionData *cfn = &functions[i];
|
||||
const CustomFunctionData * cfn = &functions[i];
|
||||
int8_t swtch = CFN_SWITCH(cfn);
|
||||
if (swtch) {
|
||||
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
|
||||
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool active = getSwitch(swtch, IS_PLAY_FUNC(CFN_FUNC(cfn)) ? GETSWITCH_MIDPOS_DELAY : 0);
|
||||
|
||||
@@ -140,7 +140,7 @@ enum SwitchContext
|
||||
bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
{
|
||||
if (swtch < 0) {
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
|
||||
return false;
|
||||
}
|
||||
swtch = -swtch;
|
||||
@@ -156,7 +156,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
}
|
||||
}
|
||||
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
lcd_putsLeft(MENU_HEADER_HEIGHT+1+4*FH, STR_BATT_CALIB);
|
||||
static int32_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
|
||||
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128) * 4191;
|
||||
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
|
||||
batCalV /= 55296;
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (m_posVert==1 ? INVERS : 0));
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
@@ -85,18 +85,18 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
|
||||
static uint16_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P)
|
||||
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.vBatCalib)/8) / BandGap;
|
||||
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/8) / BandGap;
|
||||
lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
|
||||
#else
|
||||
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (m_posVert==1 ? INVERS : 0));
|
||||
#endif
|
||||
if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
|
||||
if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
|
||||
#if defined(PCBSKY9X) && !defined(REVA) && !defined(AR9X)
|
||||
lcd_putsLeft(6*FH+1, STR_CURRENT_CALIB);
|
||||
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (m_posVert==2 ? INVERS : 0)) ;
|
||||
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.currentCalib, -49, 49);
|
||||
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
|
||||
@@ -140,8 +140,9 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
||||
}
|
||||
else if (cstate == LS_FAMILY_TIMER) {
|
||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, v1_val+1, LEFT|attr);
|
||||
v1_max = 99;
|
||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1|attr);
|
||||
v1_min = -128;
|
||||
v1_max = 122;
|
||||
}
|
||||
else {
|
||||
v1_val = (uint8_t)cs->v1;
|
||||
@@ -163,8 +164,9 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
|
||||
}
|
||||
else if (cstate == LS_FAMILY_TIMER) {
|
||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2+1, LEFT|attr);
|
||||
v2_max = 99;
|
||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr);
|
||||
v2_min = -128;
|
||||
v2_max = 122;
|
||||
}
|
||||
else if (cstate == LS_FAMILY_EDGE) {
|
||||
putsEdgeDelayParam(CSWONE_2ND_COLUMN, y, cs, m_posHorz==0 ? attr : 0, m_posHorz==1 ? attr : 0);
|
||||
@@ -286,8 +288,8 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
putsEdgeDelayParam(CSW_3RD_COLUMN, y, cs, 0, 0);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_TIMER) {
|
||||
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT);
|
||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT);
|
||||
lcd_outdezAtt(CSW_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1);
|
||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1);
|
||||
}
|
||||
else {
|
||||
uint8_t v1 = cs->v1;
|
||||
|
||||
@@ -256,7 +256,7 @@ void menuModelSetup(uint8_t event)
|
||||
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
|
||||
{
|
||||
TimerData * timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)];
|
||||
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, 0, 2, attr, event);
|
||||
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,10 @@ enum menuModelTelemetryItems {
|
||||
ITEM_TELEMETRY_SENSOR30,
|
||||
ITEM_TELEMETRY_SENSOR31,
|
||||
ITEM_TELEMETRY_SENSOR32,
|
||||
ITEM_TELEMETRY_NEWSENSOR,
|
||||
ITEM_TELEMETRY_IGNORE_SENSORID,
|
||||
ITEM_TELEMETRY_DISCOVER_SENSORS,
|
||||
ITEM_TELEMETRY_NEW_SENSOR,
|
||||
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
|
||||
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
@@ -132,30 +134,30 @@ enum menuModelTelemetryItems {
|
||||
};
|
||||
|
||||
#if defined(FRSKY)
|
||||
#define TELEM_COL1 INDENT_WIDTH
|
||||
#define TELEM_COL1 INDENT_WIDTH
|
||||
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_CZ)
|
||||
#define TELEM_COL2 (9*FW)
|
||||
#define TELEM_COL2 (9*FW)
|
||||
#else
|
||||
#define TELEM_COL2 (8*FW)
|
||||
#define TELEM_COL2 (8*FW)
|
||||
#endif
|
||||
#define TELEM_BARS_COLMIN (56-3*FW)
|
||||
#define TELEM_BARS_COLMAX (14*FW-3)
|
||||
#define TELEM_SCRTYPE_COL TELEM_COL2
|
||||
#define TELEM_BARS_COLMIN (56-3*FW)
|
||||
#define TELEM_BARS_COLMAX (14*FW-3)
|
||||
#define TELEM_SCRTYPE_COL TELEM_COL2
|
||||
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHANNELS_ROWS
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0,
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
|
||||
#else
|
||||
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
|
||||
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
|
||||
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
|
||||
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
|
||||
#define SENSORS_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
#define IF_FAS_OFFSET(x) x,
|
||||
#define IF_FAS_OFFSET(x) x,
|
||||
#else
|
||||
#define IF_FAS_OFFSET(x)
|
||||
#endif
|
||||
@@ -163,38 +165,38 @@ enum menuModelTelemetryItems {
|
||||
#if defined(CPUARM)
|
||||
#define USRDATA_ROWS
|
||||
#elif defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
|
||||
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
|
||||
#else
|
||||
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
|
||||
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
|
||||
#endif
|
||||
|
||||
#define RSSI_ROWS LABEL(RSSI), 1, 1,
|
||||
#define RSSI_ROWS LABEL(RSSI), 1, 1,
|
||||
|
||||
#if defined(CPUARM) || defined(GAUGES)
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
#else
|
||||
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
|
||||
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define VARIO_RANGE_ROWS 1
|
||||
#define VARIO_RANGE_ROWS 1
|
||||
#else
|
||||
#define VARIO_RANGE_ROWS 3
|
||||
#define VARIO_RANGE_ROWS 3
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_TYPE_ROWS 0,
|
||||
#define TELEMETRY_TYPE_ROWS 0,
|
||||
#else
|
||||
#define TELEMETRY_TYPE_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
|
||||
#define TELEMETRY_CURRENT_EDIT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
|
||||
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
|
||||
#define TELEMETRY_CURRENT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
|
||||
#else
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
|
||||
#define TELEMETRY_CURRENT_EDIT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
|
||||
#define TELEMETRY_CURRENT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
@@ -497,7 +499,7 @@ void onSensorMenu(const char *result)
|
||||
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
|
||||
m_posVert += 1;
|
||||
else
|
||||
m_posVert = 1+ITEM_TELEMETRY_NEWSENSOR;
|
||||
m_posVert = 1+ITEM_TELEMETRY_NEW_SENSOR;
|
||||
}
|
||||
else if (result == STR_COPY) {
|
||||
int newIndex = availableTelemetryIndex();
|
||||
@@ -521,6 +523,15 @@ void onSensorMenu(const char *result)
|
||||
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
@@ -549,7 +560,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint8_t ch = TELEMETRY_CURRENT_EDIT_CHANNEL(k);
|
||||
uint8_t ch = TELEMETRY_CURRENT_CHANNEL(k);
|
||||
FrSkyChannelData & channel = g_model.frsky.channels[ch];
|
||||
uint8_t dest = TELEM_A1-1+ch;
|
||||
#endif
|
||||
@@ -604,7 +615,15 @@ void menuModelTelemetry(uint8_t event)
|
||||
lcd_putsLeft(y, STR_TELEMETRY_SENSORS);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_NEWSENSOR:
|
||||
case ITEM_TELEMETRY_DISCOVER_SENSORS:
|
||||
lcd_putsAtt(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
allowNewSensors = !allowNewSensors;
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_NEW_SENSOR:
|
||||
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
@@ -618,9 +637,18 @@ void menuModelTelemetry(uint8_t event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_IGNORE_SENSORID:
|
||||
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNOREIDS, attr, event);
|
||||
|
||||
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
|
||||
lcd_putsAtt(0, y, STR_DELETE_ALL_SENSORS, attr);
|
||||
s_editMode = 0;
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
|
||||
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -830,7 +858,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL3:
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL4:
|
||||
{
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(k);
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
|
||||
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
|
||||
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
|
||||
@@ -900,8 +928,14 @@ void menuModelTelemetry(uint8_t event)
|
||||
#if defined(CPUARM)
|
||||
putsMixerSource(TELEM_COL1, y, barSource, m_posHorz==0 ? attr : 0);
|
||||
if (barSource) {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
if (barSource <= MIXSRC_LAST_CH) {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
}
|
||||
#else
|
||||
lcd_putsiAtt(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);
|
||||
|
||||
@@ -629,37 +629,62 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (l_posVert<1) {
|
||||
s_pgOfs=0;
|
||||
}
|
||||
else if (menuTab && horTab) {
|
||||
vertpos_t realPosVert = l_posVert;
|
||||
vertpos_t realPgOfs = s_pgOfs;
|
||||
vertpos_t realMaxrow = maxrow;
|
||||
for (vertpos_t i=1; i<=maxrow; i++) {
|
||||
if (MAXCOL(i) == HIDDEN_ROW) {
|
||||
realMaxrow--;
|
||||
if (i < l_posVert)
|
||||
realPosVert--;
|
||||
if (i < s_pgOfs)
|
||||
realPgOfs--;
|
||||
int linesCount = maxrow;
|
||||
|
||||
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
|
||||
s_pgOfs = 0;
|
||||
if (horTab) {
|
||||
linesCount = 0;
|
||||
for (int i=0; i<maxrow; i++) {
|
||||
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||
linesCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 (MAXCOL(i) == HIDDEN_ROW) {
|
||||
s_pgOfs++;
|
||||
else if (horTab) {
|
||||
if (maxrow > NUM_BODY_LINES) {
|
||||
while (1) {
|
||||
vertpos_t firstLine = 0;
|
||||
for (int numLines=0; firstLine<maxrow && numLines<s_pgOfs; firstLine++) {
|
||||
if (firstLine>=horTabMax || horTab[firstLine+1] != HIDDEN_ROW) {
|
||||
numLines++;
|
||||
}
|
||||
}
|
||||
if (l_posVert <= firstLine) {
|
||||
s_pgOfs--;
|
||||
}
|
||||
else {
|
||||
vertpos_t lastLine = firstLine;
|
||||
for (int numLines=0; lastLine<maxrow && numLines<NUM_BODY_LINES; lastLine++) {
|
||||
if (lastLine>=horTabMax || horTab[lastLine+1] != HIDDEN_ROW) {
|
||||
numLines++;
|
||||
}
|
||||
}
|
||||
if (l_posVert > lastLine) {
|
||||
s_pgOfs++;
|
||||
}
|
||||
else {
|
||||
linesCount = s_pgOfs + NUM_BODY_LINES;
|
||||
for (int i=lastLine; i<maxrow; i++) {
|
||||
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||
linesCount++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (l_posVert>NUM_BODY_LINES+s_pgOfs) {
|
||||
s_pgOfs = l_posVert-NUM_BODY_LINES;
|
||||
}
|
||||
else if (l_posVert<=s_pgOfs) {
|
||||
s_pgOfs = l_posVert-1;
|
||||
}
|
||||
}
|
||||
maxrow = realMaxrow;
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -226,8 +226,8 @@ void displayVoltageOrAlarm()
|
||||
if (g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
|
||||
putsValueWithUnit(6*FW-1, 2*FH, getTemperature(), UNIT_TEMPERATURE, BLINK|INVERS|DBLSIZE);
|
||||
}
|
||||
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
|
||||
putsValueWithUnit(7*FW-1, 2*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
|
||||
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.txCurrentCalibration)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
|
||||
putsValueWithUnit(7*FW-1, 2*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.txCurrentCalibration)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
|
||||
}
|
||||
else {
|
||||
displayBattVoltage();
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "opentx.h"
|
||||
#include "telemetry/mavlink.h"
|
||||
#include "gui/9X/menus.h"
|
||||
#include "serial.h"
|
||||
#include "targets/common_avr/serial_driver.h"
|
||||
|
||||
#define APSIZE (BSS | DBLSIZE)
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ void menuStatisticsDebug(uint8_t event)
|
||||
// current
|
||||
lcd_putsLeft(MENU_DEBUG_Y_CURRENT, STR_CPU_CURRENT);
|
||||
putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CURRENT, getCurrent(), UNIT_MILLIAMPS, LEFT);
|
||||
uint32_t current_scale = 488 + g_eeGeneral.currentCalib;
|
||||
uint32_t current_scale = 488 + g_eeGeneral.txCurrentCalibration;
|
||||
lcd_putc(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CURRENT, '>');
|
||||
putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT);
|
||||
// consumption
|
||||
@@ -196,11 +196,11 @@ void menuStatisticsDebug(uint8_t event)
|
||||
|
||||
#if defined(CPUARM)
|
||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, stack_free(0), UNSIGN|LEFT|TINSIZE);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(1), UNSIGN|LEFT|TINSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(2), UNSIGN|LEFT|TINSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, audioStack.available(), UNSIGN|LEFT|TINSIZE);
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
@@ -213,7 +213,7 @@ void menuStatisticsDebug(uint8_t event)
|
||||
lcd_putsLeft(4*FH, STR_TMIXMAXMS);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2);
|
||||
lcd_putsLeft(5*FH, STR_FREESTACKMINB);
|
||||
lcd_outdezAtt(14*FW, 5*FH, stack_free(), UNSIGN) ;
|
||||
lcd_outdezAtt(14*FW, 5*FH, stackAvailable(), UNSIGN) ;
|
||||
#endif
|
||||
|
||||
lcd_puts(4*FW, 7*FH+1, STR_MENUTORESET);
|
||||
|
||||
@@ -246,6 +246,10 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
#if defined(CPUARM)
|
||||
getvalue_t barMin = bar.barMin;
|
||||
getvalue_t barMax = bar.barMax;
|
||||
if (source <= MIXSRC_LAST_CH) {
|
||||
barMin = calc100toRESX(barMin);
|
||||
barMax = calc100toRESX(barMax);
|
||||
}
|
||||
#else
|
||||
getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
|
||||
getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);
|
||||
|
||||
@@ -203,7 +203,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
|
||||
if (swtch < 0) {
|
||||
negative = true;
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
|
||||
return false;
|
||||
}
|
||||
swtch = -swtch;
|
||||
@@ -245,7 +245,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
}
|
||||
}
|
||||
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -674,7 +674,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
||||
else
|
||||
lcd_putsiAtt(x, y, STR_VSRCRAW, idx+1, att);
|
||||
}
|
||||
else if (idx >= MIXSRC_FIRST_SWITCH && idx < MIXSRC_FIRST_LOGICAL_SWITCH) {
|
||||
else if (idx >= MIXSRC_FIRST_SWITCH && idx <= MIXSRC_LAST_SWITCH) {
|
||||
idx = idx-MIXSRC_FIRST_SWITCH;
|
||||
if (ZEXIST(g_eeGeneral.switchNames[idx])) {
|
||||
lcd_putcAtt(x, y, '\312', att); //switch symbol
|
||||
@@ -692,8 +692,8 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
||||
else if (idx <= MIXSRC_LAST_CH) {
|
||||
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
|
||||
if (ZEXIST(g_model.limitData[idx-MIXSRC_CH1].name) && (att & STREXPANDED)) {
|
||||
lcd_putcAtt(lcdLastPos, y, ' ', att);
|
||||
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att);
|
||||
lcd_putcAtt(lcdLastPos, y, ' ', att|SMLSIZE);
|
||||
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att|SMLSIZE);
|
||||
}
|
||||
}
|
||||
else if (idx <= MIXSRC_LAST_GVAR)
|
||||
@@ -727,29 +727,48 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
|
||||
}
|
||||
}
|
||||
|
||||
void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx == SWSRC_OFF)
|
||||
if (idx == SWSRC_NONE) {
|
||||
return lcd_putsiAtt(x, y, STR_VSWITCHES, 0, att);
|
||||
}
|
||||
else if (idx == SWSRC_OFF) {
|
||||
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
|
||||
}
|
||||
|
||||
if (idx < 0) {
|
||||
lcd_putcAtt(x-2, y, '!', att);
|
||||
idx = -idx;
|
||||
}
|
||||
#if defined(FLIGHT_MODES)
|
||||
if (idx >= SWSRC_FIRST_FLIGHT_MODE) {
|
||||
return putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
#endif
|
||||
if (idx >= SWSRC_FIRST_SWITCH && idx <= SWSRC_LAST_SWITCH) {
|
||||
|
||||
if (idx <= SWSRC_LAST_SWITCH) {
|
||||
div_t swinfo = switchInfo(idx);
|
||||
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
|
||||
lcd_putsnAtt(x, y, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME, ZCHAR|att);
|
||||
char c = "\300-\301"[swinfo.rem];
|
||||
lcd_putcAtt(lcdNextPos, y, c, att);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
lcd_putcAtt(x, y, 'S', att);
|
||||
lcd_putcAtt(lcdNextPos, y, 'A'+swinfo.quot, att);
|
||||
}
|
||||
char c = "\300-\301"[swinfo.rem];
|
||||
lcd_putcAtt(lcdNextPos, y, c, att);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
|
||||
div_t swinfo = div(idx - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
|
||||
putsStrIdx(x, y, "S", swinfo.quot*10+swinfo.rem+11, att);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_TRIM) {
|
||||
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_FIRST_TRIM+1, att);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
putsStrIdx(x, y, "L", idx-SWSRC_FIRST_LOGICAL_SWITCH+1, att);
|
||||
}
|
||||
else if (idx <= SWSRC_ONE) {
|
||||
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_ON+1+(2*NUM_STICKS), att);
|
||||
}
|
||||
else {
|
||||
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
return lcd_putsiAtt(x, y, STR_VSWITCHES, idx, att);
|
||||
}
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
@@ -803,7 +822,7 @@ void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
putsStrIdx(x, y, STR_CV, idx, att);
|
||||
}
|
||||
|
||||
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
|
||||
void putsTimerMode(coord_t x, coord_t y, int32_t mode, LcdFlags att)
|
||||
{
|
||||
if (mode >= 0) {
|
||||
if (mode < TMRMODE_COUNT)
|
||||
|
||||
@@ -167,7 +167,7 @@ void lcd_outdez8(coord_t x, coord_t y, int8_t val);
|
||||
|
||||
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
|
||||
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
|
||||
void putsSwitches(coord_t x, coord_t y, int8_t swtch, LcdFlags att=0);
|
||||
void putsSwitches(coord_t x, coord_t y, int32_t swtch, LcdFlags att=0);
|
||||
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||
void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att=0);
|
||||
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
@@ -175,7 +175,7 @@ void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att);
|
||||
#endif
|
||||
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
|
||||
void putsTimerMode(coord_t x, coord_t y, int32_t mode, LcdFlags att=0);
|
||||
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
|
||||
#define putsChn(x, y, idx, att) putsMixerSource(x, y, MIXSRC_CH1+idx-1, att)
|
||||
|
||||
@@ -62,9 +62,9 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
lcd_putsLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_BATT_CALIB);
|
||||
static int32_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
|
||||
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
|
||||
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.txVoltageCalibration)/128) * BATT_SCALE;
|
||||
batCalV >>= 11;
|
||||
batCalV += 2; // because of the diode
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+5*FH, batCalV, s_editMode > 0 ? BLINK|INVERS : INVERS);
|
||||
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
|
||||
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
}
|
||||
|
||||
@@ -219,9 +219,9 @@ void menuGeneralHardware(uint8_t event)
|
||||
break;
|
||||
#endif
|
||||
case ITEM_SETUP_HW_UART3_MODE:
|
||||
g_eeGeneral.uart3Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.uart3Mode, 0, UART_MODE_MAX, attr, event);
|
||||
g_eeGeneral.serial2Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL());
|
||||
serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -121,6 +121,35 @@ void onCustomFunctionsMenu(const char *result)
|
||||
}
|
||||
}
|
||||
|
||||
void onAdjustGvarSourceLongEnterPress(const char * result)
|
||||
{
|
||||
CustomFunctionData * cfn = &g_model.customFn[m_posVert];
|
||||
|
||||
if (result == STR_CONSTANT) {
|
||||
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_CONSTANT;
|
||||
CFN_PARAM(cfn) = 0;
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
else if (result == STR_MIXSOURCE) {
|
||||
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_SOURCE;
|
||||
CFN_PARAM(cfn) = 0;
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
else if (result == STR_GLOBALVAR) {
|
||||
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_GVAR;
|
||||
CFN_PARAM(cfn) = 0;
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
else if (result == STR_INCDEC) {
|
||||
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INC;
|
||||
CFN_PARAM(cfn) = 0;
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
onSourceLongEnterPress(result);
|
||||
}
|
||||
}
|
||||
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
@@ -325,8 +354,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
case FUNC_ADJUST_GVAR_SOURCE:
|
||||
val_max = MIXSRC_LAST_CH;
|
||||
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
|
||||
// TODO later, we have a conflict on [Enter Long] here ...
|
||||
// INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
|
||||
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
break;
|
||||
case FUNC_ADJUST_GVAR_GVAR:
|
||||
@@ -334,27 +362,39 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
|
||||
break;
|
||||
default: // FUNC_ADJUST_GVAR_INC
|
||||
#if 0 // TODO 2.2.X
|
||||
val_min = -100; val_max = +100;
|
||||
if (val_displayed < 0)
|
||||
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "-=", attr);
|
||||
else
|
||||
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "+=", attr);
|
||||
lcd_outdezAtt(lcdNextPos, y, abs(val_displayed), attr|LEFT);
|
||||
#endif
|
||||
val_max = 1;
|
||||
lcd_putsiAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
|
||||
break;
|
||||
}
|
||||
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
s_editMode = !s_editMode;
|
||||
active = true;
|
||||
CFN_GVAR_MODE(cfn) += 1;
|
||||
CFN_GVAR_MODE(cfn) &= 0x03;
|
||||
val_displayed = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
|
||||
if (active) {
|
||||
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_CONSTANT)
|
||||
MENU_ADD_ITEM(STR_CONSTANT);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_SOURCE)
|
||||
MENU_ADD_ITEM(STR_MIXSOURCE);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_GVAR)
|
||||
MENU_ADD_ITEM(STR_GLOBALVAR);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INC)
|
||||
MENU_ADD_ITEM(STR_INCDEC);
|
||||
menuHandler = onAdjustGvarSourceLongEnterPress;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void DrawFunction(FnFuncP fn, uint8_t offset)
|
||||
|
||||
coord_t prev_yv = (coord_t)-1;
|
||||
|
||||
for (int8_t xv=-WCHART; xv<=WCHART; xv++) {
|
||||
for (int xv=-WCHART; xv<=WCHART; xv++) {
|
||||
coord_t yv = (LCD_H-1) - (((uint16_t)RESX + fn(xv * (RESX/WCHART))) / 2 * (LCD_H-1) / RESX);
|
||||
if (prev_yv != (coord_t)-1) {
|
||||
if (abs((int8_t)yv-prev_yv) <= 1) {
|
||||
@@ -108,7 +108,7 @@ uint8_t getExpoMixCount(uint8_t expo)
|
||||
uint8_t count = 0;
|
||||
uint8_t ch ;
|
||||
|
||||
for(int8_t i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
|
||||
for (int i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
|
||||
ch = (expo ? EXPO_VALID(expoAddress(i)) : mixAddress(i)->srcRaw);
|
||||
if (ch != 0) {
|
||||
count++;
|
||||
@@ -652,7 +652,7 @@ void displayHeaderChannelName(uint8_t ch)
|
||||
{
|
||||
uint8_t len = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name));
|
||||
if (len) {
|
||||
lcd_putsnAtt(70, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
|
||||
lcd_putsnAtt(80, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,14 +837,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
// Value
|
||||
uint8_t index = expoAddress(s_currIdx)->chn;
|
||||
if (!s_currCh) {
|
||||
lcd_outdezAtt(120, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE);
|
||||
lcd_outdezAtt(127, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE);
|
||||
}
|
||||
|
||||
SIMPLE_MENU(STR_MENUINPUTS, menuTabModel, e_InputsAll, s_maxLines);
|
||||
|
||||
// Gauge
|
||||
if (!s_currCh) {
|
||||
drawGauge(120, 1, 58, 6, anas[index], 1024);
|
||||
drawGauge(127, 1, 58, 6, anas[index], 1024);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -855,14 +855,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
uint8_t index = mixAddress(s_currIdx)->destCh;
|
||||
if (!s_currCh) {
|
||||
displayHeaderChannelName(index);
|
||||
lcd_outdezAtt(120, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE);
|
||||
lcd_outdezAtt(127, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE);
|
||||
}
|
||||
|
||||
SIMPLE_MENU(STR_MIXER, menuTabModel, e_MixAll, s_maxLines);
|
||||
|
||||
// Gauge
|
||||
if (!s_currCh) {
|
||||
drawGauge(120, 1, 58, 6, ex_chans[index], 1024);
|
||||
drawGauge(127, 1, 58, 6, ex_chans[index], 1024);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,15 +142,15 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
{
|
||||
int8_t timerMode = timer->mode;
|
||||
swsrc_t timerMode = timer->mode;
|
||||
if (timerMode < 0) timerMode -= TMRMODE_COUNT-1;
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, timerMode, -TMRMODE_COUNT-SWSRC_LAST+1, TMRMODE_COUNT+SWSRC_LAST-1, isSwitchAvailableInTimers);
|
||||
if (timerMode < 0) timerMode += TMRMODE_COUNT-1;
|
||||
timer->mode = timerMode;
|
||||
#if defined(AUTOSWITCH)
|
||||
if (s_editMode>0) {
|
||||
int8_t val = timer->mode - (TMRMODE_COUNT-1);
|
||||
int8_t switchVal = checkIncDecMovedSwitch(val);
|
||||
swsrc_t val = timer->mode - (TMRMODE_COUNT-1);
|
||||
swsrc_t switchVal = checkIncDecMovedSwitch(val);
|
||||
if (val != switchVal) {
|
||||
timer->mode = switchVal + (TMRMODE_COUNT-1);
|
||||
eeDirty(EE_MODEL);
|
||||
@@ -321,7 +321,7 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
|
||||
g_model.timers[0].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[0].countdownBeep, 0, 2, attr, event);
|
||||
g_model.timers[0].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[0].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER1_PERSISTENT:
|
||||
@@ -342,7 +342,7 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
|
||||
g_model.timers[1].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[1].countdownBeep, 0, 2, attr, event);
|
||||
g_model.timers[1].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[1].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER2_PERSISTENT:
|
||||
@@ -364,7 +364,7 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
|
||||
g_model.timers[2].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[2].countdownBeep, 0, 2, attr, event);
|
||||
g_model.timers[2].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[2].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER3_PERSISTENT:
|
||||
|
||||
@@ -73,8 +73,10 @@ enum menuModelTelemetryItems {
|
||||
ITEM_TELEMETRY_SENSOR30,
|
||||
ITEM_TELEMETRY_SENSOR31,
|
||||
ITEM_TELEMETRY_SENSOR32,
|
||||
ITEM_TELEMETRY_NEWSENSOR,
|
||||
ITEM_TELEMETRY_IGNORE_SENSORID,
|
||||
ITEM_TELEMETRY_DISCOVER_SENSORS,
|
||||
ITEM_TELEMETRY_NEW_SENSOR,
|
||||
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
|
||||
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
|
||||
#if defined(VARIO)
|
||||
ITEM_TELEMETRY_VARIO_LABEL,
|
||||
ITEM_TELEMETRY_VARIO_SOURCE,
|
||||
@@ -110,39 +112,39 @@ enum menuModelTelemetryItems {
|
||||
ITEM_TELEMETRY_MAX
|
||||
};
|
||||
|
||||
#define TELEM_COL1 (1*FW)
|
||||
#define TELEM_COL2 (16*FW)
|
||||
#define TELEM_COL3 (28*FW)
|
||||
#define TELEM_BARS_COLMIN TELEM_COL2
|
||||
#define TELEM_BARS_COLMAX TELEM_COL3
|
||||
#define TELEM_SCRTYPE_COL TELEM_COL2
|
||||
#define TELEM_COL1 (1*FW)
|
||||
#define TELEM_COL2 (16*FW)
|
||||
#define TELEM_COL3 (28*FW)
|
||||
#define TELEM_BARS_COLMIN TELEM_COL2
|
||||
#define TELEM_BARS_COLMAX TELEM_COL3
|
||||
#define TELEM_SCRTYPE_COL TELEM_COL2
|
||||
|
||||
#define IF_FAS_OFFSET(x) x,
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
#define IF_FAS_OFFSET(x) x,
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0,
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
|
||||
#if defined(VARIO)
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
|
||||
#else
|
||||
#define VARIO_ROWS
|
||||
#endif
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0,
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0,
|
||||
#if defined(LUA)
|
||||
#define SCREEN_TYPE_ROWS 1
|
||||
#define SCREEN_TYPE_ROWS 1
|
||||
#else
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
#endif
|
||||
#define VARIO_RANGE_ROWS 3
|
||||
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
#define VARIO_RANGE_ROWS 3
|
||||
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
|
||||
#if defined(LUA)
|
||||
#define TELEMETRY_SCREEN_LINE(x) ((TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE || TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_SCRIPT) ? HIDDEN_ROW : (uint8_t)2)
|
||||
#define TELEMETRY_SCREEN_LINE(x) ((TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE || TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_SCRIPT) ? HIDDEN_ROW : (uint8_t)2)
|
||||
#else
|
||||
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
|
||||
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
|
||||
#endif
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
|
||||
#define TELEMETRY_CURRENT_EDIT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
|
||||
#define TELEMETRY_CURRENT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
|
||||
|
||||
enum SensorFields {
|
||||
SENSOR_FIELD_NAME,
|
||||
@@ -344,7 +346,7 @@ void menuModelSensor(uint8_t event)
|
||||
lcd_putsLeft(y, STR_CURRENTSENSOR);
|
||||
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
|
||||
if (attr) {
|
||||
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCurrentSensor);
|
||||
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isTelemetryFieldAvailable);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -467,7 +469,7 @@ void onSensorMenu(const char *result)
|
||||
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
|
||||
m_posVert += 1;
|
||||
else
|
||||
m_posVert = ITEM_TELEMETRY_NEWSENSOR;
|
||||
m_posVert = ITEM_TELEMETRY_NEW_SENSOR;
|
||||
}
|
||||
else if (result == STR_COPY) {
|
||||
int newIndex = availableTelemetryIndex();
|
||||
@@ -492,7 +494,7 @@ void onSensorMenu(const char *result)
|
||||
void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(sub);
|
||||
int screenIndex = TELEMETRY_CURRENT_SCREEN(sub);
|
||||
|
||||
if (result == STR_UPDATE_LIST) {
|
||||
if (!listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
|
||||
@@ -517,6 +519,13 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS LABEL(TopBar), 0, 0, TOPLCD_ROWS TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3)) });
|
||||
|
||||
int sub = m_posVert;
|
||||
@@ -574,7 +583,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
switch (k) {
|
||||
case ITEM_TELEMETRY_PROTOCOL_TYPE:
|
||||
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, g_eeGeneral.uart3Mode==UART_MODE_TELEMETRY ? PROTOCOL_FRSKY_D_SECONDARY : PROTOCOL_FRSKY_D, attr, event);
|
||||
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, g_eeGeneral.serial2Mode==UART_MODE_TELEMETRY ? PROTOCOL_FRSKY_D_SECONDARY : PROTOCOL_FRSKY_D, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_SENSORS_LABEL:
|
||||
@@ -585,7 +594,15 @@ void menuModelTelemetry(uint8_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_NEWSENSOR:
|
||||
case ITEM_TELEMETRY_DISCOVER_SENSORS:
|
||||
lcd_putsAtt(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
allowNewSensors = !allowNewSensors;
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_NEW_SENSOR:
|
||||
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
@@ -600,8 +617,17 @@ void menuModelTelemetry(uint8_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_IGNORE_SENSORID:
|
||||
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNOREIDS, attr, event);
|
||||
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
|
||||
lcd_putsAtt(0, y, STR_DELETE_ALL_SENSORS, attr);
|
||||
s_editMode = 0;
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
|
||||
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
@@ -705,7 +731,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL3:
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL4:
|
||||
{
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(k);
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
|
||||
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
|
||||
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
|
||||
|
||||
@@ -176,7 +176,7 @@ extern const CheckIncDecStops &stopsSwitch;
|
||||
(val), (val+1)
|
||||
|
||||
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
|
||||
int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
||||
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
|
||||
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
|
||||
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
|
||||
|
||||
@@ -45,10 +45,10 @@ uint8_t calibrationState;
|
||||
int checkIncDecSelection = 0;
|
||||
|
||||
#if defined(AUTOSWITCH)
|
||||
int8_t checkIncDecMovedSwitch(int8_t val)
|
||||
swsrc_t checkIncDecMovedSwitch(swsrc_t val)
|
||||
{
|
||||
if (s_editMode>0) {
|
||||
int8_t swtch = getMovedSwitch();
|
||||
swsrc_t swtch = getMovedSwitch();
|
||||
if (swtch) {
|
||||
div_t info = switchInfo(swtch);
|
||||
if (IS_TOGGLE(info.quot)) {
|
||||
|
||||
@@ -98,13 +98,28 @@ void menuStatisticsView(uint8_t event)
|
||||
#define MENU_DEBUG_Y_MIXMAX (2*FH-3)
|
||||
#define MENU_DEBUG_Y_LUA (3*FH-2)
|
||||
#define MENU_DEBUG_Y_FREE_RAM (4*FH-1)
|
||||
#define MENU_DEBUG_Y_STACK (5*FH)
|
||||
#define MENU_DEBUG_Y_USB (5*FH)
|
||||
#define MENU_DEBUG_Y_RTOS (6*FH)
|
||||
|
||||
#if defined(USB_SERIAL)
|
||||
extern uint16_t usbWraps;
|
||||
extern uint16_t charsWritten;
|
||||
extern "C" volatile uint32_t APP_Rx_ptr_in;
|
||||
#endif
|
||||
|
||||
void menuStatisticsDebug(uint8_t event)
|
||||
{
|
||||
TITLE(STR_MENUDEBUG);
|
||||
|
||||
#if defined(WATCHDOG_TEST)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
// do a user requested watchdog test
|
||||
TRACE("Performing watchdog test");
|
||||
pausePulses();
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
@@ -136,10 +151,19 @@ void menuStatisticsDebug(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
break;
|
||||
#if defined(WATCHDOG_TEST)
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
{
|
||||
POPUP_CONFIRMATION("Test the watchdog?");
|
||||
const char * w = "The radio will reset!";
|
||||
SET_WARNING_INFO(w, strlen(w), 0);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem");
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, getAvailableMemory(), LEFT);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b");
|
||||
|
||||
#if defined(LUA)
|
||||
@@ -154,15 +178,24 @@ void menuStatisticsDebug(uint8_t event)
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
||||
|
||||
#if defined(USB_SERIAL)
|
||||
lcd_putsLeft(MENU_DEBUG_Y_USB, "Usb");
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_USB, charsWritten, LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_USB, " ");
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_USB, APP_Rx_ptr_in, LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_USB, " ");
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_USB, usbWraps, LEFT);
|
||||
#endif
|
||||
|
||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, menusStack.available(), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, mixerStack.available(), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[A]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, audioStack.available(), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[I]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(255), UNSIGN|LEFT);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stackAvailable(), UNSIGN|LEFT);
|
||||
|
||||
lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET);
|
||||
lcd_status_line();
|
||||
|
||||
@@ -128,19 +128,6 @@ enum EnumKeys {
|
||||
SW_SR0,
|
||||
SW_SR1,
|
||||
SW_SR2,
|
||||
#else
|
||||
SW_SI0,
|
||||
SW_SI2,
|
||||
SW_SJ0,
|
||||
SW_SJ2,
|
||||
SW_SK0,
|
||||
SW_SK2,
|
||||
SW_SL0,
|
||||
SW_SL2,
|
||||
SW_SM0,
|
||||
SW_SM2,
|
||||
SW_SN0,
|
||||
SW_SN2,
|
||||
#endif
|
||||
#else
|
||||
SW_ID0=SW_BASE,
|
||||
|
||||
+40
-12
@@ -89,27 +89,55 @@ const uint8_t BootCode[] = {
|
||||
__attribute__ ((section(".bootrodata"), used))
|
||||
void _bootStart()
|
||||
{
|
||||
// turn soft power ON now
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; // Enable portD clock
|
||||
GPIOD->BSRRL = 1;
|
||||
GPIOD->MODER = (GPIOD->MODER & 0xFFFFFFFC) | 1;
|
||||
|
||||
#if defined(REV9E)
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN; // Enable portC clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOGEN; // Enable portG clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN | RCC_AHB1ENR_GPIOGEN | RCC_AHB1ENR_GPIODEN;
|
||||
#else
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN; // Enable portC clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOEEN; // Enable portE clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN | RCC_AHB1ENR_GPIOEEN | RCC_AHB1ENR_GPIODEN;
|
||||
#endif
|
||||
|
||||
// these two NOPs are needed (see STM32F errata sheet) before the peripheral
|
||||
// register can be written after the peripheral clock was enabled
|
||||
__ASM volatile ("nop");
|
||||
__ASM volatile ("nop");
|
||||
|
||||
// Turn soft power ON now, but only if we got started because of the watchdog
|
||||
// or software reset. If the radio was started by user pressing the power button
|
||||
// then that button is providing power and we don't need to enable it here.
|
||||
//
|
||||
// If we were to turn it on here indiscriminately, then the radio can go into the
|
||||
// power on/off loop after being powered off by the user. (issue #2790)
|
||||
if (WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
||||
GPIOD->BSRRL = 1; // set PWR_GPIO_PIN_ON pin to 1
|
||||
GPIOD->MODER = (GPIOD->MODER & 0xFFFFFFFC) | 1; // General purpose output mode
|
||||
}
|
||||
|
||||
// TRIMS_GPIO_PIN_LHR is on PG0 on 9XE and on PE3 on Taranis
|
||||
// TRIMS_GPIO_PIN_RHL is on PC1 on all versions
|
||||
// turn on pull-ups on trim keys
|
||||
GPIOC->PUPDR = 0x00000004;
|
||||
#if defined(REV9E)
|
||||
GPIOG->PUPDR = 0x00000001;
|
||||
#else
|
||||
GPIOE->PUPDR = 0x00000040;
|
||||
|
||||
uint32_t i;
|
||||
for (i = 0; i < 50000; i += 1) {
|
||||
#endif
|
||||
|
||||
// wait for inputs to stabilize
|
||||
for (uint32_t i = 0; i < 50000; i += 1) {
|
||||
bwdt_reset();
|
||||
}
|
||||
|
||||
// now the second part of power on sequence
|
||||
// If we got here and the radio was not started by the watchdog/software reset,
|
||||
// then we must have a power button pressed. If not then we are in power on/off loop
|
||||
// and to terminate it, just wait here without turning on PWR pin. The power supply will
|
||||
// eventually exhaust and the radio will turn off.
|
||||
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
||||
// wait here until the power key is pressed
|
||||
while (GPIOD->IDR & PWR_GPIO_PIN_SWITCH) {
|
||||
bwdt_reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (!(TRIMS_GPIO_REG_LHR & TRIMS_GPIO_PIN_LHR) && !(TRIMS_GPIO_REG_RHL & TRIMS_GPIO_PIN_RHL)) {
|
||||
// Bootloader needed
|
||||
const uint8_t *src;
|
||||
|
||||
+70
-12
@@ -116,33 +116,91 @@ static int luaGetTime(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void luaPushDateTime(lua_State *L, uint32_t year, uint32_t mon, uint32_t day,
|
||||
uint32_t hour, uint32_t min, uint32_t sec)
|
||||
{
|
||||
lua_createtable(L, 0, 6);
|
||||
lua_pushtableinteger(L, "year", year);
|
||||
lua_pushtableinteger(L, "mon", mon);
|
||||
lua_pushtableinteger(L, "day", day);
|
||||
lua_pushtableinteger(L, "hour", hour);
|
||||
lua_pushtableinteger(L, "min", min);
|
||||
lua_pushtableinteger(L, "sec", sec);
|
||||
}
|
||||
|
||||
static int luaGetDateTime(lua_State *L)
|
||||
{
|
||||
struct gtm utm;
|
||||
gettime(&utm);
|
||||
lua_newtable(L);
|
||||
lua_pushtableinteger(L, "year", utm.tm_year+1900);
|
||||
lua_pushtableinteger(L, "mon", utm.tm_mon+1);
|
||||
lua_pushtableinteger(L, "day", utm.tm_mday);
|
||||
lua_pushtableinteger(L, "hour", utm.tm_hour);
|
||||
lua_pushtableinteger(L, "min", utm.tm_min);
|
||||
lua_pushtableinteger(L, "sec", utm.tm_sec);
|
||||
luaPushDateTime(L, utm.tm_year + 1900, utm.tm_mon + 1, utm.tm_mday, utm.tm_hour, utm.tm_min, utm.tm_sec);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void luaPushLatLon(TelemetrySensor & telemetrySensor, TelemetryItem & telemetryItem)
|
||||
/* result is lua table containing members ["lat"] and ["lon"] as lua_Number (doubles) in decimal degrees */
|
||||
{
|
||||
lua_Number lat = 0.0;
|
||||
lua_Number lon = 0.0;
|
||||
uint32_t gpsLat = 0;
|
||||
uint32_t gpsLon = 0;
|
||||
|
||||
telemetryItem.gps.extractLatitudeLongitude(&gpsLat, &gpsLon); /* close, but not the format we want */
|
||||
lat = gpsLat / 1000000.0;
|
||||
if (telemetryItem.gps.latitudeNS == 'S') lat = -lat;
|
||||
lon = gpsLon / 1000000.0;
|
||||
if (telemetryItem.gps.longitudeEW == 'W') lon = -lon;
|
||||
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushtablenumber(L, "lat", lat);
|
||||
lua_pushtablenumber(L, "lon", lon);
|
||||
}
|
||||
|
||||
static void luaPushTelemetryDateTime(TelemetrySensor & telemetrySensor, TelemetryItem & telemetryItem)
|
||||
{
|
||||
luaPushDateTime(L, telemetryItem.datetime.year + 2000, telemetryItem.datetime.month, telemetryItem.datetime.day,
|
||||
telemetryItem.datetime.hour, telemetryItem.datetime.min, telemetryItem.datetime.sec);
|
||||
}
|
||||
|
||||
static void luaPushCells(TelemetrySensor & telemetrySensor, TelemetryItem & telemetryItem)
|
||||
{
|
||||
if (telemetryItem.cells.count == 0)
|
||||
lua_pushinteger(L, (int)0); // returns zero if no cells
|
||||
else {
|
||||
lua_createtable(L, telemetryItem.cells.count, 0);
|
||||
for (int i = 0; i < telemetryItem.cells.count; i++) {
|
||||
lua_pushnumber(L, i + 1);
|
||||
lua_pushnumber(L, telemetryItem.cells.values[i].value / 100.0);
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void luaGetValueAndPush(int src)
|
||||
{
|
||||
getvalue_t value = getValue(src);
|
||||
getvalue_t value = getValue(src); // ignored for GPS, DATETIME, and CELLS
|
||||
|
||||
if (src >= MIXSRC_FIRST_TELEM && src <= MIXSRC_LAST_TELEM) {
|
||||
src = (src-MIXSRC_FIRST_TELEM) / 3;
|
||||
// telemetry values
|
||||
if (TELEMETRY_STREAMING() && telemetryItems[src].isAvailable()) {
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[src];
|
||||
if (telemetrySensor.prec > 0)
|
||||
lua_pushnumber(L, float(value)/(telemetrySensor.prec == 2 ? 100.0 : 10.0));
|
||||
else
|
||||
lua_pushinteger(L, value);
|
||||
switch (telemetrySensor.unit) {
|
||||
case UNIT_GPS:
|
||||
luaPushLatLon(telemetrySensor, telemetryItems[src]);
|
||||
break;
|
||||
case UNIT_DATETIME:
|
||||
luaPushTelemetryDateTime(telemetrySensor, telemetryItems[src]);
|
||||
break;
|
||||
case UNIT_CELLS:
|
||||
luaPushCells(telemetrySensor, telemetryItems[src]);
|
||||
break;
|
||||
default:
|
||||
if (telemetrySensor.prec > 0)
|
||||
lua_pushnumber(L, float(value)/(telemetrySensor.prec == 2 ? 100.0 : 10.0));
|
||||
else
|
||||
lua_pushinteger(L, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// telemetry not working, return zero for telemetry sources
|
||||
|
||||
+24
-13
@@ -44,29 +44,40 @@ void handleUsbConnection()
|
||||
{
|
||||
#if defined(PCBTARANIS) && !defined(SIMU)
|
||||
static bool usbStarted = false;
|
||||
|
||||
if (!usbStarted && usbPlugged()) {
|
||||
usbStarted = true;
|
||||
|
||||
/*
|
||||
We used to initialize USB peripheral and driver here.
|
||||
According to my tests this is way too late. The USB peripheral
|
||||
therefore does not have enough information to start responding to
|
||||
USB host request, which causes very slow USB device recognition,
|
||||
multiple USB device resets, etc...
|
||||
|
||||
If we want to change the USB profile, the procedure is simple:
|
||||
* USB cable must be disconnected
|
||||
* call usbDeInit();
|
||||
* call usbUnit(); which initializes USB with the new profile.
|
||||
Obviously the usbInit() should be modified to have a runtime
|
||||
selection of the USB profile.
|
||||
*/
|
||||
|
||||
#if defined(USB_MASS_STORAGE)
|
||||
opentxClose();
|
||||
#endif
|
||||
usbStart();
|
||||
#if defined(USB_MASS_STORAGE)
|
||||
usbPluggedIn();
|
||||
#endif
|
||||
usbStarted = true;
|
||||
}
|
||||
if (usbStarted && !usbPlugged()) {
|
||||
usbStarted = false;
|
||||
}
|
||||
|
||||
#if defined(USB_JOYSTICK)
|
||||
if (usbStarted) {
|
||||
if (!usbPlugged()) {
|
||||
//disable USB
|
||||
usbStop();
|
||||
usbStarted = false;
|
||||
}
|
||||
else {
|
||||
usbJoystickUpdate();
|
||||
}
|
||||
if (usbStarted ) {
|
||||
usbJoystickUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //#if defined(PCBTARANIS) && !defined(SIMU)
|
||||
}
|
||||
|
||||
|
||||
+8
-5
@@ -511,13 +511,16 @@ void evalInputs(uint8_t mode)
|
||||
}
|
||||
|
||||
#if defined(VIRTUALINPUTS)
|
||||
int getStickTrimValue(int stick, int value)
|
||||
int getStickTrimValue(int stick, int stickValue)
|
||||
{
|
||||
if (stick < 0)
|
||||
return 0;
|
||||
|
||||
int trim = trims[stick];
|
||||
if (stick == THR_STICK) {
|
||||
if (g_model.thrTrim) {
|
||||
int trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN;
|
||||
trim = ((g_model.throttleReversed ? (trim+trimMin) : (trim-trimMin)) * (RESX-value)) >> (RESX_SHIFT+1);
|
||||
trim = ((g_model.throttleReversed ? (trim+trimMin) : (trim-trimMin)) * (RESX-stickValue)) >> (RESX_SHIFT+1);
|
||||
}
|
||||
if (g_model.throttleReversed) {
|
||||
trim = -trim;
|
||||
@@ -526,12 +529,12 @@ int getStickTrimValue(int stick, int value)
|
||||
return trim;
|
||||
}
|
||||
|
||||
int getSourceTrimValue(int source, int value=0)
|
||||
int getSourceTrimValue(int source, int stickValue=0)
|
||||
{
|
||||
if (source >= MIXSRC_Rud && source <= MIXSRC_Ail)
|
||||
return getStickTrimValue(source - MIXSRC_Rud, value);
|
||||
return getStickTrimValue(source - MIXSRC_Rud, stickValue);
|
||||
else if (source >= MIXSRC_FIRST_INPUT && source <= MIXSRC_LAST_INPUT)
|
||||
return getStickTrimValue(virtualInputsTrims[source - MIXSRC_FIRST_INPUT], value);
|
||||
return getStickTrimValue(virtualInputsTrims[source - MIXSRC_FIRST_INPUT], stickValue);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
+18
-12
@@ -116,7 +116,7 @@
|
||||
#define MAX_FLIGHT_MODES 9
|
||||
#define MAX_MIXERS 64
|
||||
#define MAX_EXPOS 64
|
||||
#define NUM_LOGICAL_SWITCH 32 // number of custom switches
|
||||
#define NUM_LOGICAL_SWITCH 32 // number of logical switches
|
||||
#define NUM_CFN 64 // number of functions assigned to switches
|
||||
#define MAX_SCRIPTS 7
|
||||
#define MAX_INPUTS 32
|
||||
@@ -203,7 +203,7 @@ PACK(typedef struct {
|
||||
}) CurveInfo;
|
||||
#else
|
||||
struct CurveInfo {
|
||||
int8_t *crv;
|
||||
int8_t * crv;
|
||||
uint8_t points;
|
||||
bool custom;
|
||||
};
|
||||
@@ -328,7 +328,7 @@ enum BeeperMode {
|
||||
#if defined(CPUARM)
|
||||
#define EXTRA_GENERAL_FIELDS_ARM \
|
||||
uint8_t backlightBright; \
|
||||
int8_t currentCalib; \
|
||||
int8_t txCurrentCalibration; \
|
||||
int8_t temperatureWarn; \
|
||||
uint8_t mAhWarn; \
|
||||
uint16_t mAhUsed; \
|
||||
@@ -382,7 +382,7 @@ enum BeeperMode {
|
||||
#define LEN_SWITCH_NAME 3
|
||||
#define LEN_ANA_NAME 3
|
||||
#define LEN_BLUETOOTH_NAME 10
|
||||
#define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.uart3Mode==UART_MODE_SBUS_TRAINER/* || g_eeGeneral.uart3Mode==UART_MODE_CPPM_TRAINER*/)
|
||||
#define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.serial2Mode==UART_MODE_SBUS_TRAINER/* || g_eeGeneral.serial2Mode==UART_MODE_CPPM_TRAINER*/)
|
||||
|
||||
#if defined(REV9E)
|
||||
#define BLUETOOTH_FIELDS \
|
||||
@@ -394,7 +394,7 @@ enum BeeperMode {
|
||||
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
EXTRA_GENERAL_FIELDS_ARM \
|
||||
uint8_t uart3Mode:6; \
|
||||
uint8_t serial2Mode:6; \
|
||||
uint8_t slidersConfig:2; \
|
||||
uint8_t potsConfig; /*two bits for every pot*/\
|
||||
uint8_t backlightColor; \
|
||||
@@ -754,7 +754,7 @@ PACK(typedef struct {
|
||||
int8_t currModel;
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t vBatCalib;
|
||||
int8_t txVoltageCalibration;
|
||||
int8_t backlightMode;
|
||||
TrainerData trainer;
|
||||
uint8_t view; // index of view in main screen
|
||||
@@ -1749,7 +1749,7 @@ enum SwitchSources {
|
||||
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+NUM_LOGICAL_SWITCH-1,
|
||||
|
||||
SWSRC_ON,
|
||||
SWSRC_One,
|
||||
SWSRC_ONE,
|
||||
|
||||
#if defined(CPUARM)
|
||||
SWSRC_FIRST_FLIGHT_MODE,
|
||||
@@ -1764,12 +1764,13 @@ enum SwitchSources {
|
||||
SWSRC_FIRST = -SWSRC_LAST,
|
||||
|
||||
#if defined(CPUARM)
|
||||
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_FLIGHT_MODE,
|
||||
SWSRC_LAST_IN_MIXES = SWSRC_LAST_FLIGHT_MODE,
|
||||
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_COUNT-1,
|
||||
SWSRC_LAST_IN_MIXES = SWSRC_COUNT-1,
|
||||
#else
|
||||
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_LOGICAL_SWITCH,
|
||||
SWSRC_LAST_IN_MIXES = SWSRC_LAST_LOGICAL_SWITCH,
|
||||
#endif
|
||||
|
||||
SWSRC_FIRST_IN_LOGICAL_SWITCHES = -SWSRC_LAST_IN_LOGICAL_SWITCHES,
|
||||
SWSRC_FIRST_IN_MIXES = -SWSRC_LAST_IN_MIXES,
|
||||
|
||||
@@ -1962,7 +1963,11 @@ enum TimerModes {
|
||||
enum CountDownModes {
|
||||
COUNTDOWN_SILENT,
|
||||
COUNTDOWN_BEEPS,
|
||||
COUNTDOWN_VOICE
|
||||
COUNTDOWN_VOICE,
|
||||
#if defined(CPUARM) && defined(HAPTIC)
|
||||
COUNTDOWN_HAPTIC,
|
||||
#endif
|
||||
COUNTDOWN_COUNT
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
@@ -2152,8 +2157,9 @@ PACK(typedef struct {
|
||||
FlightModeData flightModeData[MAX_FLIGHT_MODES];
|
||||
|
||||
AVR_FIELD(int8_t ppmFrameLength) // 0=22.5ms (10ms-30ms) 0.5ms increments
|
||||
uint8_t thrTraceSrc;
|
||||
|
||||
|
||||
uint8_t thrTraceSrc;
|
||||
|
||||
swarnstate_t switchWarningState;
|
||||
swarnenable_t switchWarningEnable;
|
||||
|
||||
|
||||
+13
-18
@@ -1260,12 +1260,7 @@ void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
uint32_t pwr_check = pwrCheck();
|
||||
if (pwr_check == e_power_off) {
|
||||
// TODO this is quick & dirty
|
||||
lcdOff();
|
||||
BACKLIGHT_OFF();
|
||||
topLcdOff();
|
||||
SysTick->CTRL = 0; // turn off systick
|
||||
pwrOff();
|
||||
boardOff();
|
||||
}
|
||||
else if (pwr_check == e_power_press) {
|
||||
refresh = true;
|
||||
@@ -1276,7 +1271,7 @@ void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
|
||||
}
|
||||
#else
|
||||
if (pwrCheck() == e_power_off) {
|
||||
pwrOff(); // turn power off now
|
||||
boardOff(); // turn power off now
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1886,7 +1881,7 @@ void opentxClose()
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
uint32_t mAhUsed = g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib) / 8192 / 36;
|
||||
uint32_t mAhUsed = g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.txCurrentCalibration) / 8192 / 36;
|
||||
if (g_eeGeneral.mAhUsed != mAhUsed) {
|
||||
g_eeGeneral.mAhUsed = mAhUsed;
|
||||
}
|
||||
@@ -2013,16 +2008,16 @@ void checkBattery()
|
||||
counter = 10;
|
||||
int32_t instant_vbat = anaIn(TX_VOLTAGE);
|
||||
#if defined(PCBTARANIS)
|
||||
instant_vbat = (instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
|
||||
instant_vbat = (instant_vbat + instant_vbat*(g_eeGeneral.txVoltageCalibration)/128) * BATT_SCALE;
|
||||
instant_vbat >>= 11;
|
||||
instant_vbat += 2; // because of the diode
|
||||
#elif defined(PCBSKY9X)
|
||||
instant_vbat = (instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128) * 4191;
|
||||
instant_vbat = (instant_vbat + instant_vbat*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
|
||||
instant_vbat /= 55296;
|
||||
#elif defined(CPUM2560)
|
||||
instant_vbat = (instant_vbat*1112 + instant_vbat*g_eeGeneral.vBatCalib + (BandGap<<2)) / (BandGap<<3);
|
||||
instant_vbat = (instant_vbat*1112 + instant_vbat*g_eeGeneral.txVoltageCalibration + (BandGap<<2)) / (BandGap<<3);
|
||||
#else
|
||||
instant_vbat = (instant_vbat*16 + instant_vbat*g_eeGeneral.vBatCalib/8) / BandGap;
|
||||
instant_vbat = (instant_vbat*16 + instant_vbat*g_eeGeneral.txVoltageCalibration/8) / BandGap;
|
||||
#endif
|
||||
|
||||
static uint8_t s_batCheck;
|
||||
@@ -2061,7 +2056,7 @@ void checkBattery()
|
||||
else if (g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
|
||||
AUDIO_TX_TEMP_HIGH();
|
||||
}
|
||||
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
|
||||
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.txCurrentCalibration)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
|
||||
AUDIO_TX_MAH_HIGH();
|
||||
}
|
||||
#endif
|
||||
@@ -2353,7 +2348,7 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
|
||||
#if !defined(CPUARM) && !defined(SIMU)
|
||||
extern unsigned char __bss_end ;
|
||||
#define STACKPTR _SFR_IO16(0x3D)
|
||||
void stack_paint()
|
||||
void stackPaint()
|
||||
{
|
||||
// Init Stack while interrupts are disabled
|
||||
unsigned char *p ;
|
||||
@@ -2367,7 +2362,7 @@ void stack_paint()
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t stack_free()
|
||||
uint16_t stackAvailable()
|
||||
{
|
||||
unsigned char *p ;
|
||||
|
||||
@@ -2456,7 +2451,7 @@ void opentxInit(OPENTX_INIT_ARGS)
|
||||
backlightOn();
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL());
|
||||
serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL());
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && !defined(SIMU)
|
||||
@@ -2497,7 +2492,7 @@ int main(void)
|
||||
lcdInit();
|
||||
#endif
|
||||
|
||||
stack_paint();
|
||||
stackPaint();
|
||||
|
||||
#if defined(GUI)
|
||||
g_menuStack[0] = menuMainView;
|
||||
@@ -2577,7 +2572,7 @@ int main(void)
|
||||
opentxClose();
|
||||
lcd_clear() ;
|
||||
lcdRefresh() ;
|
||||
pwrOff(); // Only turn power off if necessary
|
||||
boardOff(); // Only turn power off if necessary
|
||||
wdt_disable();
|
||||
while(1); // never return from main() - there is no code to return back, if any delays occurs in physical power it does dead loop.
|
||||
#endif
|
||||
|
||||
+41
-42
@@ -297,33 +297,39 @@
|
||||
#include "debug.h"
|
||||
|
||||
#if defined(SIMU)
|
||||
#include "targets/simu/simpgmspace.h"
|
||||
#include "targets/simu/simpgmspace.h"
|
||||
#elif defined(CPUARM)
|
||||
typedef const unsigned char pm_uchar;
|
||||
typedef const char pm_char;
|
||||
typedef const uint16_t pm_uint16_t;
|
||||
typedef const uint8_t pm_uint8_t;
|
||||
typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
#define pgm_read_byte(address_short) (*(uint8_t*)(address_short))
|
||||
#define PSTR(adr) adr
|
||||
#define PROGMEM
|
||||
#define pgm_read_adr(x) *(x)
|
||||
#define cli()
|
||||
#define sei()
|
||||
extern void boardInit();
|
||||
typedef const unsigned char pm_uchar;
|
||||
typedef const char pm_char;
|
||||
typedef const uint16_t pm_uint16_t;
|
||||
typedef const uint8_t pm_uint8_t;
|
||||
typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
#define pgm_read_byte(address_short) (*(uint8_t*)(address_short))
|
||||
#define PSTR(adr) adr
|
||||
#define PROGMEM
|
||||
#define pgm_read_adr(x) *(x)
|
||||
#define cli()
|
||||
#define sei()
|
||||
extern void boardInit();
|
||||
#if defined(PCBTARANIS)
|
||||
extern void boardOff();
|
||||
#else
|
||||
#define boardOff() pwrOff();
|
||||
#endif
|
||||
#else
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include "pgmtypes.h"
|
||||
#define boardOff() pwrOff();
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include "pgmtypes.h"
|
||||
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/sleep.h>
|
||||
#include <avr/interrupt.h>
|
||||
#define F_CPU 16000000UL // 16 MHz
|
||||
#include <util/delay.h>
|
||||
#define pgm_read_adr(address_short) pgm_read_word(address_short)
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/sleep.h>
|
||||
#include <avr/interrupt.h>
|
||||
#define F_CPU 16000000UL // 16 MHz
|
||||
#include <util/delay.h>
|
||||
#define pgm_read_adr(address_short) pgm_read_word(address_short)
|
||||
#include <avr/wdt.h>
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -416,6 +422,7 @@ extern void boardInit();
|
||||
typedef int32_t rotenc_t;
|
||||
typedef int32_t getvalue_t;
|
||||
typedef uint32_t mixsrc_t;
|
||||
typedef int8_t swsrc_t;
|
||||
#else
|
||||
#define tmr10ms_t uint16_t
|
||||
extern volatile tmr10ms_t g_tmr10ms;
|
||||
@@ -430,7 +437,7 @@ extern void boardInit();
|
||||
typedef int8_t rotenc_t;
|
||||
typedef int16_t getvalue_t;
|
||||
typedef uint8_t mixsrc_t;
|
||||
void watchdogSetTimeout(uint32_t timeout);
|
||||
typedef int8_t swsrc_t;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
@@ -529,7 +536,7 @@ typedef struct {
|
||||
MASK_CFN_TYPE activeSwitches;
|
||||
tmr10ms_t lastFunctionTime[NUM_CFN];
|
||||
|
||||
inline bool isFuunctionActive(uint8_t func)
|
||||
inline bool isFunctionActive(uint8_t func)
|
||||
{
|
||||
return activeFunctions & ((MASK_FUNC_TYPE)1 << func);
|
||||
}
|
||||
@@ -716,14 +723,14 @@ extern uint8_t flightModeTransitionLast;
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
inline int getAvailableMemory() { return 1000; }
|
||||
inline int availableMemory() { return 1000; }
|
||||
#elif defined(CPUARM) && !defined(SIMU)
|
||||
extern unsigned char *heap;
|
||||
extern int _end;
|
||||
extern int _estack;
|
||||
extern int _main_stack_start;
|
||||
extern int _heap_end;
|
||||
#define getAvailableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
||||
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
||||
#endif
|
||||
|
||||
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
||||
@@ -767,7 +774,7 @@ void logicalSwitchesReset();
|
||||
#endif
|
||||
|
||||
extern swarnstate_t switches_states;
|
||||
int8_t getMovedSwitch();
|
||||
swsrc_t getMovedSwitch();
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define GET_MOVED_SOURCE_PARAMS uint8_t min
|
||||
@@ -941,11 +948,8 @@ extern uint16_t lastMixerDuration;
|
||||
uint16_t getTmr16KHz();
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint32_t stack_free(uint32_t tid);
|
||||
void stack_paint();
|
||||
#else
|
||||
uint16_t stack_free();
|
||||
#if !defined(CPUARM)
|
||||
uint16_t stackAvailable();
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH)
|
||||
@@ -1049,12 +1053,7 @@ template<class t> void SWAP(t & a, t & b) { t tmp = b; b = a; a = tmp; }
|
||||
uint16_t isqrt32(uint32_t n);
|
||||
|
||||
#if defined(CPUARM) && !defined(BOOT)
|
||||
#if !defined(SIMU)
|
||||
extern "C" {
|
||||
#include <CoOS.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "tasks_arm.h"
|
||||
extern OS_MutexID mixerMutex;
|
||||
inline void pauseMixerCalculations()
|
||||
{
|
||||
@@ -1332,7 +1331,7 @@ extern CustomFunctionsContext modelFunctionsContext;
|
||||
extern CustomFunctionsContext globalFunctionsContext;
|
||||
inline bool isFunctionActive(uint8_t func)
|
||||
{
|
||||
return globalFunctionsContext.isFuunctionActive(func) || modelFunctionsContext.isFuunctionActive(func);
|
||||
return globalFunctionsContext.isFunctionActive(func) || modelFunctionsContext.isFunctionActive(func);
|
||||
}
|
||||
void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||
inline void customFunctionsReset()
|
||||
@@ -1342,7 +1341,7 @@ inline void customFunctionsReset()
|
||||
}
|
||||
#else
|
||||
extern CustomFunctionsContext modelFunctionsContext;
|
||||
#define isFunctionActive(func) modelFunctionsContext.isFuunctionActive(func)
|
||||
#define isFunctionActive(func) modelFunctionsContext.isFunctionActive(func)
|
||||
void evalFunctions();
|
||||
#define customFunctionsReset() modelFunctionsContext.reset()
|
||||
#endif
|
||||
|
||||
+52
-277
@@ -1,297 +1,72 @@
|
||||
/*
|
||||
* Authors - Gerard Valade <gerard.valade@gmail.com>
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* Adapted from frsky
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "serial.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
Receive serial (RS-232) characters, detecting and storing each Fr-Sky
|
||||
0x7e-framed packet as it arrives. When a complete packet has been
|
||||
received, process its data into storage variables. NOTE: This is an
|
||||
interrupt routine and should not get too lengthy. I originally had
|
||||
the buffer being checked in the perMain function (because per10ms
|
||||
isn't quite often enough for data streaming at 9600baud) but alas
|
||||
that scheme lost packets also. So each packet is parsed as it arrives,
|
||||
directly at the ISR function (through a call to frskyProcessPacket).
|
||||
#define PRINTF_BUFFER_SIZE 256
|
||||
|
||||
If this proves a problem in the future, then I'll just have to implement
|
||||
a second buffer to receive data while one buffer is being processed (slowly).
|
||||
*/
|
||||
|
||||
#ifndef SIMU
|
||||
ISR (USART0_RX_vect)
|
||||
void serialPutc(char c)
|
||||
{
|
||||
uint8_t iostat; //USART control and Status Register 0 A
|
||||
// uint8_t rh; //USART control and Status Register 0 B
|
||||
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
|
||||
sei();
|
||||
iostat = UCSR0A; //USART control and Status Register 0 A
|
||||
uint8_t byte = UDR0;
|
||||
|
||||
/*
|
||||
bit 7 6 5 4 3 2 1 0
|
||||
RxC0 TxC0 UDRE0 FE0 DOR0 UPE0 U2X0 MPCM0
|
||||
|
||||
RxC0: Receive complete
|
||||
TXC0: Transmit Complete
|
||||
UDRE0: USART Data Register Empty
|
||||
FE0: Frame Error
|
||||
DOR0: Data OverRun
|
||||
UPE0: USART Parity Error
|
||||
U2X0: Double Tx Speed
|
||||
MPCM0: MultiProcessor Comms Mode
|
||||
*/
|
||||
if (iostat & ((1 << FE0) | (1 << DOR0) | (1 << UPE0))) {
|
||||
byte = 0;
|
||||
}
|
||||
//rh = UCSR0B; //USART control and Status Register 0 B
|
||||
#ifdef MAVLINK
|
||||
(RXHandler)(byte);
|
||||
#if defined(USB_SERIAL)
|
||||
usbSerialPutc(c);
|
||||
#else
|
||||
serial2Putc(c);
|
||||
#endif
|
||||
|
||||
cli();
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void SERIAL_EnableRXD(void) {
|
||||
UCSR0B |= (1 << RXEN0); // enable RX
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SERIAL_DisableRXD(void) {
|
||||
UCSR0B &= ~(1 << RXEN0); // disable RX
|
||||
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
USART0 (transmit) Data Register Emtpy ISR
|
||||
Usef to transmit FrSky data packets, which are buffered in frskyTXBuffer.
|
||||
*/
|
||||
uint8_t serialTxBuffer[MAX_TX_BUFFER]; // 32 characters
|
||||
uint8_t serialTxBufferCount = 0;
|
||||
uint8_t * ptrTxISR = 0;
|
||||
serial_tx_state_t serialTxState = TX_STATE_EMPTY;
|
||||
|
||||
#ifndef SIMU
|
||||
ISR(USART0_UDRE_vect)
|
||||
void serialPrintf(const char * format, ...)
|
||||
{
|
||||
if (serialTxBufferCount > 0) {
|
||||
UDR0 = *ptrTxISR++;
|
||||
serialTxBufferCount--;
|
||||
} else {
|
||||
UCSR0B &= ~(1 << UDRIE0); // disable UDRE0 interrupt
|
||||
serialTxState = TX_STATE_EMPTY;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
va_list arglist;
|
||||
char tmp[PRINTF_BUFFER_SIZE];
|
||||
|
||||
void SERIAL_start_uart_send() {
|
||||
ptrTxISR = serialTxBuffer;
|
||||
serialTxBufferCount = 0;
|
||||
va_start(arglist, format);
|
||||
vsnprintf(tmp, PRINTF_BUFFER_SIZE, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
const char *t = tmp;
|
||||
while (*t) {
|
||||
serialPutc(*t++);
|
||||
}
|
||||
}
|
||||
|
||||
void SERIAL_end_uart_send() {
|
||||
ptrTxISR = serialTxBuffer;
|
||||
//UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt
|
||||
serialTxState = TX_STATE_READY;
|
||||
void serialCrlf()
|
||||
{
|
||||
serialPutc('\r');
|
||||
serialPutc('\n');
|
||||
}
|
||||
|
||||
void SERIAL_send_uart_bytes(const uint8_t * buf, uint16_t len) {
|
||||
while (len--) {
|
||||
*ptrTxISR++ = *buf++;
|
||||
serialTxBufferCount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SERIAL_transmitBuffer(uint8_t len) {
|
||||
serialTxBufferCount = len;
|
||||
ptrTxISR = serialTxBuffer;
|
||||
//UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt
|
||||
serialTxState = TX_STATE_READY;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SERIAL_startTX(void) {
|
||||
if (serialTxState == TX_STATE_READY) {
|
||||
serialTxState = TX_STATE_BUSY;
|
||||
UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt
|
||||
}
|
||||
}
|
||||
|
||||
static void uart_4800(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 4800
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_9600(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 9600
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_14400(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 14400
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_19200(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 19200
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_38400(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 38400
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_57600(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 57600
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void uart_76800(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 76800
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void SERIAL_EnableTXD(void) {
|
||||
//UCSR0B |= (1 << TXEN0); // enable TX
|
||||
UCSR0B |= (1 << TXEN0) | (1 << UDRIE0); // enable TX and TX interrupt
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SERIAL_DisableTXD(void) {
|
||||
UCSR0B &= ~(1 << TXEN0); // disable TX
|
||||
UCSR0B &= ~(1 << UDRIE0); // disable Interrupt
|
||||
}
|
||||
#endif
|
||||
|
||||
void SERIAL_Init(void) {
|
||||
DDRE &= ~(1 << DDE0); // set RXD0 pin as input
|
||||
PORTE &= ~(1 << PORTE0); // disable pullup on RXD0 pin
|
||||
|
||||
switch (g_eeGeneral.mavbaud) {
|
||||
case BAUD_4800:
|
||||
uart_4800();
|
||||
break;
|
||||
case BAUD_9600:
|
||||
uart_9600();
|
||||
break;
|
||||
case BAUD_14400:
|
||||
uart_14400();
|
||||
break;
|
||||
case BAUD_19200:
|
||||
uart_19200();
|
||||
break;
|
||||
case BAUD_38400:
|
||||
uart_38400();
|
||||
break;
|
||||
case BAUD_57600:
|
||||
uart_57600();
|
||||
break;
|
||||
case BAUD_76800:
|
||||
uart_76800();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// UCSR0A &= ~(1 << U2X0); // disable double speed operation
|
||||
// set 8N1
|
||||
UCSR0B = 0 | (0 << RXCIE0) | (0 << TXCIE0) | (0 << UDRIE0) | (0 << RXEN0) | (0 << TXEN0) | (0 << UCSZ02);
|
||||
UCSR0C = 0 | (1 << UCSZ01) | (1 << UCSZ00);
|
||||
while (UCSR0A & (1 << RXC0))
|
||||
UDR0; // flush receive buffer
|
||||
|
||||
SERIAL_EnableTXD();
|
||||
SERIAL_EnableRXD();
|
||||
}
|
||||
|
||||
|
||||
+55
-59
@@ -1,59 +1,55 @@
|
||||
/*
|
||||
* Authors - Gerard Valade <gerard.valade@gmail.com>
|
||||
*
|
||||
* Adapted from frsky
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SERIAL_H_
|
||||
#define _SERIAL_H_
|
||||
|
||||
typedef enum serial_tx_state_ {
|
||||
TX_STATE_EMPTY = 0, //
|
||||
TX_STATE_READY, //
|
||||
TX_STATE_BUSY
|
||||
} serial_tx_state_t;
|
||||
extern serial_tx_state_t serialTxState;
|
||||
|
||||
//! \brief Baudrate selection.
|
||||
enum SERIAL_BAUDS {
|
||||
BAUD_4800 = 0,
|
||||
BAUD_9600,
|
||||
BAUD_14400,
|
||||
BAUD_19200,
|
||||
BAUD_38400,
|
||||
BAUD_57600,
|
||||
BAUD_76800
|
||||
};
|
||||
|
||||
//! \brief Definition of baudrate settings item choices.
|
||||
typedef void (*SerialFuncP)(uint8_t event);
|
||||
|
||||
extern SerialFuncP RXHandler;
|
||||
|
||||
#define MAX_TX_BUFFER 32
|
||||
//#if 0
|
||||
extern uint8_t serialTxBuffer[MAX_TX_BUFFER]; // 32 characters
|
||||
extern uint8_t serialTxBufferCount;
|
||||
extern uint8_t * ptrTxISR;
|
||||
//#endif
|
||||
|
||||
void SERIAL_Init(void);
|
||||
//void SERIAL_transmitBuffer(uint8_t len);
|
||||
extern void SERIAL_start_uart_send();
|
||||
extern void SERIAL_end_uart_send();
|
||||
extern void SERIAL_send_uart_bytes(uint8_t * buf, uint16_t len);
|
||||
|
||||
void SERIAL_startTX(void);
|
||||
#define IS_TX_BUSY (serialTxState!=TX_STATE_EMPTY)
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SERIAL_H_
|
||||
#define _SERIAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void serialPutc(char c);
|
||||
void serialPrintf(const char *format, ...);
|
||||
void serialCrlf();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define serialPrint(...) do { serialPrintf(__VA_ARGS__); serialCrlf(); } while(0)
|
||||
|
||||
#endif // _SERIAL_H_
|
||||
|
||||
|
||||
+44
-33
@@ -72,11 +72,18 @@ volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value = 0;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
tmr10ms_t switchesMidposStart[6] = { 0 };
|
||||
#if defined(REV9E)
|
||||
tmr10ms_t switchesMidposStart[6];
|
||||
#else
|
||||
tmr10ms_t switchesMidposStart[16]; // TODO constant
|
||||
#endif
|
||||
uint64_t switchesPos = 0;
|
||||
tmr10ms_t potsLastposStart[NUM_XPOTS] = { 0 };
|
||||
tmr10ms_t potsLastposStart[NUM_XPOTS];
|
||||
uint8_t potsPos[NUM_XPOTS];
|
||||
|
||||
#define SWITCH_POSITION(sw) (switchesPos & ((MASK_CFN_TYPE)1<<(sw)))
|
||||
#define POT_POSITION(sw) ((potsPos[(sw)/XPOTS_MULTIPOS_COUNT] & 0x0f) == ((sw) % XPOTS_MULTIPOS_COUNT))
|
||||
|
||||
div_t switchInfo(int switchPosition)
|
||||
{
|
||||
return div(switchPosition-SWSRC_FIRST_SWITCH, 3);
|
||||
@@ -92,7 +99,7 @@ uint64_t check2PosSwitchPosition(EnumKeys sw)
|
||||
else
|
||||
index = sw - SW_SA0 + 2;
|
||||
|
||||
result = ((int64_t)1 << index);
|
||||
result = ((uint64_t)1 << index);
|
||||
|
||||
if (!(switchesPos & result)) {
|
||||
PLAY_SWITCH_MOVED(index);
|
||||
@@ -101,32 +108,33 @@ uint64_t check2PosSwitchPosition(EnumKeys sw)
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t check3PosSwitchPosition(uint8_t idx, EnumKeys sw, bool startup)
|
||||
uint64_t check3PosSwitchPosition(uint8_t idx, EnumKeys sw, bool startup)
|
||||
{
|
||||
uint32_t result;
|
||||
uint64_t result;
|
||||
uint32_t index;
|
||||
|
||||
if (switchState(sw)) {
|
||||
index = sw - SW_SA0;
|
||||
result = (1 << index);
|
||||
result = ((MASK_CFN_TYPE)1 << index);
|
||||
switchesMidposStart[idx] = 0;
|
||||
}
|
||||
else if (switchState(EnumKeys(sw+2))) {
|
||||
index = sw - SW_SA0 + 2;
|
||||
result = (1 << index);
|
||||
switchesMidposStart[idx] = 0;
|
||||
}
|
||||
else if (startup || (switchesPos & (1 << (sw - SW_SA0 + 1))) || g_eeGeneral.switchesDelay==SWITCHES_DELAY_NONE || (switchesMidposStart[idx] && (tmr10ms_t)(get_tmr10ms() - switchesMidposStart[idx]) > SWITCHES_DELAY())) {
|
||||
index = sw - SW_SA0 + 1;
|
||||
result = (1 << index);
|
||||
result = ((MASK_CFN_TYPE)1 << index);
|
||||
switchesMidposStart[idx] = 0;
|
||||
}
|
||||
else {
|
||||
index = sw - SW_SA0 + 1;
|
||||
if (!switchesMidposStart[idx]) {
|
||||
switchesMidposStart[idx] = get_tmr10ms();
|
||||
if (startup || SWITCH_POSITION(index) || g_eeGeneral.switchesDelay==SWITCHES_DELAY_NONE || (switchesMidposStart[idx] && (tmr10ms_t)(get_tmr10ms() - switchesMidposStart[idx]) > SWITCHES_DELAY())) {
|
||||
result = ((MASK_CFN_TYPE)1 << index);
|
||||
switchesMidposStart[idx] = 0;
|
||||
}
|
||||
else {
|
||||
result = (switchesPos & ((MASK_CFN_TYPE)0x7 << (sw - SW_SA0)));
|
||||
if (!switchesMidposStart[idx]) {
|
||||
switchesMidposStart[idx] = get_tmr10ms();
|
||||
}
|
||||
}
|
||||
result = (switchesPos & (0x7 << (sw - SW_SA0)));
|
||||
}
|
||||
|
||||
if (!(switchesPos & result)) {
|
||||
@@ -151,6 +159,19 @@ void getSwitchesPosition(bool startup)
|
||||
CHECK_3POS(5, SW_SG);
|
||||
CHECK_2POS(SW_SH);
|
||||
|
||||
#if defined(REV9E)
|
||||
CHECK_3POS(6, SW_SI);
|
||||
CHECK_3POS(7, SW_SJ);
|
||||
CHECK_3POS(8, SW_SK);
|
||||
CHECK_3POS(9, SW_SL);
|
||||
CHECK_3POS(10, SW_SM);
|
||||
CHECK_3POS(11, SW_SN);
|
||||
CHECK_3POS(12, SW_SO);
|
||||
CHECK_3POS(13, SW_SP);
|
||||
CHECK_3POS(14, SW_SQ);
|
||||
CHECK_3POS(15, SW_SR);
|
||||
#endif
|
||||
|
||||
switchesPos = newPos;
|
||||
|
||||
for (int i=0; i<NUM_XPOTS; i++) {
|
||||
@@ -178,10 +199,8 @@ void getSwitchesPosition(bool startup)
|
||||
}
|
||||
}
|
||||
}
|
||||
#define SWITCH_POSITION(sw) (switchesPos & (1<<(sw)))
|
||||
#define POT_POSITION(sw) ((potsPos[(sw)/XPOTS_MULTIPOS_COUNT] & 0x0f) == ((sw) % XPOTS_MULTIPOS_COUNT))
|
||||
|
||||
getvalue_t getValueForLogicalSwitch(uint8_t i)
|
||||
getvalue_t getValueForLogicalSwitch(mixsrc_t i)
|
||||
{
|
||||
getvalue_t result = getValue(i);
|
||||
if (i>=MIXSRC_FIRST_INPUT && i<=MIXSRC_LAST_INPUT) {
|
||||
@@ -276,7 +295,7 @@ bool getLogicalSwitch(uint8_t idx)
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint8_t v1 = ls->v1;
|
||||
mixsrc_t v1 = ls->v1;
|
||||
#if defined(FRSKY)
|
||||
// Telemetry
|
||||
if (v1 >= MIXSRC_FIRST_TELEM) {
|
||||
@@ -436,7 +455,7 @@ bool getSwitch(int8_t swtch)
|
||||
|
||||
uint8_t cs_idx = abs(swtch);
|
||||
|
||||
if (cs_idx == SWSRC_One) {
|
||||
if (cs_idx == SWSRC_ONE) {
|
||||
result = !s_mixer_first_run_done;
|
||||
}
|
||||
else if (cs_idx == SWSRC_ON) {
|
||||
@@ -444,18 +463,10 @@ bool getSwitch(int8_t swtch)
|
||||
}
|
||||
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
||||
#if defined(PCBTARANIS)
|
||||
if (flags & GETSWITCH_MIDPOS_DELAY) {
|
||||
div_t swinfo = switchInfo(cs_idx);
|
||||
if (IS_3POS(swinfo.quot)) {
|
||||
result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
|
||||
}
|
||||
else {
|
||||
result = switchState((EnumKeys)(SW_BASE+cs_idx-SWSRC_FIRST_SWITCH));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (flags & GETSWITCH_MIDPOS_DELAY)
|
||||
result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
|
||||
else
|
||||
result = switchState((EnumKeys)(SW_BASE+cs_idx-SWSRC_FIRST_SWITCH));
|
||||
}
|
||||
#else
|
||||
result = switchState((EnumKeys)(SW_BASE+cs_idx-SWSRC_FIRST_SWITCH));
|
||||
#endif
|
||||
@@ -552,10 +563,10 @@ void evalLogicalSwitches(bool isCurrentPhase)
|
||||
#endif
|
||||
|
||||
swarnstate_t switches_states = 0;
|
||||
int8_t getMovedSwitch()
|
||||
swsrc_t getMovedSwitch()
|
||||
{
|
||||
static tmr10ms_t s_move_last_time = 0;
|
||||
int8_t result = 0;
|
||||
swsrc_t result = 0;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
for (int i=0; i<NUM_SWITCHES; i++) {
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
* Authors - Gerard Valade <gerard.valade@gmail.com>
|
||||
*
|
||||
* Adapted from frsky
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "serial_driver.h"
|
||||
#include "opentx.h"
|
||||
|
||||
/*
|
||||
Receive serial (RS-232) characters, detecting and storing each Fr-Sky
|
||||
0x7e-framed packet as it arrives. When a complete packet has been
|
||||
received, process its data into storage variables. NOTE: This is an
|
||||
interrupt routine and should not get too lengthy. I originally had
|
||||
the buffer being checked in the perMain function (because per10ms
|
||||
isn't quite often enough for data streaming at 9600baud) but alas
|
||||
that scheme lost packets also. So each packet is parsed as it arrives,
|
||||
directly at the ISR function (through a call to frskyProcessPacket).
|
||||
|
||||
If this proves a problem in the future, then I'll just have to implement
|
||||
a second buffer to receive data while one buffer is being processed (slowly).
|
||||
*/
|
||||
|
||||
#ifndef SIMU
|
||||
ISR (USART0_RX_vect)
|
||||
{
|
||||
uint8_t iostat; //USART control and Status Register 0 A
|
||||
// uint8_t rh; //USART control and Status Register 0 B
|
||||
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
|
||||
sei();
|
||||
iostat = UCSR0A; //USART control and Status Register 0 A
|
||||
uint8_t byte = UDR0;
|
||||
|
||||
/*
|
||||
bit 7 6 5 4 3 2 1 0
|
||||
RxC0 TxC0 UDRE0 FE0 DOR0 UPE0 U2X0 MPCM0
|
||||
|
||||
RxC0: Receive complete
|
||||
TXC0: Transmit Complete
|
||||
UDRE0: USART Data Register Empty
|
||||
FE0: Frame Error
|
||||
DOR0: Data OverRun
|
||||
UPE0: USART Parity Error
|
||||
U2X0: Double Tx Speed
|
||||
MPCM0: MultiProcessor Comms Mode
|
||||
*/
|
||||
if (iostat & ((1 << FE0) | (1 << DOR0) | (1 << UPE0))) {
|
||||
byte = 0;
|
||||
}
|
||||
//rh = UCSR0B; //USART control and Status Register 0 B
|
||||
#ifdef MAVLINK
|
||||
(RXHandler)(byte);
|
||||
#endif
|
||||
|
||||
cli();
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void SERIAL_EnableRXD(void) {
|
||||
UCSR0B |= (1 << RXEN0); // enable RX
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SERIAL_DisableRXD(void) {
|
||||
UCSR0B &= ~(1 << RXEN0); // disable RX
|
||||
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
USART0 (transmit) Data Register Emtpy ISR
|
||||
Usef to transmit FrSky data packets, which are buffered in frskyTXBuffer.
|
||||
*/
|
||||
uint8_t serialTxBuffer[MAX_TX_BUFFER]; // 32 characters
|
||||
uint8_t serialTxBufferCount = 0;
|
||||
uint8_t * ptrTxISR = 0;
|
||||
serial_tx_state_t serialTxState = TX_STATE_EMPTY;
|
||||
|
||||
#ifndef SIMU
|
||||
ISR(USART0_UDRE_vect)
|
||||
{
|
||||
if (serialTxBufferCount > 0) {
|
||||
UDR0 = *ptrTxISR++;
|
||||
serialTxBufferCount--;
|
||||
} else {
|
||||
UCSR0B &= ~(1 << UDRIE0); // disable UDRE0 interrupt
|
||||
serialTxState = TX_STATE_EMPTY;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void SERIAL_start_uart_send() {
|
||||
ptrTxISR = serialTxBuffer;
|
||||
serialTxBufferCount = 0;
|
||||
}
|
||||
|
||||
void SERIAL_end_uart_send() {
|
||||
ptrTxISR = serialTxBuffer;
|
||||
//UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt
|
||||
serialTxState = TX_STATE_READY;
|
||||
}
|
||||
|
||||
void SERIAL_send_uart_bytes(const uint8_t * buf, uint16_t len) {
|
||||
while (len--) {
|
||||
*ptrTxISR++ = *buf++;
|
||||
serialTxBufferCount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SERIAL_transmitBuffer(uint8_t len) {
|
||||
serialTxBufferCount = len;
|
||||
ptrTxISR = serialTxBuffer;
|
||||
//UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt
|
||||
serialTxState = TX_STATE_READY;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SERIAL_startTX(void) {
|
||||
if (serialTxState == TX_STATE_READY) {
|
||||
serialTxState = TX_STATE_BUSY;
|
||||
UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt
|
||||
}
|
||||
}
|
||||
|
||||
static void uart_4800(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 4800
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_9600(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 9600
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_14400(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 14400
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_19200(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 19200
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_38400(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 38400
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uart_57600(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 57600
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void uart_76800(void) {
|
||||
#ifndef SIMU
|
||||
#undef BAUD // avoid compiler warning
|
||||
#define BAUD 76800
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
#if USE_2X
|
||||
UCSR0A |= (1 << U2X0);
|
||||
#else
|
||||
UCSR0A &= ~(1 << U2X0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void SERIAL_EnableTXD(void) {
|
||||
//UCSR0B |= (1 << TXEN0); // enable TX
|
||||
UCSR0B |= (1 << TXEN0) | (1 << UDRIE0); // enable TX and TX interrupt
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SERIAL_DisableTXD(void) {
|
||||
UCSR0B &= ~(1 << TXEN0); // disable TX
|
||||
UCSR0B &= ~(1 << UDRIE0); // disable Interrupt
|
||||
}
|
||||
#endif
|
||||
|
||||
void SERIAL_Init(void) {
|
||||
DDRE &= ~(1 << DDE0); // set RXD0 pin as input
|
||||
PORTE &= ~(1 << PORTE0); // disable pullup on RXD0 pin
|
||||
|
||||
switch (g_eeGeneral.mavbaud) {
|
||||
case BAUD_4800:
|
||||
uart_4800();
|
||||
break;
|
||||
case BAUD_9600:
|
||||
uart_9600();
|
||||
break;
|
||||
case BAUD_14400:
|
||||
uart_14400();
|
||||
break;
|
||||
case BAUD_19200:
|
||||
uart_19200();
|
||||
break;
|
||||
case BAUD_38400:
|
||||
uart_38400();
|
||||
break;
|
||||
case BAUD_57600:
|
||||
uart_57600();
|
||||
break;
|
||||
case BAUD_76800:
|
||||
uart_76800();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// UCSR0A &= ~(1 << U2X0); // disable double speed operation
|
||||
// set 8N1
|
||||
UCSR0B = 0 | (0 << RXCIE0) | (0 << TXCIE0) | (0 << UDRIE0) | (0 << RXEN0) | (0 << TXEN0) | (0 << UCSZ02);
|
||||
UCSR0C = 0 | (1 << UCSZ01) | (1 << UCSZ00);
|
||||
while (UCSR0A & (1 << RXC0))
|
||||
UDR0; // flush receive buffer
|
||||
|
||||
SERIAL_EnableTXD();
|
||||
SERIAL_EnableRXD();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Authors - Gerard Valade <gerard.valade@gmail.com>
|
||||
*
|
||||
* Adapted from frsky
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SERIAL_H_
|
||||
#define _SERIAL_H_
|
||||
|
||||
typedef enum serial_tx_state_ {
|
||||
TX_STATE_EMPTY = 0, //
|
||||
TX_STATE_READY, //
|
||||
TX_STATE_BUSY
|
||||
} serial_tx_state_t;
|
||||
extern serial_tx_state_t serialTxState;
|
||||
|
||||
//! \brief Baudrate selection.
|
||||
enum SERIAL_BAUDS {
|
||||
BAUD_4800 = 0,
|
||||
BAUD_9600,
|
||||
BAUD_14400,
|
||||
BAUD_19200,
|
||||
BAUD_38400,
|
||||
BAUD_57600,
|
||||
BAUD_76800
|
||||
};
|
||||
|
||||
//! \brief Definition of baudrate settings item choices.
|
||||
typedef void (*SerialFuncP)(uint8_t event);
|
||||
|
||||
extern SerialFuncP RXHandler;
|
||||
|
||||
#define MAX_TX_BUFFER 32
|
||||
//#if 0
|
||||
extern uint8_t serialTxBuffer[MAX_TX_BUFFER]; // 32 characters
|
||||
extern uint8_t serialTxBufferCount;
|
||||
extern uint8_t * ptrTxISR;
|
||||
//#endif
|
||||
|
||||
void SERIAL_Init(void);
|
||||
//void SERIAL_transmitBuffer(uint8_t len);
|
||||
extern void SERIAL_start_uart_send();
|
||||
extern void SERIAL_end_uart_send();
|
||||
extern void SERIAL_send_uart_bytes(uint8_t * buf, uint16_t len);
|
||||
|
||||
void SERIAL_startTX(void);
|
||||
#define IS_TX_BUSY (serialTxState!=TX_STATE_EMPTY)
|
||||
|
||||
#endif
|
||||
@@ -62,11 +62,10 @@ inline void boardInit()
|
||||
OCR2A = 156;
|
||||
TIMSK2 |= (1<<OCIE2A) | (1<<TOIE2); // Enable Output-Compare and Overflow interrrupts
|
||||
|
||||
// Set up Phase correct Waveform Gen. mode, at clk/64 = 250,000 counts/second
|
||||
// (Higher speed allows for finer control of frequencies in the audio range.)
|
||||
// TIMER4 set into CTC mode, prescaler 16MHz/64=250 kHz
|
||||
// Used for audio tone generation
|
||||
TCCR4B = (1<<WGM42) | (0b011 << CS00);
|
||||
TCCR4A = (0b01<<WGM40);
|
||||
TCCR4A = 0x00;
|
||||
|
||||
#if defined (VOICE) // OLD FROM GRUVIN9X, TO REWRITE
|
||||
// SOMO set-up
|
||||
|
||||
@@ -330,7 +330,7 @@ void *main_thread(void *)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
stack_paint();
|
||||
stackPaint();
|
||||
#endif
|
||||
|
||||
s_current_protocol[0] = 255;
|
||||
@@ -657,12 +657,10 @@ void eepromWriteBlock(uint8_t * pointer_ram, uint32_t pointer_eeprom, uint32_t s
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint16_t stack_free()
|
||||
uint16_t stackAvailable()
|
||||
{
|
||||
return 500;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void EeFsDump(){
|
||||
@@ -1228,7 +1226,6 @@ uint32_t pwrPressed() { return false; }
|
||||
#else
|
||||
uint32_t pwrCheck() { return true; }
|
||||
#endif
|
||||
void usbStart() { }
|
||||
int usbPlugged() { return false; }
|
||||
void USART_DeInit(USART_TypeDef* ) { }
|
||||
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct) { return SUCCESS; }
|
||||
|
||||
@@ -377,6 +377,7 @@ void eepromReadBlock (uint8_t * pointer_ram, uint32_t address, uint32_t size);
|
||||
#define wdt_enable(...) sleep(1/*ms*/)
|
||||
#define wdt_reset() sleep(1/*ms*/)
|
||||
#define boardInit()
|
||||
#define boardOff()
|
||||
|
||||
#define OS_MutexID pthread_mutex_t
|
||||
extern OS_MutexID audioMutex;
|
||||
|
||||
@@ -603,7 +603,7 @@ uint16_t getCurrent()
|
||||
Current_count = 0 ;
|
||||
}
|
||||
|
||||
uint32_t current_scale = 488 + g_eeGeneral.currentCalib ;
|
||||
uint32_t current_scale = 488 + g_eeGeneral.txCurrentCalibration ;
|
||||
return (current_scale * Current) / 8192;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -290,7 +290,7 @@ uint32_t telemetryTransmitPending();
|
||||
void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size);
|
||||
|
||||
// Second UART driver
|
||||
void telemetrySecondPortInit(unsigned int protocol);
|
||||
void serial2TelemetryInit(unsigned int protocol);
|
||||
bool telemetrySecondPortReceive(uint8_t & data);
|
||||
|
||||
#endif
|
||||
|
||||
+7
-2
@@ -53,7 +53,7 @@ Fifo<512> serial2RxFifo;
|
||||
* This function is synchronous (i.e. uses polling).
|
||||
* c Character to send.
|
||||
*/
|
||||
void debugPutc(const char c)
|
||||
void serial2Putc(const char c)
|
||||
{
|
||||
Uart *pUart = SECOND_SERIAL_UART;
|
||||
|
||||
@@ -64,6 +64,11 @@ void debugPutc(const char c)
|
||||
pUart->UART_THR = c;
|
||||
}
|
||||
|
||||
uint8_t serial2TracesEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a UART peripheral with the specified parameters.
|
||||
*
|
||||
@@ -117,7 +122,7 @@ extern "C" void UART0_IRQHandler()
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
void telemetrySecondPortInit(unsigned int /*protocol*/)
|
||||
void serial2TelemetryInit(unsigned int /*protocol*/)
|
||||
{
|
||||
SECOND_UART_Configure(FRSKY_D_BAUDRATE, Master_frequency);
|
||||
// startPdcUsartReceive();
|
||||
@@ -133,7 +133,7 @@ void bluetoothWriteString(const char * str)
|
||||
void bluetoothWriteWakeup(void)
|
||||
{
|
||||
if (bluetoothWriteState == BLUETOOTH_WRITE_IDLE) {
|
||||
if (!btTxFifo.empty()) {
|
||||
if (!btTxFifo.isEmpty()) {
|
||||
bluetoothWriteState = BLUETOOTH_WRITE_INIT;
|
||||
GPIO_ResetBits(BT_GPIO_BRTS, BT_GPIO_PIN_BRTS);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
#if defined(REV9E)
|
||||
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
|
||||
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
||||
lcd_clear();
|
||||
lcd_bmp(76, 2, bmp_lock, 0, 60);
|
||||
lcdRefresh();
|
||||
@@ -187,7 +187,7 @@ void boardInit()
|
||||
lcdRefreshWait();
|
||||
}
|
||||
if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) {
|
||||
pwrOff();
|
||||
boardOff();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -198,8 +198,27 @@ void boardInit()
|
||||
backlightInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void boardOff()
|
||||
{
|
||||
BACKLIGHT_OFF();
|
||||
#if defined(REV9E)
|
||||
topLcdOff();
|
||||
#endif
|
||||
|
||||
#if defined(REV9E)
|
||||
while (pwrPressed()) {
|
||||
wdt_reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
lcdOff();
|
||||
SysTick->CTRL = 0; // turn off systick
|
||||
pwrOff();
|
||||
}
|
||||
|
||||
#endif // #if !defined(SIMU)
|
||||
|
||||
|
||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||
@@ -258,7 +277,7 @@ void checkTrainerSettings()
|
||||
stop_sbus_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
|
||||
uart3Stop();
|
||||
serial2Stop();
|
||||
}
|
||||
|
||||
currentTrainerMode = requiredTrainerMode;
|
||||
@@ -273,8 +292,8 @@ void checkTrainerSettings()
|
||||
init_sbus_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
|
||||
if (g_eeGeneral.uart3Mode == UART_MODE_SBUS_TRAINER) {
|
||||
uart3SbusInit();
|
||||
if (g_eeGeneral.serial2Mode == UART_MODE_SBUS_TRAINER) {
|
||||
serial2SbusInit();
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
|
||||
@@ -74,9 +74,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc/usbd_msc_core.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc/usbd_hid_core.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_usr.h"
|
||||
#include "usbd_cdc_core.h"
|
||||
#include "usbd_msc_core.h"
|
||||
#include "usbd_hid_core.h"
|
||||
#include "usbd_usr.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usb_conf.h"
|
||||
#include "usbd_conf.h"
|
||||
@@ -236,8 +237,9 @@ void checkRotaryEncoder(void);
|
||||
void watchdogInit(unsigned int duration);
|
||||
#define wdt_enable(x) watchdogInit(1500)
|
||||
#define wdt_reset() IWDG->KR = 0xAAAA
|
||||
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
|
||||
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
|
||||
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
|
||||
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
|
||||
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF))
|
||||
#endif
|
||||
|
||||
// ADC driver
|
||||
@@ -281,10 +283,8 @@ void backlightInit(void);
|
||||
// USB driver
|
||||
int usbPlugged(void);
|
||||
void usbInit(void);
|
||||
void usbStart(void);
|
||||
#if defined(USB_JOYSTICK)
|
||||
void usbStop(void);
|
||||
#endif
|
||||
void usbDeInit(void);
|
||||
void usbSerialPutc(uint8_t c);
|
||||
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
}
|
||||
@@ -322,13 +322,13 @@ void hapticOff(void);
|
||||
void hapticOn(void);
|
||||
#endif
|
||||
|
||||
// SERIAL_USART driver
|
||||
// Second serial port driver
|
||||
#define DEBUG_BAUDRATE 115200
|
||||
void uart3Init(unsigned int mode, unsigned int protocol);
|
||||
void uart3Putc(const char c);
|
||||
#define telemetrySecondPortInit(protocol) uart3Init(UART_MODE_TELEMETRY, protocol)
|
||||
void uart3SbusInit(void);
|
||||
void uart3Stop(void);
|
||||
void serial2Init(unsigned int mode, unsigned int protocol);
|
||||
void serial2Putc(char c);
|
||||
#define serial2TelemetryInit(protocol) serial2Init(UART_MODE_TELEMETRY, protocol)
|
||||
void serial2SbusInit(void);
|
||||
void serial2Stop(void);
|
||||
|
||||
// BT driver
|
||||
#define BLUETOOTH_DEFAULT_BAUDRATE 115200
|
||||
|
||||
@@ -109,6 +109,8 @@ ifeq ($(PCB), TARANIS)
|
||||
EXTRAINCDIRS += $(STM32USBPATH)/STM32_USB_OTG_Driver/inc
|
||||
EXTRAINCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Core/inc
|
||||
EXTRAINCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/inc
|
||||
EXTRAINCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
|
||||
EXTRAINCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/inc
|
||||
EXTRAINCDIRS += .. ../../.. ../../../fonts/std
|
||||
ifeq ($(PCBREV), REV4a)
|
||||
CPPDEFS += -DREV4a
|
||||
|
||||
@@ -418,7 +418,6 @@ int main()
|
||||
// SD card detect pin
|
||||
sdInit();
|
||||
usbInit();
|
||||
usbStart();
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
|
||||
@@ -363,7 +363,7 @@ void lcdInit()
|
||||
{
|
||||
LCD_Hardware_Init();
|
||||
|
||||
if (WAS_RESET_BY_WATCHDOG()|WAS_RESET_BY_SOFTWARE()) return; //no need to reset LCD module
|
||||
if (WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) return; //no need to reset LCD module
|
||||
|
||||
//reset LCD module
|
||||
LCD_RST_LOW();
|
||||
@@ -400,7 +400,7 @@ void lcdInitFinish()
|
||||
initialization (without reset) is also recommended by the data sheet.
|
||||
*/
|
||||
|
||||
if (!WAS_RESET_BY_WATCHDOG() && !WAS_RESET_BY_SOFTWARE()) {
|
||||
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
||||
#if !defined(BOOT)
|
||||
while(g_tmr10ms < (RESET_WAIT_DELAY_MS/10)) {}; //wait measured from the power-on
|
||||
#else
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
#include "board_taranis.h"
|
||||
#include "../../pwr.h"
|
||||
|
||||
extern volatile uint32_t g_tmr10ms;
|
||||
#define get_tmr10ms() g_tmr10ms
|
||||
|
||||
void pwrInit()
|
||||
{
|
||||
// if any changes are done to the PWR PIN or pwrOn() function
|
||||
// then the same changes must be done in _bootStart()
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
@@ -84,23 +84,29 @@ void pwrOff()
|
||||
{
|
||||
GPIO_ResetBits(PWR_GPIO, PWR_GPIO_PIN_ON);
|
||||
|
||||
#if defined(REV9E)
|
||||
// 9E needs watchdog reset because CPU is still running while the power
|
||||
// key is held pressed by the user
|
||||
while (1) {
|
||||
// disable interrupts
|
||||
__disable_irq();
|
||||
|
||||
while(1) {
|
||||
wdt_reset();
|
||||
#if 0
|
||||
// It doesn't work correctly, if we press long on the pwr button, the radio restarts when the button is released
|
||||
PWR->CR |= PWR_CR_CWUF;
|
||||
/* Select STANDBY mode */
|
||||
PWR->CR |= PWR_CR_PDDS;
|
||||
/* Set SLEEPDEEP bit of Cortex System Control Register */
|
||||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||
/* Request Wait For Event */
|
||||
__WFE();
|
||||
#if defined(REV9E)
|
||||
// 9E needs watchdog reset because CPU is still running while
|
||||
// the power key is held pressed by the user.
|
||||
// The power key should be released by now, but we must make sure
|
||||
if (!pwrPressed()) {
|
||||
// Put the CPU into sleep to reduce the consumption,
|
||||
// it might help with the RTC reset issue
|
||||
PWR->CR |= PWR_CR_CWUF;
|
||||
/* Select STANDBY mode */
|
||||
PWR->CR |= PWR_CR_PDDS;
|
||||
/* Set SLEEPDEEP bit of Cortex System Control Register */
|
||||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||
/* Request Wait For Event */
|
||||
__WFE();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
//this function must not return!
|
||||
}
|
||||
|
||||
#if defined(REV9E)
|
||||
|
||||
+22
-22
@@ -36,8 +36,8 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
uint8_t uart3Mode = UART_MODE_NONE;
|
||||
Fifo<512> uart3TxFifo;
|
||||
uint8_t serial2Mode = 0;
|
||||
Fifo<512> serial2TxFifo;
|
||||
extern Fifo<512> telemetryFifo;
|
||||
extern Fifo<32> sbusFifo;
|
||||
|
||||
@@ -73,17 +73,17 @@ void uart3Setup(unsigned int baudrate)
|
||||
NVIC_EnableIRQ(SERIAL_USART_IRQn);
|
||||
}
|
||||
|
||||
void uart3Init(unsigned int mode, unsigned int protocol)
|
||||
void serial2Init(unsigned int mode, unsigned int protocol)
|
||||
{
|
||||
USART_DeInit(SERIAL_USART);
|
||||
|
||||
uart3Mode = false;
|
||||
serial2Mode = mode;
|
||||
|
||||
switch (mode) {
|
||||
case UART_MODE_TELEMETRY_MIRROR:
|
||||
uart3Setup(FRSKY_SPORT_BAUDRATE);
|
||||
break;
|
||||
#if defined(DEBUG)
|
||||
#if !defined(USB_SERIAL) && (defined(DEBUG) || defined(CLI))
|
||||
case UART_MODE_DEBUG:
|
||||
uart3Setup(DEBUG_BAUDRATE);
|
||||
break;
|
||||
@@ -94,43 +94,38 @@ void uart3Init(unsigned int mode, unsigned int protocol)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
uart3Mode = mode;
|
||||
}
|
||||
|
||||
void uart3Putc(const char c)
|
||||
void serial2Putc(char c)
|
||||
{
|
||||
uart3TxFifo.push(c);
|
||||
while (serial2TxFifo.isFull());
|
||||
serial2TxFifo.push(c);
|
||||
USART_ITConfig(SERIAL_USART, USART_IT_TXE, ENABLE);
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void debugPutc(const char c)
|
||||
{
|
||||
if (uart3Mode == UART_MODE_DEBUG) {
|
||||
uart3Putc(c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void uart3SbusInit()
|
||||
void serial2SbusInit()
|
||||
{
|
||||
uart3Setup(100000);
|
||||
SERIAL_USART->CR1 |= USART_CR1_M | USART_CR1_PCE ;
|
||||
}
|
||||
|
||||
void uart3Stop()
|
||||
void serial2Stop()
|
||||
{
|
||||
USART_DeInit(SERIAL_USART);
|
||||
}
|
||||
|
||||
uint8_t serial2TracesEnabled()
|
||||
{
|
||||
return (serial2Mode == 0);
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" void SERIAL_USART_IRQHandler(void)
|
||||
{
|
||||
// Send
|
||||
if (USART_GetITStatus(SERIAL_USART, USART_IT_TXE) != RESET) {
|
||||
uint8_t txchar;
|
||||
if (uart3TxFifo.pop(txchar)) {
|
||||
if (serial2TxFifo.pop(txchar)) {
|
||||
/* Write one byte to the transmit data register */
|
||||
USART_SendData(SERIAL_USART, txchar);
|
||||
}
|
||||
@@ -145,13 +140,18 @@ extern "C" void SERIAL_USART_IRQHandler(void)
|
||||
uint8_t data = SERIAL_USART->DR;
|
||||
|
||||
if (!(status & USART_FLAG_ERRORS)) {
|
||||
switch (uart3Mode) {
|
||||
switch (serial2Mode) {
|
||||
case UART_MODE_TELEMETRY:
|
||||
telemetryFifo.push(data);
|
||||
break;
|
||||
case UART_MODE_SBUS_TRAINER:
|
||||
sbusFifo.push(data);
|
||||
break;
|
||||
#if !defined(USB_SERIAL) && defined(CLI)
|
||||
case UART_MODE_DEBUG:
|
||||
cliRxFifo.push(data);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
* when FS core is used.
|
||||
*******************************************************************************/
|
||||
#ifndef USE_USB_OTG_FS
|
||||
#define USE_USB_OTG_FS
|
||||
#define USE_USB_OTG_FS // USB2.0 Full Speed == 12 Mbit
|
||||
#endif /* USE_USB_OTG_FS */
|
||||
|
||||
#ifdef USE_USB_OTG_FS
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
*/
|
||||
|
||||
#include "board_taranis.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
|
||||
|
||||
int usbPlugged(void)
|
||||
{
|
||||
@@ -63,28 +61,24 @@ USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||
|
||||
void OTG_FS_IRQHandler(void)
|
||||
{
|
||||
USBD_OTG_ISR_Handler (&USB_OTG_dev);
|
||||
USBD_OTG_ISR_Handler(&USB_OTG_dev);
|
||||
}
|
||||
|
||||
void usbInit(void)
|
||||
{
|
||||
USB_OTG_BSP_Init(&USB_OTG_dev);
|
||||
}
|
||||
|
||||
void usbStart(void)
|
||||
{
|
||||
#if defined(USB_JOYSTICK)
|
||||
// initialize USB as HID device
|
||||
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_HID_cb, &USR_cb);
|
||||
#elif defined(USB_SERIAL)
|
||||
// initialize USB as CDC device (virtual serial port)
|
||||
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb);
|
||||
#elif defined(USB_MASS_STORAGE)
|
||||
// initialize USB as MSC device
|
||||
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(USB_JOYSTICK)
|
||||
void usbStop(void)
|
||||
void usbDeInit(void)
|
||||
{
|
||||
USBD_DeInit(&USB_OTG_dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbd_cdc_vcp.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 19-March-2012
|
||||
* @brief Generic media access Layer.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
|
||||
* You may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.st.com/software_license_agreement_liberty_v2
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
|
||||
#pragma data_alignment = 4
|
||||
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usb_conf.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
|
||||
/* These are external variables imported from CDC core to be used for IN
|
||||
transfer management. */
|
||||
extern uint8_t APP_Rx_Buffer []; /* Write CDC received data in this buffer.
|
||||
These data will be sent over USB IN endpoint
|
||||
in the CDC core functions. */
|
||||
extern volatile uint32_t APP_Rx_ptr_in; /* Increment this pointer or roll it back to
|
||||
start address when writing received data
|
||||
in the buffer APP_Rx_Buffer. */
|
||||
extern volatile uint32_t APP_Rx_ptr_out;
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
static uint16_t VCP_Init (void);
|
||||
static uint16_t VCP_DeInit (void);
|
||||
static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len);
|
||||
static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len);
|
||||
|
||||
// static uint16_t VCP_COMConfig(uint8_t Conf);
|
||||
|
||||
CDC_IF_Prop_TypeDef VCP_fops =
|
||||
{
|
||||
VCP_Init,
|
||||
VCP_DeInit,
|
||||
VCP_Ctrl,
|
||||
0,
|
||||
VCP_DataRx
|
||||
};
|
||||
|
||||
} // extern "C"
|
||||
|
||||
bool cdcConnected = false;
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/**
|
||||
* @brief VCP_Init
|
||||
* Initializes the Media on the STM32
|
||||
* @param None
|
||||
* @retval Result of the opeartion (USBD_OK in all cases)
|
||||
*/
|
||||
static uint16_t VCP_Init(void)
|
||||
{
|
||||
cdcConnected = true;
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief VCP_DeInit
|
||||
* DeInitializes the Media on the STM32
|
||||
* @param None
|
||||
* @retval Result of the opeartion (USBD_OK in all cases)
|
||||
*/
|
||||
static uint16_t VCP_DeInit(void)
|
||||
{
|
||||
cdcConnected = false;
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief VCP_Ctrl
|
||||
* Manage the CDC class requests
|
||||
* @param Cmd: Command code
|
||||
* @param Buf: Buffer containing command data (request parameters)
|
||||
* @param Len: Number of data to be sent (in bytes)
|
||||
* @retval Result of the opeartion (USBD_OK in all cases)
|
||||
*/
|
||||
static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len)
|
||||
{
|
||||
switch (Cmd)
|
||||
{
|
||||
case SEND_ENCAPSULATED_COMMAND:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case GET_ENCAPSULATED_RESPONSE:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case SET_COMM_FEATURE:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case GET_COMM_FEATURE:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case CLEAR_COMM_FEATURE:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case SET_LINE_CODING:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case GET_LINE_CODING:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case SET_CONTROL_LINE_STATE:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
case SEND_BREAK:
|
||||
/* Not needed for this driver */
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
// some debug vars
|
||||
uint16_t usbWraps = 0;
|
||||
uint16_t charsWritten = 0;
|
||||
|
||||
void usbSerialPutc(uint8_t c)
|
||||
{
|
||||
if (!cdcConnected) return;
|
||||
|
||||
uint32_t txDataLen;
|
||||
do {
|
||||
txDataLen = APP_RX_DATA_SIZE + APP_Rx_ptr_in - APP_Rx_ptr_out;
|
||||
if (txDataLen >= APP_RX_DATA_SIZE) {
|
||||
txDataLen -= APP_RX_DATA_SIZE;
|
||||
}
|
||||
} while (txDataLen >= (APP_RX_DATA_SIZE - CDC_DATA_MAX_PACKET_SIZE));
|
||||
|
||||
APP_Rx_Buffer[APP_Rx_ptr_in] = c;
|
||||
++charsWritten;
|
||||
/* To avoid buffer overflow */
|
||||
if (APP_Rx_ptr_in >= APP_RX_DATA_SIZE-1) {
|
||||
APP_Rx_ptr_in = 0;
|
||||
++usbWraps;
|
||||
}
|
||||
else {
|
||||
APP_Rx_ptr_in++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief VCP_DataRx
|
||||
* Data received over USB OUT endpoint is available here
|
||||
*
|
||||
* @note
|
||||
* This function will block any OUT packet reception on USB endpoint
|
||||
* until exiting this function. If you exit this function before transfer
|
||||
* is complete on CDC interface (ie. using DMA controller) it will result
|
||||
* in receiving more data while previous ones are still not sent.
|
||||
*
|
||||
* @note
|
||||
* This function is executed inside the USBD_OTG_ISR_Handler() interrupt handler!
|
||||
|
||||
* @param Buf: Buffer of data to be received
|
||||
* @param Len: Number of data received (in bytes)
|
||||
* @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL
|
||||
*/
|
||||
static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len)
|
||||
{
|
||||
// TODO: try implementing inbound flow control:
|
||||
// if the cliRxFifo does not have enough free space to receive all
|
||||
// available characters, return VCP_FAIL. Maybe that will throttle down
|
||||
// the sender and we will receive the same packet at a later time.
|
||||
|
||||
#if defined(CLI)
|
||||
//copy data to the application FIFO
|
||||
for (uint32_t i = 0; i < Len; i++)
|
||||
{
|
||||
cliRxFifo.push(Buf[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -36,13 +36,13 @@
|
||||
#define USBD_ITF_MAX_NUM 1
|
||||
#define USB_MAX_STR_DESC_SIZ 64
|
||||
|
||||
#define USBD_SELF_POWERED
|
||||
#define USBD_SELF_POWERED
|
||||
|
||||
/* Class Layer Parameter */
|
||||
|
||||
#define MSC_IN_EP 0x81
|
||||
#define MSC_OUT_EP 0x01
|
||||
#define MSC_MAX_PACKET 64
|
||||
#define MSC_MAX_PACKET 64
|
||||
|
||||
#define MSC_MEDIA_PACKET 4096
|
||||
|
||||
@@ -52,6 +52,17 @@
|
||||
#define HID_IN_PACKET 9
|
||||
#define HID_OUT_PACKET 9
|
||||
|
||||
#define CDC_IN_EP 0x81 /* EP1 for data IN */
|
||||
#define CDC_OUT_EP 0x01 /* EP1 for data OUT */
|
||||
#define CDC_CMD_EP 0x82 /* EP2 for CDC commands */
|
||||
|
||||
/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
|
||||
#define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
|
||||
#define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */
|
||||
|
||||
#define CDC_IN_FRAME_INTERVAL 5 /* Number of frames between IN transfers */
|
||||
#define APP_RX_DATA_SIZE 512 // USB serial port output buffer. TODO: tune this buffer size /* Total size of IN buffer: APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */
|
||||
#define APP_FOPS VCP_fops
|
||||
|
||||
#endif //__USBD_CONF__H__
|
||||
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
#define USBD_PRODUCT_FS_STRING "FrSky Taranis Joystick"
|
||||
#define USBD_CONFIGURATION_FS_STRING "HID Config"
|
||||
#define USBD_INTERFACE_FS_STRING "HID Interface"
|
||||
#elif defined(USB_SERIAL)
|
||||
#define USBD_PID 0x5740 // do not change, this ID is used by the ST USB driver for Windows
|
||||
#define USBD_PRODUCT_FS_STRING "FrSky Taranis Serial Port"
|
||||
#define USBD_CONFIGURATION_FS_STRING "VSP Config"
|
||||
#define USBD_INTERFACE_FS_STRING "VSP Interface"
|
||||
#elif defined(USB_MASS_STORAGE)
|
||||
#define USBD_PID 0x5720
|
||||
#define USBD_PRODUCT_FS_STRING "FrSky Taranis Mass Storage"
|
||||
|
||||
+70
-69
@@ -36,11 +36,10 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#define MENUS_STACK_SIZE 2000
|
||||
#define MIXER_STACK_SIZE 500
|
||||
#define AUDIO_STACK_SIZE 500
|
||||
#define BT_STACK_SIZE 500
|
||||
#define DEBUG_STACK_SIZE 500
|
||||
#define MENUS_STACK_SIZE 2000
|
||||
#define MIXER_STACK_SIZE 500
|
||||
#define AUDIO_STACK_SIZE 500
|
||||
#define BLUETOOTH_STACK_SIZE 500
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define _ALIGNED(x) __declspec(align(x))
|
||||
@@ -49,78 +48,85 @@
|
||||
#endif
|
||||
|
||||
OS_TID menusTaskId;
|
||||
// stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
||||
OS_STK _ALIGNED(8) menusStack[MENUS_STACK_SIZE];
|
||||
// menus stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
||||
TaskStack<MENUS_STACK_SIZE> _ALIGNED(8) menusStack;
|
||||
|
||||
OS_TID mixerTaskId;
|
||||
OS_STK mixerStack[MIXER_STACK_SIZE];
|
||||
TaskStack<MENUS_STACK_SIZE> mixerStack;
|
||||
|
||||
OS_TID audioTaskId;
|
||||
OS_STK audioStack[AUDIO_STACK_SIZE];
|
||||
TaskStack<AUDIO_STACK_SIZE> audioStack;
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
OS_TID btTaskId;
|
||||
OS_STK btStack[BT_STACK_SIZE];
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG)
|
||||
OS_TID debugTaskId;
|
||||
OS_STK debugStack[DEBUG_STACK_SIZE];
|
||||
TaskStack<BLUETOOTH_STACK_SIZE> bluetoothStack;
|
||||
#endif
|
||||
|
||||
OS_MutexID audioMutex;
|
||||
OS_MutexID mixerMutex;
|
||||
|
||||
void stack_paint()
|
||||
enum TaskIndex {
|
||||
MENU_TASK_INDEX,
|
||||
MIXER_TASK_INDEX,
|
||||
AUDIO_TASK_INDEX,
|
||||
CLI_TASK_INDEX,
|
||||
BLUETOOTH_TASK_INDEX,
|
||||
TASK_INDEX_COUNT,
|
||||
MAIN_TASK_INDEX = 255
|
||||
};
|
||||
|
||||
template<int SIZE>
|
||||
void TaskStack<SIZE>::paint()
|
||||
{
|
||||
for (uint32_t i=0; i<MENUS_STACK_SIZE; i++)
|
||||
menusStack[i] = 0x55555555;
|
||||
for (uint32_t i=0; i<MIXER_STACK_SIZE; i++)
|
||||
mixerStack[i] = 0x55555555;
|
||||
for (uint32_t i=0; i<AUDIO_STACK_SIZE; i++)
|
||||
audioStack[i] = 0x55555555;
|
||||
for (uint32_t i=0; i<SIZE; i++) {
|
||||
stack[i] = 0x55555555;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t stack_free(uint32_t tid)
|
||||
template<int SIZE>
|
||||
uint16_t TaskStack<SIZE>::size()
|
||||
{
|
||||
OS_STK *stack;
|
||||
uint32_t size;
|
||||
return SIZE*4;
|
||||
}
|
||||
|
||||
switch(tid) {
|
||||
case 0:
|
||||
stack = menusStack;
|
||||
size = MENUS_STACK_SIZE;
|
||||
break;
|
||||
case 1:
|
||||
stack = mixerStack;
|
||||
size = MIXER_STACK_SIZE;
|
||||
break;
|
||||
case 2:
|
||||
stack = audioStack;
|
||||
size = AUDIO_STACK_SIZE;
|
||||
break;
|
||||
#if defined(PCBTARANIS)
|
||||
case 255:
|
||||
#if defined(SIMU)
|
||||
return 1024;
|
||||
#else
|
||||
// main stack
|
||||
stack = (OS_STK *)&_main_stack_start;
|
||||
size = ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
uint16_t getStackAvailable(void * address, uint16_t size)
|
||||
{
|
||||
uint32_t * array = (uint32_t *)address;
|
||||
uint16_t i = 0;
|
||||
while (i < size && array[i] == 0x55555555) {
|
||||
i++;
|
||||
}
|
||||
|
||||
uint32_t i=0;
|
||||
for (; i<size; i++)
|
||||
if (stack[i] != 0x55555555)
|
||||
break;
|
||||
return i*4;
|
||||
}
|
||||
|
||||
template<int SIZE>
|
||||
uint16_t TaskStack<SIZE>::available()
|
||||
{
|
||||
return getStackAvailable(stack, SIZE);
|
||||
}
|
||||
|
||||
void stackPaint()
|
||||
{
|
||||
menusStack.paint();
|
||||
mixerStack.paint();
|
||||
audioStack.paint();
|
||||
#if defined(CLI)
|
||||
cliStack.paint();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CPUSTM32) && !defined(SIMU)
|
||||
uint16_t stackSize()
|
||||
{
|
||||
return ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
|
||||
}
|
||||
|
||||
uint16_t stackAvailable()
|
||||
{
|
||||
return getStackAvailable(&_main_stack_start, stackSize());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
|
||||
void mixerTask(void * pdata)
|
||||
@@ -182,7 +188,7 @@ void menusTask(void * pdata)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(REV9E)
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
topLcdOff();
|
||||
#endif
|
||||
|
||||
@@ -196,12 +202,7 @@ void menusTask(void * pdata)
|
||||
#endif
|
||||
|
||||
opentxClose();
|
||||
|
||||
#if !defined(SIMU)
|
||||
SysTick->CTRL = 0; // turn off systick
|
||||
#endif
|
||||
|
||||
pwrOff(); // Only turn power off if necessary
|
||||
boardOff(); // Only turn power off if necessary
|
||||
}
|
||||
|
||||
extern void audioTask(void* pdata);
|
||||
@@ -210,17 +211,17 @@ void tasksStart()
|
||||
{
|
||||
CoInitOS();
|
||||
|
||||
#if defined(CPUARM) && defined(DEBUG) && !defined(SIMU)
|
||||
debugTaskId = CoCreateTaskEx(debugTask, NULL, 10, &debugStack[DEBUG_STACK_SIZE-1], DEBUG_STACK_SIZE, 1, false);
|
||||
#if defined(CLI)
|
||||
cliStart();
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
btTaskId = CoCreateTask(btTask, NULL, 15, &btStack[BT_STACK_SIZE-1], BT_STACK_SIZE);
|
||||
btTaskId = CoCreateTask(btTask, NULL, 15, &bluetoothStack.stack[BLUETOOTH_STACK_SIZE-1], BLUETOOTH_STACK_SIZE);
|
||||
#endif
|
||||
|
||||
mixerTaskId = CoCreateTask(mixerTask, NULL, 5, &mixerStack[MIXER_STACK_SIZE-1], MIXER_STACK_SIZE);
|
||||
menusTaskId = CoCreateTask(menusTask, NULL, 10, &menusStack[MENUS_STACK_SIZE-1], MENUS_STACK_SIZE);
|
||||
audioTaskId = CoCreateTask(audioTask, NULL, 7, &audioStack[AUDIO_STACK_SIZE-1], AUDIO_STACK_SIZE);
|
||||
mixerTaskId = CoCreateTask(mixerTask, NULL, 5, &mixerStack.stack[MIXER_STACK_SIZE-1], MIXER_STACK_SIZE);
|
||||
menusTaskId = CoCreateTask(menusTask, NULL, 10, &menusStack.stack[MENUS_STACK_SIZE-1], MENUS_STACK_SIZE);
|
||||
audioTaskId = CoCreateTask(audioTask, NULL, 7, &audioStack.stack[AUDIO_STACK_SIZE-1], AUDIO_STACK_SIZE);
|
||||
|
||||
#if !defined(SIMU)
|
||||
audioMutex = CoCreateMutex();
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TASKS_ARM_H_
|
||||
#define _TASKS_ARM_H_
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" {
|
||||
#include <CoOS.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
template<int SIZE>
|
||||
class TaskStack
|
||||
{
|
||||
public:
|
||||
TaskStack() { }
|
||||
void paint();
|
||||
uint16_t size();
|
||||
uint16_t available();
|
||||
OS_STK stack[SIZE];
|
||||
};
|
||||
|
||||
void stackPaint();
|
||||
uint16_t stackSize();
|
||||
uint16_t stackAvailable();
|
||||
|
||||
#endif // _TASKS_ARM_H_
|
||||
@@ -165,8 +165,8 @@ NOINLINE void processSerialData(uint8_t data)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (g_eeGeneral.uart3Mode == UART_MODE_TELEMETRY_MIRROR) {
|
||||
uart3Putc(data);
|
||||
if (g_eeGeneral.serial2Mode == UART_MODE_TELEMETRY_MIRROR) {
|
||||
serial2Putc(data);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -604,7 +604,7 @@ void telemetryInit(void)
|
||||
}
|
||||
else if (telemetryProtocol==PROTOCOL_FRSKY_D_SECONDARY) {
|
||||
telemetryPortInit(0);
|
||||
telemetrySecondPortInit(PROTOCOL_FRSKY_D_SECONDARY);
|
||||
serial2TelemetryInit(PROTOCOL_FRSKY_D_SECONDARY);
|
||||
}
|
||||
else {
|
||||
telemetryPortInit(FRSKY_SPORT_BAUDRATE);
|
||||
|
||||
@@ -43,10 +43,8 @@
|
||||
#define MAVLINK_COMM_NUM_BUFFERS 1
|
||||
|
||||
#include "GCS_MAVLink/include_v1.0/mavlink_types.h"
|
||||
#include "serial.h"
|
||||
#include "targets/common_avr/serial_driver.h"
|
||||
#include "opentx.h"
|
||||
#include "serial.h"
|
||||
//#include "include/mavlink_helpers.h"
|
||||
|
||||
extern mavlink_system_t mavlink_system;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "../opentx.h"
|
||||
|
||||
TelemetryItem telemetryItems[MAX_SENSORS];
|
||||
uint8_t allowNewSensors;
|
||||
|
||||
void TelemetryItem::gpsReceived()
|
||||
{
|
||||
@@ -491,11 +492,11 @@ void setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t instance
|
||||
if (telemetrySensor.type == TELEM_TYPE_CUSTOM && telemetrySensor.id == id && (telemetrySensor.instance == instance || g_model.ignoreSensorIds)) {
|
||||
telemetryItems[index].setValue(telemetrySensor, value, unit, prec);
|
||||
available = true;
|
||||
// we continue search here, because more than one sensor can have the same id and instance
|
||||
// we continue search here, because sensors can share the same id and instance
|
||||
}
|
||||
}
|
||||
|
||||
if (available) {
|
||||
if (available || !allowNewSensors) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ class TelemetryItem
|
||||
};
|
||||
|
||||
extern TelemetryItem telemetryItems[MAX_SENSORS];
|
||||
extern uint8_t allowNewSensors;
|
||||
|
||||
inline bool isTelemetryFieldAvailable(int index)
|
||||
{
|
||||
|
||||
@@ -129,6 +129,8 @@ TEST(FrSky, Vfas_0x39_HiPrecision)
|
||||
TELEMETRY_RESET();
|
||||
EXPECT_EQ(telemetryItems[0].value, 0);
|
||||
|
||||
allowNewSensors = true;
|
||||
|
||||
// normal precision, resolution 0.1V
|
||||
processHubPacket(VFAS_ID, 1234); // set value of 123.4V
|
||||
EXPECT_EQ(telemetryItems[0].value, 12340); // stored value has resolution of 0.01V
|
||||
@@ -148,6 +150,8 @@ TEST(FrSky, HubAltNegative)
|
||||
TELEMETRY_RESET();
|
||||
EXPECT_EQ(telemetryItems[0].value, 0);
|
||||
|
||||
allowNewSensors = true;
|
||||
|
||||
// altimeter auto offset
|
||||
processHubPacket(BARO_ALT_BP_ID, 0);
|
||||
processHubPacket(BARO_ALT_AP_ID, 0);
|
||||
|
||||
@@ -92,7 +92,7 @@ void doPaint(QPainter & p)
|
||||
}
|
||||
}
|
||||
|
||||
bool checkScreenshot(QString test)
|
||||
bool checkScreenshot(const QString & test)
|
||||
{
|
||||
lcdRefresh();
|
||||
QImage buffer(LCD_W, LCD_H, QImage::Format_RGB32);
|
||||
|
||||
@@ -38,42 +38,6 @@
|
||||
#include "opentx.h"
|
||||
#include "timers.h"
|
||||
|
||||
/*
|
||||
struct TimerState {
|
||||
uint16_t cnt;
|
||||
uint16_t sum;
|
||||
uint8_t state;
|
||||
int16_t val;
|
||||
uint8_t val_10ms;
|
||||
};
|
||||
|
||||
PACK(typedef struct t_TimerData {
|
||||
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint16_t start;
|
||||
uint8_t countdownBeep:2;
|
||||
uint8_t minuteBeep:1;
|
||||
uint8_t persistent:2; // 0 off, 1 flight, 2 manual reset
|
||||
uint8_t spare:3;
|
||||
uint16_t value;
|
||||
}) TimerData;
|
||||
|
||||
enum TimerModes {
|
||||
TMRMODE_NONE,
|
||||
TMRMODE_ABS,
|
||||
TMRMODE_THR,
|
||||
TMRMODE_THR_REL,
|
||||
TMRMODE_THR_TRG,
|
||||
TMRMODE_COUNT
|
||||
};
|
||||
|
||||
enum CountDownModes {
|
||||
COUNTDOWN_SILENT,
|
||||
COUNTDOWN_BEEPS,
|
||||
COUNTDOWN_VOICE
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#undef timerSet
|
||||
void timerSet(int idx, int16_t val)
|
||||
|
||||
+5
-5
@@ -122,7 +122,7 @@ static uint8_t usbd_cdc_SOF (void *pdev);
|
||||
CDC specific management functions
|
||||
*********************************************/
|
||||
static void Handle_USBAsynchXfer (void *pdev);
|
||||
static uint8_t *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length);
|
||||
static const uint8_t *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length);
|
||||
#ifdef USE_USB_OTG_HS
|
||||
static uint8_t *USBD_cdc_GetOtherCfgDesc (uint8_t speed, uint16_t *length);
|
||||
#endif
|
||||
@@ -134,7 +134,7 @@ static uint8_t *USBD_cdc_GetOtherCfgDesc (uint8_t speed, uint16_t *length);
|
||||
* @{
|
||||
*/
|
||||
extern CDC_IF_Prop_TypeDef APP_FOPS;
|
||||
extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC];
|
||||
extern const uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC];
|
||||
|
||||
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
|
||||
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
||||
@@ -179,8 +179,8 @@ __ALIGN_BEGIN uint8_t APP_Rx_Buffer [APP_RX_DATA_SIZE] __ALIGN_END ;
|
||||
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
|
||||
__ALIGN_BEGIN uint8_t CmdBuff[CDC_CMD_PACKET_SZE] __ALIGN_END ;
|
||||
|
||||
uint32_t APP_Rx_ptr_in = 0;
|
||||
uint32_t APP_Rx_ptr_out = 0;
|
||||
volatile uint32_t APP_Rx_ptr_in = 0;
|
||||
volatile uint32_t APP_Rx_ptr_out = 0;
|
||||
uint32_t APP_Rx_length = 0;
|
||||
|
||||
uint8_t USB_Tx_State = 0;
|
||||
@@ -782,7 +782,7 @@ static void Handle_USBAsynchXfer (void *pdev)
|
||||
* @param length : pointer data length
|
||||
* @retval pointer to descriptor buffer
|
||||
*/
|
||||
static uint8_t *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length)
|
||||
static const uint8_t *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length)
|
||||
{
|
||||
*length = sizeof (usbd_cdc_CfgDesc);
|
||||
return usbd_cdc_CfgDesc;
|
||||
|
||||
@@ -188,15 +188,15 @@ void evalTimers(int16_t throttle, uint8_t tick10ms)
|
||||
timerState->val = newTimerVal;
|
||||
if (timerState->state == TMR_RUNNING) {
|
||||
if (g_model.timers[i].countdownBeep && g_model.timers[i].start) {
|
||||
if (newTimerVal==30) {
|
||||
if (newTimerVal == 30) {
|
||||
AUDIO_TIMER_30();
|
||||
// TRACE("Timer[%d] 30s announcement", i);
|
||||
}
|
||||
if (newTimerVal==20) {
|
||||
if (newTimerVal == 20) {
|
||||
AUDIO_TIMER_20();
|
||||
// TRACE("Timer[%d] 20s announcement", i);
|
||||
}
|
||||
if (newTimerVal<=10) {
|
||||
if (newTimerVal <= 10) {
|
||||
AUDIO_TIMER_LT10(g_model.timers[i].countdownBeep, newTimerVal);
|
||||
// TRACE("Timer[%d] %ds announcement", i, newTimerVal);
|
||||
}
|
||||
|
||||
@@ -570,7 +570,11 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
||||
const pm_char STR_ONLYPOSITIVE[] PROGMEM = TR_ONLYPOSITIVE;
|
||||
const pm_char STR_FILTER[] PROGMEM = TR_FILTER;
|
||||
const pm_char STR_TELEMETRYFULL[] PROGMEM = TR_TELEMETRYFULL;
|
||||
const pm_char STR_IGNOREIDS[] PROGMEM = TR_IGNOREIDS;
|
||||
const pm_char STR_IGNORE_INSTANCE[] PROGMEM = TR_IGNORE_INSTANCE;
|
||||
const pm_char STR_DISCOVER_SENSORS[] PROGMEM = TR_DISCOVER_SENSORS;
|
||||
const pm_char STR_STOP_DISCOVER_SENSORS[] PROGMEM = TR_STOP_DISCOVER_SENSORS;
|
||||
const pm_char STR_DELETE_ALL_SENSORS[] PROGMEM = TR_DELETE_ALL_SENSORS;
|
||||
const pm_char STR_CONFIRMDELETE[] PROGMEM = TR_CONFIRMDELETE;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -590,6 +594,10 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
||||
const pm_char STR_SMOOTH[] PROGMEM = TR_SMOOTH;
|
||||
const pm_char STR_COPY_STICKS_TO_OFS[] PROGMEM = TR_COPY_STICKS_TO_OFS;
|
||||
const pm_char STR_COPY_TRIMS_TO_OFS[] PROGMEM = TR_COPY_TRIMS_TO_OFS;
|
||||
const pm_char STR_INCDEC[] PROGMEM = TR_INCDEC;
|
||||
const pm_char STR_GLOBALVAR[] PROGMEM = TR_GLOBALVAR;
|
||||
const pm_char STR_MIXSOURCE[] PROGMEM = TR_MIXSOURCE;
|
||||
const pm_char STR_CONSTANT[] PROGMEM = TR_CONSTANT;
|
||||
const pm_char STR_TOP_BAR[] PROGMEM = TR_TOP_BAR;
|
||||
const pm_char STR_ALTITUDE[] PROGMEM = TR_ALTITUDE;
|
||||
const pm_char STR_SCALE[] PROGMEM = TR_SCALE;
|
||||
|
||||
@@ -789,7 +789,11 @@ extern const pm_char STR_BLCOLOR[];
|
||||
extern const pm_char STR_ONLYPOSITIVE[];
|
||||
extern const pm_char STR_FILTER[];
|
||||
extern const pm_char STR_TELEMETRYFULL[];
|
||||
extern const pm_char STR_IGNOREIDS[];
|
||||
extern const pm_char STR_IGNORE_INSTANCE[];
|
||||
extern const pm_char STR_DISCOVER_SENSORS[];
|
||||
extern const pm_char STR_STOP_DISCOVER_SENSORS[];
|
||||
extern const pm_char STR_DELETE_ALL_SENSORS[];
|
||||
extern const pm_char STR_CONFIRMDELETE[];
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -809,6 +813,10 @@ extern const pm_char STR_BLCOLOR[];
|
||||
extern const pm_char STR_SMOOTH[];
|
||||
extern const pm_char STR_COPY_STICKS_TO_OFS[];
|
||||
extern const pm_char STR_COPY_TRIMS_TO_OFS[];
|
||||
extern const pm_char STR_INCDEC[];
|
||||
extern const pm_char STR_GLOBALVAR[];
|
||||
extern const pm_char STR_MIXSOURCE[];
|
||||
extern const pm_char STR_CONSTANT[];
|
||||
extern const pm_char STR_TOP_BAR[];
|
||||
extern const pm_char STR_ALTITUDE[];
|
||||
extern const pm_char STR_SCALE[];
|
||||
@@ -827,13 +835,13 @@ extern const pm_char STR_BLCOLOR[];
|
||||
extern const pm_char STR_MENU_HELI[];
|
||||
extern const pm_char STR_MENU_TRIMS[];
|
||||
extern const pm_char STR_MENU_SWITCHES[];
|
||||
extern const pm_char STR_MENU_LOGICAL_SWITCHES[];
|
||||
extern const pm_char STR_MENU_LOGICAL_SWITCHES[];
|
||||
extern const pm_char STR_MENU_TRAINER[];
|
||||
extern const pm_char STR_MENU_CHANNELS[];
|
||||
extern const pm_char STR_MENU_GVARS[];
|
||||
extern const pm_char STR_MENU_TELEMETRY[];
|
||||
extern const pm_char STR_MENU_OTHER[];
|
||||
extern const pm_char STR_MENU_INVERT[];
|
||||
extern const pm_char STR_MENU_OTHER[];
|
||||
extern const pm_char STR_MENU_INVERT[];
|
||||
#endif
|
||||
|
||||
#if MENUS_LOCK == 1
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#define TR_VDISPLAYTRIMS "Ne\0 ""Změna\0""Ano\0 "
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "Ne\0 ""Zvuk\0 ""Hlas\0 "
|
||||
#define TR_VBEEPCOUNTDOWN "Ne\0 ""Zvuk\0 ""Hlas\0 Haptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\005"
|
||||
#define TR_VVARIOCENTER "Tón\0 ""Ticho"
|
||||
@@ -487,23 +487,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ZAP""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ZAP""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ZAP""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -949,6 +943,10 @@
|
||||
#define TR_SMOOTH "Hladká"
|
||||
#define TR_COPY_STICKS_TO_OFS "Kopie pák do subtrimu"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Kopíe trimů do subtrimu"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Ukládat mAh")
|
||||
#define TR_PREFLIGHT "Předletová kontrola"
|
||||
#define TR_CHECKLIST INDENT "Zobrazit poznámky"
|
||||
@@ -1074,12 +1072,16 @@
|
||||
#define TR_ALTSENSOR "Senzor výšky"
|
||||
#define TR_CELLSENSOR "Senzor článků"
|
||||
#define TR_GPSSENSOR "GPS senzor"
|
||||
#define TR_CURRENTSENSOR "Sensor proudu"
|
||||
#define TR_CURRENTSENSOR "Senzor"
|
||||
#define TR_AUTOOFFSET "Auto ofset"
|
||||
#define TR_ONLYPOSITIVE "Jen kladné"
|
||||
#define TR_FILTER "Filtr"
|
||||
#define TR_TELEMETRYFULL "Všechny sloty jsou plné!"
|
||||
#define TR_IGNOREIDS INDENT "Ignoruj chyby ID"
|
||||
#define TR_IGNORE_INSTANCE INDENT "Ignoruj chyby ID"
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Vstupy"
|
||||
#define TR_MENU_LUA "\322Lua skripty"
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
#define TR_VDISPLAYTRIMS "Nein\0 ""Kurz\0 ""Ja\0" //Trimmwerte Keine, kurze Anzeigen, Ja
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "Kein\0 Pieps\0Stimme"
|
||||
#define TR_VBEEPCOUNTDOWN "Kein\0 Pieps\0StimmeHaptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Ton\0 ""Ruhe "
|
||||
@@ -491,23 +491,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -953,6 +947,10 @@
|
||||
#define TR_SMOOTH "Runden"
|
||||
#define TR_COPY_STICKS_TO_OFS "Kopie Stick to Servo-Mitte"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Kopie Trimm to Servo-Mitte" // "Trim to Subtrim"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Spr. mAh", INDENT "Speichern mAh") //9XR-Pro
|
||||
#define TR_PREFLIGHT TR("---Vorflug-Checkliste--", "----Vorflug-Checkliste----")
|
||||
#define TR_CHECKLIST TR(INDENT "Checkliste", INDENT "Checkliste anzeigen") //9XR-Pro
|
||||
@@ -1078,12 +1076,16 @@
|
||||
#define TR_ALTSENSOR "Höhen Sensor"
|
||||
#define TR_CELLSENSOR "Zellen Sensor"
|
||||
#define TR_GPSSENSOR "GPS Sensor"
|
||||
#define TR_CURRENTSENSOR "Strom Sensor"
|
||||
#define TR_CURRENTSENSOR "Sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Nur Positiv"
|
||||
#define TR_FILTER "Filter aktiv"
|
||||
#define TR_TELEMETRYFULL "Telemetriezeilen voll!"
|
||||
#define TR_IGNOREIDS INDENT "Ignore instance"
|
||||
#define TR_IGNORE_INSTANCE INDENT "Ignore instance"
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
// ----------------------------- Symbole für Auswahlliste----------
|
||||
#define TR_MENU_INPUTS "\314Inputs"
|
||||
#define TR_MENU_LUA "\322Lua Scripte"
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#define TR_VDISPLAYTRIMS "No\0 ""Change""Yes\0"
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voice\0"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voice\0Haptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tone\0 ""Silent"
|
||||
@@ -486,23 +486,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -544,8 +538,8 @@
|
||||
#define LEN_VFORMULAS "\010"
|
||||
#define TR_VFORMULAS "Add\0 ""Average\0""Min\0 ""Max\0 ""Multiply""Totalize""Cell\0 ""Consumpt""Distance"
|
||||
|
||||
#define LEN_VPREC "\005"
|
||||
#define TR_VPREC "PREC0""PREC1""PREC2"
|
||||
#define LEN_VPREC "\004"
|
||||
#define TR_VPREC "0.--""0.0 ""0.00"
|
||||
|
||||
#define LEN_VCELLINDEX "\007"
|
||||
#define TR_VCELLINDEX "Lowest\0""1\0 ""2\0 ""3\0 ""4\0 ""5\0 ""6\0 ""Highest""Delta\0"
|
||||
@@ -948,6 +942,10 @@
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy sticks to subtrim"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Persistent mAh")
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST TR(INDENT "Checklist", INDENT "Display Checklist")
|
||||
@@ -1073,12 +1071,16 @@
|
||||
#define TR_ALTSENSOR "Alt sensor"
|
||||
#define TR_CELLSENSOR "Cell sensor"
|
||||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Curr. sensor"
|
||||
#define TR_CURRENTSENSOR "Sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
#define TR_IGNOREIDS TR(INDENT "No inst.","Ignore instance")
|
||||
#define TR_IGNORE_INSTANCE TR(INDENT "No inst.", INDENT "Ignore instances")
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Inputs"
|
||||
#define TR_MENU_LUA "\322Lua scripts"
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#define TR_VDISPLAYTRIMS "No\0 ""Change""Yes\0"
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voz\0"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voz\0 Haptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tone\0 ""Silent"
|
||||
@@ -471,23 +471,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -522,8 +516,8 @@
|
||||
#define LEN_VFORMULAS "\010"
|
||||
#define TR_VFORMULAS "Add\0 ""Average\0""Min\0 ""Max\0 ""Multiply""Totalize""Cell\0 ""Consumpt""Distance"
|
||||
|
||||
#define LEN_VPREC "\005"
|
||||
#define TR_VPREC "PREC0""PREC1""PREC2"
|
||||
#define LEN_VPREC "\004"
|
||||
#define TR_VPREC "0.--""0.0 ""0.00"
|
||||
|
||||
#define LEN_VCELLINDEX "\007"
|
||||
#define TR_VCELLINDEX "Lowest\0""1\0 ""2\0 ""3\0 ""4\0 ""5\0 ""6\0 ""Highest""Delta\0"
|
||||
@@ -903,6 +897,10 @@
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH INDENT "Valor mAh"
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST INDENT "Display Checklist"
|
||||
@@ -1028,12 +1026,16 @@
|
||||
#define TR_ALTSENSOR "Alt sensor"
|
||||
#define TR_CELLSENSOR "Cell sensor"
|
||||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_CURRENTSENSOR "Sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
#define TR_IGNOREIDS INDENT "Ignore instance"
|
||||
#define TR_IGNORE_INSTANCE INDENT "Ignore instance"
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Inputs"
|
||||
#define TR_MENU_LUA "\322Lua scripts"
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#define TR_VDISPLAYTRIMS "No\0 ""Change""Yes\0"
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voice\0"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voice\0Haptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tone\0 ""Silent"
|
||||
@@ -471,23 +471,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -522,8 +516,8 @@
|
||||
#define LEN_VFORMULAS "\010"
|
||||
#define TR_VFORMULAS "Add\0 ""Average\0""Min\0 ""Max\0 ""Multiply""Totalize""Cell\0 ""Consumpt""Distance"
|
||||
|
||||
#define LEN_VPREC "\005"
|
||||
#define TR_VPREC "PREC0""PREC1""PREC2"
|
||||
#define LEN_VPREC "\004"
|
||||
#define TR_VPREC "0.--""0.0 ""0.00"
|
||||
|
||||
#define LEN_VCELLINDEX "\007"
|
||||
#define TR_VCELLINDEX "Lowest\0""1\0 ""2\0 ""3\0 ""4\0 ""5\0 ""6\0 ""Highest""Delta\0"
|
||||
@@ -903,6 +897,10 @@
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH INDENT "Store mAh"
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST INDENT "Display Checklist"
|
||||
@@ -1028,12 +1026,16 @@
|
||||
#define TR_ALTSENSOR "Alt sensor"
|
||||
#define TR_CELLSENSOR "Cell sensor"
|
||||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_CURRENTSENSOR "Sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
#define TR_IGNOREIDS INDENT "Ignore instance"
|
||||
#define TR_IGNORE_INSTANCE INDENT "Ignore instance"
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Inputs"
|
||||
#define TR_MENU_LUA "\322Lua scripts"
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#define TR_VDISPLAYTRIMS "Non\0 ""Change""Oui\0"
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\007"
|
||||
#define TR_VBEEPCOUNTDOWN "Aucun\0 ""Bips\0 ""Voix\0 "
|
||||
#define TR_VBEEPCOUNTDOWN "Aucun\0 ""Bips\0 ""Voix\0 Haptic\0"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tone\0 ""Silent"
|
||||
@@ -486,23 +486,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""Un"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""Un"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""Un"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -544,8 +538,8 @@
|
||||
#define LEN_VFORMULAS "\010"
|
||||
#define TR_VFORMULAS "Addition""Moyenne\0""Min\0 ""Max\0 ""Multipl.""Totalise""Elément\0""Consomm.""Distance"
|
||||
|
||||
#define LEN_VPREC "\005"
|
||||
#define TR_VPREC "PREC0""PREC1""PREC2"
|
||||
#define LEN_VPREC "\004"
|
||||
#define TR_VPREC "0.--""0.0 ""0.00"
|
||||
|
||||
#define LEN_VCELLINDEX "\007"
|
||||
#define TR_VCELLINDEX "Mini.\0 ""1\0 ""2\0 ""3\0 ""4\0 ""5\0 ""6\0 ""Maxi.\0 ""Diff.\0 "
|
||||
@@ -720,7 +714,7 @@
|
||||
#define OFS_RX 4
|
||||
#define TR_ACCEL "Acc:"
|
||||
#define TR_NODATA CENTER "NO DATA"
|
||||
#define TR_TOTTM1TM2THRTHP "\037\146SES\036TM1\037\146TM2\036000GAZ\037\146GZ%"
|
||||
#define TR_TOTTM1TM2THRTHP "\037\146SES\036TM1\037\146TM2\036GAZ\037\146GZ%"
|
||||
#define TR_TMR1LATMAXUS "Tmr1Lat max\037\124us"
|
||||
#define STR_US (STR_TMR1LATMAXUS+13)
|
||||
#define TR_TMR1LATMINUS "Tmr1Lat min\037\124us"
|
||||
@@ -940,6 +934,10 @@
|
||||
#define TR_SMOOTH "Lissage"
|
||||
#define TR_COPY_STICKS_TO_OFS "Manche vers subtrim"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Trim vers subtrim"
|
||||
#define TR_INCDEC "Inc/Décrementer"
|
||||
#define TR_GLOBALVAR "Var. Globale"
|
||||
#define TR_MIXSOURCE "Source mixeur"
|
||||
#define TR_CONSTANT "Constante"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Enr. mAh", INDENT "Enregistrer mAh")
|
||||
#define TR_PREFLIGHT "Vérifications avant vol"
|
||||
#define TR_CHECKLIST TR(INDENT "Notes", INDENT "Afficher notes")
|
||||
@@ -951,7 +949,7 @@
|
||||
#define TR_EEBACKUP "\004[ENTER Long]: Sauvegarder l'EEPROM"
|
||||
#define TR_FACTORYRESET "\016[MENU Long]: RAZ d'usine"
|
||||
#define TR_CONFIRMRESET "Effacer TOUS modèles/réglages?"
|
||||
#define TR_TO_MANY_LUA_SCRIPTS "Too many Lua scripts!"
|
||||
#define TR_TO_MANY_LUA_SCRIPTS "Trop de scripts lua!"
|
||||
|
||||
#if defined(MAVLINK)
|
||||
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "RSSI Max"
|
||||
@@ -1065,12 +1063,16 @@
|
||||
#define TR_ALTSENSOR "Capteur Alt"
|
||||
#define TR_CELLSENSOR "Capteur Elém"
|
||||
#define TR_GPSSENSOR "Capteur GPS"
|
||||
#define TR_CURRENTSENSOR "Capt courant"
|
||||
#define TR_CURRENTSENSOR "Capteur"
|
||||
#define TR_AUTOOFFSET "Offset auto"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filtrage"
|
||||
#define TR_TELEMETRYFULL "Plus de capteurs libres!"
|
||||
#define TR_IGNOREIDS TR(INDENT "Ign. inst.",INDENT "Ignorer instance")
|
||||
#define TR_IGNORE_INSTANCE TR(INDENT "Ign. inst.",INDENT "Ignorer instance")
|
||||
#define TR_DISCOVER_SENSORS INDENT "Découvrir capteurs"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Terminer découverte"
|
||||
#define TR_DELETE_ALL_SENSORS TR(INDENT "Suppr. tous capteurs",INDENT "Supprimer tous capteurs")
|
||||
#define TR_CONFIRMDELETE TR("Tout effacer?","Vraiment tout effacer?")
|
||||
|
||||
#define TR_MENU_INPUTS "\314Entrées"
|
||||
#define TR_MENU_LUA "\322Scripts Lua"
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
#define TR_VDISPLAYTRIMS "No\0 ""Cambio""Si\0 "
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "NienteSuoni\0Voce\0 "
|
||||
#define TR_VBEEPCOUNTDOWN "NienteSuoni\0Voce\0 Haptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tono\0 ""Silent"
|
||||
@@ -489,23 +489,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -547,8 +541,8 @@
|
||||
#define LEN_VFORMULAS "\011"
|
||||
#define TR_VFORMULAS "Somma\0 ""Media\0 ""Min\0 ""Max\0 ""Moltipl\0 ""Totalizza""Cella\0 ""Consumo\0 ""Distanza\0"
|
||||
|
||||
#define LEN_VPREC "\005"
|
||||
#define TR_VPREC "PREC0""PREC1""PREC2"
|
||||
#define LEN_VPREC "\004"
|
||||
#define TR_VPREC "0.--""0.0 ""0.00"
|
||||
|
||||
#define LEN_VCELLINDEX "\010"
|
||||
#define TR_VCELLINDEX "Minore\0 ""1\0 ""2\0 ""3\0 ""4\0 ""5\0 ""6\0 ""Maggiore""Delta\0"
|
||||
@@ -951,6 +945,10 @@
|
||||
#define TR_SMOOTH "Smussa"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copia Stick su Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copia Trim in Subtrim"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH INDENT "Memo mAh"
|
||||
#define TR_PREFLIGHT "Controlli Prevolo"
|
||||
#define TR_CHECKLIST INDENT "Mostra Checklist"
|
||||
@@ -1076,12 +1074,16 @@
|
||||
#define TR_ALTSENSOR "Sensore Alt"
|
||||
#define TR_CELLSENSOR "Sensore Cell"
|
||||
#define TR_GPSSENSOR "Sensore GPS"
|
||||
#define TR_CURRENTSENSOR "Sensore Currente"
|
||||
#define TR_CURRENTSENSOR "Sensore"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positivo"
|
||||
#define TR_FILTER "Filtro"
|
||||
#define TR_TELEMETRYFULL "Tutti gli slot sono pieni!"
|
||||
#define TR_IGNOREIDS TR(INDENT "No inst.","Ignora instanza")
|
||||
#define TR_IGNORE_INSTANCE TR(INDENT "No inst.","Ignora instanza")
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Ingressi"
|
||||
#define TR_MENU_LUA "\322Lua scripts"
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
#define TR_VDISPLAYTRIMS "Nee\0 ""Kort\0 ""Ja\0 "
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "StilteBeeps\0Spraak"
|
||||
#define TR_VBEEPCOUNTDOWN "StilteBeeps\0SpraakTril\0 "
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tonen\0""Stilte"
|
||||
@@ -319,22 +319,22 @@
|
||||
#endif
|
||||
|
||||
#if ROTARY_ENCODERS == 2
|
||||
#define TR_FSW_RESET_ROTENC TR("REa\0""REb\0", "RotEnc A\0""RotEnc B\0")
|
||||
#define TR_FSW_RESET_ROTENC TR("REa\0""REb\0", "RotEnc A\0 ""RotEnc B\0 ")
|
||||
#elif ROTARY_ENCODERS == 1
|
||||
#define TR_FSW_RESET_ROTENC TR("R.E.", "RotEnc\0 ")
|
||||
#define TR_FSW_RESET_ROTENC TR("R.E.", "RotEnc\0 ")
|
||||
#else
|
||||
#define TR_FSW_RESET_ROTENC
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
#define TR_FSW_RESET_TIMERS "Timer 1\0 ""Timer 2\0 ""Timer 3\0 "
|
||||
#define TR_FSW_RESET_TIMERS "Timer 1\0 ""Timer 2\0 ""Timer 3\0 "
|
||||
#elif defined(CPUARM)
|
||||
#define TR_FSW_RESET_TIMERS "Tmr1""Tmr2""Tmr3"
|
||||
#else
|
||||
#define TR_FSW_RESET_TIMERS "Tmr1""Tmr2"
|
||||
#endif
|
||||
|
||||
#define TR_VFSWRESET TR(TR_FSW_RESET_TIMERS "All\0" TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC, TR_FSW_RESET_TIMERS "Flight\0 " TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC)
|
||||
#define TR_VFSWRESET TR(TR_FSW_RESET_TIMERS "All\0" TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC, TR_FSW_RESET_TIMERS "Vliegdata\0" TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC)
|
||||
|
||||
#define LEN_FUNCSOUNDS TR("\004", "\006")
|
||||
#define TR_FUNCSOUNDS TR("Bp1\0""Bp2\0""Bp3\0""Wrn1""Wrn2""Chee""Rata""Tick""Sirn""Ring""SciF""Robt""Chrp""Tada""Crck""Alrm", "Beep1 ""Beep2 ""Beep3 ""Warn1 ""Warn2 ""Cheep ""Ratata""Tick ""Siren ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""AlmClk")
|
||||
@@ -489,23 +489,27 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
|
||||
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
|
||||
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
|
||||
|
||||
|
||||
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -545,7 +549,8 @@
|
||||
#define TR_VSENSORTYPES "Custom\0 ""Berekend"
|
||||
|
||||
#define LEN_VFORMULAS "\014"
|
||||
#define TR_VFORMULAS "Optellen\0 ""Gemiddeld\0 ""Min\0 ""Max\0 ""Vermenigvuld""Totaal\0 ""Cellen\0 ""Verbruik\0 ""Afstand\0 "
|
||||
#define TR_VFORMULAS "Optellen\0 ""Gemiddeld\0 ""Min\0 ""Max\0 ""Vermenigvuld""Totaal\0 ""Cellen\0 ""Verbruik\0 ""Afstand\0 "
|
||||
|
||||
|
||||
|
||||
#define LEN_VPREC "\004" // "\005" Prec0 Prec1 Prec2
|
||||
@@ -956,9 +961,13 @@
|
||||
#define TR_COUNT "Punten"
|
||||
#define TR_PT "Pt"
|
||||
#define TR_PTS "Ptn"
|
||||
#define TR_SMOOTH "Afronden"
|
||||
#define TR_SMOOTH "Zacht"
|
||||
#define TR_COPY_STICKS_TO_OFS "Kopieer Sticks naar Subtrim"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Kopieer Trim naar Subtrim"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Globale Var"
|
||||
#define TR_MIXSOURCE "Mixer Bron"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Vasthouden mAh")
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST TR(INDENT "Checklist", INDENT "Display Checklist")
|
||||
@@ -1089,7 +1098,11 @@
|
||||
#define TR_ONLYPOSITIVE "Geen Negatief"
|
||||
#define TR_FILTER "Filter aktief"
|
||||
#define TR_TELEMETRYFULL "Telemetrie slots vol!"
|
||||
#define TR_IGNOREIDS TR(INDENT "Neg. ID ","Negeer ID's")
|
||||
#define TR_IGNORE_INSTANCE TR(INDENT "Neg. ID ","Negeer ID's")
|
||||
#define TR_DISCOVER_SENSORS INDENT "Ontdek nieuwe sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop ontdekking"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Wis alle sensors"
|
||||
#define TR_CONFIRMDELETE "Echt alles wissen?"
|
||||
|
||||
|
||||
#define TR_MENU_INPUTS "\314Inputs"
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
#define TR_VDISPLAYTRIMS "Nie\0 ""Zmień\0""Tak\0"
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "Cichy Pik \0Dźwięk"
|
||||
#define TR_VBEEPCOUNTDOWN "Cichy Pik \0DźwiękWibrac"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Ton\0 ""Cicho "
|
||||
@@ -490,23 +490,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "GAZ""SK ""SW ""LOT""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -548,8 +542,8 @@
|
||||
#define LEN_VFORMULAS "\010" /*8 decimal*/
|
||||
#define TR_VFORMULAS "Dodaj\0 ""Średnie\0""Min\0 ""Max\0 ""Mnóż\0 ""Zliczani""Komórka\0""Zużycie\0""Zasięg\0 "
|
||||
|
||||
#define LEN_VPREC "\005"
|
||||
#define TR_VPREC "PREC0""PREC1""PREC2"
|
||||
#define LEN_VPREC "\004"
|
||||
#define TR_VPREC "0.--""0.0 ""0.00"
|
||||
|
||||
#define LEN_VCELLINDEX "\007"
|
||||
#define TR_VCELLINDEX "Niskie\0""1\0 ""2\0 ""3\0 ""4\0 ""5\0 ""6\0 ""Wysokie""Delta\0"
|
||||
@@ -952,6 +946,10 @@
|
||||
#define TR_SMOOTH "Gładka"
|
||||
#define TR_COPY_STICKS_TO_OFS "Skopiuj Drążki Do Offsetu"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Skopiuj Trymery Do subtrymerów"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Zap. mAh", INDENT "Zapisz mAh")
|
||||
#define TR_PREFLIGHT "Lista Ostrzeżeń"
|
||||
#define TR_CHECKLIST TR(INDENT "Czeklista",INDENT "Pokaż Listę Ostrzeżeń")
|
||||
@@ -1077,12 +1075,16 @@
|
||||
#define TR_ALTSENSOR "Alt sensor"
|
||||
#define TR_CELLSENSOR "Cell sensor"
|
||||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Curr. sensor"
|
||||
#define TR_CURRENTSENSOR "Sensor"
|
||||
#define TR_AUTOOFFSET "Auto Ofset"
|
||||
#define TR_ONLYPOSITIVE "Dodatni"
|
||||
#define TR_FILTER "Filtr"
|
||||
#define TR_TELEMETRYFULL "Wszyskie miejsca zajęte!"
|
||||
#define TR_IGNOREIDS INDENT "Ignoruj przypadek"
|
||||
#define TR_IGNORE_INSTANCE INDENT "Ignoruj przypadek"
|
||||
#define TR_DISCOVER_SENSORS INDENT "Znajdź nowe czujniki"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Szukanie STOP "
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Usuń czujniki "
|
||||
#define TR_CONFIRMDELETE "Usunąć wszystkie ?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Wejści"
|
||||
#define TR_MENU_LUA "\322SkryptyLUA"
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#define TR_VDISPLAYTRIMS "No\0 ""Change""Yes\0"
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voice\0"
|
||||
#define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voice\0Haptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tone\0 ""Silent"
|
||||
@@ -471,23 +471,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -903,6 +897,10 @@
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH INDENT "Store mAh"
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST INDENT "Display Checklist"
|
||||
@@ -1028,12 +1026,16 @@
|
||||
#define TR_ALTSENSOR "Alt sensor"
|
||||
#define TR_CELLSENSOR "Cell sensor"
|
||||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_CURRENTSENSOR "Sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
#define TR_IGNOREIDS INDENT "Ignore instance"
|
||||
#define TR_IGNORE_INSTANCE INDENT "Ignore instance"
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Inputs"
|
||||
#define TR_MENU_LUA "\322Lua scripts"
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#define TR_VDISPLAYTRIMS "No\0 ""Change""Yes\0"
|
||||
|
||||
#define LEN_VBEEPCOUNTDOWN "\006"
|
||||
#define TR_VBEEPCOUNTDOWN "Tyst\0 Pip\0 Röst\0 "
|
||||
#define TR_VBEEPCOUNTDOWN "Tyst\0 Pip\0 Röst\0 Haptic"
|
||||
|
||||
#define LEN_VVARIOCENTER "\006"
|
||||
#define TR_VVARIOCENTER "Tone\0 ""Silent"
|
||||
@@ -471,23 +471,17 @@
|
||||
#define TR_ROTENC_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301"
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301"
|
||||
#else
|
||||
#if !defined(PCBTARANIS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(REV9E)
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46"
|
||||
#else
|
||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||
#endif
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW TR_ON_ONE_SWITCHES
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
@@ -522,8 +516,8 @@
|
||||
#define LEN_VFORMULAS "\010"
|
||||
#define TR_VFORMULAS "Add\0 ""Average\0""Min\0 ""Max\0 ""Multiply""Totalize""Cell\0 ""Consumpt""Distance"
|
||||
|
||||
#define LEN_VPREC "\005"
|
||||
#define TR_VPREC "PREC0""PREC1""PREC2"
|
||||
#define LEN_VPREC "\004"
|
||||
#define TR_VPREC "0.--""0.0 ""0.00"
|
||||
|
||||
#define LEN_VCELLINDEX "\007"
|
||||
#define TR_VCELLINDEX "Lowest\0""1\0 ""2\0 ""3\0 ""4\0 ""5\0 ""6\0 ""Highest""Delta\0"
|
||||
@@ -903,6 +897,10 @@
|
||||
#define TR_SMOOTH "Mjuk"
|
||||
#define TR_COPY_STICKS_TO_OFS "Spara spakar som offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Spara trimmar som offset"
|
||||
#define TR_INCDEC "Inc/Decrement"
|
||||
#define TR_GLOBALVAR "Global Var"
|
||||
#define TR_MIXSOURCE "Mixer Source"
|
||||
#define TR_CONSTANT "Constant"
|
||||
#define TR_PERSISTENT_MAH INDENT "Lagra mAh"
|
||||
#define TR_PREFLIGHT "Startkontroller"
|
||||
#define TR_CHECKLIST TR(INDENT "Checklista", INDENT "Visa Checklista")
|
||||
@@ -1028,12 +1026,16 @@
|
||||
#define TR_ALTSENSOR "Alt sensor"
|
||||
#define TR_CELLSENSOR "Cell sensor"
|
||||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_CURRENTSENSOR "Sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
#define TR_IGNOREIDS INDENT "Ignore instance"
|
||||
#define TR_IGNORE_INSTANCE INDENT "Ignore instance"
|
||||
#define TR_DISCOVER_SENSORS INDENT "Discover new sensors"
|
||||
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop discovery"
|
||||
#define TR_DELETE_ALL_SENSORS INDENT "Delete all sensors"
|
||||
#define TR_CONFIRMDELETE "Really delete all?"
|
||||
|
||||
#define TR_MENU_INPUTS "\314Inputs"
|
||||
#define TR_MENU_LUA "\322Lua scripts"
|
||||
|
||||
@@ -88,7 +88,7 @@ I18N_PLAY_FUNCTION(pl, pushUnitPrompt, int16_t number, uint8_t unitprompt)
|
||||
test_2 =number % 10;
|
||||
int ten=0;
|
||||
ten=(number - (number % 10))/10;
|
||||
if ((test_2 > 1 && test_2 < 5) && ten >2)
|
||||
if ((test_2 > 1 && test_2 < 5) && ten >=2)
|
||||
PUSH_NUMBER_PROMPT(unitprompt+1);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(unitprompt+2);
|
||||
@@ -149,11 +149,16 @@ I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
switch(unit) {
|
||||
case 0:
|
||||
break;
|
||||
// ft/s
|
||||
case 6:
|
||||
// mph
|
||||
case 8:
|
||||
// feet
|
||||
case 10:
|
||||
case 13:
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
//mAh
|
||||
case 14:
|
||||
//flOz
|
||||
case 21:
|
||||
att = ZENSKI;
|
||||
break;
|
||||
case 100:
|
||||
@@ -186,10 +191,14 @@ I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
if (number >= 1000) {
|
||||
if (number >= 2000)
|
||||
PLAY_NUMBER(number / 1000, 0, 0);
|
||||
|
||||
if (number >= 2000 && number < 5000)
|
||||
PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIACE);
|
||||
else
|
||||
else if (number >= 5000)
|
||||
PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIECY);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIAC);
|
||||
|
||||
number %= 1000;
|
||||
if (number == 0)
|
||||
number = -1;
|
||||
|
||||
Reference in New Issue
Block a user