Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4fc8482f0 | |||
| 0576edc6a6 | |||
| 36d300b248 | |||
| ae1be246b6 | |||
| 9cb026ec58 | |||
| fd39a178bb | |||
| a7655c30ff | |||
| 471511c24c | |||
| 37cc13c140 | |||
| 5118eccf4d | |||
| aa9ae51e21 | |||
| 452ac21f89 | |||
| 1ec8c74911 | |||
| ebbfb7336e | |||
| 464755e302 | |||
| 064c8d8a5c | |||
| f14a874bf5 | |||
| de34cb7ef2 | |||
| 72a3098f26 | |||
| 358a57945f | |||
| e9abf59ee4 | |||
| 5ff4335b50 | |||
| 4d797f5e83 | |||
| 2a8fe6d110 | |||
| ea7acfa5a6 | |||
| 2de5a8dcb6 | |||
| e064edc69b | |||
| 4d03134e9e | |||
| 541c5aa000 | |||
| ad82ce9c1b | |||
| 7c4bb27ebd | |||
| e484668033 | |||
| 5f9a24cddd | |||
| 5154ba238a | |||
| c4a8e121d3 | |||
| 6c068076e4 | |||
| 8b5165c271 | |||
| 61f430cb43 | |||
| 144f47b6cf | |||
| a493e022a7 | |||
| 517c5521be | |||
| aedb5211ab | |||
| 8833a3e451 | |||
| 79c0754af9 | |||
| 49cb4f97d6 | |||
| a5bf114f2b | |||
| 022caee996 |
+38
-29
@@ -130,9 +130,6 @@ GRAPHICS = YES
|
||||
BOLD = YES
|
||||
BATTGRAPH = NO
|
||||
|
||||
# THR trace (in STATS screen)
|
||||
THR_TRACE = YES
|
||||
|
||||
# PPM center adjustable
|
||||
# Values = YES, NO
|
||||
PPM_CENTER_ADJUSTABLE = NO
|
||||
@@ -204,9 +201,9 @@ EEPROM_PROGRESS_BAR = NO
|
||||
# Values = YES, NO
|
||||
DEBUG = NO
|
||||
|
||||
# Flight Phases
|
||||
# Flight Modes
|
||||
# Values = YES, NO
|
||||
FLIGHT_PHASES = YES
|
||||
FLIGHT_MODES = YES
|
||||
|
||||
# Curves
|
||||
# Values = YES, NO
|
||||
@@ -239,6 +236,12 @@ ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 GRUVIN9X MEGA2560
|
||||
$(error Sorry, the PCB $(PCB) is not supported yet in openTx)
|
||||
endif
|
||||
|
||||
GVARS_VARIANT = +1
|
||||
FRSKY_VARIANT = +2
|
||||
3POS_VARIANT = +4
|
||||
M128_VARIANT = +32768
|
||||
EEPROM_VARIANT = 0
|
||||
|
||||
ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
# 9x/9xr radio
|
||||
ARCH = AVR
|
||||
@@ -247,6 +250,7 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
OPT = s
|
||||
XCURVES = NO
|
||||
SDCARD = NO
|
||||
THR_TRACE = NO
|
||||
EXTRAINCDIRS = stock
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM64 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
@@ -264,8 +268,8 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
CPPDEFS += -DAUDIO
|
||||
CPPSRC += audio_avr.cpp
|
||||
else
|
||||
CPPDEFS += -DBEEPER
|
||||
CPPSRC += beeper.cpp
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
@@ -276,9 +280,11 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
ifeq ($(PWM_BACKLIGHT), YES)
|
||||
ifeq ($(VOICE), YES)
|
||||
$(error Sorry, PWM_BACKLIGHT doesnt work on stock board with VOICE mod)
|
||||
else
|
||||
CPPDEFS += -DPWM_BACKLIGHT
|
||||
endif
|
||||
ifeq ($(AUDIO), YES)
|
||||
$(error Sorry, PWM_BACKLIGHT doesnt work on stock board with AUDIO mod)
|
||||
endif
|
||||
CPPDEFS += -DPWM_BACKLIGHT
|
||||
endif
|
||||
|
||||
ifeq ($(HAPTIC), YES)
|
||||
@@ -298,7 +304,9 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
MCU = atmega128
|
||||
OPT = 2
|
||||
SDCARD = NO
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM128 -DEEPROM_VARIANT=0x8000
|
||||
THR_TRACE = NO
|
||||
EEPROM_VARIANT += ${M128_VARIANT}
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM128 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
|
||||
EXTRAINCDIRS = stock
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
EXTRABOARDSRC = stock/lcd_driver.cpp
|
||||
@@ -315,8 +323,8 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
CPPDEFS += -DAUDIO
|
||||
CPPSRC += audio_avr.cpp
|
||||
else
|
||||
CPPDEFS += -DBEEPER
|
||||
CPPSRC += beeper.cpp
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
@@ -327,9 +335,11 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
ifeq ($(PWM_BACKLIGHT), YES)
|
||||
ifeq ($(VOICE), YES)
|
||||
$(error Sorry, PWM_BACKLIGHT doesnt work on stock board with VOICE mod)
|
||||
else
|
||||
CPPDEFS += -DPWM_BACKLIGHT
|
||||
endif
|
||||
ifeq ($(AUDIO), YES)
|
||||
$(error Sorry, PWM_BACKLIGHT doesnt work on stock board with AUDIO mod)
|
||||
endif
|
||||
CPPDEFS += -DPWM_BACKLIGHT
|
||||
endif
|
||||
|
||||
ifeq ($(HAPTIC), YES)
|
||||
@@ -355,7 +365,8 @@ ifeq ($(PCB), GRUVIN9X)
|
||||
OPT = 2
|
||||
CPPDEFS += -DF_CPU=$(F_CPU)UL -DPCBGRUVIN9X -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC
|
||||
SDCARD = NO
|
||||
BEEPER = NO
|
||||
BUZZER = NO
|
||||
THR_TRACE = YES
|
||||
EXTRAINCDIRS = gruvin9x stock FatFs FatFs/option
|
||||
BOARDSRC = gruvin9x/board_gruvin9x.cpp
|
||||
EXTRABOARDSRC = stock/lcd_driver.cpp
|
||||
@@ -369,9 +380,9 @@ ifeq ($(PCB), GRUVIN9X)
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c gruvin9x/diskio.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(BEEPER), YES)
|
||||
CPPDEFS += -DBEEPER
|
||||
CPPSRC += beeper.cpp
|
||||
ifeq ($(BUZZER), YES)
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
@@ -393,6 +404,7 @@ ifeq ($(PCB), MEGA2560)
|
||||
OPT = 2
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBGRUVIN9X -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC
|
||||
SDCARD = NO
|
||||
THR_TRACE = YES
|
||||
EXTRAINCDIRS = gruvin9x stock FatFs FatFs/option
|
||||
BOARDSRC = mega2560/board_mega2560.cpp
|
||||
EXTRABOARDSRC = mega2560/lcd_driver_ST7565R.cpp
|
||||
@@ -435,7 +447,8 @@ ifeq ($(PCB), SKY9X)
|
||||
MCU = cortex-m3
|
||||
OPT = 2
|
||||
SDCARD = YES
|
||||
BEEPER = NO
|
||||
BUZZER = NO
|
||||
THR_TRACE = YES
|
||||
CPPDEFS += -DPCBSKY9X -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1
|
||||
EXTRAINCDIRS = sky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = sky9x/board_sky9x.cpp
|
||||
@@ -457,9 +470,9 @@ ifeq ($(PCB), SKY9X)
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c sky9x/diskio.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(BEEPER), YES)
|
||||
CPPDEFS += -DBEEPER
|
||||
CPPSRC += beeper.cpp
|
||||
ifeq ($(BUZZER), YES)
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(RTCLOCK), YES)
|
||||
@@ -493,6 +506,7 @@ ifeq ($(PCB), TARANIS)
|
||||
OPT = 2
|
||||
CPPDEFS += -DHSE_VALUE=12000000
|
||||
SDCARD = YES
|
||||
THR_TRACE = YES
|
||||
EXT = FRSKY
|
||||
CPPDEFS += -DPCBTARANIS -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DPXX
|
||||
EXTRAINCDIRS = taranis CoOS/kernel CoOS/portable
|
||||
@@ -592,11 +606,6 @@ CPPDEFS += -DTRANSLATIONS_$(TRANSLATIONS)
|
||||
# TTS language
|
||||
CPPDEFS += -DTTS_$(TTS)
|
||||
|
||||
GVARS_VARIANT = +1
|
||||
FRSKY_VARIANT = +2
|
||||
3POS_VARIANT = +4
|
||||
EEPROM_VARIANT = 0
|
||||
|
||||
ifeq ($(UNITS), IMPERIAL)
|
||||
CPPDEFS += -DIMPERIAL_UNITS
|
||||
endif
|
||||
@@ -660,8 +669,8 @@ ifeq ($(THR_TRACE), YES)
|
||||
CPPDEFS += -DTHRTRACE
|
||||
endif
|
||||
|
||||
ifeq ($(FLIGHT_PHASES), YES)
|
||||
CPPDEFS += -DFLIGHT_PHASES
|
||||
ifeq ($(FLIGHT_MODES), YES)
|
||||
CPPDEFS += -DFLIGHT_MODES
|
||||
endif
|
||||
|
||||
ifeq ($(CURVES), YES)
|
||||
|
||||
+6
-11
@@ -552,11 +552,11 @@ void AudioQueue::wakeup()
|
||||
inline uint8_t getToneLength(uint8_t tLen)
|
||||
{
|
||||
uint8_t result = tLen; // default
|
||||
if (g_eeGeneral.beeperLength < 0) {
|
||||
result /= (1-g_eeGeneral.beeperLength);
|
||||
if (g_eeGeneral.beepLength < 0) {
|
||||
result /= (1-g_eeGeneral.beepLength);
|
||||
}
|
||||
if (g_eeGeneral.beeperLength > 0) {
|
||||
result *= (1+g_eeGeneral.beeperLength);
|
||||
if (g_eeGeneral.beepLength > 0) {
|
||||
result *= (1+g_eeGeneral.beepLength);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -711,17 +711,12 @@ void audioEvent(uint8_t e, uint8_t f)
|
||||
#endif
|
||||
|
||||
if (e <= AU_ERROR || e >= AU_WARNING1) {
|
||||
#if defined(BEEPER)
|
||||
beep();
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.alarmsFlash) {
|
||||
if (lightOffCounter < FLASH_DURATION)
|
||||
lightOffCounter = FLASH_DURATION;
|
||||
flashCounter = FLASH_DURATION;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR)) {
|
||||
if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beepMode>=-1 && e<=AU_ERROR)) {
|
||||
#if defined(SDCARD)
|
||||
if (e < AU_FRSKY_FIRST && isAudioFileAvailable(e, filename)) {
|
||||
audioQueue.playFile(filename);
|
||||
|
||||
+27
-20
@@ -151,16 +151,13 @@ void codecsInit();
|
||||
void audioEvent(uint8_t e, uint8_t f=BEEP_DEFAULT_FREQ);
|
||||
void audioStart();
|
||||
|
||||
#define AUDIO_TADA() audioEvent(AU_TADA)
|
||||
#define AUDIO_KEYPAD_UP() audioEvent(AU_KEYPAD_UP)
|
||||
#define AUDIO_KEYPAD_DOWN() audioEvent(AU_KEYPAD_DOWN)
|
||||
#define AUDIO_MENUS() audioEvent(AU_MENUS)
|
||||
#define AUDIO_WARNING1() audioEvent(AU_WARNING1)
|
||||
#define AUDIO_WARNING2() audioEvent(AU_WARNING2)
|
||||
#define AUDIO_TX_BATTERY_LOW() audioEvent(AU_TX_BATTERY_LOW)
|
||||
#define AUDIO_TX_MAH_HIGH() audioEvent(AU_TX_MAH_HIGH)
|
||||
#define AUDIO_TX_TEMP_HIGH() audioEvent(AU_TX_TEMP_HIGH)
|
||||
#define AUDIO_ERROR() audioEvent(AU_ERROR)
|
||||
#if defined(AUDIO) && defined(BUZZER)
|
||||
#define AUDIO_BUZZER(a, b) do { a; b; } while(0)
|
||||
#elif defined(AUDIO)
|
||||
#define AUDIO_BUZZER(a, b) a
|
||||
#else
|
||||
#define AUDIO_BUZZER(a, b) b
|
||||
#endif
|
||||
|
||||
#if defined(VOICE)
|
||||
#define AUDIO_ERROR_MESSAGE(e) audioEvent(e)
|
||||
@@ -170,18 +167,28 @@ void audioStart();
|
||||
#define AUDIO_TIMER_MINUTE(t) audioDefevent(AU_WARNING1)
|
||||
#endif
|
||||
|
||||
#define AUDIO_TIMER_30() audioEvent(AU_TIMER_30)
|
||||
#define AUDIO_TIMER_20() audioEvent(AU_TIMER_20)
|
||||
#define AUDIO_TIMER_10() audioEvent(AU_TIMER_10)
|
||||
#define AUDIO_TIMER_LT3(x) audioEvent(AU_TIMER_LT3)
|
||||
#define AUDIO_INACTIVITY() audioEvent(AU_INACTIVITY)
|
||||
#define AUDIO_MIX_WARNING(x) audioEvent(AU_MIX_WARNING_1+x-1)
|
||||
#define AUDIO_POT_STICK_MIDDLE() audioEvent(AU_POT_STICK_MIDDLE)
|
||||
#define AUDIO_TADA() audioEvent(AU_TADA)
|
||||
#define AUDIO_KEYPAD_UP() AUDIO_BUZZER(audioEvent(AU_KEYPAD_UP), beep(0))
|
||||
#define AUDIO_KEYPAD_DOWN() AUDIO_BUZZER(audioEvent(AU_KEYPAD_DOWN), beep(0))
|
||||
#define AUDIO_MENUS() AUDIO_BUZZER(audioEvent(AU_MENUS), beep(0))
|
||||
#define AUDIO_WARNING1() AUDIO_BUZZER(audioEvent(AU_WARNING1), beep(3))
|
||||
#define AUDIO_WARNING2() AUDIO_BUZZER(audioEvent(AU_WARNING2), beep(2))
|
||||
#define AUDIO_TX_BATTERY_LOW() AUDIO_BUZZER(audioEvent(AU_TX_BATTERY_LOW), beep(4))
|
||||
#define AUDIO_TX_MAH_HIGH() audioEvent(AU_TX_MAH_HIGH)
|
||||
#define AUDIO_TX_TEMP_HIGH() audioEvent(AU_TX_TEMP_HIGH)
|
||||
#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); })
|
||||
#define AUDIO_TIMER_10() AUDIO_BUZZER(audioEvent(AU_TIMER_10), beep(2))
|
||||
#define AUDIO_TIMER_LT3(x) AUDIO_BUZZER(audioEvent(AU_TIMER_LT3), beep(2))
|
||||
#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_STICK_MIDDLE() AUDIO_BUZZER(audioEvent(AU_POT_STICK_MIDDLE), beep(2))
|
||||
#define AUDIO_VARIO_UP() audioEvent(AU_KEYPAD_UP)
|
||||
#define AUDIO_VARIO_DOWN() audioEvent(AU_KEYPAD_DOWN)
|
||||
#define AUDIO_TRIM_MIDDLE(f) audioEvent(AU_TRIM_MIDDLE, f)
|
||||
#define AUDIO_TRIM_END(f) audioEvent(AU_TRIM_END, f)
|
||||
#define AUDIO_TRIM(event, f) audioEvent(AU_TRIM_MOVE, f)
|
||||
#define AUDIO_TRIM_MIDDLE(f) AUDIO_BUZZER(audioEvent(AU_TRIM_MIDDLE, f), beep(2))
|
||||
#define AUDIO_TRIM_END(f) AUDIO_BUZZER(audioEvent(AU_TRIM_END, f), beep(2))
|
||||
#define AUDIO_TRIM(event, f) AUDIO_BUZZER(audioEvent(AU_TRIM_MOVE, f), { if (!IS_KEY_FIRST(event)) warble = true; beep(1); })
|
||||
#define AUDIO_PLAY(p) audioEvent(p)
|
||||
#define AUDIO_VARIO(f, t) audioQueue.play(f, t, 0, PLAY_BACKGROUND)
|
||||
|
||||
|
||||
+6
-11
@@ -107,11 +107,11 @@ void audioQueue::heartbeat()
|
||||
inline uint8_t audioQueue::getToneLength(uint8_t tLen)
|
||||
{
|
||||
uint8_t result = tLen; // default
|
||||
if (g_eeGeneral.beeperLength < 0) {
|
||||
result /= (1-g_eeGeneral.beeperLength);
|
||||
if (g_eeGeneral.beepLength < 0) {
|
||||
result /= (1-g_eeGeneral.beepLength);
|
||||
}
|
||||
if (g_eeGeneral.beeperLength > 0) {
|
||||
result *= (1+g_eeGeneral.beeperLength);
|
||||
if (g_eeGeneral.beepLength > 0) {
|
||||
result *= (1+g_eeGeneral.beepLength);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -168,17 +168,12 @@ void audioQueue::event(uint8_t e, uint8_t f)
|
||||
#endif
|
||||
|
||||
if (e <= AU_ERROR || e >= AU_WARNING1) {
|
||||
#if defined(BEEPER)
|
||||
beep();
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.alarmsFlash) {
|
||||
if (lightOffCounter < FLASH_DURATION)
|
||||
lightOffCounter = FLASH_DURATION;
|
||||
flashCounter = FLASH_DURATION;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR)) {
|
||||
if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beepMode>=-1 && e<=AU_ERROR)) {
|
||||
if (e < AU_FRSKY_FIRST || empty()) {
|
||||
// TODO when VOICE enable some cases here are not needed!
|
||||
switch (e) {
|
||||
|
||||
+31
-32
@@ -107,47 +107,46 @@ class audioQueue
|
||||
|
||||
};
|
||||
|
||||
|
||||
extern audioQueue audio;
|
||||
|
||||
void audioDefevent(uint8_t e);
|
||||
|
||||
#define AUDIO_KEYPAD_UP() audioDefevent(AU_KEYPAD_UP)
|
||||
#define AUDIO_KEYPAD_DOWN() audioDefevent(AU_KEYPAD_DOWN)
|
||||
#define AUDIO_MENUS() audioDefevent(AU_MENUS)
|
||||
#define AUDIO_WARNING1() audioDefevent(AU_WARNING1)
|
||||
#define AUDIO_WARNING2() audioDefevent(AU_WARNING2)
|
||||
#define AUDIO_ERROR() audioDefevent(AU_ERROR)
|
||||
|
||||
#if defined(VOICE)
|
||||
#define AUDIO_TADA() PUSH_SYSTEM_PROMPT(AU_TADA)
|
||||
#define AUDIO_TX_BATTERY_LOW() PUSH_SYSTEM_PROMPT(AU_TX_BATTERY_LOW)
|
||||
#define AUDIO_INACTIVITY() PUSH_SYSTEM_PROMPT(AU_INACTIVITY)
|
||||
#define AUDIO_ERROR_MESSAGE(e) PUSH_SYSTEM_PROMPT((e))
|
||||
#define AUDIO_TIMER_MINUTE(t) playDuration(t)
|
||||
#define AUDIO_TIMER_30() PUSH_SYSTEM_PROMPT(AU_TIMER_30)
|
||||
#define AUDIO_TIMER_20() PUSH_SYSTEM_PROMPT(AU_TIMER_20)
|
||||
#define AUDIO_TIMER_10() PUSH_SYSTEM_PROMPT(AU_TIMER_10)
|
||||
#define AUDIO_TIMER_LT3(x) PUSH_SYSTEM_PROMPT(AU_TIMER_LT3)
|
||||
#if defined(AUDIO) && defined(BUZZER)
|
||||
#define AUDIO_BUZZER(a, b) do { a; b; } while(0)
|
||||
#elif defined(AUDIO)
|
||||
#define AUDIO_BUZZER(a, b) a
|
||||
#else
|
||||
#define AUDIO_TADA()
|
||||
#define AUDIO_TX_BATTERY_LOW() audioDefevent(AU_TX_BATTERY_LOW)
|
||||
#define AUDIO_INACTIVITY() audioDefevent(AU_INACTIVITY)
|
||||
#define AUDIO_ERROR_MESSAGE(e) audioDefevent(AU_ERROR)
|
||||
#define AUDIO_TIMER_MINUTE(t) audioDefevent(AU_WARNING1)
|
||||
#define AUDIO_TIMER_30() audioDefevent(AU_TIMER_30)
|
||||
#define AUDIO_TIMER_20() audioDefevent(AU_TIMER_20)
|
||||
#define AUDIO_TIMER_10() audioDefevent(AU_TIMER_10)
|
||||
#define AUDIO_TIMER_LT3(x) audioDefevent(AU_TIMER_LT3)
|
||||
#define AUDIO_BUZZER(a, b) b
|
||||
#endif
|
||||
|
||||
#define AUDIO_MIX_WARNING(x) audioDefevent(AU_MIX_WARNING_1+x-1)
|
||||
#define AUDIO_POT_STICK_MIDDLE() audioDefevent(AU_POT_STICK_MIDDLE)
|
||||
#if defined(VOICE)
|
||||
#define VOICE_AUDIO_BUZZER(v, a, b) v
|
||||
#else
|
||||
#define VOICE_AUDIO_BUZZER(v, a, b) AUDIO_BUZZER(a, b)
|
||||
#endif
|
||||
|
||||
#define AUDIO_KEYPAD_UP() AUDIO_BUZZER(audioDefevent(AU_KEYPAD_UP), beep(0))
|
||||
#define AUDIO_KEYPAD_DOWN() AUDIO_BUZZER(audioDefevent(AU_KEYPAD_DOWN), beep(0))
|
||||
#define AUDIO_MENUS() AUDIO_BUZZER(audioDefevent(AU_MENUS), beep(0))
|
||||
#define AUDIO_WARNING1() AUDIO_BUZZER(audioDefevent(AU_WARNING1), beep(3))
|
||||
#define AUDIO_WARNING2() AUDIO_BUZZER(audioDefevent(AU_WARNING2), beep(2))
|
||||
#define AUDIO_ERROR() AUDIO_BUZZER(audioDefevent(AU_ERROR), beep(4))
|
||||
#define AUDIO_TADA() VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT(AU_TADA),,)
|
||||
#define AUDIO_TX_BATTERY_LOW() VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT(AU_TX_BATTERY_LOW), audioDefevent(AU_TX_BATTERY_LOW), beep(4))
|
||||
#define AUDIO_INACTIVITY() VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT(AU_INACTIVITY), audioDefevent(AU_INACTIVITY), beep(3))
|
||||
#define AUDIO_ERROR_MESSAGE(e) VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT((e)), audioDefevent(AU_ERROR), beep(4))
|
||||
#define AUDIO_TIMER_MINUTE(t) VOICE_AUDIO_BUZZER(playDuration(t), audioDefevent(AU_WARNING1), beep(2))
|
||||
#define AUDIO_TIMER_30() VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT(AU_TIMER_30), audioDefevent(AU_TIMER_30), { beepAgain=2; beep(2); })
|
||||
#define AUDIO_TIMER_20() VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT(AU_TIMER_20), audioDefevent(AU_TIMER_20), { beepAgain=1; beep(2); })
|
||||
#define AUDIO_TIMER_10() VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT(AU_TIMER_10), audioDefevent(AU_TIMER_10), beep(2))
|
||||
#define AUDIO_TIMER_LT3(x) VOICE_AUDIO_BUZZER(PUSH_SYSTEM_PROMPT(AU_TIMER_LT3), audioDefevent(AU_TIMER_LT3), beep(2))
|
||||
#define AUDIO_MIX_WARNING(x) AUDIO_BUZZER(audioDefevent(AU_MIX_WARNING_1+x-1), beep(1))
|
||||
#define AUDIO_POT_STICK_MIDDLE() AUDIO_BUZZER(audioDefevent(AU_POT_STICK_MIDDLE), beep(2))
|
||||
#define AUDIO_VARIO_UP() audioDefevent(AU_KEYPAD_UP)
|
||||
#define AUDIO_VARIO_DOWN() audioDefevent(AU_KEYPAD_DOWN)
|
||||
#define AUDIO_TRIM_MIDDLE(f) audio.event(AU_TRIM_MIDDLE, f)
|
||||
#define AUDIO_TRIM_END(f) AUDIO_TRIM_MIDDLE(f)
|
||||
#define AUDIO_TRIM(event, f) audio.event(AU_TRIM_MOVE, f)
|
||||
#define AUDIO_TRIM_MIDDLE(f) AUDIO_BUZZER(audio.event(AU_TRIM_MIDDLE, f), beep(2))
|
||||
#define AUDIO_TRIM_END(f) AUDIO_BUZZER(audioDefevent(f), beep(2))
|
||||
#define AUDIO_TRIM(event, f) AUDIO_BUZZER(audio.event(AU_TRIM_MOVE, f), { if (!IS_KEY_FIRST(event)) warble = true; beep(1); })
|
||||
#define AUDIO_PLAY(p) audio.event(p)
|
||||
#define AUDIO_VARIO(f, t) audio.play(f, t, 0, PLAY_BACKGROUND)
|
||||
|
||||
|
||||
@@ -43,15 +43,6 @@ uint8_t beepOn = false;
|
||||
bool warble = false;
|
||||
bool warbleC;
|
||||
|
||||
#if defined(AUDIO)
|
||||
static const pm_uint8_t beepTab[] PROGMEM = {
|
||||
60, 80, 100, 120, 150,
|
||||
};
|
||||
void beep()
|
||||
{
|
||||
_beep(pgm_read_byte(beepTab+(2+g_eeGeneral.beeperLength)));
|
||||
}
|
||||
#else
|
||||
// The various "beep" tone lengths
|
||||
static const pm_uint8_t beepTab[] PROGMEM = {
|
||||
// key, trim, warn2, warn1, error
|
||||
@@ -64,14 +55,16 @@ static const pm_uint8_t beepTab[] PROGMEM = {
|
||||
|
||||
void beep(uint8_t val)
|
||||
{
|
||||
#if defined(HAPTIC)
|
||||
#if defined(HAPTIC) && !defined(AUDIO)
|
||||
haptic.event(val==0 ? AU_KEYPAD_UP : (val==4 ? AU_ERROR : AU_TIMER_10+beepAgain));
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.alarmsFlash && val>1 && lightOffCounter<FLASH_DURATION) lightOffCounter = FLASH_DURATION;
|
||||
#if !defined(AUDIO)
|
||||
if (g_eeGeneral.alarmsFlash && val>1) flashCounter = FLASH_DURATION;
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && val!=0) || (g_eeGeneral.beeperMode==-1 && val>=3)) {
|
||||
_beep(pgm_read_byte(beepTab+5*(2+g_eeGeneral.beeperLength)+val));
|
||||
if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && val!=0) || (g_eeGeneral.beepMode==-1 && val>=3)) {
|
||||
_beep(pgm_read_byte(beepTab+5*(2+g_eeGeneral.beepLength)+val));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BEEPER_H
|
||||
#define BEEPER_H
|
||||
#ifndef BUZZER_H
|
||||
#define BUZZER_H
|
||||
|
||||
extern uint8_t g_beepCnt;
|
||||
extern uint8_t beepAgain;
|
||||
@@ -47,7 +47,7 @@ extern bool warbleC;
|
||||
extern uint8_t hapticTick;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if defined(CPUARM) && !defined(SIMU)
|
||||
inline void _beep(uint8_t b)
|
||||
{
|
||||
buzzerSound(b);
|
||||
@@ -59,11 +59,7 @@ inline void _beep(uint8_t b)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO)
|
||||
void beep();
|
||||
#else
|
||||
void beep(uint8_t val);
|
||||
#endif
|
||||
|
||||
#if !defined(AUDIO)
|
||||
#if defined(VOICE)
|
||||
@@ -111,7 +107,7 @@ void beep(uint8_t val);
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
inline void BEEPER_HEARTBEAT()
|
||||
inline void BUZZER_HEARTBEAT()
|
||||
{
|
||||
if(g_beepCnt) {
|
||||
if(!beepAgainOrig) {
|
||||
+1
-1
@@ -813,7 +813,7 @@ bool eeLoadGeneral()
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 1) == 1 && g_eeGeneral.version == EEPROM_VER) {
|
||||
theFile.openRlc(FILE_GENERAL);
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral)) {
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
if (g_eeGeneral.variant == EEPROM_VARIANT && g_eeGeneral.chkSum == evalChkSum()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+33
-2
@@ -46,9 +46,13 @@ void doMixerCalculations();
|
||||
memset(channelOutputs, 0, sizeof(channelOutputs)); \
|
||||
memset(ex_chans, 0, sizeof(ex_chans))
|
||||
|
||||
uint16_t anaInValues[NUM_STICKS+NUM_POTS] = { 0 };
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
return 0;
|
||||
if (chan < NUM_STICKS+NUM_POTS)
|
||||
return anaInValues[chan];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST(Trims, greaterTrimLink)
|
||||
@@ -299,7 +303,7 @@ TEST(getSwitch, nullSW)
|
||||
EXPECT_EQ(getSwitch(0, 0), false);
|
||||
}
|
||||
|
||||
TEST(Phases, nullFadeOut_posFadeIn)
|
||||
TEST(FlightModes, nullFadeOut_posFadeIn)
|
||||
{
|
||||
MODEL_RESET();
|
||||
g_model.phaseData[1].swtch = SWSRC_ID1;
|
||||
@@ -309,6 +313,33 @@ TEST(Phases, nullFadeOut_posFadeIn)
|
||||
perMain();
|
||||
}
|
||||
|
||||
TEST(Mixer, R2029Comment)
|
||||
{
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_CH2;
|
||||
g_model.mixData[0].swtch = -SWSRC_THR;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_Thr;
|
||||
g_model.mixData[1].swtch = SWSRC_THR;
|
||||
g_model.mixData[1].weight = 100;
|
||||
anaInValues[THR_STICK] = 1024;
|
||||
simuSetSwitch(0, 1);
|
||||
perOut(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], 1024*256);
|
||||
simuSetSwitch(0, 0);
|
||||
perOut(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], 0);
|
||||
simuSetSwitch(0, 1);
|
||||
perOut(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], 1024*256);
|
||||
}
|
||||
|
||||
TEST(Mixer, Cascaded3Channels)
|
||||
{
|
||||
MODEL_RESET();
|
||||
|
||||
+5
-4
@@ -730,11 +730,12 @@ void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2
|
||||
|
||||
qr = div(tme, 60);
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBTARANIS)
|
||||
if (att & MIDSIZE) {
|
||||
div_t qr2 = div(qr.quot, 60);
|
||||
LCD_2DOTS(x+2*8-6, y, att);
|
||||
lcd_outdezNAtt(x, y, qr2.quot, att|LEADING0|LEFT, 2);
|
||||
qr.quot = qr2.rem;
|
||||
x += 2*8+1;
|
||||
}
|
||||
#define separator ':'
|
||||
@@ -812,7 +813,7 @@ void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att)
|
||||
putsStrIdx(x, y, STR_PPM, idx-MIXSRC_PPM1+1, att);
|
||||
else if (idx <= MIXSRC_LAST_CH)
|
||||
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
|
||||
#if defined(GVARS) || !defined(CPUM64)
|
||||
#if defined(GVARS) || !defined(PCBSTD)
|
||||
else if (idx <= MIXSRC_LAST_GVAR)
|
||||
putsStrIdx(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
|
||||
#endif
|
||||
@@ -859,7 +860,7 @@ void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#if !defined(PCBSTD)
|
||||
else if (idx >= SWSRC_TRAINER_SHORT) {
|
||||
idx -= SWSRC_TRAINER_SHORT;
|
||||
lcd_putcAtt(x+3*FW, y, (idx & 1) ? CHR_LONG : CHR_SHORT, att);
|
||||
@@ -884,7 +885,7 @@ void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
||||
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-1, att);
|
||||
}
|
||||
|
||||
#ifdef FLIGHT_PHASES
|
||||
#if defined(FLIGHT_MODES)
|
||||
void putsFlightPhase(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx==0) { lcd_putsiAtt(x, y, STR_MMMINV, 0, att); return; }
|
||||
|
||||
+15
-20
@@ -116,9 +116,9 @@ enum menuGeneralSetupItems {
|
||||
IF_RTCLOCK(ITEM_SETUP_TIME)
|
||||
IF_BATTGRAPH(ITEM_SETUP_BATT_RANGE)
|
||||
ITEM_SETUP_SOUND_LABEL,
|
||||
IF_AUDIO(ITEM_SETUP_AUDIO_MODE)
|
||||
IF_BEEPER(ITEM_SETUP_BEEPER_MODE)
|
||||
ITEM_SETUP_BEEPER_LENGTH,
|
||||
IF_AUDIO(ITEM_SETUP_BEEP_MODE)
|
||||
IF_BUZZER(ITEM_SETUP_BUZZER_MODE)
|
||||
ITEM_SETUP_BEEP_LENGTH,
|
||||
IF_AUDIO(ITEM_SETUP_SPEAKER_PITCH)
|
||||
IF_VOICE(ITEM_SETUP_SPEAKER_VOLUME)
|
||||
IF_HAPTIC(ITEM_SETUP_HAPTIC_LABEL)
|
||||
@@ -135,7 +135,6 @@ enum menuGeneralSetupItems {
|
||||
ITEM_SETUP_MEMORY_WARNING,
|
||||
ITEM_SETUP_ALARM_WARNING,
|
||||
IF_ROTARY_ENCODERS(ITEM_SETUP_RE_NAVIGATION)
|
||||
ITEM_SETUP_THROTTLE_REVERSED,
|
||||
ITEM_SETUP_BACKLIGHT_LABEL,
|
||||
ITEM_SETUP_BACKLIGHT_MODE,
|
||||
ITEM_SETUP_BACKLIGHT_DELAY,
|
||||
@@ -167,7 +166,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, IF_RTCLOCK(2) IF_RTCLOCK(2) IF_BATTGRAPH(1) LABEL(SOUND), IF_AUDIO(0) IF_BEEPER(0) 0, IF_AUDIO(0) IF_VOICE(0) IF_HAPTIC(LABEL(HAPTIC)) IF_HAPTIC(0) IF_HAPTIC(0) IF_HAPTIC(0) IF_PCBSKY9X(0) IF_9X(0) LABEL(ALARMS), 0, IF_PCBSKY9X(0) IF_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) 0, LABEL(BACKLIGHT), 0, 0, CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, IF_SPLASH(0) IF_FRSKY(0) IF_FRSKY(0) IF_PXX(0) IF_CPUARM(0) 0, LABEL(TX_MODE), CASE_PCBTARANIS(0) 1/*to force edit mode*/});
|
||||
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, IF_RTCLOCK(2) IF_RTCLOCK(2) IF_BATTGRAPH(1) LABEL(SOUND), IF_AUDIO(0) IF_BUZZER(0) 0, IF_AUDIO(0) IF_VOICE(0) IF_HAPTIC(LABEL(HAPTIC)) IF_HAPTIC(0) IF_HAPTIC(0) IF_HAPTIC(0) IF_PCBSKY9X(0) IF_9X(0) LABEL(ALARMS), 0, IF_PCBSKY9X(0) IF_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, IF_SPLASH(0) IF_FRSKY(0) IF_FRSKY(0) IF_PXX(0) IF_CPUARM(0) 0, LABEL(TX_MODE), CASE_PCBTARANIS(0) 1/*to force edit mode*/});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
@@ -263,32 +262,32 @@ void menuGeneralSetup(uint8_t event)
|
||||
break;
|
||||
|
||||
#if defined(AUDIO)
|
||||
case ITEM_SETUP_AUDIO_MODE:
|
||||
g_eeGeneral.beeperMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beeperMode, -2, 1, attr, event);
|
||||
case ITEM_SETUP_BEEP_MODE:
|
||||
g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event);
|
||||
#if defined(FRSKY)
|
||||
if (attr && checkIncDec_Ret) frskySendAlarms();
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(BEEPER)
|
||||
case ITEM_SETUP_BEEPER_MODE:
|
||||
g_eeGeneral.alarmsBeep = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_BEEPER, STR_VBEEPMODE, g_eeGeneral.alarmsBeep, 0, 1, attr, event);
|
||||
#if defined(BUZZER)
|
||||
case ITEM_SETUP_BUZZER_MODE:
|
||||
g_eeGeneral.buzzerMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_BUZZER, STR_VBEEPMODE, g_eeGeneral.buzzerMode, -2, 1, attr, event);
|
||||
#if defined(FRSKY)
|
||||
if (attr && checkIncDec_Ret) frskySendAlarms();
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#else
|
||||
case ITEM_SETUP_BEEPER_MODE:
|
||||
g_eeGeneral.beeperMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beeperMode, -2, 1, attr, event);
|
||||
case ITEM_SETUP_BUZZER_MODE:
|
||||
g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event);
|
||||
#if defined(FRSKY)
|
||||
if (attr && checkIncDec_Ret) frskySendAlarms();
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_BEEPER_LENGTH:
|
||||
SLIDER_5POS(y, g_eeGeneral.beeperLength, STR_LENGTH, event, attr);
|
||||
case ITEM_SETUP_BEEP_LENGTH:
|
||||
SLIDER_5POS(y, g_eeGeneral.beepLength, STR_LENGTH, event, attr);
|
||||
break;
|
||||
|
||||
#if defined(AUDIO)
|
||||
@@ -421,18 +420,14 @@ void menuGeneralSetup(uint8_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_THROTTLE_REVERSED:
|
||||
g_eeGeneral.throttleReversed = onoffMenuItem(g_eeGeneral.throttleReversed, RADIO_SETUP_2ND_COLUMN, y, STR_THROTTLEREVERSE, attr, event ) ;
|
||||
case ITEM_SETUP_BACKLIGHT_LABEL:
|
||||
lcd_putsLeft(y, STR_BACKLIGHT_LABEL);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_BACKLIGHT_MODE:
|
||||
g_eeGeneral.backlightMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_BACKLIGHT_LABEL:
|
||||
lcd_putsLeft(y, STR_BACKLIGHT_LABEL);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_FLASH_BEEP:
|
||||
g_eeGeneral.alarmsFlash = onoffMenuItem(g_eeGeneral.alarmsFlash, RADIO_SETUP_2ND_COLUMN, y, STR_ALARM, attr, event ) ;
|
||||
break;
|
||||
|
||||
+399
-238
File diff suppressed because it is too large
Load Diff
+29
-17
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
pgofs_t s_pgOfs;
|
||||
vertpos_t s_pgOfs;
|
||||
int8_t s_editMode;
|
||||
uint8_t s_noHi;
|
||||
uint8_t s_noScroll;
|
||||
@@ -82,6 +82,10 @@ void displayScrollbar(xcoord_t x, uint8_t y, uint8_t h, uint16_t offset, uint16_
|
||||
int16_t p1valdiff;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_POT2)
|
||||
int8_t p2valdiff;
|
||||
#endif
|
||||
|
||||
int8_t checkIncDec_Ret;
|
||||
int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, uint8_t i_flags)
|
||||
{
|
||||
@@ -296,10 +300,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
#ifdef NAVIGATION_POT2
|
||||
// check pot 2 - if changed -> scroll menu
|
||||
static int16_t p2valprev;
|
||||
int8_t scrollLR = (p2valprev-calibratedStick[4]) / SCROLL_TH;
|
||||
if (scrollLR) p2valprev = calibratedStick[4];
|
||||
#else
|
||||
#define scrollLR 0
|
||||
p2valdiff = (p2valprev-calibratedStick[4]) / SCROLL_TH;
|
||||
if (p2valdiff) p2valprev = calibratedStick[4];
|
||||
#endif
|
||||
|
||||
#ifdef NAVIGATION_POT3
|
||||
@@ -311,7 +313,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
#define scrollUD 0
|
||||
#endif
|
||||
|
||||
if (scrollLR || scrollUD || p1valdiff) backlightOn(); // on keypress turn the light on
|
||||
if (p2valdiff || scrollUD || p1valdiff) backlightOn(); // on keypress turn the light on
|
||||
|
||||
if (menuTab) {
|
||||
uint8_t attr = 0;
|
||||
@@ -345,8 +347,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
|
||||
int8_t cc = curr;
|
||||
|
||||
if (scrollLR) {
|
||||
cc = limit((int8_t)0, (int8_t)(cc - scrollLR), (int8_t)(menuTabSize-1));
|
||||
if (p2valdiff) {
|
||||
cc = limit((int8_t)0, (int8_t)(cc - p2valdiff), (int8_t)(menuTabSize-1));
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
@@ -422,8 +424,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert));
|
||||
}
|
||||
|
||||
if (scrollLR && l_posVert>0) {
|
||||
l_posHorz = limit((int8_t)0, (int8_t)((uint8_t)l_posHorz - scrollLR), (int8_t)maxcol);
|
||||
if (p2valdiff && l_posVert>0) {
|
||||
l_posHorz = limit((int8_t)0, (int8_t)((uint8_t)l_posHorz - p2valdiff), (int8_t)maxcol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -675,8 +677,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
|
||||
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
|
||||
if (l_posVert<1) s_pgOfs=0;
|
||||
else if (l_posVert-s_pgOfs>max) s_pgOfs = l_posVert-max;
|
||||
else if (l_posVert-s_pgOfs<1) s_pgOfs = l_posVert-1;
|
||||
else if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max;
|
||||
else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1;
|
||||
m_posVert = l_posVert;
|
||||
m_posHorz = l_posHorz;
|
||||
#if !defined(CPUM64)
|
||||
@@ -891,7 +893,7 @@ const char * displayMenu(uint8_t event)
|
||||
const char * result = NULL;
|
||||
|
||||
uint8_t display_count = min(s_menu_count, (uint16_t)MENU_MAX_LINES);
|
||||
uint8_t y = display_count > 4 ? MENU_Y - FH : MENU_Y;
|
||||
uint8_t y = (display_count >= 5 ? MENU_Y - FH : MENU_Y);
|
||||
lcd_filled_rect(MENU_X, y, MENU_W, display_count * (FH+1) + 2, SOLID, ERASE);
|
||||
lcd_rect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
|
||||
@@ -908,29 +910,39 @@ const char * displayMenu(uint8_t event)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
CASE_EVT_ROTARY_LEFT
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_MOVE_UP):
|
||||
if (s_menu_item > 0)
|
||||
case EVT_KEY_FIRST(KEY_MOVE_UP):
|
||||
case EVT_KEY_REPT(KEY_MOVE_UP):
|
||||
if (s_menu_item > 0) {
|
||||
s_menu_item--;
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else if (s_menu_offset > 0) {
|
||||
s_menu_offset--;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
s_menu_item = display_count - 1;
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
CASE_EVT_ROTARY_RIGHT
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_MOVE_DOWN):
|
||||
if (s_menu_item < display_count - 1 && s_menu_offset + s_menu_item + 1 < s_menu_count)
|
||||
case EVT_KEY_FIRST(KEY_MOVE_DOWN):
|
||||
case EVT_KEY_REPT(KEY_MOVE_DOWN):
|
||||
if (s_menu_item < display_count - 1 && s_menu_offset + s_menu_item + 1 < s_menu_count) {
|
||||
s_menu_item++;
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else if (s_menu_count > s_menu_offset + display_count) {
|
||||
s_menu_offset++;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
s_menu_item = 0;
|
||||
}
|
||||
break;
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
|
||||
+20
-26
@@ -73,13 +73,24 @@ inline void displayColumnHeader(const char **headers, uint8_t index)
|
||||
#define lcd_putsColumnLeft(x, y, str) lcd_putsLeft(y, str)
|
||||
#endif
|
||||
|
||||
// Menus related stuff ...
|
||||
#if defined(SDCARD)
|
||||
typedef uint16_t pgofs_t;
|
||||
typedef uint16_t vertpos_t;
|
||||
#else
|
||||
typedef uint8_t pgofs_t;
|
||||
typedef uint8_t vertpos_t;
|
||||
#endif
|
||||
|
||||
extern pgofs_t s_pgOfs;
|
||||
#if defined(PCBTARANIS)
|
||||
typedef uint8_t & check_event_t;
|
||||
#define horzpos_t int8_t
|
||||
#else
|
||||
typedef uint8_t check_event_t;
|
||||
#define horzpos_t uint8_t
|
||||
#endif
|
||||
|
||||
extern vertpos_t m_posVert;
|
||||
extern horzpos_t m_posHorz;
|
||||
extern vertpos_t s_pgOfs;
|
||||
extern uint8_t s_noHi;
|
||||
extern uint8_t s_noScroll;
|
||||
|
||||
@@ -122,6 +133,12 @@ void menuStatisticsDebug(uint8_t event);
|
||||
#define p1valdiff 0
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_POT2)
|
||||
extern int8_t p2valdiff;
|
||||
#else
|
||||
#define p2valdiff 0
|
||||
#endif
|
||||
|
||||
extern int8_t checkIncDec_Ret; // global helper vars
|
||||
|
||||
#define EDIT_SELECT_MENU -1
|
||||
@@ -173,24 +190,6 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
#define CHECK_INCDEC_GENVAR(event, var, min, max) \
|
||||
var = checkIncDecGen(event,var,min,max)
|
||||
|
||||
// Menus related stuff ...
|
||||
#if defined(SDCARD)
|
||||
#define vertpos_t uint16_t
|
||||
#else
|
||||
#define vertpos_t uint8_t
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
typedef uint8_t & check_event_t;
|
||||
#define horzpos_t int8_t
|
||||
#else
|
||||
typedef uint8_t check_event_t;
|
||||
#define horzpos_t uint8_t
|
||||
#endif
|
||||
|
||||
extern vertpos_t m_posVert;
|
||||
extern horzpos_t m_posHorz;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
#else
|
||||
@@ -276,11 +275,6 @@ void displayWarning(uint8_t event);
|
||||
#else
|
||||
#define MENU_ADD_SD_ITEM(s)
|
||||
#endif
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#define MENU_ADD_NAVIGATION_ITEM(s) MENU_ADD_ITEM(s)
|
||||
#else
|
||||
#define MENU_ADD_NAVIGATION_ITEM(s)
|
||||
#endif
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+1)
|
||||
extern const char *s_menu[MENU_MAX_LINES];
|
||||
extern uint16_t s_menu_count;
|
||||
|
||||
+107
-73
@@ -52,35 +52,89 @@
|
||||
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define EEPROM_VER 214
|
||||
#define EEPROM_VER 214
|
||||
#elif defined(PCBSKY9X)
|
||||
#define EEPROM_VER 214
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#define EEPROM_VER 214
|
||||
#define EEPROM_VER 214
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define EEPROM_VER 214
|
||||
#elif defined(CPUM128)
|
||||
#define EEPROM_VER 215
|
||||
#else
|
||||
#define EEPROM_VER 213
|
||||
#define EEPROM_VER 213
|
||||
#endif
|
||||
|
||||
#ifndef PACK
|
||||
#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MAX_MODELS 60
|
||||
#define NUM_CHNOUT 32 // number of real output channels CH1-CH32
|
||||
#define MAX_PHASES 9
|
||||
#define MAX_MIXERS 64
|
||||
#define MAX_EXPOS 32
|
||||
#define NUM_CSW 32 // number of custom switches
|
||||
#define NUM_CFN 32 // number of functions assigned to switches
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define MAX_MODELS 30
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define MAX_PHASES 6
|
||||
#define MAX_MIXERS 32
|
||||
#define MAX_EXPOS 16
|
||||
#define NUM_CSW 15 // number of custom switches
|
||||
#define NUM_CFN 24 // number of functions assigned to switches
|
||||
#elif defined(CPUM128)
|
||||
#define MAX_MODELS 30
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define MAX_PHASES 5
|
||||
#define MAX_MIXERS 32
|
||||
#define MAX_EXPOS 14
|
||||
#define NUM_CSW 15 // number of custom switches
|
||||
#define NUM_CFN 24 // number of functions assigned to switches
|
||||
#else
|
||||
#define MAX_MODELS 16
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define MAX_PHASES 5
|
||||
#define MAX_MIXERS 32
|
||||
#define MAX_EXPOS 14
|
||||
#define NUM_CSW 12 // number of custom switches
|
||||
#define NUM_CFN 16 // number of functions assigned to switches
|
||||
#endif
|
||||
|
||||
#define MAX_TIMERS 2
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MAX_CURVES 16
|
||||
#define NUM_POINTS 512
|
||||
#define CURVTYPE int16_t
|
||||
#else
|
||||
#define MAX_CURVES 8
|
||||
#define NUM_POINTS (112-MAX_CURVES)
|
||||
#define CURVTYPE int8_t
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define NUM_MODULES 2
|
||||
#else
|
||||
#define NUM_MODULES 1
|
||||
#endif
|
||||
|
||||
typedef int16_t gvar_t;
|
||||
|
||||
#if !defined(CPUM64)
|
||||
typedef char gvar_name_t[6];
|
||||
#define GVAR_MAX 1024
|
||||
#if !defined(PCBSTD)
|
||||
typedef char gvar_name_t[6];
|
||||
#define GVAR_MAX 1024
|
||||
#endif
|
||||
|
||||
#define RESERVE_RANGE_FOR_GVARS 10
|
||||
// even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
|
||||
#if defined(CPUM64) && defined(GVARS)
|
||||
|
||||
#if defined(PCBSTD) && defined(GVARS)
|
||||
#define MAX_GVARS 5
|
||||
#define MODEL_GVARS_DATA gvar_t gvars[MAX_GVARS];
|
||||
#define PHASE_GVARS_DATA
|
||||
#define GVAR_VALUE(x, p) g_model.gvars[x]
|
||||
#elif defined(CPUM64)
|
||||
#elif defined(PCBSTD)
|
||||
#define MAX_GVARS 0
|
||||
#define MODEL_GVARS_DATA
|
||||
#define PHASE_GVARS_DATA
|
||||
@@ -152,12 +206,20 @@ enum BeeperMode {
|
||||
#define EXTRA_GENERAL_FIELDS
|
||||
#endif
|
||||
|
||||
PACK(typedef struct t_ModuleData {
|
||||
int8_t rfProtocol;
|
||||
uint8_t channelsStart;
|
||||
int8_t channelsCount; // 0=8 channels
|
||||
uint8_t failsafeMode;
|
||||
int16_t failsafeChannels[NUM_CHNOUT];
|
||||
}) ModuleData;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define MODELDATA_EXTRA char bitmap[10]; int8_t rfProtocol; uint8_t ppmSCH; uint8_t failsafeMode; int16_t failsafeChannels[16];
|
||||
#define MODELDATA_EXTRA char bitmap[10]; uint8_t externalModule; ModuleData moduleData[NUM_MODULES]; uint8_t trainerMode;
|
||||
#define LIMITDATA_EXTRA char name[6];
|
||||
#define swstate_t uint16_t
|
||||
#elif defined(PCBSKY9X)
|
||||
#define MODELDATA_EXTRA uint8_t ppmSCH; int8_t ppm2SCH; int8_t ppm2NCH; int8_t rfProtocol;
|
||||
#define MODELDATA_EXTRA uint8_t ppmSCH; int8_t ppm2SCH; int8_t ppm2NCH; ModuleData moduleData[NUM_MODULES];
|
||||
#define LIMITDATA_EXTRA
|
||||
#define swstate_t uint8_t
|
||||
#else
|
||||
@@ -194,28 +256,28 @@ PACK(typedef struct t_EEGeneral {
|
||||
int8_t vBatCalib;
|
||||
int8_t backlightMode;
|
||||
TrainerData trainer;
|
||||
uint8_t view; //index of subview in main scrren
|
||||
uint8_t spare1:3;
|
||||
int8_t beeperMode:2;
|
||||
uint8_t view; // index of view in main screen
|
||||
int8_t buzzerMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
|
||||
uint8_t spare1:1;
|
||||
int8_t beepMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
|
||||
uint8_t alarmsFlash:1;
|
||||
uint8_t disableMemoryWarning:1;
|
||||
uint8_t disableAlarmWarning:1;
|
||||
uint8_t stickMode:2;
|
||||
int8_t timezone:5;
|
||||
uint8_t alarmsBeep:1;
|
||||
uint8_t spare2:1;
|
||||
uint8_t inactivityTimer;
|
||||
uint8_t throttleReversed:1;
|
||||
uint8_t spare2:2;
|
||||
uint8_t spare3:3;
|
||||
SPLASH_MODE; /* 3bits */
|
||||
int8_t hapticMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
|
||||
uint8_t blOffBright:4;
|
||||
uint8_t blOnBright:4;
|
||||
uint8_t lightAutoOff;
|
||||
uint8_t templateSetup; //RETA order according to chout_ar array
|
||||
uint8_t templateSetup; // RETA order for receiver channels
|
||||
int8_t PPM_Multiplier;
|
||||
int8_t hapticLength;
|
||||
uint8_t reNavigation; // not used on STOCK board
|
||||
int8_t beeperLength:3;
|
||||
uint8_t reNavigation; // not used on STOCK board
|
||||
int8_t beepLength:3;
|
||||
uint8_t hapticStrength:3;
|
||||
uint8_t gpsFormat:1;
|
||||
uint8_t unexpectedShutdown:1;
|
||||
@@ -252,7 +314,7 @@ PACK(typedef struct t_ExpoData {
|
||||
char name[LEN_EXPOMIX_NAME];
|
||||
int8_t curveParam;
|
||||
}) ExpoData;
|
||||
#elif defined(CPUM64)
|
||||
#elif defined(PCBSTD)
|
||||
PACK(typedef struct t_ExpoData {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
int8_t swtch:6;
|
||||
@@ -287,7 +349,6 @@ PACK(typedef struct t_LimitData {
|
||||
|
||||
}) LimitData;
|
||||
|
||||
|
||||
#define TRIM_OFF (1)
|
||||
#define TRIM_ON (0)
|
||||
#define TRIM_RUD (-1)
|
||||
@@ -354,7 +415,7 @@ PACK( union u_int8int16_t {
|
||||
#define DELAY_MAX 15 /* 7.5 seconds */
|
||||
#define SLOW_MAX 15 /* 7.5 seconds */
|
||||
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
PACK(typedef struct t_MixData {
|
||||
uint8_t destCh:4; // 0, 1..NUM_CHNOUT
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
@@ -823,15 +884,17 @@ PACK(typedef struct t_SwashRingData { // Swash Ring data
|
||||
#define ROTARY_ENCODER_ARRAY_EXTRA
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
#define TRIM_ARRAY int8_t trim[4]; int8_t trim_ext:8
|
||||
#if defined(PCBSTD)
|
||||
#define TRIMS_ARRAY int8_t trim[4]; int8_t trim_ext:8
|
||||
#define TRIMS_ARRAY_SIZE 5
|
||||
#else
|
||||
#define TRIM_ARRAY int16_t trim[4]
|
||||
#define TRIMS_ARRAY int16_t trim[4]
|
||||
#define TRIMS_ARRAY_SIZE 8
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(typedef struct t_PhaseData {
|
||||
TRIM_ARRAY;
|
||||
TRIMS_ARRAY;
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[LEN_FP_NAME];
|
||||
uint8_t fadeIn;
|
||||
@@ -841,7 +904,7 @@ PACK(typedef struct t_PhaseData {
|
||||
}) PhaseData;
|
||||
#else
|
||||
PACK(typedef struct t_PhaseData {
|
||||
TRIM_ARRAY;
|
||||
TRIMS_ARRAY;
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[LEN_FP_NAME];
|
||||
uint8_t fadeIn:4;
|
||||
@@ -851,44 +914,6 @@ PACK(typedef struct t_PhaseData {
|
||||
}) PhaseData;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MAX_MODELS 60
|
||||
#define NUM_CHNOUT 32 // number of real output channels CH1-CH32
|
||||
#define MAX_PHASES 9
|
||||
#define MAX_MIXERS 64
|
||||
#define MAX_EXPOS 32
|
||||
#define NUM_CSW 32 // number of custom switches
|
||||
#define NUM_CFN 32 // number of functions assigned to switches
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#define MAX_MODELS 30
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define MAX_PHASES 6
|
||||
#define MAX_MIXERS 32
|
||||
#define MAX_EXPOS 16
|
||||
#define NUM_CSW 15 // number of custom switches
|
||||
#define NUM_CFN 24 // number of functions assigned to switches
|
||||
#else
|
||||
#define MAX_MODELS 16
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define MAX_PHASES 5
|
||||
#define MAX_MIXERS 32
|
||||
#define MAX_EXPOS 14
|
||||
#define NUM_CSW 12 // number of custom switches
|
||||
#define NUM_CFN 16 // number of functions assigned to switches
|
||||
#endif
|
||||
|
||||
#define MAX_TIMERS 2
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MAX_CURVES 16
|
||||
#define NUM_POINTS 512
|
||||
#define CURVTYPE int16_t
|
||||
#else
|
||||
#define MAX_CURVES 8
|
||||
#define NUM_POINTS (112-MAX_CURVES)
|
||||
#define CURVTYPE int8_t
|
||||
#endif
|
||||
|
||||
enum SwitchSources {
|
||||
SWSRC_NONE = 0,
|
||||
|
||||
@@ -952,7 +977,7 @@ enum SwitchSources {
|
||||
SWSRC_FIRST_MOMENT_SWITCH,
|
||||
SWSRC_LAST_MOMENT_SWITCH = SWSRC_FIRST_MOMENT_SWITCH+SWSRC_ON-1,
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#if !defined(PCBSTD)
|
||||
SWSRC_TRAINER_SHORT,
|
||||
SWSRC_TRAINER_LONG,
|
||||
#endif
|
||||
@@ -1125,7 +1150,7 @@ enum Protocols {
|
||||
PROTO_NONE
|
||||
};
|
||||
|
||||
enum RfProtocols {
|
||||
enum RFProtocols {
|
||||
RF_PROTO_OFF = -1,
|
||||
RF_PROTO_X16,
|
||||
RF_PROTO_D8,
|
||||
@@ -1133,6 +1158,15 @@ enum RfProtocols {
|
||||
RF_PROTO_LAST = RF_PROTO_LR12
|
||||
};
|
||||
|
||||
enum ModuleTypes {
|
||||
MODULE_TYPE_NONE = 0,
|
||||
MODULE_TYPE_PPM,
|
||||
MODULE_TYPE_XJT,
|
||||
MODULE_TYPE_DJT,
|
||||
MODULE_TYPE_DSM2,
|
||||
MODULE_TYPE_LAST = MODULE_TYPE_DJT
|
||||
};
|
||||
|
||||
enum FailsafeModes {
|
||||
FAILSAFE_HOLD,
|
||||
FAILSAFE_CUSTOM,
|
||||
@@ -1142,7 +1176,7 @@ enum FailsafeModes {
|
||||
|
||||
#if defined(MAVLINK)
|
||||
#define TELEMETRY_DATA MavlinkData mavlink;
|
||||
#elif defined(FRSKY) || !defined(CPUM64)
|
||||
#elif defined(FRSKY)
|
||||
#define TELEMETRY_DATA FrSkyData frsky;
|
||||
#else
|
||||
#define TELEMETRY_DATA
|
||||
@@ -1166,9 +1200,9 @@ PACK(typedef struct t_ModelData {
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare1:1;
|
||||
uint8_t throttleReversed:1;
|
||||
int8_t ppmDelay;
|
||||
BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
MixData mixData[MAX_MIXERS];
|
||||
LimitData limitData[NUM_CHNOUT];
|
||||
ExpoData expoData[MAX_EXPOS];
|
||||
@@ -1177,7 +1211,7 @@ PACK(typedef struct t_ModelData {
|
||||
int8_t points[NUM_POINTS];
|
||||
|
||||
CustomSwData customSw[NUM_CSW];
|
||||
CustomFnData funcSw[NUM_CFN];
|
||||
CustomFnData funcSw[NUM_CFN];
|
||||
SwashRingData swashR;
|
||||
PhaseData phaseData[MAX_PHASES];
|
||||
|
||||
|
||||
+37
-37
@@ -234,6 +234,7 @@ void per10ms()
|
||||
#endif
|
||||
|
||||
if (lightOffCounter) lightOffCounter--;
|
||||
if (flashCounter) flashCounter--;
|
||||
if (s_noHi) s_noHi--;
|
||||
if (trimsCheckTimer) trimsCheckTimer --;
|
||||
|
||||
@@ -670,14 +671,13 @@ void applyExpos(int16_t *anas)
|
||||
else
|
||||
v = expo(v, GET_GVAR(curveParam, -100, 100, s_perout_flight_phase));
|
||||
}
|
||||
int16_t weight=GET_GVAR(ed.weight, 0, 100, s_perout_flight_phase);
|
||||
weight=calc100to256(weight);
|
||||
int16_t weight = GET_GVAR(ed.weight, 0, 100, s_perout_flight_phase);
|
||||
weight = calc100to256(weight);
|
||||
v = ((int32_t)v * weight) >> 8;
|
||||
// v = ((int32_t)v * GET_GVAR(ed.weight, 0, 100, s_perout_flight_phase)) / 100;
|
||||
anas[cur_chn] = v;
|
||||
} //endif
|
||||
} //endif getSwitch
|
||||
} //endfor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
@@ -920,7 +920,7 @@ getvalue_t getValue(uint8_t i)
|
||||
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_VSPD) return frskyData.hub.varioSpeed;
|
||||
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_MIN_A1) return frskyData.analog[0].min;
|
||||
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_MIN_A2) return frskyData.analog[1].min;
|
||||
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_MAX_CURRENT) return *(((int16_t*)(&frskyData.hub.minAltitude))+i+1-(MIXSRC_FIRST_TELEM-1+TELEM_MAX_CURRENT));
|
||||
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_MAX_CURRENT) return *(((int16_t*)(&frskyData.hub.minAltitude))+i+1-(MIXSRC_FIRST_TELEM-1+TELEM_MIN_ALT));
|
||||
#endif
|
||||
#endif
|
||||
else return 0;
|
||||
@@ -1017,7 +1017,7 @@ bool __getSwitch(int8_t swtch)
|
||||
#if defined(FRSKY)
|
||||
// Telemetry
|
||||
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
||||
if (frskyStreaming <= 0 && cs->v1 > MIXSRC_FIRST_TELEM-1+MAX_TIMERS)
|
||||
if (frskyStreaming <= 0 && cs->v1 > MIXSRC_FIRST_TELEM-1+TELEM_TM2)
|
||||
return swtch > 0 ? false : true;
|
||||
|
||||
y = convertCswTelemValue(cs);
|
||||
@@ -1039,8 +1039,11 @@ bool __getSwitch(int8_t swtch)
|
||||
y = calc100toRESX(cs->v2);
|
||||
}
|
||||
#else
|
||||
if (cs->v1 >= MIXSRC_GVAR1) {
|
||||
y = cs->v2; // it's a GVAR or a Timer
|
||||
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
||||
y = (int16_t)3 * cs->v2; // it's a Timer
|
||||
}
|
||||
else if (cs->v1 >= MIXSRC_GVAR1) {
|
||||
y = cs->v2; // it's a GVAR
|
||||
}
|
||||
else {
|
||||
y = calc100toRESX(cs->v2);
|
||||
@@ -1212,7 +1215,7 @@ int8_t getMovedSource()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FLIGHT_PHASES
|
||||
#if defined(FLIGHT_MODES)
|
||||
uint8_t getFlightPhase()
|
||||
{
|
||||
for (uint8_t i=1; i<MAX_PHASES; i++) {
|
||||
@@ -1228,7 +1231,7 @@ uint8_t getFlightPhase()
|
||||
int16_t getRawTrimValue(uint8_t phase, uint8_t idx)
|
||||
{
|
||||
PhaseData *p = phaseaddress(phase);
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
return (((int16_t)p->trim[idx]) << 2) + ((p->trim_ext >> (2*idx)) & 0x03);
|
||||
#else
|
||||
return p->trim[idx];
|
||||
@@ -1243,7 +1246,7 @@ int16_t getTrimValue(uint8_t phase, uint8_t idx)
|
||||
void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim)
|
||||
{
|
||||
PhaseData *p = phaseaddress(phase);
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
p->trim[idx] = (int8_t)(trim >> 2);
|
||||
p->trim_ext = (p->trim_ext & ~(0x03 << (2*idx))) + (((trim & 0x03) << (2*idx)));
|
||||
#else
|
||||
@@ -1318,7 +1321,7 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
|
||||
uint8_t s_gvar_timer = 0;
|
||||
uint8_t s_gvar_last = 0;
|
||||
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
int16_t getGVarValue(int16_t x, int16_t min, int16_t max)
|
||||
{
|
||||
if (GV_IS_GV_VALUE(x,min,max)) {
|
||||
@@ -1457,7 +1460,9 @@ void checkBacklight()
|
||||
backlightOn();
|
||||
}
|
||||
|
||||
if (g_eeGeneral.backlightMode == e_backlight_mode_on || lightOffCounter || isFunctionActive(FUNC_BACKLIGHT))
|
||||
bool backlightOn = (g_eeGeneral.backlightMode == e_backlight_mode_on || lightOffCounter || isFunctionActive(FUNC_BACKLIGHT));
|
||||
if (flashCounter) backlightOn = !backlightOn;
|
||||
if (backlightOn)
|
||||
BACKLIGHT_ON();
|
||||
else
|
||||
BACKLIGHT_OFF();
|
||||
@@ -1579,7 +1584,7 @@ void checkTHR()
|
||||
#else
|
||||
getADC(); // if thr is down - do not display warning at all
|
||||
int16_t lowLim = g_eeGeneral.calibMid[thrchn];
|
||||
lowLim = (g_eeGeneral.throttleReversed ? - lowLim - g_eeGeneral.calibSpanPos[thrchn] : lowLim - g_eeGeneral.calibSpanNeg[thrchn]);
|
||||
lowLim = (g_model.throttleReversed ? - lowLim - g_eeGeneral.calibSpanPos[thrchn] : lowLim - g_eeGeneral.calibSpanNeg[thrchn]);
|
||||
lowLim += THRCHK_DEADBAND;
|
||||
#endif
|
||||
int16_t v = thrAnaIn(thrchn);
|
||||
@@ -1736,7 +1741,7 @@ uint8_t checkTrim(uint8_t event)
|
||||
#if defined(GVARS)
|
||||
#define TRIM_REUSED() trimGvar[idx] >= 0
|
||||
if (TRIM_REUSED()) {
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
phase = 0;
|
||||
#else
|
||||
phase = getGVarFlightPhase(s_perout_flight_phase, trimGvar[idx]);
|
||||
@@ -1863,7 +1868,7 @@ uint16_t BandGap ;
|
||||
int16_t thrAnaIn(uint8_t chan)
|
||||
{
|
||||
int16_t v = anaIn(chan);
|
||||
return (g_eeGeneral.throttleReversed) ? -v : v;
|
||||
return (g_model.throttleReversed) ? -v : v;
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
@@ -1975,6 +1980,7 @@ void getADC_bandgap()
|
||||
|
||||
uint8_t g_vbat100mV = 0;
|
||||
uint16_t lightOffCounter;
|
||||
uint8_t flashCounter = 0;
|
||||
|
||||
uint16_t s_timeCumTot;
|
||||
uint16_t s_timeCumThr; // THR in 1/16 sec
|
||||
@@ -2066,7 +2072,7 @@ FORCEINLINE void evalTrims()
|
||||
// do trim -> throttle trim if applicable
|
||||
int16_t trim = getTrimValue(phase, i);
|
||||
if (i==THR_STICK && g_model.thrTrim) {
|
||||
if (g_eeGeneral.throttleReversed)
|
||||
if (g_model.throttleReversed)
|
||||
trim = -trim;
|
||||
int16_t v = anas[i];
|
||||
int32_t vv = ((int32_t)trim-TRIM_MIN)*(RESX-v)>>(RESX_SHIFT+1);
|
||||
@@ -2124,7 +2130,7 @@ BeepANACenter evalSticks(uint8_t mode)
|
||||
v = -v;
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.throttleReversed && ch==THR_STICK)
|
||||
if (g_model.throttleReversed && ch==THR_STICK)
|
||||
v = -v;
|
||||
|
||||
#if defined(EXTRA_3POS)
|
||||
@@ -2321,7 +2327,7 @@ PLAY_FUNCTION(playValue, uint8_t idx)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#if !defined(PCBSTD)
|
||||
uint8_t mSwitchDuration[1+NUM_ROTARY_ENCODERS] = { 0 };
|
||||
#define CFN_PRESSLONG_DURATION 100
|
||||
#endif
|
||||
@@ -2367,7 +2373,7 @@ void evalFunctions()
|
||||
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
|
||||
uint8_t momentary = 0;
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#if !defined(PCBSTD)
|
||||
|
||||
#define MOMENTARY_START_TEST() ( (momentary && !(activeSwitches & switch_mask) && active) || \
|
||||
(short_long==1 && !active && mSwitchDuration[mswitch]>0 && mSwitchDuration[mswitch]<CFN_PRESSLONG_DURATION) || \
|
||||
@@ -2408,7 +2414,7 @@ void evalFunctions()
|
||||
if (active) newActiveSwitches |= switch_mask;
|
||||
if (momentary || short_long) {
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#if !defined(PCBSTD)
|
||||
bool swState = active;
|
||||
#endif
|
||||
|
||||
@@ -2439,7 +2445,7 @@ void evalFunctions()
|
||||
active = (activeFnSwitches & switch_mask);
|
||||
momentary = false;
|
||||
}
|
||||
#if !defined(CPUM64)
|
||||
#if !defined(PCBSTD)
|
||||
if (short_long) {
|
||||
if (swState) {
|
||||
if (mSwitchDuration[mswitch] < 255)
|
||||
@@ -2459,13 +2465,6 @@ void evalFunctions()
|
||||
|
||||
if (active || momentary) {
|
||||
|
||||
if (active)
|
||||
TRACE_DEBUG("ACTIVE ");
|
||||
if (momentary)
|
||||
TRACE_DEBUG("MOMENTARY ");
|
||||
|
||||
TRACE_DEBUG("\n");
|
||||
|
||||
if (CFN_ACTIVE(sd)) {
|
||||
if (CFN_FUNC(sd) < FUNC_TRAINER) {
|
||||
safetyCh[CFN_CH_NUMBER(sd)] = CFN_PARAM(sd);
|
||||
@@ -2989,7 +2988,8 @@ void perOut(uint8_t mode, uint8_t tick10ms)
|
||||
|
||||
if (tmp.dword<0) {
|
||||
if ((tmp.words_t.hi&0xFF80)!=0xFF80) tmp.words_t.hi=0xFF86; // set to min nearly
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ((tmp.words_t.hi|0x007F)!=0x007F) tmp.words_t.hi=0x0079; // set to max nearly
|
||||
}
|
||||
*ptr=tmp.dword;
|
||||
@@ -3320,9 +3320,9 @@ void doMixerCalculations()
|
||||
AUDIO_INACTIVITY();
|
||||
|
||||
#if defined(AUDIO)
|
||||
if (mixWarning & 1) if ((s_timeCumTot&0x03)== 0) AUDIO_MIX_WARNING(1);
|
||||
if (mixWarning & 2) if ((s_timeCumTot&0x03)== 1) AUDIO_MIX_WARNING(2);
|
||||
if (mixWarning & 4) if ((s_timeCumTot&0x03)== 2) AUDIO_MIX_WARNING(3);
|
||||
if (mixWarning & 1) if ((s_timeCumTot&0x03)==0) AUDIO_MIX_WARNING(1);
|
||||
if (mixWarning & 2) if ((s_timeCumTot&0x03)==1) AUDIO_MIX_WARNING(2);
|
||||
if (mixWarning & 4) if ((s_timeCumTot&0x03)==2) AUDIO_MIX_WARNING(3);
|
||||
#endif
|
||||
|
||||
#if defined(ACCURAT_THROTTLE_TIMER)
|
||||
@@ -3640,7 +3640,7 @@ uint16_t getTmr16KHz()
|
||||
ISR(TIMER2_OVF_vect, ISR_NOBLOCK)
|
||||
{
|
||||
cli();
|
||||
TIMSK &= ~ (1<<TOIE2) ; // stop reentrance
|
||||
TIMSK &= ~(1<<TOIE2) ; // stop reentrance
|
||||
sei();
|
||||
|
||||
#if defined(AUDIO)
|
||||
@@ -3796,7 +3796,7 @@ ISR(USART0_UDRE_vect)
|
||||
else {
|
||||
FRSKY_USART0_vect();
|
||||
}
|
||||
#elif defined (FRSKY)
|
||||
#elif defined(FRSKY)
|
||||
FRSKY_USART0_vect();
|
||||
#else
|
||||
DSM2_USART0_vect();
|
||||
|
||||
+26
-21
@@ -86,10 +86,10 @@
|
||||
#define IF_RTCLOCK(x)
|
||||
#endif
|
||||
|
||||
#if defined(BEEPER)
|
||||
#define IF_BEEPER(x) x,
|
||||
#if defined(BUZZER)
|
||||
#define IF_BUZZER(x) x,
|
||||
#else
|
||||
#define IF_BEEPER(x)
|
||||
#define IF_BUZZER(x)
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO)
|
||||
@@ -164,10 +164,10 @@
|
||||
#define IF_TEMPLATES(x)
|
||||
#endif
|
||||
|
||||
#if defined(FLIGHT_PHASES)
|
||||
#define IF_FLIGHT_PHASES(x) x,
|
||||
#if defined(FLIGHT_MODES)
|
||||
#define IF_FLIGHT_MODES(x) x,
|
||||
#else
|
||||
#define IF_FLIGHT_PHASES(x)
|
||||
#define IF_FLIGHT_MODES(x)
|
||||
#endif
|
||||
|
||||
#if defined(CURVES)
|
||||
@@ -457,13 +457,17 @@ enum EnumKeys {
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define NUM_PORT1_CHANNELS(model) ((8+(model.ppmNCH*2)))
|
||||
static const int8_t maxChannelsModules[] = { 0, 8, 8, 0, 0 };
|
||||
static const int8_t maxChannelsXJT[] = { 0, 8, 0, 4 };
|
||||
#define IS_MODULE_XJT(idx) ((idx==0 || g_model.externalModule == MODULE_TYPE_XJT) && (g_model.moduleData[idx].rfProtocol != RF_PROTO_OFF))
|
||||
#define IS_MODULE_PPM(idx) (idx==1 && g_model.externalModule == MODULE_TYPE_PPM)
|
||||
#define NUM_CHANNELS(idx) (8+g_model.moduleData[idx].channelsCount)
|
||||
#define MAX_PORT1_CHANNELS() (maxChannelsXJT[1+g_model.moduleData[0].rfProtocol])
|
||||
#define MAX_PORT2_CHANNELS() ((g_model.externalModule == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[1].rfProtocol] : maxChannelsModules[g_model.externalModule])
|
||||
#define MAX_CHANNELS(idx) (idx==0 ? MAX_PORT1_CHANNELS() : MAX_PORT2_CHANNELS())
|
||||
#else
|
||||
#define NUM_PORT1_CHANNELS(model) (IS_PXX_PROTOCOL(model.protocol) ? 8 : (IS_DSM2_PROTOCOL(model.protocol) ? 6 : (8+(model.ppmNCH*2))))
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define NUM_PORT2_CHANNELS(model) (8+(model.ppm2NCH*2))
|
||||
#define NUM_PORT1_CHANNELS() (IS_PXX_PROTOCOL(g_model.protocol) ? 8 : (IS_DSM2_PROTOCOL(g_model.protocol) ? 6 : (8+(g_model.ppmNCH*2))))
|
||||
#define NUM_PORT2_CHANNELS() (8+(g_model.ppm2NCH*2))
|
||||
#endif
|
||||
|
||||
#include "lcd.h"
|
||||
@@ -666,7 +670,7 @@ extern uint16_t inacCounter;
|
||||
extern uint16_t inacSum;
|
||||
|
||||
#if defined(PXX)
|
||||
extern uint8_t pxxFlag;
|
||||
extern uint8_t pxxFlag[NUM_MODULES];
|
||||
#endif
|
||||
|
||||
#define PXX_SEND_RXNUM 0x01
|
||||
@@ -747,7 +751,7 @@ int8_t getMovedSwitch();
|
||||
int8_t getMovedSource();
|
||||
#endif
|
||||
|
||||
#ifdef FLIGHT_PHASES
|
||||
#if defined(FLIGHT_MODES)
|
||||
extern uint8_t getFlightPhase();
|
||||
#else
|
||||
#define getFlightPhase() 0
|
||||
@@ -772,7 +776,7 @@ extern void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim);
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
int16_t getGVarValue(int16_t x, int16_t min, int16_t max);
|
||||
void setGVarValue(uint8_t x, int8_t value);
|
||||
#define GET_GVAR(x, min, max, p) getGVarValue(x, min, max)
|
||||
@@ -1062,10 +1066,11 @@ extern uint16_t anaIn(uint8_t chan);
|
||||
extern int16_t thrAnaIn(uint8_t chan);
|
||||
extern int16_t calibratedStick[NUM_STICKS+NUM_POTS];
|
||||
|
||||
#define FLASH_DURATION 50 /*500ms*/
|
||||
#define FLASH_DURATION 20 /*200ms*/
|
||||
|
||||
extern uint8_t beepAgain;
|
||||
extern uint16_t lightOffCounter;
|
||||
extern uint8_t flashCounter;
|
||||
extern uint8_t mixWarning;
|
||||
|
||||
extern PhaseData *phaseaddress(uint8_t idx);
|
||||
@@ -1234,8 +1239,8 @@ enum AUDIO_SOUNDS {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BEEPER)
|
||||
#include "beeper.h"
|
||||
#if defined(BUZZER)
|
||||
#include "buzzer.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
@@ -1376,10 +1381,10 @@ void getGpsPilotPosition();
|
||||
void getGpsDistance();
|
||||
void varioWakeup();
|
||||
|
||||
#if defined(AUDIO) && defined(BEEPER)
|
||||
#define IS_SOUND_OFF() (!g_eeGeneral.alarmsBeep && g_eeGeneral.beeperMode == e_mode_quiet)
|
||||
#if defined(AUDIO) && defined(BUZZER)
|
||||
#define IS_SOUND_OFF() (g_eeGeneral.buzzerMode==e_mode_quiet && g_eeGeneral.beepMode==e_mode_quiet)
|
||||
#else
|
||||
#define IS_SOUND_OFF() (g_eeGeneral.beeperMode == e_mode_quiet)
|
||||
#define IS_SOUND_OFF() (g_eeGeneral.beepMode == e_mode_quiet)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
+206
-46
@@ -39,7 +39,7 @@
|
||||
uint8_t s_pulses_paused = 0;
|
||||
uint8_t s_current_protocol = 255;
|
||||
uint32_t failsafeCounter = 100;
|
||||
uint8_t pxxFlag = 0;
|
||||
uint8_t pxxFlag[NUM_MODULES] = { 0 };
|
||||
|
||||
uint16_t ppmStream[20] = { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ;
|
||||
uint16_t ppm2Stream[20] = { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ;
|
||||
@@ -51,8 +51,14 @@ uint8_t Bit_pulses[64] ; // Likely more than we need
|
||||
uint8_t *Pulses2MHzptr ;
|
||||
#else
|
||||
uint16_t pxxStream[400] ; // Transisitions
|
||||
#if defined(PCBTARANIS)
|
||||
uint16_t pxx2Stream[400] ; // Transisitions
|
||||
uint16_t *pxxStreamPtr[NUM_MODULES] ;
|
||||
uint16_t PxxValue[NUM_MODULES] ;
|
||||
#else
|
||||
uint16_t *pxxStreamPtr ;
|
||||
uint16_t PxxValue ;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// DSM2 control bits
|
||||
@@ -67,7 +73,14 @@ uint8_t Serial_byte ;
|
||||
uint8_t Serial_bit_count;
|
||||
uint8_t Serial_byte_count ;
|
||||
|
||||
void setupPulses();
|
||||
#if defined(PCBTARANIS)
|
||||
#define MODULE_INDEX_PARAM uint32_t module_index
|
||||
#else
|
||||
#define MODULE_INDEX_PARAM
|
||||
#endif
|
||||
|
||||
void setupPulses( MODULE_INDEX_PARAM ) ;
|
||||
|
||||
void setupPulsesDsm2(uint8_t chns);
|
||||
void setupPulsesPXX();
|
||||
|
||||
@@ -77,7 +90,11 @@ void startPulses()
|
||||
#if defined(PCBSKY9X)
|
||||
init_main_ppm(3000, 1) ; // Default for now, initial period 1.5 mS, output on
|
||||
#else
|
||||
#if defined(PCBTARANIS)
|
||||
init_ppm( 0 ) ;
|
||||
#else
|
||||
init_main_ppm();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -113,11 +130,11 @@ void setupPulsesPPM(PPM_PORT_PARAM) // Don't enable interrupts
|
||||
pwmCh = 1;
|
||||
ptr = ppm2Stream;
|
||||
firstCh = g_model.ppm2SCH;
|
||||
lastCh = min<uint32_t>(NUM_CHNOUT, firstCh + 8 + (g_model.ppm2NCH * 2));
|
||||
lastCh = min<uint32_t>(NUM_CHNOUT, firstCh + NUM_PORT2_CHANNELS());
|
||||
}
|
||||
#else
|
||||
#define firstCh 0
|
||||
uint32_t lastCh = 8 + g_model.ppmNCH * 2; //Channels *2
|
||||
uint32_t lastCh = NUM_CHANNELS(0);
|
||||
uint16_t * ptr = ppmStream;
|
||||
#endif
|
||||
|
||||
@@ -141,8 +158,13 @@ void setupPulsesPPM(PPM_PORT_PARAM) // Don't enable interrupts
|
||||
*(ptr + 1) = 0;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
TIM1->CCR2 = rest - 1000 ; // Update time
|
||||
TIM1->CCR1 = (g_model.ppmDelay*50+300)*2 ;
|
||||
// THIS IS SPECIFIC TO EITHER THE INTERNAL OR EXTERNAL MODULE
|
||||
// OTHER IS COMMENTED OUT. IF PPM IS NEEDED ON INTERNAL AS WELL AS EXTARNAL
|
||||
// setupPulsesPPM() WILL NEED A "MODULE" PARAMETER
|
||||
TIM8->CCR2 = rest - 1000 ; // Update time
|
||||
TIM8->CCR1 = (g_model.ppmDelay*50+300)*2 ;
|
||||
// TIM1->CCR2 = rest - 1000 ; // Update time
|
||||
// TIM1->CCR3 = (g_model.ppmDelay*50+300)*2 ;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -182,9 +204,80 @@ const uint16_t CRCTable[]=
|
||||
0x7bc7,0x6a4e,0x58d5,0x495c,0x3de3,0x2c6a,0x1ef1,0x0f78
|
||||
};
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
uint16_t PcmCrc[2] ;
|
||||
uint8_t PcmOnesCount[2] ;
|
||||
|
||||
void crc( uint8_t data, uint32_t module_index )
|
||||
{
|
||||
// uint8_t i ;
|
||||
|
||||
PcmCrc[module_index]=(PcmCrc[module_index]<<8)^(CRCTable[((PcmCrc[module_index]>>8)^data) & 0xFF]);
|
||||
}
|
||||
|
||||
void putPcmPart( uint8_t value, uint32_t module_index )
|
||||
{
|
||||
PxxValue[module_index] += 18 ; // Output 1 for this time
|
||||
*pxxStreamPtr[module_index]++ = PxxValue[module_index] ;
|
||||
PxxValue[module_index] += 14 ;
|
||||
if ( value ) {
|
||||
PxxValue[module_index] += 16 ;
|
||||
}
|
||||
*pxxStreamPtr[module_index]++ = PxxValue[module_index] ; // Output 0 for this time
|
||||
}
|
||||
|
||||
void putPcmFlush( uint32_t module_index )
|
||||
{
|
||||
*pxxStreamPtr[module_index]++ = 18010 ; // Past the 18000 of the ARR
|
||||
}
|
||||
|
||||
void putPcmBit( uint8_t bit, uint32_t module_index )
|
||||
{
|
||||
if ( bit )
|
||||
{
|
||||
PcmOnesCount[module_index] += 1 ;
|
||||
putPcmPart( 1, module_index ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
PcmOnesCount[module_index] = 0 ;
|
||||
putPcmPart( 0, module_index ) ;
|
||||
}
|
||||
if ( PcmOnesCount[module_index] >= 5 )
|
||||
{
|
||||
putPcmBit( 0, module_index ) ; // Stuff a 0 bit in
|
||||
}
|
||||
}
|
||||
|
||||
void putPcmByte( uint8_t byte, uint32_t module_index )
|
||||
{
|
||||
crc(byte, module_index);
|
||||
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
putPcmBit(byte & 0x80, module_index);
|
||||
byte <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void putPcmHead( uint32_t module_index )
|
||||
{
|
||||
// send 7E, do not CRC
|
||||
// 01111110
|
||||
putPcmPart( 0, module_index ) ;
|
||||
putPcmPart( 1, module_index ) ;
|
||||
putPcmPart( 1, module_index ) ;
|
||||
putPcmPart( 1, module_index ) ;
|
||||
putPcmPart( 1, module_index ) ;
|
||||
putPcmPart( 1, module_index ) ;
|
||||
putPcmPart( 1, module_index ) ;
|
||||
putPcmPart( 0, module_index ) ;
|
||||
}
|
||||
|
||||
#else // Not Taranis
|
||||
uint16_t PcmCrc ;
|
||||
uint8_t PcmOnesCount ;
|
||||
|
||||
|
||||
void crc( uint8_t data )
|
||||
{
|
||||
// uint8_t i ;
|
||||
@@ -285,11 +378,11 @@ void putPcmHead()
|
||||
putPcmPart( 1 ) ;
|
||||
putPcmPart( 0 ) ;
|
||||
}
|
||||
#endif // Taranis
|
||||
|
||||
void setupPulsesPXX()
|
||||
void setupPulsesPXX(MODULE_INDEX_PARAM)
|
||||
{
|
||||
uint16_t chan ;
|
||||
uint16_t chan_1 ;
|
||||
uint16_t chan=0, chan_low=0;
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
Serial_byte = 0 ;
|
||||
@@ -297,10 +390,25 @@ void setupPulsesPXX()
|
||||
Serial_byte_count = 0 ;
|
||||
Pulses2MHzptr = Bit_pulses ;
|
||||
#else
|
||||
#if defined(PCBTARANIS)
|
||||
pxxStreamPtr[module_index] = module_index ? pxx2Stream : pxxStream ;
|
||||
PxxValue[module_index] = 0 ;
|
||||
#else
|
||||
pxxStreamPtr = pxxStream ;
|
||||
PxxValue = 0 ;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
PcmCrc[module_index] = 0;
|
||||
PcmOnesCount[module_index] = 0;
|
||||
|
||||
/* Sync */
|
||||
putPcmHead(module_index);
|
||||
|
||||
/* Rx Number */
|
||||
putPcmByte(g_model.modelId, module_index);
|
||||
#else
|
||||
PcmCrc = 0;
|
||||
PcmOnesCount = 0;
|
||||
|
||||
@@ -309,83 +417,116 @@ void setupPulsesPXX()
|
||||
|
||||
/* Rx Number */
|
||||
putPcmByte(g_model.modelId);
|
||||
#endif
|
||||
|
||||
/* FLAG1 */
|
||||
uint8_t flag1;
|
||||
if (pxxFlag & PXX_SEND_RXNUM) {
|
||||
flag1 = (g_model.rfProtocol << 6) | (g_eeGeneral.countryCode << 1) | pxxFlag;
|
||||
if (pxxFlag[0] & PXX_SEND_RXNUM) {
|
||||
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
flag1 = (g_model.moduleData[module_index].rfProtocol << 6) | (g_eeGeneral.countryCode << 1) | pxxFlag[module_index];
|
||||
}
|
||||
else {
|
||||
flag1 = (g_model.rfProtocol << 6) | pxxFlag;
|
||||
flag1 = (g_model.moduleData[module_index].rfProtocol << 6) | pxxFlag[0];
|
||||
#else
|
||||
flag1 = (g_model.moduleData[0].rfProtocol << 6) | (g_eeGeneral.countryCode << 1) | pxxFlag[0];
|
||||
}
|
||||
else {
|
||||
flag1 = (g_model.moduleData[0].rfProtocol << 6) | pxxFlag[0];
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (g_model.failsafeMode != FAILSAFE_HOLD) {
|
||||
if (g_model.moduleData[module_index].failsafeMode != FAILSAFE_HOLD) {
|
||||
if (failsafeCounter-- == 0) {
|
||||
failsafeCounter = 1000;
|
||||
flag1 |= PXX_SEND_FAILSAFE;
|
||||
}
|
||||
if (failsafeCounter == 0 && g_model.ppmNCH > 0) {
|
||||
if (failsafeCounter == 0 && g_model.moduleData[module_index].channelsCount > 0) {
|
||||
flag1 |= PXX_SEND_FAILSAFE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if defined(PCBTARANIS)
|
||||
putPcmByte(flag1, module_index);
|
||||
|
||||
/* FLAG2 */
|
||||
putPcmByte(0, module_index);
|
||||
#else
|
||||
putPcmByte(flag1);
|
||||
|
||||
/* FLAG2 */
|
||||
putPcmByte(0);
|
||||
#endif
|
||||
|
||||
/* PPM */
|
||||
static uint32_t pass = 0;
|
||||
uint32_t sendUpperChannels = 0;
|
||||
if (pass++ & 0x01) {
|
||||
sendUpperChannels = g_model.ppmNCH*2;
|
||||
#if defined(PCBTARANIS)
|
||||
sendUpperChannels = g_model.moduleData[module_index].channelsCount;
|
||||
#else
|
||||
sendUpperChannels = g_model.moduleData[0].channelsCount;
|
||||
#endif
|
||||
}
|
||||
for (uint32_t i=0; i<8; i+=2) {
|
||||
for (uint32_t i=0; i<8; i++) {
|
||||
#if defined(PCBTARANIS)
|
||||
if (flag1 & PXX_SEND_FAILSAFE) {
|
||||
if (g_model.failsafeMode == FAILSAFE_NOPULSES) {
|
||||
if (i < sendUpperChannels) {
|
||||
chan = 3072;
|
||||
chan_1 = 3072;
|
||||
}
|
||||
else {
|
||||
chan = 1024;
|
||||
chan_1 = 1024;
|
||||
}
|
||||
if (g_model.moduleData[module_index].failsafeMode == FAILSAFE_NOPULSES) {
|
||||
if (i < sendUpperChannels)
|
||||
chan = 3072;
|
||||
else
|
||||
chan = 1024;
|
||||
}
|
||||
else {
|
||||
if (i < sendUpperChannels) {
|
||||
chan = limit(2048, (g_model.failsafeChannels[8+g_model.ppmSCH+i] * 512 / 682) + 3072, 4095);
|
||||
chan_1 = limit(2048, (g_model.failsafeChannels[8+g_model.ppmSCH+i+1] * 512 / 682) + 3072, 4095);
|
||||
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[module_index].channelsStart+i) - PPM_CENTER + (g_model.moduleData[module_index].failsafeChannels[8+g_model.moduleData[0].channelsStart+i] * 512 / 682) + 3072, 4095);
|
||||
if (chan == 3072) chan = 3073;
|
||||
if (chan_1 == 3072) chan_1 = 3073;
|
||||
}
|
||||
else {
|
||||
chan = limit(0, (g_model.failsafeChannels[g_model.ppmSCH+i] * 512 / 682) + 1024, 2047);
|
||||
chan_1 = limit(0, (g_model.failsafeChannels[g_model.ppmSCH+i+1] * 512 / 682) + 1024, 2047);
|
||||
chan = limit(0, PPM_CH_CENTER(g_model.moduleData[module_index].channelsStart+i) - PPM_CENTER + (g_model.moduleData[module_index].failsafeChannels[g_model.moduleData[0].channelsStart+i] * 512 / 682) + 1024, 2047);
|
||||
if (chan == 1024) chan = 1025;
|
||||
if (chan_1 == 1024) chan_1 = 1025;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (i < sendUpperChannels) {
|
||||
chan = limit(2048, (channelOutputs[8+g_model.ppmSCH+i] * 512 / 682) + 3072, 4095);
|
||||
chan_1 = limit(2048, (channelOutputs[8+g_model.ppmSCH+i+1] * 512 / 682) + 3072, 4095);
|
||||
}
|
||||
else {
|
||||
chan = limit(0, (channelOutputs[g_model.ppmSCH+i] * 512 / 682) + 1024, 2047);
|
||||
chan_1 = limit(0, (channelOutputs[g_model.ppmSCH+i+1] * 512 / 682) + 1024, 2047);
|
||||
}
|
||||
if (i < sendUpperChannels)
|
||||
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[0].channelsStart+i) - PPM_CENTER + (channelOutputs[8+g_model.moduleData[0].channelsStart+i] * 512 / 682) + 3072, 4095);
|
||||
else
|
||||
chan = limit(0, PPM_CH_CENTER(g_model.moduleData[0].channelsStart+i) - PPM_CENTER + (channelOutputs[g_model.moduleData[0].channelsStart+i] * 512 / 682) + 1024, 2047);
|
||||
}
|
||||
|
||||
if (i & 1) {
|
||||
#if defined(PCBTARANIS)
|
||||
putPcmByte(chan_low, module_index); // Low byte of channel
|
||||
putPcmByte( ( ( chan_low >> 8 ) & 0x0F ) | ( chan << 4), module_index ) ; // 4 bits each from 2 channels
|
||||
putPcmByte(chan >> 4, module_index); // High byte of channel
|
||||
#else
|
||||
putPcmByte(chan_low); // Low byte of channel
|
||||
putPcmByte( ( ( chan_low >> 8 ) & 0x0F ) | ( chan << 4) ) ; // 4 bits each from 2 channels
|
||||
putPcmByte(chan >> 4); // High byte of channel
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
chan_low = chan;
|
||||
}
|
||||
putPcmByte(chan); // Low byte of channel
|
||||
putPcmByte( ( ( chan >> 8 ) & 0x0F ) | ( chan_1 << 4) ) ; // 4 bits each from 2 channels
|
||||
putPcmByte(chan_1 >> 4); // High byte of channel
|
||||
}
|
||||
|
||||
/* CRC16 */
|
||||
#if defined(PCBTARANIS)
|
||||
putPcmByte(0, module_index);
|
||||
chan = PcmCrc[module_index];
|
||||
putPcmByte(chan>>8, module_index);
|
||||
putPcmByte(chan, module_index);
|
||||
|
||||
/* Sync */
|
||||
putPcmHead(module_index);
|
||||
|
||||
putPcmFlush(module_index);
|
||||
#else
|
||||
putPcmByte(0);
|
||||
chan = PcmCrc;
|
||||
putPcmByte(chan>>8);
|
||||
@@ -395,6 +536,7 @@ void setupPulsesPXX()
|
||||
putPcmHead();
|
||||
|
||||
putPcmFlush();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(DSM2)
|
||||
@@ -549,12 +691,16 @@ extern "C" void PWM_IRQHandler(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void setupPulses()
|
||||
void setupPulses(MODULE_INDEX_PARAM)
|
||||
{
|
||||
heartbeat |= HEART_TIMER_PULSES;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t required_protocol = (g_model.rfProtocol == RF_PROTO_OFF ? PROTO_NONE : PROTO_PXX);
|
||||
if ( module_index )
|
||||
{
|
||||
module_index = 1 ; // Ensure is 0 or 1 only
|
||||
}
|
||||
uint8_t required_protocol = (g_model.moduleData[module_index].rfProtocol == RF_PROTO_OFF ? PROTO_NONE : PROTO_PXX);
|
||||
#else
|
||||
uint8_t required_protocol = g_model.protocol;
|
||||
#endif
|
||||
@@ -566,7 +712,11 @@ void setupPulses()
|
||||
|
||||
switch (s_current_protocol) { // stop existing protocol hardware
|
||||
case PROTO_PXX:
|
||||
#if defined(PCBTARANIS)
|
||||
disable_pxx(module_index);
|
||||
#else
|
||||
disable_pxx();
|
||||
#endif
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
@@ -576,7 +726,11 @@ void setupPulses()
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if defined(PCBTARANIS)
|
||||
disable_ppm(module_index);
|
||||
#else
|
||||
disable_main_ppm();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -585,10 +739,12 @@ void setupPulses()
|
||||
#if defined(PCBTARANIS)
|
||||
switch (required_protocol) {
|
||||
case PROTO_PXX:
|
||||
init_pxx();
|
||||
init_pxx(0);
|
||||
// init_pxx(module_index);
|
||||
break;
|
||||
default:
|
||||
init_main_ppm();
|
||||
init_ppm(0);
|
||||
// init_ppm(module_index);
|
||||
break;
|
||||
}
|
||||
#elif defined(PCBSKY9X)
|
||||
@@ -616,7 +772,11 @@ void setupPulses()
|
||||
// Set up output data here
|
||||
switch (required_protocol) {
|
||||
case PROTO_PXX:
|
||||
#if defined(PCBTARANIS)
|
||||
setupPulsesPXX(module_index);
|
||||
#else
|
||||
setupPulsesPXX();
|
||||
#endif
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ typedef const uint8_t pm_uint8_t;
|
||||
typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBACT)
|
||||
#if defined(PCBTARANIS)
|
||||
extern GPIO_TypeDef gpioa;
|
||||
#undef GPIOA
|
||||
#define GPIOA (&gpioa)
|
||||
|
||||
+11
-64
@@ -56,7 +56,6 @@ public:
|
||||
Open9xSim(){};
|
||||
Open9xSim(FXApp* a);
|
||||
long onKeypress(FXObject*,FXSelector,void*);
|
||||
long onArrowPress(FXObject*,FXSelector,void*);
|
||||
long onTimeout(FXObject*,FXSelector,void*);
|
||||
void makeSnapshot(const FXDrawable* drawable);
|
||||
void doEvents();
|
||||
@@ -69,18 +68,13 @@ private:
|
||||
|
||||
public:
|
||||
FXSlider *sliders[8];
|
||||
FXKnob *knobs[8];
|
||||
FXKnob *knobsppm[8];
|
||||
FXArrowButton *arrow[3];
|
||||
FXArrowButton *arrow2[3];
|
||||
FXToggleButton *togButPpm;
|
||||
FXKnob *knobs[NUM_POTS];
|
||||
};
|
||||
// Message Map
|
||||
FXDEFMAP(Open9xSim) Open9xSimMap[]={
|
||||
|
||||
//________Message_Type_________ID_____________________Message_Handler_______
|
||||
FXMAPFUNC(SEL_TIMEOUT, 2, Open9xSim::onTimeout),
|
||||
FXMAPFUNC(SEL_COMMAND, 1000, Open9xSim::onArrowPress),
|
||||
FXMAPFUNC(SEL_KEYPRESS, 0, Open9xSim::onKeypress),
|
||||
};
|
||||
|
||||
@@ -89,16 +83,10 @@ FXIMPLEMENT(Open9xSim,FXMainWindow,Open9xSimMap,ARRAYNUMBER(Open9xSimMap))
|
||||
Open9xSim::Open9xSim(FXApp* a)
|
||||
:FXMainWindow(a,"Open9xSim",NULL,NULL,DECOR_ALL,20,90,0,0)
|
||||
{
|
||||
|
||||
firstTime=true;
|
||||
for(int i=0; i<(LCD_W*LCD_H/8); i++) displayBuf[i]=0;//rand();
|
||||
bmp = new FXPPMImage(getApp(),NULL,IMAGE_OWNED|IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP, W2, H2);
|
||||
|
||||
FXHorizontalFrame *hf00=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
||||
FXHorizontalFrame *hf01=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
||||
FXHorizontalFrame *hf02=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
||||
//FXHorizontalFrame *hf2=new FXHorizontalFrame(this,LAYOUT_FILL_X);
|
||||
FXHorizontalFrame *hf10=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
||||
FXHorizontalFrame *hf11=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
||||
FXHorizontalFrame *hf1=new FXHorizontalFrame(this,LAYOUT_FILL_X);
|
||||
|
||||
@@ -109,18 +97,18 @@ Open9xSim::Open9xSim(FXApp* a)
|
||||
#define L LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_FIX_X|LAYOUT_FIX_Y
|
||||
#undef X0
|
||||
#define X0 10
|
||||
#define Y0 20
|
||||
#define Y0 10
|
||||
case 0:
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_HORIZONTAL,X0+0,Y0+120,100,20);
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_HORIZONTAL,X0+0,Y0+100,100,20);
|
||||
break;
|
||||
case 1:
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_VERTICAL,X0+100,Y0+20,20,100);
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_VERTICAL,X0+100,Y0+0,20,100);
|
||||
break;
|
||||
case 2:
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_VERTICAL,X0+120,Y0+20,20,100);
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_VERTICAL,X0+120,Y0+0,20,100);
|
||||
break;
|
||||
case 3:
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_HORIZONTAL,X0+140,Y0+120,100,20);
|
||||
sliders[i]=new FXSlider(hf1,NULL,0,L|SLIDER_HORIZONTAL,X0+140,Y0+100,100,20);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
@@ -128,26 +116,13 @@ Open9xSim::Open9xSim(FXApp* a)
|
||||
sliders[i]->setTickDelta(7);
|
||||
sliders[i]->setValue(0);
|
||||
}
|
||||
arrow[0]= new FXArrowButton(hf10,this,1000,ARROW_LEFT);
|
||||
arrow[1]= new FXArrowButton(hf10,this,1000,ARROW_UP);
|
||||
arrow[2]= new FXArrowButton(hf10,this,1000,ARROW_RIGHT);
|
||||
for(int i=4; i<8; i++){
|
||||
|
||||
for(int i=0; i<NUM_POTS; i++){
|
||||
knobs[i]= new FXKnob(hf11,NULL,0,KNOB_TICKS|LAYOUT_LEFT);
|
||||
knobs[i]->setRange(-1024, 1024);
|
||||
knobs[i]->setValue(0);
|
||||
}
|
||||
|
||||
arrow2[0]= new FXArrowButton(hf00,this,1000,ARROW_LEFT);
|
||||
arrow2[1]= new FXArrowButton(hf00,this,1000,ARROW_UP);
|
||||
arrow2[2]= new FXArrowButton(hf00,this,1000,ARROW_RIGHT);
|
||||
togButPpm = new FXToggleButton(hf00,"on", "off", NULL, NULL, NULL, 0, TOGGLEBUTTON_NORMAL);
|
||||
for(int i=0; i<8; i++){
|
||||
knobsppm[i]= new FXKnob(i<4?hf01:hf02,NULL,0,KNOB_TICKS|LAYOUT_LEFT);
|
||||
knobsppm[i]->setRange(1000,2000);
|
||||
knobsppm[i]->setValue(1500+i*20);
|
||||
}
|
||||
|
||||
|
||||
bmf = new FXImageFrame(this,bmp);
|
||||
|
||||
getApp()->addTimeout(this,2,100);
|
||||
@@ -194,25 +169,6 @@ void Open9xSim::doEvents()
|
||||
getApp()->runOneEvent(false);
|
||||
}
|
||||
|
||||
long Open9xSim::onArrowPress(FXObject*sender,FXSelector sel,void*v)
|
||||
{
|
||||
int which,val;
|
||||
if(sender==arrow[0]) { which=1; val=0;}
|
||||
if(sender==arrow[1]) { which=1; val=512;}
|
||||
if(sender==arrow[2]) { which=1; val=1023;}
|
||||
if(sender==arrow2[0]){ which=2; val=1000;}
|
||||
if(sender==arrow2[1]){ which=2; val=1500;}
|
||||
if(sender==arrow2[2]){ which=2; val=2000;}
|
||||
if(which == 1){
|
||||
for(int i=0; i<4; i++) sliders[i]->setValue(val);
|
||||
for(int i=4; i<7; i++) knobs[i]->setValue(val);
|
||||
}
|
||||
if(which == 2){
|
||||
for(int i=0; i<8; i++) knobsppm[i]->setValue(val);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long Open9xSim::onKeypress(FXObject*,FXSelector,void*v)
|
||||
{
|
||||
FXEvent *evt=(FXEvent*)v;
|
||||
@@ -225,15 +181,6 @@ long Open9xSim::onKeypress(FXObject*,FXSelector,void*v)
|
||||
|
||||
long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
{
|
||||
if(togButPpm->getState()){
|
||||
for(int i=0; i<8; i++){
|
||||
g_ppmIns[i]=knobsppm[i]->getValue()-1500;
|
||||
if(g_ppmIns[i]<-400){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(hasFocus()) {
|
||||
static int keys1[]={
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -241,8 +188,8 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
KEY_Page_Down, KEY_PAGE,
|
||||
KEY_Return, KEY_ENTER,
|
||||
KEY_BackSpace, KEY_EXIT,
|
||||
KEY_Right, KEY_PLUS,
|
||||
KEY_Left, KEY_MINUS,
|
||||
KEY_Up, KEY_PLUS,
|
||||
KEY_Down, KEY_MINUS,
|
||||
#else
|
||||
KEY_Return, KEY_MENU,
|
||||
KEY_BackSpace, KEY_EXIT,
|
||||
@@ -464,5 +411,5 @@ uint16_t anaIn(uint8_t chan)
|
||||
else if (chan<NUM_STICKS)
|
||||
return th9xSim->sliders[chan]->getValue();
|
||||
else
|
||||
return th9xSim->knobs[chan]->getValue();
|
||||
return th9xSim->knobs[chan-NUM_STICKS]->getValue();
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
const pm_char stamp1[] PROGMEM = " SVN: " SVN_STR;
|
||||
const pm_char stamp2[] PROGMEM = "DATE: " DATE_STR;
|
||||
const pm_char stamp3[] PROGMEM = "TIME: " TIME_STR;
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
const pm_char eeprom_stamp[] PROGMEM = "EEPR: " DEFNUMSTR(EEPROM_VER) "-" DEFNUMSTR(EEPROM_VARIANT);
|
||||
#else
|
||||
const pm_char eeprom_stamp[] PROGMEM = "EEPR: " DEFNUMSTR(EEPROM_VER);
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
volatile uint16_t Analog_values[NUMBER_ANALOG];
|
||||
#if !defined(REV3)
|
||||
const char ana_direction[NUMBER_ANALOG] = {0,1,1,1, 1,0,1,0, 0};
|
||||
const char ana_direction[NUMBER_ANALOG] = {0,1,1,1, 1,1,1,0, 0};
|
||||
#endif
|
||||
|
||||
void adcInit()
|
||||
|
||||
@@ -221,14 +221,14 @@ void boardInit()
|
||||
usbInit();
|
||||
|
||||
//Temporary: Configure second PPM pin as input (done after USB init in case the lib already initialises USB_ID)
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIO_EXTPPM, ENABLE);
|
||||
GPIO_InitStructure.GPIO_Pin = PIN_EXTPPM_OUT;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(GPIO_EXTPPM, &GPIO_InitStructure);
|
||||
// GPIO_InitTypeDef GPIO_InitStructure;
|
||||
// RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIO_EXTPPM, ENABLE);
|
||||
// GPIO_InitStructure.GPIO_Pin = PIN_EXTPPM_OUT;
|
||||
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
// GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
// GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
// GPIO_Init(GPIO_EXTPPM, &GPIO_InitStructure);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -84,7 +84,8 @@ uint8_t usbPlugged(void);
|
||||
#define BOOTLOADER_REQUEST() (0)
|
||||
#define usbBootloader()
|
||||
|
||||
#define SLAVE_MODE() (0/*pwrCheck() == e_power_trainer*/)
|
||||
#define SLAVE_MODE() (g_model.trainerMode == 1)
|
||||
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(GPIOTRNDET, PIN_TRNDET) == Bit_RESET)
|
||||
|
||||
void delaysInit();
|
||||
|
||||
@@ -113,15 +114,16 @@ uint32_t sdMounted();
|
||||
#endif
|
||||
|
||||
// Pulses driver
|
||||
void init_main_ppm();
|
||||
void disable_main_ppm();
|
||||
void init_pxx();
|
||||
void disable_pxx();
|
||||
void init_ppm( uint32_t module_index );
|
||||
void disable_ppm( uint32_t module_index );
|
||||
void init_pxx( uint32_t module_index );
|
||||
void disable_pxx( uint32_t module_index );
|
||||
|
||||
// Trainer driver
|
||||
void init_trainer_ppm();
|
||||
void stop_trainer_ppm();
|
||||
void init_trainer_capture();
|
||||
void stop_trainer_ppm() ;
|
||||
|
||||
// Keys driver
|
||||
void keysInit();
|
||||
@@ -164,7 +166,7 @@ void pwrOff();
|
||||
#define setBacklight(xx)
|
||||
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define IS_BACKLIGHT_ON() GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_BL)
|
||||
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
|
||||
|
||||
// USB driver
|
||||
void usbInit(void);
|
||||
|
||||
+316
-62
@@ -36,72 +36,136 @@
|
||||
|
||||
#include "../opentx.h"
|
||||
|
||||
#define EXTERNAL_TEST 0
|
||||
|
||||
// CURRENTLY EXPECTS ONLY PXX ON THE INTERNAL SIGNAL, PPM ALLOWED ON THE EXTERNAL SIGNAL
|
||||
|
||||
// TODO not here!
|
||||
void setupPulses();
|
||||
void setupPulsesPPM();
|
||||
void setupPulsesPXX();
|
||||
void setupPulses( uint32_t module );
|
||||
void setupPulsesPPM() ;
|
||||
void setupPulsesPXX( uint32_t module );
|
||||
|
||||
uint16_t *ppmStreamPtr;
|
||||
uint16_t *ppm2StreamPtr;
|
||||
extern uint16_t ppmStream[20];
|
||||
extern uint16_t ppm2Stream[20];
|
||||
extern uint16_t pxxStream[400] ;
|
||||
extern uint16_t pxx2Stream[400] ;
|
||||
|
||||
void init_pxx()
|
||||
#define INT_MODULE 0
|
||||
#define EXT_MODULE 0
|
||||
|
||||
static void init_pa10_pxx( void ) ;
|
||||
static void disable_pa10_pxx( void ) ;
|
||||
static void init_pa10_ppm( void ) ;
|
||||
static void disable_pa10_ppm( void ) ;
|
||||
static void init_pa7_pxx( void ) ;
|
||||
static void disable_pa7_pxx( void ) ;
|
||||
static void init_pa7_ppm( void ) ;
|
||||
static void disable_pa7_ppm( void ) ;
|
||||
|
||||
void init_pxx( uint32_t module_index )
|
||||
{
|
||||
INTERNAL_RF_ON();
|
||||
if ( module_index )
|
||||
{
|
||||
init_pa10_pxx() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
init_pa7_pxx() ;
|
||||
}
|
||||
}
|
||||
|
||||
// Timer1
|
||||
setupPulsesPXX() ; // TODO not here!
|
||||
void disable_pxx( uint32_t module_index )
|
||||
{
|
||||
if ( module_index )
|
||||
{
|
||||
disable_pa10_pxx() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
disable_pa7_pxx() ;
|
||||
}
|
||||
}
|
||||
|
||||
void init_ppm( uint32_t module_index )
|
||||
{
|
||||
if ( module_index )
|
||||
{
|
||||
init_pa10_ppm() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
init_pa7_ppm() ;
|
||||
}
|
||||
}
|
||||
|
||||
void disable_ppm( uint32_t module_index )
|
||||
{
|
||||
if ( module_index )
|
||||
{
|
||||
disable_pa10_ppm() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
disable_pa7_ppm() ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void init_pa10_pxx()
|
||||
{
|
||||
EXTERNAL_RF_ON();
|
||||
|
||||
// Timer1, channel 3
|
||||
setupPulsesPXX(EXT_MODULE) ; // TODO not here!
|
||||
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN ; // Enable portA clock
|
||||
#if defined(REV3)
|
||||
configure_pins( 0x0100, PIN_PERIPHERAL | PIN_PORTA | PIN_PER_1 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
#else
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOCPPM, ENABLE);
|
||||
GPIO_PinAFConfig(GPIOCPPM, GPIO_PinSource_CPPM, GPIO_AF_TIM1);
|
||||
GPIO_InitStructure.GPIO_Pin = PIN_CPPM_OUT;
|
||||
// RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOCPPM, ENABLE);
|
||||
|
||||
GPIO_PinAFConfig(GPIO_EXTPPM, GPIO_PinSource_EXTPPM, GPIO_AF_TIM1);
|
||||
GPIO_InitStructure.GPIO_Pin = PIN_EXTPPM_OUT;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(GPIOCPPM, &GPIO_InitStructure);
|
||||
#endif
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN ; // Enable clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN ; // Enable DMA1 clock
|
||||
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN ; // Enable clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN ; // Enable DMA2 clock
|
||||
|
||||
TIM1->CR1 &= ~TIM_CR1_CEN ;
|
||||
TIM1->ARR = 18000 ; // 9mS
|
||||
TIM1->CCR2 = 15000 ; // Update time
|
||||
TIM1->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 2000000 - 1 ; // 0.5uS from 30MHz
|
||||
#if defined(REV3)
|
||||
TIM1->CCER = TIM_CCER_CC1E | TIM_CCER_CC1P ;
|
||||
#else
|
||||
TIM1->CCER = TIM_CCER_CC1NE ;
|
||||
#endif
|
||||
TIM1->CR2 = TIM_CR2_OIS1 ; // O/P idle high
|
||||
|
||||
TIM1->CCER = TIM_CCER_CC3E ;
|
||||
|
||||
TIM1->CR2 = TIM_CR2_OIS3 ; // O/P idle high
|
||||
TIM1->BDTR = TIM_BDTR_MOE ; // Enable outputs
|
||||
TIM1->CCR1 = pxxStream[0] ;
|
||||
TIM1->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0 ; // Force O/P high
|
||||
TIM1->CCR3 = pxxStream[0] ;
|
||||
TIM1->CCMR2 = TIM_CCMR2_OC3M_2 | TIM_CCMR2_OC3M_0 ; // Force O/P high
|
||||
TIM1->EGR = 1 ; // Restart
|
||||
|
||||
// TIM1->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
// TIM1->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM1->DIER |= TIM_DIER_CC1DE ; // Enable DMA on CC1 match
|
||||
TIM1->DCR = 13 ; // DMA to CC1
|
||||
// TIM1->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
// TIM1->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM1->DIER |= TIM_DIER_CC3DE ; // Enable DMA on CC3 match
|
||||
TIM1->DCR = 15 ; // DMA to CC1
|
||||
|
||||
// TIM1->CR1 = TIM_CR1_OPM ; // Just run once
|
||||
// Enable the DMA channel here, DMA2 stream 1, channel 6
|
||||
DMA2_Stream1->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
DMA2->LIFCR = DMA_LIFCR_CTCIF1 | DMA_LIFCR_CHTIF1 | DMA_LIFCR_CTEIF1 | DMA_LIFCR_CDMEIF1 | DMA_LIFCR_CFEIF1 ; // Write ones to clear bits
|
||||
DMA2_Stream1->CR = DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_2 | DMA_SxCR_PL_0 | DMA_SxCR_MSIZE_0
|
||||
| DMA_SxCR_PSIZE_0 | DMA_SxCR_MINC | DMA_SxCR_DIR_0 | DMA_SxCR_PFCTRL ;
|
||||
DMA2_Stream1->PAR = CONVERT_PTR(&TIM1->DMAR);
|
||||
DMA2_Stream1->M0AR = CONVERT_PTR(&pxxStream[1]);
|
||||
// DMA2_Stream1->FCR = 0x05 ; //DMA_SxFCR_DMDIS | DMA_SxFCR_FTH_0 ;
|
||||
// DMA2_Stream1->NDTR = 100 ;
|
||||
DMA2_Stream1->CR |= DMA_SxCR_EN ; // Enable DMA
|
||||
// Enable the DMA channel here, DMA2 stream 6, channel 6
|
||||
DMA2_Stream6->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
DMA2->HIFCR = DMA_HIFCR_CTCIF6 | DMA_HIFCR_CHTIF6 | DMA_HIFCR_CTEIF6 | DMA_HIFCR_CDMEIF6 | DMA_HIFCR_CFEIF6 ; // Write ones to clear bits
|
||||
DMA2_Stream6->CR = DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_2 | DMA_SxCR_PL_0 | DMA_SxCR_MSIZE_0
|
||||
| DMA_SxCR_PSIZE_0 | DMA_SxCR_MINC | DMA_SxCR_DIR_0 | DMA_SxCR_PFCTRL ;
|
||||
DMA2_Stream6->PAR = CONVERT_PTR(&TIM1->DMAR);
|
||||
DMA2_Stream6->M0AR = CONVERT_PTR(&pxxStream[1]);
|
||||
// DMA2_Stream2->FCR = 0x05 ; //DMA_SxFCR_DMDIS | DMA_SxFCR_FTH_0 ;
|
||||
// DMA2_Stream2->NDTR = 100 ;
|
||||
DMA2_Stream6->CR |= DMA_SxCR_EN ; // Enable DMA
|
||||
|
||||
TIM1->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0 ; // Toggle CC1 o/p
|
||||
TIM1->CCMR2 = TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_0 ; // Toggle CC1 o/p
|
||||
TIM1->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
TIM1->CR1 |= TIM_CR1_CEN ;
|
||||
@@ -109,18 +173,19 @@ void init_pxx()
|
||||
NVIC_EnableIRQ(TIM1_CC_IRQn) ;
|
||||
}
|
||||
|
||||
void disable_pxx()
|
||||
static void disable_pa10_pxx()
|
||||
{
|
||||
DMA2_Stream6->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
NVIC_DisableIRQ(TIM1_CC_IRQn) ;
|
||||
TIM1->DIER &= ~TIM_DIER_CC2IE ;
|
||||
TIM1->CR1 &= ~TIM_CR1_CEN ;
|
||||
INTERNAL_RF_OFF();
|
||||
EXTERNAL_RF_OFF();
|
||||
}
|
||||
|
||||
// PPM output
|
||||
// Timer 1, channel 1 on PA8 for prototype
|
||||
// Pin is AF1 function for timer 1
|
||||
void init_main_ppm()
|
||||
static void init_pa10_ppm()
|
||||
{
|
||||
EXTERNAL_RF_ON();
|
||||
// Timer1
|
||||
@@ -128,22 +193,20 @@ void init_main_ppm()
|
||||
ppmStreamPtr = ppmStream ;
|
||||
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN ; // Enable portA clock
|
||||
#if defined(REV3)
|
||||
configure_pins( 0x0100, PIN_PERIPHERAL | PIN_PORTA | PIN_PER_1 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
#else
|
||||
configure_pins( 0x0080, PIN_PERIPHERAL | PIN_PORTA | PIN_PER_1 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
#endif
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN ; // Enable clock
|
||||
|
||||
configure_pins( PIN_EXTPPM_OUT, PIN_PERIPHERAL | PIN_PORTA | PIN_PER_1 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN ; // Enable clock
|
||||
|
||||
TIM1->CR1 &= ~TIM_CR1_CEN ;
|
||||
TIM1->ARR = *ppmStreamPtr++ ;
|
||||
TIM1->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 2000000 - 1 ; // 0.5uS from 30MHz
|
||||
#if defined(REV3)
|
||||
TIM1->CCER = TIM_CCER_CC1E ;
|
||||
#else
|
||||
TIM1->CCER = TIM_CCER_CC1NE | TIM_CCER_CC1NP ;
|
||||
#endif
|
||||
TIM1->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC2PE ; // PWM mode 1
|
||||
TIM1->CCR1 = 600 ; // 300 uS pulse
|
||||
|
||||
TIM1->CCER = TIM_CCER_CC3E ;
|
||||
|
||||
TIM1->CCMR2 = TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_2 ; // PWM mode 1
|
||||
TIM1->CCMR1 = TIM_CCMR1_OC2PE ; // PWM mode 1
|
||||
TIM1->CCR3 = 600 ; // 300 uS pulse ?? (g_model.ppmDelay*50+300)*2 ??
|
||||
TIM1->BDTR = TIM_BDTR_MOE ;
|
||||
TIM1->EGR = 1 ;
|
||||
TIM1->DIER = TIM_DIER_UDE ;
|
||||
@@ -158,12 +221,23 @@ void init_main_ppm()
|
||||
NVIC_EnableIRQ(TIM1_UP_TIM10_IRQn) ;
|
||||
}
|
||||
|
||||
void disable_main_ppm()
|
||||
static void disable_pa10_ppm()
|
||||
{
|
||||
NVIC_DisableIRQ(TIM1_CC_IRQn) ;
|
||||
NVIC_DisableIRQ(TIM1_UP_TIM10_IRQn) ;
|
||||
TIM1->DIER &= ~TIM_DIER_CC2IE & ~TIM_DIER_UIE ;
|
||||
TIM1->CR1 &= ~TIM_CR1_CEN ;
|
||||
|
||||
// Make pin an input
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIO_EXTPPM, ENABLE);
|
||||
GPIO_InitStructure.GPIO_Pin = PIN_EXTPPM_OUT;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(GPIO_EXTPPM, &GPIO_InitStructure);
|
||||
|
||||
EXTERNAL_RF_OFF();
|
||||
}
|
||||
|
||||
@@ -172,14 +246,14 @@ extern "C" void TIM1_CC_IRQHandler()
|
||||
TIM1->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
|
||||
TIM1->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
|
||||
setupPulses() ;
|
||||
setupPulses(1) ;
|
||||
|
||||
if (s_current_protocol == PROTO_PXX) {
|
||||
DMA2_Stream1->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
DMA2->LIFCR = DMA_LIFCR_CTCIF1 | DMA_LIFCR_CHTIF1 | DMA_LIFCR_CTEIF1 | DMA_LIFCR_CDMEIF1 | DMA_LIFCR_CFEIF1 ; // Write ones to clear bits
|
||||
DMA2_Stream1->M0AR = CONVERT_PTR(&pxxStream[1]);
|
||||
DMA2_Stream1->CR |= DMA_SxCR_EN ; // Enable DMA
|
||||
TIM1->CCR1 = pxxStream[0] ;
|
||||
DMA2_Stream6->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
DMA2->HIFCR = DMA_HIFCR_CTCIF6 | DMA_HIFCR_CHTIF6 | DMA_HIFCR_CTEIF6 | DMA_HIFCR_CDMEIF6 | DMA_HIFCR_CFEIF6 ; // Write ones to clear bits
|
||||
DMA2_Stream6->M0AR = CONVERT_PTR(&pxxStream[1]);
|
||||
DMA2_Stream6->CR |= DMA_SxCR_EN ; // Enable DMA
|
||||
TIM1->CCR3 = pxxStream[0] ;
|
||||
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
else {
|
||||
@@ -202,3 +276,183 @@ extern "C" void TIM1_UP_TIM10_IRQHandler()
|
||||
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void init_pa7_pxx()
|
||||
{
|
||||
#if EXTERNAL_TEST
|
||||
init_pa10_pxx() ;
|
||||
return ;
|
||||
#endif
|
||||
INTERNAL_RF_ON();
|
||||
|
||||
// Timer8
|
||||
setupPulsesPXX(INT_MODULE) ; // TODO not here!
|
||||
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN ; // Enable portA clock
|
||||
#if defined(REV3)
|
||||
configure_pins( PIN_CPPM_OUT, PIN_PERIPHERAL | PIN_PORTA | PIN_PER_1 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
#else
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOCPPM, ENABLE);
|
||||
GPIO_PinAFConfig(GPIOCPPM, GPIO_PinSource_CPPM, GPIO_AF_TIM8);
|
||||
GPIO_InitStructure.GPIO_Pin = PIN_CPPM_OUT;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(GPIOCPPM, &GPIO_InitStructure);
|
||||
#endif
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM8EN ; // Enable clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN ; // Enable DMA2 clock
|
||||
|
||||
TIM8->CR1 &= ~TIM_CR1_CEN ;
|
||||
TIM8->ARR = 18000 ; // 9mS
|
||||
TIM8->CCR2 = 15000 ; // Update time
|
||||
TIM8->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 2000000 - 1 ; // 0.5uS from 30MHz
|
||||
#if defined(REV3)
|
||||
TIM8->CCER = TIM_CCER_CC1E | TIM_CCER_CC1P ;
|
||||
#else
|
||||
TIM8->CCER = TIM_CCER_CC1NE ;
|
||||
#endif
|
||||
TIM8->CR2 = TIM_CR2_OIS1 ; // O/P idle high
|
||||
TIM8->BDTR = TIM_BDTR_MOE ; // Enable outputs
|
||||
TIM8->CCR1 = pxxStream[0] ;
|
||||
TIM8->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0 ; // Force O/P high
|
||||
TIM8->EGR = 1 ; // Restart
|
||||
|
||||
// TIM8->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
// TIM8->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM8->DIER |= TIM_DIER_CC1DE ; // Enable DMA on CC1 match
|
||||
TIM8->DCR = 13 ; // DMA to CC1
|
||||
|
||||
// TIM8->CR1 = TIM_CR1_OPM ; // Just run once
|
||||
// Enable the DMA channel here, DMA2 stream 2, channel 7
|
||||
DMA2_Stream2->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
DMA2->LIFCR = DMA_LIFCR_CTCIF2 | DMA_LIFCR_CHTIF2 | DMA_LIFCR_CTEIF2 | DMA_LIFCR_CDMEIF2 | DMA_LIFCR_CFEIF2 ; // Write ones to clear bits
|
||||
DMA2_Stream2->CR = DMA_SxCR_CHSEL_0 | DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_2 | DMA_SxCR_PL_0 | DMA_SxCR_MSIZE_0
|
||||
| DMA_SxCR_PSIZE_0 | DMA_SxCR_MINC | DMA_SxCR_DIR_0 | DMA_SxCR_PFCTRL ;
|
||||
DMA2_Stream2->PAR = CONVERT_PTR(&TIM8->DMAR);
|
||||
DMA2_Stream2->M0AR = CONVERT_PTR(&pxxStream[1]);
|
||||
// DMA2_Stream2->FCR = 0x05 ; //DMA_SxFCR_DMDIS | DMA_SxFCR_FTH_0 ;
|
||||
// DMA2_Stream2->NDTR = 100 ;
|
||||
DMA2_Stream2->CR |= DMA_SxCR_EN ; // Enable DMA
|
||||
|
||||
TIM8->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0 ; // Toggle CC1 o/p
|
||||
TIM8->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM8->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
TIM8->CR1 |= TIM_CR1_CEN ;
|
||||
// NVIC_SetPriority(TIM8_CC_IRQn, 1); // Debug - high priority, doesn't help
|
||||
NVIC_EnableIRQ(TIM8_CC_IRQn) ;
|
||||
}
|
||||
|
||||
static void disable_pa7_pxx()
|
||||
{
|
||||
#if EXTERNAL_TEST
|
||||
disable_pa10_pxx() ;
|
||||
return ;
|
||||
#endif
|
||||
DMA2_Stream2->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
NVIC_DisableIRQ(TIM8_CC_IRQn) ;
|
||||
TIM8->DIER &= ~TIM_DIER_CC2IE ;
|
||||
TIM8->CR1 &= ~TIM_CR1_CEN ;
|
||||
INTERNAL_RF_OFF();
|
||||
}
|
||||
|
||||
// PPM output
|
||||
// Timer 1, channel 1 on PA8 for prototype
|
||||
// Pin is AF1 function for timer 1
|
||||
static void init_pa7_ppm()
|
||||
{
|
||||
#if EXTERNAL_TEST
|
||||
init_pa10_ppm() ;
|
||||
return ;
|
||||
#endif
|
||||
INTERNAL_RF_ON();
|
||||
// Timer1
|
||||
setupPulsesPPM() ;
|
||||
ppmStreamPtr = ppmStream ;
|
||||
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN ; // Enable portA clock
|
||||
#if defined(REV3)
|
||||
configure_pins( 0x0100, PIN_PERIPHERAL | PIN_PORTA | PIN_PER_1 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
#else
|
||||
configure_pins( 0x0080, PIN_PERIPHERAL | PIN_PORTA | PIN_PER_3 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
#endif
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM8EN ; // Enable clock
|
||||
|
||||
TIM8->CR1 &= ~TIM_CR1_CEN ;
|
||||
|
||||
TIM8->ARR = *ppmStreamPtr++ ;
|
||||
TIM8->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 2000000 - 1 ; // 0.5uS from 30MHz
|
||||
#if defined(REV3)
|
||||
TIM8->CCER = TIM_CCER_CC1E ;
|
||||
#else
|
||||
TIM8->CCER = TIM_CCER_CC1NE | TIM_CCER_CC1NP ;
|
||||
#endif
|
||||
TIM8->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC2PE ; // PWM mode 1
|
||||
TIM8->CCR1 = 600 ; // 300 uS pulse ?? (g_model.ppmDelay*50+300)*2 ??
|
||||
TIM8->BDTR = TIM_BDTR_MOE ;
|
||||
TIM8->EGR = 1 ;
|
||||
TIM8->DIER = TIM_DIER_UDE ;
|
||||
|
||||
TIM8->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
TIM8->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM8->DIER |= TIM_DIER_CC2IE ;
|
||||
TIM8->DIER |= TIM_DIER_UIE ;
|
||||
|
||||
TIM8->CR1 = TIM_CR1_CEN ;
|
||||
NVIC_EnableIRQ(TIM8_CC_IRQn) ;
|
||||
NVIC_EnableIRQ(TIM8_UP_TIM13_IRQn) ;
|
||||
}
|
||||
|
||||
static void disable_pa7_ppm()
|
||||
{
|
||||
#if EXTERNAL_TEST
|
||||
disable_pa10_ppm() ;
|
||||
return ;
|
||||
#endif
|
||||
NVIC_DisableIRQ(TIM8_CC_IRQn) ;
|
||||
NVIC_DisableIRQ(TIM8_UP_TIM13_IRQn) ;
|
||||
TIM8->DIER &= ~TIM_DIER_CC2IE & ~TIM_DIER_UIE ;
|
||||
TIM8->CR1 &= ~TIM_CR1_CEN ;
|
||||
INTERNAL_RF_OFF();
|
||||
}
|
||||
|
||||
extern "C" void TIM8_CC_IRQHandler()
|
||||
{
|
||||
TIM8->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
|
||||
TIM8->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
|
||||
setupPulses(INT_MODULE) ;
|
||||
|
||||
if (s_current_protocol == PROTO_PXX) {
|
||||
DMA2_Stream2->CR &= ~DMA_SxCR_EN ; // Disable DMA
|
||||
DMA2->LIFCR = DMA_LIFCR_CTCIF2 | DMA_LIFCR_CHTIF2 | DMA_LIFCR_CTEIF2 | DMA_LIFCR_CDMEIF2 | DMA_LIFCR_CFEIF2 ; // Write ones to clear bits
|
||||
DMA2_Stream2->M0AR = CONVERT_PTR(&pxxStream[1]);
|
||||
DMA2_Stream2->CR |= DMA_SxCR_EN ; // Enable DMA
|
||||
TIM8->CCR1 = pxxStream[0] ;
|
||||
TIM8->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
else {
|
||||
ppmStreamPtr = ppmStream ;
|
||||
|
||||
TIM8->DIER |= TIM_DIER_UDE ;
|
||||
TIM8->SR &= ~TIM_SR_UIF ; // Clear this flag
|
||||
TIM8->DIER |= TIM_DIER_UIE ; // Enable this interrupt
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void TIM8_UP_TIM13_IRQHandler()
|
||||
{
|
||||
TIM8->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
|
||||
TIM8->ARR = *ppmStreamPtr++ ;
|
||||
if ( *ppmStreamPtr == 0 )
|
||||
{
|
||||
TIM8->SR &= ~TIM_SR_CC2IF ; // Clear this flag
|
||||
TIM8->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,6 @@ uint32_t pwrCheck()
|
||||
#else
|
||||
if (GPIO_ReadInputDataBit(GPIOPWR, PIN_PWR_STATUS) == Bit_RESET)
|
||||
return e_power_on;
|
||||
#if !defined(REV3)
|
||||
else if (GPIO_ReadInputDataBit(GPIOTRNDET, PIN_TRNDET) == Bit_SET)
|
||||
return e_power_trainer;
|
||||
#endif
|
||||
else if (usbPlugged())
|
||||
return e_power_usb;
|
||||
else
|
||||
|
||||
@@ -57,7 +57,7 @@ void setupTrainerPulses()
|
||||
int16_t PPM_range = g_model.extendedLimits ? 640 * 2 : 512 * 2; //range of 0.7..1.7msec
|
||||
|
||||
uint16_t *ptr ;
|
||||
uint32_t p=8+g_model.ppmNCH*2; //Channels *2
|
||||
uint32_t p = NUM_CHANNELS(0);
|
||||
|
||||
ptr = TrainerPpmStream ;
|
||||
|
||||
@@ -72,72 +72,48 @@ void setupTrainerPulses()
|
||||
*ptr++ = rest ;
|
||||
*ptr = 0 ;
|
||||
|
||||
TIM8->CCR2 = rest - 1000 ; // Update time
|
||||
TIM8->CCR4 = (g_model.ppmDelay*50+300)*2 ;
|
||||
TIM3->CCR2 = rest - 1000 ; // Update time
|
||||
TIM3->CCR4 = (g_model.ppmDelay*50+300)*2 ;
|
||||
}
|
||||
|
||||
// Trainer PPM oputput PC9, Timer 8 channel 4
|
||||
// Trainer PPM oputput PC9, Timer 3 channel 4, (Alternate Function 2)
|
||||
void init_trainer_ppm()
|
||||
{
|
||||
setupTrainerPulses() ;
|
||||
TrainerPulsePtr = TrainerPpmStream ;
|
||||
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN ; // Enable portC clock
|
||||
configure_pins( 0x0200, PIN_PERIPHERAL | PIN_PORTC | PIN_PER_3 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM8EN ; // Enable clock
|
||||
configure_pins( PIN_TR_PPM_OUT, PIN_PERIPHERAL | PIN_PORTC | PIN_PER_3 | PIN_OS25 | PIN_PUSHPULL ) ;
|
||||
configure_pins( PIN_TR_PPM_IN, PIN_PORTA | PIN_INPUT ) ;
|
||||
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN ; // Enable clock
|
||||
|
||||
TIM8->ARR = *TrainerPulsePtr++ ;
|
||||
TIM8->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 2000000 - 1 ; // 0.5uS from 30MHz
|
||||
TIM8->CCER = TIM_CCER_CC4E ;
|
||||
TIM8->CCMR2 = TIM_CCMR2_OC4M_1 | TIM_CCMR2_OC4M_2 | TIM_CCMR2_OC4PE ; // PWM mode 1
|
||||
TIM8->CCR4 = 600 ; // 300 uS pulse
|
||||
TIM8->BDTR = TIM_BDTR_MOE ;
|
||||
TIM8->EGR = 1 ;
|
||||
// TIM8->DIER = TIM_DIER_UDE ;
|
||||
TIM3->ARR = *TrainerPulsePtr++ ;
|
||||
TIM3->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 2000000 - 1 ; // 0.5uS
|
||||
TIM3->CCER = TIM_CCER_CC4E ;
|
||||
TIM3->CCMR2 = TIM_CCMR2_OC4M_1 | TIM_CCMR2_OC4M_2 | TIM_CCMR2_OC4PE ; // PWM mode 1
|
||||
TIM3->CCR4 = 600 ; // 300 uS pulse
|
||||
TIM3->BDTR = TIM_BDTR_MOE ;
|
||||
TIM3->EGR = 1 ;
|
||||
// TIM3->DIER = TIM_DIER_UDE ;
|
||||
|
||||
TIM8->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
TIM8->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM8->DIER |= TIM_DIER_CC2IE ;
|
||||
TIM8->DIER |= TIM_DIER_UIE ;
|
||||
TIM3->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
TIM3->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM3->DIER |= TIM_DIER_CC2IE ;
|
||||
TIM3->DIER |= TIM_DIER_UIE ;
|
||||
|
||||
TIM8->CR1 = TIM_CR1_CEN ;
|
||||
NVIC_EnableIRQ(TIM8_CC_IRQn) ;
|
||||
NVIC_EnableIRQ(TIM8_UP_TIM13_IRQn) ;
|
||||
TIM3->CR1 = TIM_CR1_CEN ;
|
||||
NVIC_EnableIRQ(TIM3_IRQn) ;
|
||||
// NVIC_EnableIRQ(TIM8_UP_TIM13_IRQn) ;
|
||||
}
|
||||
|
||||
// TODO - testing
|
||||
void stop_trainer_ppm()
|
||||
{
|
||||
configure_pins( 0x0200, PIN_INPUT | PIN_PORTC ) ;
|
||||
TIM8->CR1 &= ~TIM_CR1_CEN ; // Stop counter
|
||||
NVIC_DisableIRQ(TIM8_CC_IRQn) ; // Stop Interrupt
|
||||
NVIC_DisableIRQ(TIM8_UP_TIM13_IRQn) ; // Stop Interrupt
|
||||
}
|
||||
|
||||
extern "C" void TIM8_CC_IRQHandler()
|
||||
{
|
||||
TIM8->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
|
||||
TIM8->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
|
||||
setupTrainerPulses() ;
|
||||
|
||||
TrainerPulsePtr = TrainerPpmStream ;
|
||||
TIM8->DIER |= TIM_DIER_UDE ;
|
||||
|
||||
TIM8->SR &= ~TIM_SR_UIF ; // Clear this flag
|
||||
TIM8->DIER |= TIM_DIER_UIE ; // Enable this interrupt
|
||||
}
|
||||
|
||||
extern "C" void TIM8_UP_TIM13_IRQHandler()
|
||||
{
|
||||
TIM8->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
|
||||
TIM8->ARR = *TrainerPulsePtr++ ;
|
||||
if ( *TrainerPulsePtr == 0 )
|
||||
{
|
||||
TIM8->SR &= ~TIM_SR_CC2IF ; // Clear this flag
|
||||
TIM8->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
configure_pins( PIN_TR_PPM_OUT, PIN_INPUT | PIN_PORTC ) ; // Pin as input
|
||||
TIM3->CR1 &= ~TIM_CR1_CEN ; // Stop counter
|
||||
TIM3->DIER &= ~TIM_DIER_CC2IE ; // Stop Interrupt
|
||||
TIM3->DIER &= ~TIM_DIER_UIE ; // Stop Interrupt
|
||||
NVIC_DisableIRQ(TIM3_IRQn) ; // Stop Interrupt
|
||||
}
|
||||
|
||||
// Trainer capture, PC8, Timer 3 channel 3
|
||||
@@ -152,12 +128,18 @@ void init_trainer_capture()
|
||||
TIM3->CR2 = 0 ;
|
||||
TIM3->CCMR2 = TIM_CCMR2_IC3F_0 | TIM_CCMR2_IC3F_1 | TIM_CCMR2_CC3S_0 ;
|
||||
TIM3->CCER = TIM_CCER_CC3E ;
|
||||
TIM3->SR &= ~TIM_SR_CC3IF ; // Clear flag
|
||||
TIM3->SR &= ~TIM_SR_CC3IF & ~TIM_SR_CC2IF & ~TIM_SR_UIF ; // Clear flags
|
||||
TIM3->DIER |= TIM_DIER_CC3IE ;
|
||||
TIM3->CR1 = TIM_CR1_CEN ;
|
||||
NVIC_EnableIRQ(TIM3_IRQn) ;
|
||||
}
|
||||
|
||||
void stop_trainer_capture()
|
||||
{
|
||||
TIM3->CR1 &= ~TIM_CR1_CEN ; // Stop counter
|
||||
TIM3->DIER &= ~TIM_DIER_CC3IE ; // Stop Interrupt
|
||||
NVIC_DisableIRQ(TIM3_IRQn) ; // Stop Interrupt
|
||||
}
|
||||
|
||||
extern "C" void TIM3_IRQHandler()
|
||||
{
|
||||
@@ -165,25 +147,58 @@ extern "C" void TIM3_IRQHandler()
|
||||
static uint16_t lastCapt ;
|
||||
uint16_t val ;
|
||||
|
||||
capture = TIM3->CCR3 ;
|
||||
// What mode? in or out?
|
||||
if ( (TIM3->DIER & TIM_DIER_CC3IE ) && ( TIM3->SR & TIM_SR_CC3IF ) )
|
||||
{
|
||||
// capture mode
|
||||
capture = TIM3->CCR3 ;
|
||||
|
||||
val = (uint16_t)(capture - lastCapt) / 2 ;
|
||||
lastCapt = capture;
|
||||
val = (uint16_t)(capture - lastCapt) / 2 ;
|
||||
lastCapt = capture;
|
||||
|
||||
// We prcoess g_ppmInsright here to make servo movement as smooth as possible
|
||||
// while under trainee control
|
||||
if ((val>4000) && (val < 19000)) { // G: Prioritize reset pulse. (Needed when less than 8 incoming pulses)
|
||||
ppmInState = 1; // triggered
|
||||
}
|
||||
else {
|
||||
if(ppmInState && (ppmInState<=8)) {
|
||||
if ((val>800) && (val<2200)) {
|
||||
g_ppmIns[ppmInState++ - 1] = (int16_t)(val - 1500)*(g_eeGeneral.PPM_Multiplier+10)/10; //+-500 != 512, but close enough.
|
||||
}
|
||||
else {
|
||||
ppmInState = 0; // not triggered
|
||||
}
|
||||
}
|
||||
}
|
||||
// We prcoess g_ppmInsright here to make servo movement as smooth as possible
|
||||
// while under trainee control
|
||||
if ((val>4000) && (val < 19000)) { // G: Prioritize reset pulse. (Needed when less than 8 incoming pulses)
|
||||
ppmInState = 1; // triggered
|
||||
}
|
||||
else {
|
||||
if(ppmInState && (ppmInState<=8)) {
|
||||
if ((val>800) && (val<2200)) {
|
||||
g_ppmIns[ppmInState++ - 1] = (int16_t)(val - 1500)*(g_eeGeneral.PPM_Multiplier+10)/10; //+-500 != 512, but close enough.
|
||||
}
|
||||
else {
|
||||
ppmInState = 0; // not triggered
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// PPM out compare interrupt
|
||||
if ( ( TIM3->DIER & TIM_DIER_CC2IE ) && ( TIM3->SR & TIM_SR_CC2IF ) )
|
||||
{ // compare interrupt
|
||||
TIM3->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
TIM3->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
|
||||
TIM3->SR &= ~TIM_SR_CC2IF ; // Clear flag
|
||||
|
||||
setupTrainerPulses() ;
|
||||
|
||||
TrainerPulsePtr = TrainerPpmStream ;
|
||||
TIM3->DIER |= TIM_DIER_UDE ;
|
||||
|
||||
TIM3->SR &= ~TIM_SR_UIF ; // Clear this flag
|
||||
TIM3->DIER |= TIM_DIER_UIE ; // Enable this interrupt
|
||||
}
|
||||
|
||||
// PPM out update interrupt
|
||||
if ( (TIM3->DIER & TIM_DIER_UIE) && ( TIM3->SR & TIM_SR_UIF ) )
|
||||
{
|
||||
TIM3->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
|
||||
TIM3->ARR = *TrainerPulsePtr++ ;
|
||||
if ( *TrainerPulsePtr == 0 )
|
||||
{
|
||||
TIM3->SR &= ~TIM_SR_CC2IF ; // Clear this flag
|
||||
TIM3->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev)
|
||||
RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOA , ENABLE);
|
||||
|
||||
/* Configure SOF ID DM DP Pins */
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 |
|
||||
GPIO_InitStructure.GPIO_Pin = // GPIO_Pin_8 |
|
||||
GPIO_Pin_11 |
|
||||
GPIO_Pin_12;
|
||||
|
||||
@@ -59,7 +59,7 @@ void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev)
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource8,GPIO_AF_OTG1_FS) ;
|
||||
//GPIO_PinAFConfig(GPIOA,GPIO_PinSource8,GPIO_AF_OTG1_FS) ;
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource11,GPIO_AF_OTG1_FS) ;
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource12,GPIO_AF_OTG1_FS) ;
|
||||
|
||||
@@ -71,14 +71,14 @@ void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev)
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
/* Configure ID pin */
|
||||
/* // Configure ID pin
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_OTG1_FS) ;
|
||||
|
||||
*/
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
|
||||
RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../opentx.h"
|
||||
#include "../FatFs/diskio.h"
|
||||
#include "board_taranis.h"
|
||||
|
||||
extern "C" {
|
||||
#include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/misc.h"
|
||||
@@ -404,7 +405,7 @@ const FATDirEntry_t g_DIRroot[16] =
|
||||
{
|
||||
{ 'T', 'A', 'R', 'A', 'N', 'I', 'S', ' '},
|
||||
{ 'B', 'I', 'N'},
|
||||
0x26, // Archive, hidden, system
|
||||
0x24, // Archive, hidden, system
|
||||
0x00,
|
||||
0x3E,
|
||||
0xA301,
|
||||
@@ -652,22 +653,27 @@ int32_t fat12Read( uint8_t *buffer, uint16_t sector, uint16_t count )
|
||||
eeprom_read_block (buffer, (sector-3)*512, 512);
|
||||
}
|
||||
buffer += 512 ;
|
||||
sector += 1 ;
|
||||
count -= 1 ;
|
||||
sector++ ;
|
||||
count-- ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int32_t fat12Write( const uint8_t *buffer, uint16_t sector, uint32_t count )
|
||||
int32_t fat12Write(const uint8_t *buffer, uint16_t sector, uint32_t count )
|
||||
{
|
||||
// TO DO, actually write to the EEPROM
|
||||
if ( sector > 2 )
|
||||
if ( sector >3 )
|
||||
{
|
||||
sector -= 2 ; // Indexes EEPROM in 512 byte blocks
|
||||
sector -= 4 ; // Indexes EEPROM in 512 byte blocks
|
||||
// Look for a 4K block boundary, writing 4K+
|
||||
|
||||
while (count) {
|
||||
eeWriteBlockCmp((uint8_t *)buffer, sector*512, 512);
|
||||
buffer+=512;
|
||||
sector++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
@@ -474,8 +474,7 @@ ISR(USART0_RX_vect)
|
||||
uint8_t data;
|
||||
|
||||
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
|
||||
sei() ;
|
||||
|
||||
sei();
|
||||
|
||||
stat = UCSR0A; // USART control and Status Register 0 A
|
||||
|
||||
|
||||
@@ -140,9 +140,9 @@ const pm_char STR_AILDIRECTION[] PROGMEM = TR_AILDIRECTION;
|
||||
const pm_char STR_COLDIRECTION[] PROGMEM = TR_COLDIRECTION;
|
||||
#endif
|
||||
const pm_char STR_MODE[] PROGMEM = TR_MODE;
|
||||
#if defined(AUDIO) && defined(BEEPER)
|
||||
#if defined(AUDIO) && defined(BUZZER)
|
||||
const pm_char STR_SPEAKER[] PROGMEM = INDENT"Speaker";
|
||||
const pm_char STR_BEEPER[] PROGMEM = INDENT"Beeper";
|
||||
const pm_char STR_BUZZER[] PROGMEM = INDENT"Buzzer";
|
||||
#endif
|
||||
const pm_char STR_NOFREEEXPO[] PROGMEM = TR_NOFREEEXPO;
|
||||
const pm_char STR_NOFREEMIXER[] PROGMEM = TR_NOFREEMIXER;
|
||||
@@ -157,7 +157,7 @@ const pm_char STR_OFFSET[] PROGMEM = TR_OFFSET;
|
||||
const pm_char STR_TRIM[] PROGMEM = TR_TRIM;
|
||||
const pm_char STR_DREX[] PROGMEM = TR_DREX;
|
||||
const pm_char STR_CURVE[] PROGMEM = TR_CURVE;
|
||||
const pm_char STR_FPHASE[] PROGMEM = TR_FPHASE;
|
||||
const pm_char STR_FLMODE[] PROGMEM = TR_FLMODE;
|
||||
const pm_char STR_MIXWARNING[] PROGMEM = TR_MIXWARNING;
|
||||
const pm_char STR_OFF[] PROGMEM = TR_OFF;
|
||||
const pm_char STR_MULTPX[] PROGMEM = TR_MULTPX;
|
||||
@@ -297,6 +297,7 @@ const pm_char STR_MENUTEMPLATES[] PROGMEM = TR_MENUTEMPLATES;
|
||||
|
||||
const pm_char STR_MENUSTAT[] PROGMEM = TR_MENUSTAT;
|
||||
const pm_char STR_MENUDEBUG[] PROGMEM = TR_MENUDEBUG;
|
||||
const pm_char STR_MENUGLOBALVARS[] PROGMEM = "GLOBAL VARIABLES";
|
||||
|
||||
#if defined(DSM2) || defined(PXX)
|
||||
const pm_char STR_RXNUM[] PROGMEM = TR_RXNUM;
|
||||
@@ -313,6 +314,8 @@ const pm_char STR_FAILSAFESET[] PROGMEM = TR_FAILSAFESET;
|
||||
#endif
|
||||
|
||||
const pm_char STR_INVERT_THR[] PROGMEM = TR_INVERT_THR;
|
||||
const pm_char STR_AND_SWITCH[] PROGMEM = "AND Switch";
|
||||
extern const pm_char STR_CF[] PROGMEM = "CF";
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
const pm_char STR_MINRSSI[] PROGMEM = TR_MINRSSI;
|
||||
@@ -356,6 +359,8 @@ const pm_char STR_RESET_TELEMETRY[] PROGMEM = "Reset Telemetry";
|
||||
const pm_char STR_STATISTICS[] PROGMEM = "Statistics";
|
||||
#endif
|
||||
|
||||
const pm_char STR_RESET[] PROGMEM = "[Reset]";
|
||||
|
||||
#if defined(SDCARD)
|
||||
const pm_char STR_BACKUP_MODEL[] PROGMEM = TR_BACKUP_MODEL;
|
||||
const pm_char STR_RESTORE_MODEL[] PROGMEM = TR_RESTORE_MODEL;
|
||||
@@ -437,6 +442,7 @@ const pm_char STR_BYTES[] PROGMEM = "bytes";
|
||||
const pm_char STR_MODULE_BIND[] PROGMEM = "[Bind]";
|
||||
const pm_char STR_MODULE_RANGE[] PROGMEM = "[Range]";
|
||||
const pm_char STR_SET[] PROGMEM = "[Set]";
|
||||
const pm_char STR_TRAINER[] PROGMEM = "Trainer";
|
||||
#endif
|
||||
|
||||
const pm_uchar font_5x7[] PROGMEM = {
|
||||
|
||||
+10
-4
@@ -271,12 +271,12 @@ extern const pm_char STR_ELEDIRECTION[];
|
||||
extern const pm_char STR_AILDIRECTION[];
|
||||
extern const pm_char STR_COLDIRECTION[];
|
||||
extern const pm_char STR_MODE[];
|
||||
#if defined(AUDIO) && defined(BEEPER)
|
||||
#if defined(AUDIO) && defined(BUZZER)
|
||||
extern const pm_char STR_SPEAKER[];
|
||||
extern const pm_char STR_BEEPER[];
|
||||
extern const pm_char STR_BUZZER[];
|
||||
#else
|
||||
#define STR_SPEAKER STR_MODE
|
||||
#define STR_BEEPER STR_MODE
|
||||
#define STR_BUZZER STR_MODE
|
||||
#endif
|
||||
extern const pm_char STR_NOFREEEXPO[];
|
||||
extern const pm_char STR_NOFREEMIXER[];
|
||||
@@ -291,7 +291,7 @@ extern const pm_char STR_OFFSET[];
|
||||
extern const pm_char STR_TRIM[];
|
||||
extern const pm_char STR_DREX[];
|
||||
extern const pm_char STR_CURVE[];
|
||||
extern const pm_char STR_FPHASE[];
|
||||
extern const pm_char STR_FLMODE[];
|
||||
extern const pm_char STR_MIXWARNING[];
|
||||
extern const pm_char STR_OFF[];
|
||||
extern const pm_char STR_MULTPX[];
|
||||
@@ -407,7 +407,10 @@ extern const pm_char STR_MENUTELEMETRY[];
|
||||
extern const pm_char STR_MENUTEMPLATES[];
|
||||
extern const pm_char STR_MENUSTAT[];
|
||||
extern const pm_char STR_MENUDEBUG[];
|
||||
extern const pm_char STR_MENUGLOBALVARS[];
|
||||
extern const pm_char STR_INVERT_THR[];
|
||||
extern const pm_char STR_AND_SWITCH[];
|
||||
extern const pm_char STR_CF[];
|
||||
|
||||
#if defined(DSM2) || defined(PXX)
|
||||
extern const pm_char STR_RXNUM[];
|
||||
@@ -472,6 +475,8 @@ extern const pm_char STR_CURRENT[];
|
||||
extern const pm_char STR_STATISTICS[];
|
||||
#endif
|
||||
|
||||
extern const pm_char STR_RESET[];
|
||||
|
||||
#if defined(SDCARD)
|
||||
extern const pm_char STR_BACKUP_MODEL[];
|
||||
extern const pm_char STR_RESTORE_MODEL[];
|
||||
@@ -575,6 +580,7 @@ extern const pm_char STR_CHANNELS_MONITOR[];
|
||||
extern const pm_char STR_MODULE_BIND[];
|
||||
extern const pm_char STR_MODULE_RANGE[];
|
||||
extern const pm_char STR_SET[];
|
||||
extern const pm_char STR_TRAINER[];
|
||||
#endif
|
||||
|
||||
// TODO move to translations files
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DVex"
|
||||
#define TR_CURVE "K\206ivka"
|
||||
#define TR_FPHASE "F\200ze"
|
||||
#define TR_FLMODE "F\200ze"
|
||||
#define TR_MIXWARNING "Varov\200n\204"
|
||||
#define TR_OFF "VYP"
|
||||
#define TR_MULTPX "Mat.Operace"
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
#define LEN_VSWITCHES "\003"
|
||||
#define LEN_VSRCRAW "\004"
|
||||
|
||||
#if defined(PCBX9D)
|
||||
#if defined(PCBTARANIS)
|
||||
#define TR_POTS_VSRCRAW "S1\0 ""S2\0 ""LS\0 ""RS\0 " //4 Potis S1,S2,Links,Rechts
|
||||
#define TR_SW_VSRCRAW "SA\0 ""SB\0 ""SC\0 ""SD\0 ""SE\0 ""SF\0 ""SG\0 ""SH\0 "
|
||||
#elif defined(EXTRA_3POS)
|
||||
@@ -286,7 +286,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TR_CUSTOMSW "PS1""PS2""PS3""PS4""PS5""PS6""PS7""PS8""PS9""PSA""PSB""PSC""PSD""PSE""PSF""PSG""PSH""PSI""PSJ""PSK""PSL""PSM""PSN""PSO""PSP""PSQ""PSR""PSS""PST""PSU""PSV""PSW"
|
||||
#define TR_CUSTOMSW "PS1""PS2""PS3""PS4""PS5""PS6""PS7""PS8""PS9""PSA""PSB""PSC""PSD""PSE""PSF""PSG""PSH""PSI""PSJ""PSK""PSL""PSM""PSN""PSO""PSP""PSQ""PSR""PSS""PST""PSU""PSV""PSW"
|
||||
#elif defined(PCBGRUVIN9X) || defined(CPUM128)
|
||||
#define TR_CUSTOMSW "PS1""PS2""PS3""PS4""PS5""PS6""PS7""PS8""PS9""PSA""PSB""PSC""PSD""PSE""PSF"
|
||||
#else
|
||||
@@ -325,7 +325,7 @@
|
||||
#define LEN_INDENT 1
|
||||
#define INDENT_WIDTH (FW/2)
|
||||
|
||||
#if defined(PCBX9D)
|
||||
#if defined(PCBTARANIS)
|
||||
#define TR_ENTER "[ENTER]"
|
||||
#else
|
||||
#define TR_ENTER "[MENU]"
|
||||
@@ -383,7 +383,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Kurve"
|
||||
#define TR_FPHASE TR("Phase","Phasen")
|
||||
#define TR_FLMODE TR("Phase","Phasen")
|
||||
#define TR_MIXWARNING "Warnung"
|
||||
#define TR_OFF "AUS"
|
||||
#define TR_MULTPX "Wirkung"
|
||||
|
||||
+14
-14
@@ -127,7 +127,7 @@
|
||||
#define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|"
|
||||
|
||||
#define LEN_VMLTPX "\010"
|
||||
#define TR_VMLTPX "Add ""Multiply""Replace "
|
||||
#define TR_VMLTPX "Add\0 ""Multiply""Replace\0"
|
||||
|
||||
#define LEN_VMLTPX2 "\002"
|
||||
#define TR_VMLTPX2 "+=""*="":="
|
||||
@@ -273,7 +273,7 @@
|
||||
#define TR_VTEMPLATES "Clear Mixes\0\0""Simple 4-CH \0""Sticky-T-Cut\0""V-Tail \0""Elevon\\Delta\0""eCCPM \0""Heli Setup \0""Servo Test \0"
|
||||
|
||||
#define LEN_VSWASHTYPE "\004"
|
||||
#define TR_VSWASHTYPE "--- ""120 ""120X""140 ""90\0"
|
||||
#define TR_VSWASHTYPE "---\0""120\0""120X""140\0""90\0"
|
||||
|
||||
#define LEN_VKEYS "\005"
|
||||
#define TR_VKEYS TR(" Menu"" Exit"" Down"" Up""Right"" Left", " Menu"" Exit""Enter"" Page"" Plus""Minus")
|
||||
@@ -354,7 +354,7 @@
|
||||
#define TR_LOADINGMODEL "Loading model..."
|
||||
#define TR_NAME "Name"
|
||||
#define TR_MODELNAME "Model Name"
|
||||
#define TR_PHASENAME "Phase Name"
|
||||
#define TR_PHASENAME "Mode Name"
|
||||
#define TR_MIXNAME "Mix Name"
|
||||
#define TR_EXPONAME "Expo Name"
|
||||
#define TR_BITMAP "Model Image"
|
||||
@@ -365,8 +365,8 @@
|
||||
#define TR_TTRACE TR("T-Source","Throttle Source")
|
||||
#define TR_TTRIM TR("T-Trim","Throttle Trim")
|
||||
#define TR_BEEPCTR TR("Ctr Beep","Center Beep")
|
||||
#define TR_PROTO TR(INDENT"Proto",INDENT"Protocol")
|
||||
#define TR_PPMFRAME "PPM frame"
|
||||
#define TR_PROTO TR(INDENT "Proto", INDENT "Protocol")
|
||||
#define TR_PPMFRAME TR("PPM frame", INDENT "PPM frame")
|
||||
#define TR_MS "ms"
|
||||
#define TR_SWITCH "Switch"
|
||||
#define TR_TRIMS "Trims"
|
||||
@@ -395,7 +395,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Curve"
|
||||
#define TR_FPHASE TR("Phase","Phases")
|
||||
#define TR_FLMODE TR("Mode","Modes")
|
||||
#define TR_MIXWARNING "Warning"
|
||||
#define TR_OFF "OFF"
|
||||
#define TR_MULTPX "Multpx"
|
||||
@@ -420,14 +420,14 @@
|
||||
#define TR_HAPTICSTRENGTH INDENT"Strength"
|
||||
#define TR_CONTRAST "Contrast"
|
||||
#define TR_ALARMS_LABEL "Alarms"
|
||||
#define TR_BATTERY_RANGE "Battery Range"
|
||||
#define TR_BATTERY_RANGE TR("Battery range","Battery meter range")
|
||||
#define TR_BATTERYWARNING INDENT"Battery Low"
|
||||
#define TR_INACTIVITYALARM INDENT"Inactivity"
|
||||
#define TR_MEMORYWARNING INDENT"Memory Low"
|
||||
#define TR_ALARMWARNING INDENT"Sound Off"
|
||||
#define TR_RENAVIG "RotEnc Navig"
|
||||
#define TR_THROTTLEREVERSE TR("Thr reverse","Throttle reverse")
|
||||
#define TR_MINUTEBEEP TR(INDENT"Minute",INDENT"Every minute")
|
||||
#define TR_THROTTLEREVERSE TR("T-Reverse", "Throttle reverse")
|
||||
#define TR_MINUTEBEEP TR(INDENT"Minute",INDENT"Minute call")
|
||||
#define TR_BEEPCOUNTDOWN INDENT"Countdown"
|
||||
#define TR_PERSISTENT TR(INDENT"Persist.",INDENT"Persistent")
|
||||
#define TR_BACKLIGHT_LABEL "Backlight"
|
||||
@@ -473,7 +473,7 @@
|
||||
#define TR_PPM "PPM"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FP"
|
||||
#define TR_FP "FM"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM low mem"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
@@ -494,13 +494,13 @@
|
||||
#define TR_TRIMS2OFFSETS "\006Trims => Offsets"
|
||||
#define TR_MENUMODELSEL TR("MODELSEL","MODEL SELECTION")
|
||||
#define TR_MENUSETUP TR("SETUP","MODEL SETUP")
|
||||
#define TR_MENUFLIGHTPHASE "FLIGHT PHASE"
|
||||
#define TR_MENUFLIGHTPHASES "FLIGHT PHASES"
|
||||
#define TR_MENUFLIGHTPHASE "FLIGHT MODE"
|
||||
#define TR_MENUFLIGHTPHASES "FLIGHT MODES"
|
||||
#define TR_MENUHELISETUP "HELI SETUP"
|
||||
|
||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_LIMITS_SYMETRICAL) // The right menu titles for the gurus ...
|
||||
#define TR_MENUDREXPO "STICKS"
|
||||
#define TR_MENULIMITS "OUTPUTS"
|
||||
#define TR_MENULIMITS "SERVOS"
|
||||
#else
|
||||
#define TR_MENUDREXPO "DR/EXPO"
|
||||
#define TR_MENULIMITS "LIMITS"
|
||||
@@ -590,6 +590,6 @@
|
||||
#define TR_CHANNELS_MONITOR "CHANNEL MONITOR"
|
||||
#define TR_INTERNALRF "Internal RF"
|
||||
#define TR_EXTERNALRF "External RF"
|
||||
#define TR_FAILSAFE "Failsafe mode"
|
||||
#define TR_FAILSAFE INDENT "Failsafe mode"
|
||||
#define TR_FAILSAFESET "FAILSAFE SETTINGS"
|
||||
#define TR_COUNTRYCODE "Country Code"
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Curva"
|
||||
#define TR_FPHASE "Fase"
|
||||
#define TR_FLMODE "Fase"
|
||||
#define TR_MIXWARNING "Aviso"
|
||||
#define TR_OFF "OFF"
|
||||
#define TR_MULTPX "Multpx"
|
||||
|
||||
@@ -395,7 +395,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Courbe"
|
||||
#define TR_FPHASE TR("Phase","Phases")
|
||||
#define TR_FLMODE TR("Phase","Phases")
|
||||
#define TR_MIXWARNING "Alerte"
|
||||
#define TR_OFF "OFF"
|
||||
#define TR_MULTPX "Op\200ration"
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Curva"
|
||||
#define TR_FPHASE "Fase"
|
||||
#define TR_FLMODE "Fase"
|
||||
#define TR_MIXWARNING "Avviso"
|
||||
#define TR_OFF "OFF"
|
||||
#define TR_MULTPX "MultPx"
|
||||
|
||||
@@ -359,7 +359,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Curvas"
|
||||
#define TR_FPHASE "Fase"
|
||||
#define TR_FLMODE "Fase"
|
||||
#define TR_MIXWARNING "Aviso"
|
||||
#define TR_OFF "OFF"
|
||||
#define TR_MULTPX "Aplicar"
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
#define TR_LOADINGMODEL "Laddar Modell "
|
||||
#define TR_NAME "Namn"
|
||||
#define TR_MODELNAME "Modellnamn"
|
||||
#define TR_PHASENAME "Fasnamn "
|
||||
#define TR_PHASENAME "Modnamn "
|
||||
#define TR_MIXNAME "Mixnamn "
|
||||
#define TR_EXPONAME "Exponamn "
|
||||
#define TR_BITMAP "Modell-bild"
|
||||
@@ -395,7 +395,7 @@
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Kurva"
|
||||
#define TR_FPHASE TR("Fas","Faser")
|
||||
#define TR_FLMODE TR("Mod","Moder")
|
||||
#define TR_MIXWARNING "Varning"
|
||||
#define TR_OFF "AV "
|
||||
#define TR_MULTPX "Multpx"
|
||||
@@ -429,7 +429,7 @@
|
||||
#define TR_THROTTLEREVERSE "Reverserad Gas"
|
||||
#define TR_MINUTEBEEP INDENT"Varje Minut"
|
||||
#define TR_BEEPCOUNTDOWN INDENT"R\201kna Ned"
|
||||
#define TR_PERSISTENT TR("J\201mt p\200 ","INDENT"Alltid P\200")
|
||||
#define TR_PERSISTENT TR("J\201mt p\200 ",INDENT"Alltid P\200")
|
||||
#define TR_BACKLIGHT_LABEL "Belysning"
|
||||
#define TR_BLDELAY INDENT"Av efter"
|
||||
#define TR_BLONBRIGHTNESS INDENT"P\200 Ljusstyrka"
|
||||
@@ -494,8 +494,8 @@
|
||||
#define TR_TRIMS2OFFSETS "\004[Spara Trimv\201rden]"
|
||||
#define TR_MENUMODELSEL TR("Modell","V\201lj Modell")
|
||||
#define TR_MENUSETUP TR("V\201rden","Modellinst\201llningar")
|
||||
#define TR_MENUFLIGHTPHASE "Flygfas"
|
||||
#define TR_MENUFLIGHTPHASES "Flygfaser"
|
||||
#define TR_MENUFLIGHTPHASE "Flygmod"
|
||||
#define TR_MENUFLIGHTPHASES "Flygmoder"
|
||||
#define TR_MENUHELISETUP "Helikopter"
|
||||
|
||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_LIMITS_SYMETRICAL) // The right menu titles for the gurus ...
|
||||
|
||||
@@ -116,7 +116,16 @@ PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
number = -number;
|
||||
}
|
||||
|
||||
convertUnit(number, unit);
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_METERS) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
|
||||
@@ -106,7 +106,16 @@ PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
number = -number;
|
||||
}
|
||||
|
||||
convertUnit(number, unit);
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_METERS) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
|
||||
@@ -130,7 +130,16 @@ PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
number = -number;
|
||||
}
|
||||
|
||||
convertUnit(number, unit);
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_METERS) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
|
||||
@@ -112,7 +112,16 @@ PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
number = -number;
|
||||
}
|
||||
|
||||
convertUnit(number, unit);
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_METERS) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
|
||||
@@ -102,7 +102,16 @@ PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
number = -number;
|
||||
}
|
||||
|
||||
convertUnit(number, unit);
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_METERS) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
|
||||
@@ -115,7 +115,16 @@ PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
number = -number;
|
||||
}
|
||||
|
||||
convertUnit(number, unit);
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_METERS) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
|
||||
@@ -131,7 +131,16 @@ PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
number = -number;
|
||||
}
|
||||
|
||||
convertUnit(number, unit);
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_METERS) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
|
||||
+7
-7
@@ -137,11 +137,11 @@ void doMainScreenGraphics()
|
||||
DO_CROSS(RBOX_CENTERX, RBOX_CENTERY, 3)
|
||||
|
||||
int16_t calibStickVert = calibratedStick[CONVERT_MODE(1+1)-1];
|
||||
if (g_eeGeneral.throttleReversed && CONVERT_MODE(1+1)-1 == THR_STICK)
|
||||
if (g_model.throttleReversed && CONVERT_MODE(1+1)-1 == THR_STICK)
|
||||
calibStickVert = -calibStickVert;
|
||||
lcd_square(LBOX_CENTERX+(calibratedStick[CONVERT_MODE(0+1)-1]*BOX_LIMIT/(2*RESX))-MARKER_WIDTH/2, LBOX_CENTERY-(calibStickVert*BOX_LIMIT/(2*RESX))-MARKER_WIDTH/2, MARKER_WIDTH, ROUND);
|
||||
calibStickVert = calibratedStick[CONVERT_MODE(2+1)-1];
|
||||
if (g_eeGeneral.throttleReversed && CONVERT_MODE(2+1)-1 == THR_STICK)
|
||||
if (g_model.throttleReversed && CONVERT_MODE(2+1)-1 == THR_STICK)
|
||||
calibStickVert = -calibStickVert;
|
||||
lcd_square(RBOX_CENTERX+(calibratedStick[CONVERT_MODE(3+1)-1]*BOX_LIMIT/(2*RESX))-MARKER_WIDTH/2, RBOX_CENTERY-(calibStickVert*BOX_LIMIT/(2*RESX))-MARKER_WIDTH/2, MARKER_WIDTH, ROUND);
|
||||
|
||||
@@ -263,11 +263,11 @@ void displayTopBar()
|
||||
x -= 12;
|
||||
}
|
||||
|
||||
if (SLAVE_MODE()) {
|
||||
if (TRAINER_CONNECTED() && SLAVE_MODE()) {
|
||||
LCD_NOTIF_ICON(x, ICON_TRAINEE);
|
||||
x -= 12;
|
||||
}
|
||||
else if (0) {
|
||||
else if (TRAINER_CONNECTED() && !SLAVE_MODE()) {
|
||||
LCD_NOTIF_ICON(x, ICON_TRAINER);
|
||||
x -= 12;
|
||||
}
|
||||
@@ -765,7 +765,7 @@ void menuMainView(uint8_t event)
|
||||
}
|
||||
#endif // PCBGRUVIN9X && ROTARY_ENCODERS
|
||||
|
||||
// Curstom Switches
|
||||
// Custom Switches
|
||||
#if defined(PCBSKY9X)
|
||||
for (uint8_t i=0; i<NUM_CSW; i++) {
|
||||
int8_t len = getSwitch(SWSRC_SW1+i, 0) ? BAR_HEIGHT : 1;
|
||||
@@ -779,7 +779,7 @@ void menuMainView(uint8_t event)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
for (uint8_t i=0; i<NUM_CSW; i++)
|
||||
putsSwitches(2*FW-2 + (i/3)*(4*FW-2) + (i/3>1 ? 3*FW : 0), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i, 0) ? INVERS : 0);
|
||||
#elif !defined(CPUM64)
|
||||
#elif !defined(PCBSTD)
|
||||
for (uint8_t i=0; i<NUM_CSW; i++)
|
||||
putsSwitches(2*FW-2 + (i/3)*(4*FW-1), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i, 0) ? INVERS : 0);
|
||||
#else
|
||||
@@ -814,7 +814,7 @@ void menuMainView(uint8_t event)
|
||||
s_gvar_timer--;
|
||||
s_warning = PSTR("Global Variable");
|
||||
displayBox();
|
||||
#if defined(CPUM64)
|
||||
#if defined(PCBSTD)
|
||||
lcd_putsAtt(16+4*FW, 5*FH, PSTR("[\010]"), BOLD);
|
||||
lcd_outdezAtt(16+4*FW+4*FW+FW/2, 5*FH, GVAR_VALUE(s_gvar_last, s_perout_flight_phase), BOLD);
|
||||
#else
|
||||
|
||||
+80
-78
@@ -26,6 +26,8 @@
|
||||
|
||||
import os, sys, shutil, platform, subprocess, wave, zipfile
|
||||
|
||||
NO_ALTERNATE = 1024
|
||||
|
||||
def generate(str, idx, alternate=0):
|
||||
result = None
|
||||
if "speak" in sys.argv:
|
||||
@@ -41,7 +43,7 @@ def generate(str, idx, alternate=0):
|
||||
elif board == 'sky9x':
|
||||
result = idx + ".wav"
|
||||
else:
|
||||
if alternate == 0:
|
||||
if alternate >= NO_ALTERNATE:
|
||||
return []
|
||||
result = "%04d.wav" % alternate
|
||||
|
||||
@@ -197,19 +199,19 @@ if __name__ == "__main__":
|
||||
"point four", "point five", "point six",
|
||||
"point seven", "point eight", "point nine"]):
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+160+i))
|
||||
for s, f, a in [(u"trim center", "midtrim", 244),
|
||||
(u"maximum trim reached", "endtrim", 0),
|
||||
(u"transmitter battery low", "lowbatt", 231),
|
||||
(u"inactivity alarm", "inactiv", 230),
|
||||
(u"throttle warning", "thralert", 232),
|
||||
(u"switch warning", "swalert", 233),
|
||||
(u"Welcome to open nine ex!", "tada", 245),
|
||||
(u"tick. tock", "timerlt3", 250),
|
||||
(u"ten. seconds", "timer10", 251),
|
||||
(u"twenty. seconds", "timer20", 252),
|
||||
(u"thirty. seconds", "timer30", 253),
|
||||
for s, f, a in [(u"trim center", "midtrim", 494),
|
||||
(u"maximum trim reached", "endtrim", NO_ALTERNATE),
|
||||
(u"transmitter battery low", "lowbatt", 481),
|
||||
(u"inactivity alarm", "inactiv", 480),
|
||||
(u"throttle warning", "thralert", 482),
|
||||
(u"switch warning", "swalert", 483),
|
||||
(u"Welcome to open nine ex!", "tada", 495),
|
||||
(u"tick. tock", "timerlt3", 500),
|
||||
(u"ten. seconds", "timer10", 501),
|
||||
(u"twenty. seconds", "timer20", 502),
|
||||
(u"thirty. seconds", "timer30", 503),
|
||||
]:
|
||||
systemSounds.extend(generate(s, f, PROMPT_SYSTEM_BASE+a))
|
||||
systemSounds.extend(generate(s, f, a))
|
||||
for i, (s, f) in enumerate([
|
||||
(u"gear!, up!", "gearup"),
|
||||
(u"gear!, down!", "geardn"),
|
||||
@@ -307,23 +309,23 @@ if __name__ == "__main__":
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+103+i))
|
||||
for i, s in enumerate(["volt", "amper", "meetri per secondo", "", "chilomeetri ora", "meetri", "gradi", "percento", "milliamper", "milliamper ora", "watt", "db", "piedi", "nodi", "ore", "minuti", "secondi", "R P M", "g"]):
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+113+i))
|
||||
for s, f, a in [(u"radio inattiva controllare", "inactiv", 230),
|
||||
(u"batteria della radio scarica", "lowbatt", 231),
|
||||
(u"controllo motore non in posizione, verificare", "thralert", 232),
|
||||
(u"interruttori non in posizione, verificare", "swalert", 233),
|
||||
(u"eeprom corrotta", "eebad", 0),
|
||||
(u"formattazone eeprom in corso", "eeformat", 0),
|
||||
(u"errore", "error", 0),
|
||||
(u"trim centrato", "midtrim", 244),
|
||||
(u"tada", "tada", 245),
|
||||
(u"potenziometro centrato", "midpot", 246),
|
||||
(u"massimo trim raggiunto", "endtrim", 0),
|
||||
(u"3 secondi al termine", "timerlt3", 250),
|
||||
(u"dieci secondi", "timer10", 251),
|
||||
(u"venti secondi", "timer20", 252),
|
||||
(u"trenta secondi", "timer30", 253),
|
||||
for s, f, a in [(u"radio inattiva controllare", "inactiv", 480),
|
||||
(u"batteria della radio scarica", "lowbatt", 481),
|
||||
(u"controllo motore non in posizione, verificare", "thralert", 482),
|
||||
(u"interruttori non in posizione, verificare", "swalert", 483),
|
||||
(u"eeprom corrotta", "eebad", NO_ALTERNATE),
|
||||
(u"formattazone eeprom in corso", "eeformat", NO_ALTERNATE),
|
||||
(u"errore", "error", NO_ALTERNATE),
|
||||
(u"trim centrato", "midtrim", 494),
|
||||
(u"tada", "tada", 495),
|
||||
(u"potenziometro centrato", "midpot", 496),
|
||||
(u"massimo trim raggiunto", "endtrim", NO_ALTERNATE),
|
||||
(u"3 secondi al termine", "timerlt3", 500),
|
||||
(u"dieci secondi", "timer10", 501),
|
||||
(u"venti secondi", "timer20", 502),
|
||||
(u"trenta secondi", "timer30", 503),
|
||||
]:
|
||||
systemSounds.extend(generate(s, f, PROMPT_SYSTEM_BASE+a))
|
||||
systemSounds.extend(generate(s, f, a))
|
||||
for i, s in enumerate(["timer", "timer", "trasmissione", "ricezione", "A1", "A2", "altitudine", "motore",
|
||||
"carburante", "temperatura", "temperatura", "velocita'", "distanza", "altitudine", "cella lipo",
|
||||
"totale lipo", "tensione", "corrente", "consumo", "potenza", "accelerazione X", "accellerazione Y", "accelerazione Z",
|
||||
@@ -370,29 +372,29 @@ if __name__ == "__main__":
|
||||
voice = "german"
|
||||
|
||||
for i in range(101):
|
||||
systemSounds.extend(generate(str(i), i))
|
||||
systemSounds.extend(generate(str(i), PROMPT_SYSTEM_BASE+i))
|
||||
systemSounds.extend(generate("tausend", PROMPT_SYSTEM_BASE+101))
|
||||
for i, s in enumerate(["comma", "und", "minus", "uhr", "minute", "minuten", "sekunde", "sekunden"]):
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+102+i))
|
||||
for i, s in enumerate(["Volt", "Ampere", "Meter pro sekunde", "", "kilometer pro stunde", "Meter", "Grad", "Prozent", "Milliampere", "Milliampere pro stunde", "Watt", "db", "Fuesse", "Knoten", "Uhr", "Minuten", "Secunden", "R P M", "g"]):
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+110+i))
|
||||
for s, f, a in [(u"Sender ist inaktiv,bitte Ueberpruefen Sie", "inactiv", 230),
|
||||
(u"Senderakku niedrig", "lowbatt", 231),
|
||||
(u"Gaskanal nicht Null, bitte pruefen", "thralert", 232),
|
||||
(u"Schalten fehlpositioniert, bitte pruefen", "swalert", 233),
|
||||
(u"Das EEPROM ist fehlerhaft", "eebad", 0),
|
||||
(u"Das EEPROM ist immer formatiert", "eeformat", 0),
|
||||
(u"fehler", "error", 0),
|
||||
(u"Trim zentriert", "midtrim", 244),
|
||||
(u"tada", "tada", 245),
|
||||
(u"Poti zentriert", "midpot", 246),
|
||||
(u"Maximale trimmung erreicht", "endtrim", 0),
|
||||
(u"Noch drei sekunden", "timerlt3", 250),
|
||||
(u"10 sekunden", "timer10", 251),
|
||||
(u"20 sekunden", "timer20", 252),
|
||||
(u"30 sekunden", "timer30", 253),
|
||||
for s, f, a in [(u"Sender ist inaktiv,bitte Ueberpruefen Sie", "inactiv", 480),
|
||||
(u"Senderakku niedrig", "lowbatt", 481),
|
||||
(u"Gaskanal nicht Null, bitte pruefen", "thralert", 482),
|
||||
(u"Schalten fehlpositioniert, bitte pruefen", "swalert", 483),
|
||||
(u"Das EEPROM ist fehlerhaft", "eebad", NO_ALTERNATE),
|
||||
(u"Das EEPROM ist immer formatiert", "eeformat", NO_ALTERNATE),
|
||||
(u"fehler", "error", NO_ALTERNATE),
|
||||
(u"Trim zentriert", "midtrim", 494),
|
||||
(u"tada", "tada", 495),
|
||||
(u"Poti zentriert", "midpot", 496),
|
||||
(u"Maximale trimmung erreicht", "endtrim", NO_ALTERNATE),
|
||||
(u"Noch drei sekunden", "timerlt3", 500),
|
||||
(u"10 sekunden", "timer10", 501),
|
||||
(u"20 sekunden", "timer20", 502),
|
||||
(u"30 sekunden", "timer30", 503),
|
||||
]:
|
||||
systemSounds.extend(generate(s, f, PROMPT_SYSTEM_BASE+a))
|
||||
systemSounds.extend(generate(s, f, a))
|
||||
for i, s in enumerate(["Timer", "Timer", "Sendung", "Empfang", "A1", "A2", "Hoehe", "Motor",
|
||||
"Treibstoff", "Temperatur", "Temperatur", "Geschwindigkeit", "Ferne", "Hoehe", "Lipo-Zelle",
|
||||
"Zellen gesamt", "Spannung", "Strom", "Verbrauch", "Power", "Beschleunigung X", "Beschleunigung Y", "Beschleunigung Z",
|
||||
@@ -454,23 +456,23 @@ if __name__ == "__main__":
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+111+i))
|
||||
for i, s in enumerate([u"Volt", u"ampére", u"metros por segundo", u"", u"quilômetros por hora", u"metros", u"graus", u"cento", u"miliamperes", u"miliamperes por hora", u"watt", u"db", u"pés", u"nós", u"horas", u"minutos", u"segundos", u"RPM", u"g"]):
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+122+i))
|
||||
for s, f, a in [(u"atenção, o rádio foi esquecido ligado, por favor desligue-o", "inactiv", 230),
|
||||
(u"bateria do rádio fraca", "lowbatt", 231),
|
||||
(u"atenção,acelerador não está no mínimo", "thralert", 232),
|
||||
(u"atenção, certifique-se que os interruptores estão na posição certa", "swalert", 233),
|
||||
(u"eeprom corrompida", "eebad", 0),
|
||||
(u"formatação da eeprom em curso", "eeformat", 0),
|
||||
(u"erro", "error", 0),
|
||||
(u"trim centrado", "midtrim", 244),
|
||||
(u"tada", "tada", 245),
|
||||
(u"potenciómetro centrado", "midpot", 246),
|
||||
(u"trim no máximo", "endtrim", 0),
|
||||
(u"3 segundos", "timerlt3", 250),
|
||||
(u"10 segundos", "timer10", 251),
|
||||
(u"20 segundos", "timer20", 252),
|
||||
(u"30 segundos", "timer30", 253),
|
||||
for s, f, a in [(u"atenção, o rádio foi esquecido ligado, por favor desligue-o", "inactiv", 480),
|
||||
(u"bateria do rádio fraca", "lowbatt", 481),
|
||||
(u"atenção,acelerador não está no mínimo", "thralert", 482),
|
||||
(u"atenção, certifique-se que os interruptores estão na posição certa", "swalert", 483),
|
||||
(u"eeprom corrompida", "eebad", NO_ALTERNATE),
|
||||
(u"formatação da eeprom em curso", "eeformat", NO_ALTERNATE),
|
||||
(u"erro", "error", NO_ALTERNATE),
|
||||
(u"trim centrado", "midtrim", 494),
|
||||
(u"tada", "tada", 495),
|
||||
(u"potenciómetro centrado", "midpot", 496),
|
||||
(u"trim no máximo", "endtrim", NO_ALTERNATE),
|
||||
(u"3 segundos", "timerlt3", 500),
|
||||
(u"10 segundos", "timer10", 501),
|
||||
(u"20 segundos", "timer20", 502),
|
||||
(u"30 segundos", "timer30", 503),
|
||||
]:
|
||||
systemSounds.extend(generate(s, f, PROMPT_SYSTEM_BASE+a))
|
||||
systemSounds.extend(generate(s, f, a))
|
||||
for i, s in enumerate([u"cronómetro", u"cronómetro", u"transmissão", u"recepção", u"A1", u"A2", u"altitude", u"motor",
|
||||
u"combustível", u"temperatura", u"temperatura", u"velocidade", u"distância", u"altitude", u"célula lipo"
|
||||
u"Total lipo", u"tensão", u"corrente", u"consumo", u"potência", u"aceleração X", u"aceleração Y", u"aceleração Z"
|
||||
@@ -547,19 +549,19 @@ if __name__ == "__main__":
|
||||
u"gé", u"gé", u"gé", u"gé"]):
|
||||
systemSounds.extend(generate(s, PROMPT_SYSTEM_BASE+118+i))
|
||||
|
||||
for s, f, a in [(u"střed trimu", "midtrim", 244),
|
||||
(u"maximum trimu", "endtrim", 0),
|
||||
(u"baterie rádia je vybitá", "lowbatt", 231),
|
||||
(u"zapoměl jsi na mě!", "inactiv", 230),
|
||||
(u"plyn není na nule", "thralert", 232),
|
||||
(u"přepínače nejsou ve výchozí poloze", "swalert", 233),
|
||||
(u"tadá", "tada", 245),
|
||||
(u"ťik ťak", "timerlt3", 250),
|
||||
(u"deset sekund", "timer10", 251),
|
||||
(u"dvacet sekund", "timer20", 252),
|
||||
(u"třicet sekund", "timer30", 253),
|
||||
for s, f, a in [(u"střed trimu", "midtrim", 494),
|
||||
(u"maximum trimu", "endtrim", NO_ALTERNATE),
|
||||
(u"baterie rádia je vybitá", "lowbatt", 481),
|
||||
(u"zapoměl jsi na mě!", "inactiv", 480),
|
||||
(u"plyn není na nule", "thralert", 482),
|
||||
(u"přepínače nejsou ve výchozí poloze", "swalert", 483),
|
||||
(u"tadá", "tada", 495),
|
||||
(u"ťik ťak", "timerlt3", 500),
|
||||
(u"deset sekund", "timer10", 501),
|
||||
(u"dvacet sekund", "timer20", 502),
|
||||
(u"třicet sekund", "timer30", 503),
|
||||
]:
|
||||
systemSounds.extend(generate(s, f, PROMPT_SYSTEM_BASE+a))
|
||||
systemSounds.extend(generate(s, f, a))
|
||||
for i, (s, f) in enumerate([
|
||||
(u"podvozek je zasunut", "gearup"),
|
||||
(u"podvozek je vysunut", "geardn"),
|
||||
@@ -599,13 +601,13 @@ if __name__ == "__main__":
|
||||
for f, s in systemSounds:
|
||||
l = u""
|
||||
if board == "sky9x":
|
||||
l += u"9XSOUNDS/SYSTEM;"
|
||||
l += u"SOUNDS/SYSTEM;"
|
||||
l += f + u";" + s + u"\n"
|
||||
csvFile.write(l.encode("latin-1"))
|
||||
for f, s in sounds:
|
||||
l = u""
|
||||
if board == "sky9x":
|
||||
l += u"9XSOUNDS;"
|
||||
l += u"SOUNDS;"
|
||||
l += f + u";" + s + u"\n"
|
||||
csvFile.write(l.encode("latin-1"))
|
||||
csvFile.close()
|
||||
@@ -615,13 +617,13 @@ if __name__ == "__main__":
|
||||
zip = zipfile.ZipFile(zip_name, "w", zipfile.ZIP_DEFLATED)
|
||||
for f, s in systemSounds:
|
||||
if board == "sky9x":
|
||||
zip.write(f, "9XSOUNDS/SYSTEM/" + f)
|
||||
zip.write(f, "SOUNDS/SYSTEM/" + f)
|
||||
else:
|
||||
zip.write(f, f)
|
||||
os.remove(f)
|
||||
for f, s in sounds:
|
||||
if board == "sky9x":
|
||||
zip.write(f, "9XSOUNDS/" + f)
|
||||
zip.write(f, "SOUNDS/" + f)
|
||||
else:
|
||||
zip.write(f, f)
|
||||
os.remove(f)
|
||||
|
||||
Reference in New Issue
Block a user