mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
Cosmetics
This commit is contained in:
parent
dd44da14bc
commit
0ad015f3e7
32 changed files with 227 additions and 183 deletions
|
@ -125,7 +125,7 @@ bool RleFile::searchFat()
|
||||||
uint32_t bestFatIndex = 0;
|
uint32_t bestFatIndex = 0;
|
||||||
for (int i=0; i<EEPROM_ZONE_SIZE/EEPROM_FAT_SIZE; i++) {
|
for (int i=0; i<EEPROM_ZONE_SIZE/EEPROM_FAT_SIZE; i++) {
|
||||||
EepromHeader * header = (EepromHeader *)(eeprom+i*EEPROM_FAT_SIZE);
|
EepromHeader * header = (EepromHeader *)(eeprom+i*EEPROM_FAT_SIZE);
|
||||||
if (header->mark == EEPROM_MARK && (int)header->index >= bestFatIndex) {
|
if (header->mark == EEPROM_MARK && header->index >= bestFatIndex) {
|
||||||
eepromFatHeader = header;
|
eepromFatHeader = header;
|
||||||
bestFatIndex = header->index;
|
bestFatIndex = header->index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -359,7 +359,7 @@ int cliSet(const char ** argv)
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG_INTERRUPTS)
|
#if defined(DEBUG_INTERRUPTS)
|
||||||
void printInterrupts()
|
void printInterrupts()
|
||||||
{
|
{
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
struct InterruptCounters ic = interruptCounters;
|
struct InterruptCounters ic = interruptCounters;
|
||||||
|
@ -368,14 +368,14 @@ void printInterrupts()
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
serialPrint("Interrupts count in the last %u ms:", (get_tmr10ms() - ic.resetTime) * 10);
|
serialPrint("Interrupts count in the last %u ms:", (get_tmr10ms() - ic.resetTime) * 10);
|
||||||
for(int n = 0; n < INT_LAST; n++) {
|
for(int n = 0; n < INT_LAST; n++) {
|
||||||
serialPrint("%s: %u", interruptNames[n], ic.cnt[n]);
|
serialPrint("%s: %u", interruptNames[n], ic.cnt[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //#if defined(DEBUG_INTERRUPTS)
|
#endif //#if defined(DEBUG_INTERRUPTS)
|
||||||
|
|
||||||
#if defined(DEBUG_TASKS)
|
#if defined(DEBUG_TASKS)
|
||||||
|
|
||||||
void printTaskSwitchLog()
|
void printTaskSwitchLog()
|
||||||
{
|
{
|
||||||
serialPrint("Tasks legend [<task_id>, <task name>]:");
|
serialPrint("Tasks legend [<task_id>, <task name>]:");
|
||||||
for(int n = 0; n <= CFG_MAX_USER_TASKS+1; n++) {
|
for(int n = 0; n <= CFG_MAX_USER_TASKS+1; n++) {
|
||||||
|
@ -437,7 +437,7 @@ void printDebugTime(uint32_t time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printDebugTimer(const char * name, DebugTimer & timer)
|
void printDebugTimer(const char * name, DebugTimer & timer)
|
||||||
{
|
{
|
||||||
serialPrintf("%s: ", name);
|
serialPrintf("%s: ", name);
|
||||||
printDebugTime( timer.getMin());
|
printDebugTime( timer.getMin());
|
||||||
|
@ -465,8 +465,8 @@ void printAudioVars()
|
||||||
}
|
}
|
||||||
serialPrint("fragments:");
|
serialPrint("fragments:");
|
||||||
for(int n = 0; n < AUDIO_QUEUE_LENGTH; n++) {
|
for(int n = 0; n < AUDIO_QUEUE_LENGTH; n++) {
|
||||||
serialPrint("%d: type %u: id: %u, repeat: %u, ", n, (uint32_t)audioQueue.fragments[n].type,
|
serialPrint("%d: type %u: id: %u, repeat: %u, ", n, (uint32_t)audioQueue.fragments[n].type,
|
||||||
(uint32_t)audioQueue.fragments[n].id,
|
(uint32_t)audioQueue.fragments[n].id,
|
||||||
(uint32_t)audioQueue.fragments[n].repeat);
|
(uint32_t)audioQueue.fragments[n].repeat);
|
||||||
if ( audioQueue.fragments[n].type == FRAGMENT_FILE) {
|
if ( audioQueue.fragments[n].type == FRAGMENT_FILE) {
|
||||||
serialPrint(" file: %s", audioQueue.fragments[n].file);
|
serialPrint(" file: %s", audioQueue.fragments[n].file);
|
||||||
|
@ -552,9 +552,9 @@ int cliDisplay(const char ** argv)
|
||||||
serialPrint(reg & 0x02 ? "Thermal sensor bad" : "Thermal sensor ok");
|
serialPrint(reg & 0x02 ? "Thermal sensor bad" : "Thermal sensor ok");
|
||||||
serialPrint(reg & 0x04 ? "Power ok" : "Power bad");
|
serialPrint(reg & 0x04 ? "Power ok" : "Power bad");
|
||||||
serialPrint(reg & 0x08 ? "Connected to charger" : "Not connected to charger");
|
serialPrint(reg & 0x08 ? "Connected to charger" : "Not connected to charger");
|
||||||
const char * CHARGE_STATUS[] = { "Not Charging", "Precharge", "Fast Charging", "Charge done" };
|
static const char * const CHARGE_STATUS[] = { "Not Charging", "Precharge", "Fast Charging", "Charge done" };
|
||||||
serialPrint(CHARGE_STATUS[(reg & 0x30) >> 4]);
|
serialPrint(CHARGE_STATUS[(reg & 0x30) >> 4]);
|
||||||
const char * INPUT_STATUS[] = { "Unknown input", "USB host input", "USB adapter port input", "OTG input" };
|
static const char * const INPUT_STATUS[] = { "Unknown input", "USB host input", "USB adapter port input", "OTG input" };
|
||||||
serialPrint(INPUT_STATUS[(reg & 0xC0) >> 6]);
|
serialPrint(INPUT_STATUS[(reg & 0xC0) >> 6]);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -581,7 +581,7 @@ int cliDisplay(const char ** argv)
|
||||||
if (toInt(argv, 2, &timerNumber) > 0) {
|
if (toInt(argv, 2, &timerNumber) > 0) {
|
||||||
TIM_TypeDef * tim = TIM1;
|
TIM_TypeDef * tim = TIM1;
|
||||||
switch (timerNumber) {
|
switch (timerNumber) {
|
||||||
case 1:
|
case 1:
|
||||||
tim = TIM1;
|
tim = TIM1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
#define MAX_SCRIPTS 7
|
#define MAX_SCRIPTS 7
|
||||||
#define MAX_INPUTS 32
|
#define MAX_INPUTS 32
|
||||||
#define NUM_TRAINER 16
|
#define NUM_TRAINER 16
|
||||||
#define NUM_POTS 3
|
#define NUM_POTS 4
|
||||||
#define NUM_XPOTS 0
|
#define NUM_XPOTS 0
|
||||||
#define MAX_SENSORS 32
|
#define MAX_SENSORS 32
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
|
|
|
@ -557,6 +557,7 @@ PACK(struct FrSkyChannelData {
|
||||||
uint8_t multiplier; // 0=no multiplier, 1=*2 multiplier
|
uint8_t multiplier; // 0=no multiplier, 1=*2 multiplier
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO remove this also on Taranis
|
||||||
PACK(struct FrSkyTelemetryData {
|
PACK(struct FrSkyTelemetryData {
|
||||||
uint8_t voltsSource;
|
uint8_t voltsSource;
|
||||||
uint8_t altitudeSource;
|
uint8_t altitudeSource;
|
||||||
|
@ -965,7 +966,7 @@ PACK(struct TrainerData {
|
||||||
#define EXTRA_GENERAL_FIELDS
|
#define EXTRA_GENERAL_FIELDS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(PCBHORUS)
|
||||||
#include "gui/horus/theme.h"
|
#include "gui/horus/theme.h"
|
||||||
#define THEME_DATA \
|
#define THEME_DATA \
|
||||||
NOBACKUP(char themeName[8]); \
|
NOBACKUP(char themeName[8]); \
|
||||||
|
@ -1085,6 +1086,8 @@ static inline void check_struct()
|
||||||
CHKSIZE(ModelData, 6507);
|
CHKSIZE(ModelData, 6507);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#elif defined(PCBFLAMENCO)
|
||||||
|
|
||||||
#elif defined(PCBHORUS)
|
#elif defined(PCBHORUS)
|
||||||
CHKSIZE(MixData, 20);
|
CHKSIZE(MixData, 20);
|
||||||
CHKSIZE(ExpoData, 17);
|
CHKSIZE(ExpoData, 17);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
|
@ -56,6 +56,7 @@ uint8_t serial2TracesEnabled();
|
||||||
|
|
||||||
#define TRACE_PING(...) do { debugPrintf(__VA_ARGS__); } while(0)
|
#define TRACE_PING(...) do { debugPrintf(__VA_ARGS__); } while(0)
|
||||||
#define TRACE(...) do { debugPrintf(__VA_ARGS__); debugPrintf("\r\n"); } while(0)
|
#define TRACE(...) do { debugPrintf(__VA_ARGS__); debugPrintf("\r\n"); } while(0)
|
||||||
|
#define TRACE_WP(...) debugPrintf(__VA_ARGS__)
|
||||||
#define DUMP(data, size) dump(data, size)
|
#define DUMP(data, size) dump(data, size)
|
||||||
#define TRACE_DEBUG(...) debugPrintf("-D- " __VA_ARGS__)
|
#define TRACE_DEBUG(...) debugPrintf("-D- " __VA_ARGS__)
|
||||||
#define TRACE_DEBUG_WP(...) debugPrintf(__VA_ARGS__)
|
#define TRACE_DEBUG_WP(...) debugPrintf(__VA_ARGS__)
|
||||||
|
@ -165,21 +166,21 @@ public:
|
||||||
|
|
||||||
JitterMeter() : min(~(T)0), max(0), measured(0) {};
|
JitterMeter() : min(~(T)0), max(0), measured(0) {};
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
// store mesaurement
|
// store mesaurement
|
||||||
measured = max - min;
|
measured = max - min;
|
||||||
//reset - begin new measurement
|
//reset - begin new measurement
|
||||||
min = ~(T)0;
|
min = ~(T)0;
|
||||||
max = 0;
|
max = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void measure(T value) {
|
void measure(T value) {
|
||||||
if (value > max) max = value;
|
if (value > max) max = value;
|
||||||
if (value < min) min = value;
|
if (value < min) min = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
T get() const {
|
T get() const {
|
||||||
return measured;
|
return measured;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,7 +204,7 @@ enum InterruptNames {
|
||||||
INT_OTG_FS,
|
INT_OTG_FS,
|
||||||
INT_LAST
|
INT_LAST
|
||||||
};
|
};
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
enum InterruptNames {
|
enum InterruptNames {
|
||||||
INT_TICK,
|
INT_TICK,
|
||||||
INT_5MS,
|
INT_5MS,
|
||||||
|
@ -290,7 +291,7 @@ public:
|
||||||
|
|
||||||
debug_timer_t getMin() const { return min; }
|
debug_timer_t getMin() const { return min; }
|
||||||
debug_timer_t getMax() const { return max; }
|
debug_timer_t getMax() const { return max; }
|
||||||
debug_timer_t getLast() const { return last; }
|
debug_timer_t getLast() const { return last; }
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DebugTimers {
|
enum DebugTimers {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
|
@ -26,8 +26,10 @@
|
||||||
extern const uint16_t * const fontspecsTable[16];
|
extern const uint16_t * const fontspecsTable[16];
|
||||||
extern const uint8_t * const fontsTable[16];
|
extern const uint8_t * const fontsTable[16];
|
||||||
|
|
||||||
|
#if defined(PCBHORUS)
|
||||||
extern BitmapBuffer * fontCache[2];
|
extern BitmapBuffer * fontCache[2];
|
||||||
void loadFontCache();
|
void loadFontCache();
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,6 @@ getvalue_t getValue(mixsrc_t i)
|
||||||
else if (i==MIXSRC_SA) return (switchState(SW_SA0) ? -1024 : (switchState(SW_SA1) ? 0 : 1024));
|
else if (i==MIXSRC_SA) return (switchState(SW_SA0) ? -1024 : (switchState(SW_SA1) ? 0 : 1024));
|
||||||
else if (i==MIXSRC_SB) return (switchState(SW_SB0) ? -1024 : 1024);
|
else if (i==MIXSRC_SB) return (switchState(SW_SB0) ? -1024 : 1024);
|
||||||
else if (i==MIXSRC_SC) return (switchState(SW_SC0) ? -1024 : (switchState(SW_SC1) ? 0 : 1024));
|
else if (i==MIXSRC_SC) return (switchState(SW_SC0) ? -1024 : (switchState(SW_SC1) ? 0 : 1024));
|
||||||
// else if (i==MIXSRC_SD) return (switchState(SW_SD0) ? -1024 : 1024);
|
|
||||||
else if (i==MIXSRC_SE) return (switchState(SW_SE0) ? -1024 : 1024);
|
else if (i==MIXSRC_SE) return (switchState(SW_SE0) ? -1024 : 1024);
|
||||||
else if (i==MIXSRC_SF) return (switchState(SW_SF0) ? -1024 : (switchState(SW_SF1) ? 0 : 1024));
|
else if (i==MIXSRC_SF) return (switchState(SW_SF0) ? -1024 : (switchState(SW_SF1) ? 0 : 1024));
|
||||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
|
|
||||||
#define ALTERNATE_VIEW 0x10
|
#define ALTERNATE_VIEW 0x10
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(PCBHORUS)
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "topbar.h"
|
#include "topbar.h"
|
||||||
|
|
|
@ -471,7 +471,7 @@ void modelDefault(uint8_t id)
|
||||||
g_model.header.name[6] = '\033' + id%10;
|
g_model.header.name[6] = '\033' + id%10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(PCBHORUS)
|
||||||
extern const LayoutFactory * defaultLayout;
|
extern const LayoutFactory * defaultLayout;
|
||||||
delete customScreens[0];
|
delete customScreens[0];
|
||||||
customScreens[0] = defaultLayout->create(&g_model.screenData[0].layoutData);
|
customScreens[0] = defaultLayout->create(&g_model.screenData[0].layoutData);
|
||||||
|
@ -1913,6 +1913,8 @@ uint8_t calcStickScroll( uint8_t index )
|
||||||
|
|
||||||
void opentxStart()
|
void opentxStart()
|
||||||
{
|
{
|
||||||
|
TRACE("opentxStart()");
|
||||||
|
|
||||||
#if defined(SIMU)
|
#if defined(SIMU)
|
||||||
if (main_thread_running == 2)
|
if (main_thread_running == 2)
|
||||||
return;
|
return;
|
||||||
|
@ -1950,6 +1952,8 @@ void opentxStart()
|
||||||
#if defined(CPUARM) || defined(CPUM2560)
|
#if defined(CPUARM) || defined(CPUM2560)
|
||||||
void opentxClose()
|
void opentxClose()
|
||||||
{
|
{
|
||||||
|
TRACE("opentxClose()");
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
watchdogSetTimeout(2000/*20s*/);
|
watchdogSetTimeout(2000/*20s*/);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2494,7 +2498,7 @@ void opentxInit(OPENTX_INIT_ARGS)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(PCBHORUS)
|
||||||
topbar = new Topbar(&g_model.topbarData);
|
topbar = new Topbar(&g_model.topbarData);
|
||||||
luaInit();
|
luaInit();
|
||||||
#endif
|
#endif
|
||||||
|
@ -2545,7 +2549,7 @@ void opentxInit(OPENTX_INIT_ARGS)
|
||||||
btInit();
|
btInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(PCBHORUS)
|
||||||
loadTheme();
|
loadTheme();
|
||||||
loadFontCache();
|
loadFontCache();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -272,14 +272,7 @@
|
||||||
#define pgm_read_adr(x) *(x)
|
#define pgm_read_adr(x) *(x)
|
||||||
#define cli()
|
#define cli()
|
||||||
#define sei()
|
#define sei()
|
||||||
extern void boardInit();
|
|
||||||
#if defined(PCBTARANIS) or defined(PCBHORUS)
|
|
||||||
extern void boardOff();
|
|
||||||
#else
|
|
||||||
#define boardOff() pwrOff();
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#define boardOff() pwrOff();
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include "pgmtypes.h"
|
#include "pgmtypes.h"
|
||||||
|
|
|
@ -97,7 +97,7 @@ void postModelLoad(bool newModel)
|
||||||
referenceModelAudioFiles();
|
referenceModelAudioFiles();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(PCBHORUS)
|
||||||
loadCustomScreens();
|
loadCustomScreens();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
|
@ -23,6 +23,8 @@
|
||||||
#define CS_LAST_VALUE_INIT -32768
|
#define CS_LAST_VALUE_INIT -32768
|
||||||
|
|
||||||
#if defined(PCBFLAMENCO)
|
#if defined(PCBFLAMENCO)
|
||||||
|
#define SWITCH_WARNING_LIST_X 60
|
||||||
|
#define SWITCH_WARNING_LIST_Y 4*FH+3
|
||||||
#define SWITCH_WARNING_LIST_INTERVAL 20
|
#define SWITCH_WARNING_LIST_INTERVAL 20
|
||||||
#elif defined(PCBHORUS)
|
#elif defined(PCBHORUS)
|
||||||
#define SWITCH_WARNING_LIST_X WARNING_LINE_X
|
#define SWITCH_WARNING_LIST_X WARNING_LINE_X
|
||||||
|
@ -56,7 +58,7 @@ PACK(typedef struct {
|
||||||
LogicalSwitchesFlightModeContext lswFm[MAX_FLIGHT_MODES];
|
LogicalSwitchesFlightModeContext lswFm[MAX_FLIGHT_MODES];
|
||||||
|
|
||||||
#define LS_LAST_VALUE(fm, idx) lswFm[fm].lsw[idx].lastValue
|
#define LS_LAST_VALUE(fm, idx) lswFm[fm].lsw[idx].lastValue
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int16_t lsLastValue[NUM_LOGICAL_SWITCH];
|
int16_t lsLastValue[NUM_LOGICAL_SWITCH];
|
||||||
|
@ -518,7 +520,7 @@ DurationAndDelayProcessing:
|
||||||
context.timerState = SWITCH_DELAY;
|
context.timerState = SWITCH_DELAY;
|
||||||
context.timer = (ls->func == LS_FUNC_EDGE ? 0 : ls->delay);
|
context.timer = (ls->func == LS_FUNC_EDGE ? 0 : ls->delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.timerState == SWITCH_DELAY) {
|
if (context.timerState == SWITCH_DELAY) {
|
||||||
if (context.timer) {
|
if (context.timer) {
|
||||||
result = false; // return false while delay timer running
|
result = false; // return false while delay timer running
|
||||||
|
@ -529,7 +531,7 @@ DurationAndDelayProcessing:
|
||||||
context.timer = ls->duration;
|
context.timer = ls->duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.timerState == SWITCH_ENABLE) {
|
if (context.timerState == SWITCH_ENABLE) {
|
||||||
result = (ls->duration==0 || context.timer>0); // return false after duration timer runs out
|
result = (ls->duration==0 || context.timer>0); // return false after duration timer runs out
|
||||||
if (!result && ls->func == LS_FUNC_STICKY) {
|
if (!result && ls->func == LS_FUNC_STICKY) {
|
||||||
|
@ -541,7 +543,7 @@ DurationAndDelayProcessing:
|
||||||
else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && context.timer > 0) {
|
else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && context.timer > 0) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
context.timerState = SWITCH_START;
|
context.timerState = SWITCH_START;
|
||||||
context.timer = 0;
|
context.timer = 0;
|
||||||
}
|
}
|
||||||
|
@ -652,8 +654,8 @@ bool getSwitch(swsrc_t swtch)
|
||||||
else {
|
else {
|
||||||
s_last_switch_value &= ~mask;
|
s_last_switch_value &= ~mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return swtch > 0 ? result : !result;
|
return swtch > 0 ? result : !result;
|
||||||
|
@ -732,7 +734,7 @@ swsrc_t getMovedSwitch()
|
||||||
// don't use getSwitch here to always get the proper value, even getSwitch manipulates
|
// don't use getSwitch here to always get the proper value, even getSwitch manipulates
|
||||||
bool next = switchState((EnumKeys)(SW_BASE+i-1));
|
bool next = switchState((EnumKeys)(SW_BASE+i-1));
|
||||||
if (prev != next) {
|
if (prev != next) {
|
||||||
if (((i<NUM_PSWITCH) && (i>3)) || next==true)
|
if (((i<NUM_PSWITCH) && (i>3)) || next==true)
|
||||||
result = next ? i : -i;
|
result = next ? i : -i;
|
||||||
if (i<=3 && result==0) result = 1;
|
if (i<=3 && result==0) result = 1;
|
||||||
switches_states ^= mask;
|
switches_states ^= mask;
|
||||||
|
@ -757,7 +759,7 @@ void checkSwitches()
|
||||||
swarnstate_t last_bad_switches = 0xff;
|
swarnstate_t last_bad_switches = 0xff;
|
||||||
#endif
|
#endif
|
||||||
swarnstate_t states = g_model.switchWarningState;
|
swarnstate_t states = g_model.switchWarningState;
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
|
||||||
uint8_t bad_pots = 0, last_bad_pots = 0xff;
|
uint8_t bad_pots = 0, last_bad_pots = 0xff;
|
||||||
#endif
|
#endif
|
||||||
|
@ -780,7 +782,7 @@ void checkSwitches()
|
||||||
#endif // !defined(MODULE_ALWAYS_SEND_PULSES)
|
#endif // !defined(MODULE_ALWAYS_SEND_PULSES)
|
||||||
|
|
||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
|
|
||||||
bool warn = false;
|
bool warn = false;
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
for (int i=0; i<NUM_SWITCHES; i++) {
|
for (int i=0; i<NUM_SWITCHES; i++) {
|
||||||
|
@ -1031,7 +1033,7 @@ void logicalSwitchesTimerTick()
|
||||||
lastValue.duration = 0;
|
lastValue.duration = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// decrement delay/duration timer
|
// decrement delay/duration timer
|
||||||
LogicalSwitchContext &context = lswFm[fm].lsw[i];
|
LogicalSwitchContext &context = lswFm[fm].lsw[i];
|
||||||
if (context.timer) {
|
if (context.timer) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ void rotencPoll()
|
||||||
#define ROTENC_DOWN() (0)
|
#define ROTENC_DOWN() (0)
|
||||||
#endif // ROTARY_ENCODER_NAVIGATION
|
#endif // ROTARY_ENCODER_NAVIGATION
|
||||||
|
|
||||||
#ifndef SIMU
|
void boardInit()
|
||||||
inline void boardInit()
|
|
||||||
{
|
{
|
||||||
|
#if !defined(SIMU)
|
||||||
// Set up I/O port data directions and initial states
|
// Set up I/O port data directions and initial states
|
||||||
DDRA = 0xff; PORTA = 0x00; // LCD data
|
DDRA = 0xff; PORTA = 0x00; // LCD data
|
||||||
DDRB = 0x81; PORTB = 0x7e; //pullups keys+nc
|
DDRB = 0x81; PORTB = 0x7e; //pullups keys+nc
|
||||||
|
@ -137,8 +137,8 @@ inline void boardInit()
|
||||||
TIMSK |= (1<<OCIE0) | (1<<TOIE0); // Enable Output-Compare and Overflow interrrupts
|
TIMSK |= (1<<OCIE0) | (1<<TOIE0); // Enable Output-Compare and Overflow interrrupts
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !defined(SIMU)
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SIMU
|
#ifndef SIMU
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _BOARD_STOCK_H_
|
#ifndef _BOARD_STOCK_H_
|
||||||
#define _BOARD_STOCK_H_
|
#define _BOARD_STOCK_H_
|
||||||
|
|
||||||
#include "../common_avr/board_avr.h"
|
#include "../common_avr/board_avr.h"
|
||||||
|
|
||||||
|
@ -62,6 +62,10 @@
|
||||||
// - - - O i i i
|
// - - - O i i i
|
||||||
// SIM_CTL ID1 Haptic RF_POW RuddDR
|
// SIM_CTL ID1 Haptic RF_POW RuddDR
|
||||||
|
|
||||||
|
// Board driver
|
||||||
|
void boardInit(void);
|
||||||
|
#define boardOff() pwrOff()
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
#define KEYS_GPIO_REG_MENU pinb
|
#define KEYS_GPIO_REG_MENU pinb
|
||||||
#define KEYS_GPIO_PIN_MENU (1<<1)
|
#define KEYS_GPIO_PIN_MENU (1<<1)
|
||||||
|
@ -234,4 +238,4 @@ void rotencPoll();
|
||||||
#define eepromReadBlock(a, b, c) eeprom_read_block(a, (const void *)b, c)
|
#define eepromReadBlock(a, b, c) eeprom_read_block(a, (const void *)b, c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _BOARD_STOCK_H_
|
#endif // _BOARD_STOCK_H_
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#ifndef SIMU
|
void boardInit()
|
||||||
inline void boardInit()
|
|
||||||
{
|
{
|
||||||
|
#if !defined(SIMU)
|
||||||
// Set up I/O port data directions and initial states
|
// Set up I/O port data directions and initial states
|
||||||
DDRA = 0xff; PORTA = 0x00; // LCD data
|
DDRA = 0xff; PORTA = 0x00; // LCD data
|
||||||
DDRB = 0b11000111; PORTB = 0b00111111; // 7:SPKR, 6:PPM_OUT, 5:TrainSW, 4:IDL2_SW, SDCARD[3:MISO 2:MOSI 1:SCK 0:CS]
|
DDRB = 0b11000111; PORTB = 0b00111111; // 7:SPKR, 6:PPM_OUT, 5:TrainSW, 4:IDL2_SW, SDCARD[3:MISO 2:MOSI 1:SCK 0:CS]
|
||||||
|
@ -88,7 +88,7 @@ inline void boardInit()
|
||||||
#endif
|
#endif
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
#if defined (VOICE)
|
#if defined(VOICE)
|
||||||
/*
|
/*
|
||||||
* SOMO set-up (V4 board only)
|
* SOMO set-up (V4 board only)
|
||||||
*/
|
*/
|
||||||
|
@ -108,10 +108,10 @@ inline void boardInit()
|
||||||
UCSR1B = (1<<RXEN1)|(0<<TXEN1)|(1<<UCSZ12);
|
UCSR1B = (1<<RXEN1)|(0<<TXEN1)|(1<<UCSZ12);
|
||||||
UCSR1B |= 1 << RXCIE1; //enable interrupt on rx
|
UCSR1B |= 1 << RXCIE1; //enable interrupt on rx
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !defined(SIMU)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ROTARY_ENCODERS > 2
|
#if ROTARY_ENCODERS > 2
|
||||||
|
|
||||||
uint8_t vpotToChange = 0;
|
uint8_t vpotToChange = 0;
|
||||||
uint8_t vpot_mod_state = 0;
|
uint8_t vpot_mod_state = 0;
|
||||||
|
|
||||||
|
@ -146,7 +146,6 @@ ISR(USART1_RX_vect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif // !SIMU
|
|
||||||
|
|
||||||
uint8_t pwrCheck()
|
uint8_t pwrCheck()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,28 +1,32 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _BOARD_GRUVIN9X_H_
|
#ifndef _BOARD_GRUVIN9X_H_
|
||||||
#define _BOARD_GRUVIN9X_H_
|
#define _BOARD_GRUVIN9X_H_
|
||||||
|
|
||||||
#include "../common_avr/board_avr.h"
|
#include "../common_avr/board_avr.h"
|
||||||
|
|
||||||
|
// Board driver
|
||||||
|
void boardInit(void);
|
||||||
|
#define boardOff() pwrOff()
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
#define KEYS_GPIO_REG_MENU pinl
|
#define KEYS_GPIO_REG_MENU pinl
|
||||||
#define KEYS_GPIO_PIN_MENU (1<<4)
|
#define KEYS_GPIO_PIN_MENU (1<<4)
|
||||||
|
@ -166,4 +170,4 @@ void pwrOff();
|
||||||
#define eepromReadBlock(a, b, c) eeprom_read_block(a, (const void *)b, c)
|
#define eepromReadBlock(a, b, c) eeprom_read_block(a, (const void *)b, c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _BOARD_GRUVIN9X_H_
|
#endif // _BOARD_GRUVIN9X_H_
|
||||||
|
|
|
@ -108,7 +108,7 @@ void adcInit()
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
GPIO_InitStructure.GPIO_Pin = ADC_GPIO_PIN_MOUSE1 | ADC_GPIO_PIN_MOUSE2;
|
GPIO_InitStructure.GPIO_Pin = ADC_GPIO_PIN_MOUSE1 | ADC_GPIO_PIN_MOUSE2;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||||
GPIO_Init(ADC_GPIO_MOUSE, &GPIO_InitStructure);
|
GPIO_Init(ADC_GPIO_MOUSE, &GPIO_InitStructure);
|
||||||
|
|
|
@ -101,7 +101,6 @@ void interrupt1ms()
|
||||||
DEBUG_TIMER_STOP(debugTimerRotEnc);
|
DEBUG_TIMER_STOP(debugTimerRotEnc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(SIMU)
|
|
||||||
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
|
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
|
||||||
{
|
{
|
||||||
TIM14->SR &= ~TIM_SR_UIF;
|
TIM14->SR &= ~TIM_SR_UIF;
|
||||||
|
@ -111,6 +110,7 @@ extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
|
||||||
|
|
||||||
void boardInit()
|
void boardInit()
|
||||||
{
|
{
|
||||||
|
#if !defined(SIMU)
|
||||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph |
|
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph |
|
||||||
LED_RCC_AHB1Periph |
|
LED_RCC_AHB1Periph |
|
||||||
LCD_RCC_AHB1Periph |
|
LCD_RCC_AHB1Periph |
|
||||||
|
@ -167,6 +167,7 @@ void boardInit()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ledBlue();
|
ledBlue();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void boardOff()
|
void boardOff()
|
||||||
|
@ -181,8 +182,6 @@ void boardOff()
|
||||||
pwrOff();
|
pwrOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #if !defined(SIMU)
|
|
||||||
|
|
||||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||||
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||||
|
|
||||||
|
@ -217,7 +216,7 @@ void usbJoystickUpdate(void)
|
||||||
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET);
|
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //#if defined(USB_JOYSTICK) && defined(PCBTARANIS) && !defined(SIMU)
|
#endif // #defined(USB_JOYSTICK) && !defined(SIMU)
|
||||||
|
|
||||||
|
|
||||||
uint8_t currentTrainerMode = 0xff;
|
uint8_t currentTrainerMode = 0xff;
|
||||||
|
|
|
@ -79,11 +79,17 @@ extern uint16_t sessionTimer;
|
||||||
#define SLAVE_MODE() (g_model.trainerMode == TRAINER_MODE_SLAVE)
|
#define SLAVE_MODE() (g_model.trainerMode == TRAINER_MODE_SLAVE)
|
||||||
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_GPIO_DETECT, TRAINER_GPIO_PIN_DETECT) == Bit_RESET)
|
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_GPIO_DETECT, TRAINER_GPIO_PIN_DETECT) == Bit_RESET)
|
||||||
|
|
||||||
|
// Board driver
|
||||||
|
void boardInit(void);
|
||||||
|
void boardOff(void);
|
||||||
|
|
||||||
|
// Delays driver
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void delaysInit(void);
|
void delaysInit(void);
|
||||||
void delay_01us(uint16_t nb);
|
void delay_01us(uint16_t nb);
|
||||||
|
void delay_us(uint16_t nb);
|
||||||
void delay_ms(uint32_t ms);
|
void delay_ms(uint32_t ms);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -169,14 +175,9 @@ extern uint32_t rotencSpeed;
|
||||||
void checkRotaryEncoder(void);
|
void checkRotaryEncoder(void);
|
||||||
|
|
||||||
// WDT driver
|
// WDT driver
|
||||||
#if defined(SIMU)
|
|
||||||
#define WAS_RESET_BY_WATCHDOG() (false)
|
|
||||||
#define WAS_RESET_BY_SOFTWARE() (false)
|
|
||||||
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (false)
|
|
||||||
#else
|
|
||||||
#define wdt_disable()
|
#define wdt_disable()
|
||||||
void watchdogInit(unsigned int duration);
|
void watchdogInit(unsigned int duration);
|
||||||
#if defined(WATCHDOG_DISABLED)
|
#if defined(WATCHDOG_DISABLED) || defined(SIMU)
|
||||||
#define wdt_enable(x)
|
#define wdt_enable(x)
|
||||||
#define wdt_reset()
|
#define wdt_reset()
|
||||||
#else
|
#else
|
||||||
|
@ -186,7 +187,6 @@ void watchdogInit(unsigned int duration);
|
||||||
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
|
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
|
||||||
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
|
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
|
||||||
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF))
|
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF))
|
||||||
#endif
|
|
||||||
|
|
||||||
// ADC driver
|
// ADC driver
|
||||||
enum Analogs {
|
enum Analogs {
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "usb_bsp.h"
|
#include "usb_bsp.h"
|
||||||
|
|
||||||
#include "board_horus.h"
|
#include "board_horus.h"
|
||||||
#include "usbd_conf.h"
|
#include "usbd_conf.h"
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "usbd_desc.h"
|
#include "usbd_desc.h"
|
||||||
|
|
||||||
|
@ -58,12 +58,7 @@
|
||||||
#define USBD_SERIALNUMBER_FS_STRING "00000000001B"
|
#define USBD_SERIALNUMBER_FS_STRING "00000000001B"
|
||||||
|
|
||||||
|
|
||||||
#if defined(BOOT)
|
#if defined(USB_JOYSTICK)
|
||||||
#define USBD_PID 0x5720
|
|
||||||
#define USBD_PRODUCT_FS_STRING "FrSky Horus Bootloader"
|
|
||||||
#define USBD_CONFIGURATION_FS_STRING "MSC Config"
|
|
||||||
#define USBD_INTERFACE_FS_STRING "MSC Interface"
|
|
||||||
#elif defined(USB_JOYSTICK)
|
|
||||||
#define USBD_PID 0x5710
|
#define USBD_PID 0x5710
|
||||||
#define USBD_PRODUCT_FS_STRING "FrSky Horus Joystick"
|
#define USBD_PRODUCT_FS_STRING "FrSky Horus Joystick"
|
||||||
#define USBD_CONFIGURATION_FS_STRING "HID Config"
|
#define USBD_CONFIGURATION_FS_STRING "HID Config"
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#ifndef SIMU
|
void boardInit()
|
||||||
inline void boardInit()
|
|
||||||
{
|
{
|
||||||
|
#if !defined(SIMU)
|
||||||
// Set up I/O port data directions and initial states (unused pin setting : input, pull-up on)
|
// Set up I/O port data directions and initial states (unused pin setting : input, pull-up on)
|
||||||
DDRA = 0b11111111; PORTA = 0b00000000; // LCD data
|
DDRA = 0b11111111; PORTA = 0b00000000; // LCD data
|
||||||
DDRB = 0b01110111; PORTB = 0b00101111; // 7:WTV20SDBusy, 6:PPM_OUT, 5:SimCTRL, 4:Buzzer, SDCARD[3:MISO 2:MOSI 1:SCK 0:CS]
|
DDRB = 0b01110111; PORTB = 0b00101111; // 7:WTV20SDBusy, 6:PPM_OUT, 5:SimCTRL, 4:Buzzer, SDCARD[3:MISO 2:MOSI 1:SCK 0:CS]
|
||||||
|
@ -72,8 +72,8 @@ inline void boardInit()
|
||||||
EICRA = (1<<ISC30) | (1<<ISC20);
|
EICRA = (1<<ISC30) | (1<<ISC20);
|
||||||
EIFR = (3<<INTF2);
|
EIFR = (3<<INTF2);
|
||||||
EIMSK = (3<<INT4) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
|
EIMSK = (3<<INT4) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
|
||||||
}
|
#endif // !defined(SIMU)
|
||||||
#endif // !SIMU
|
}
|
||||||
|
|
||||||
uint8_t pwrCheck()
|
uint8_t pwrCheck()
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,10 +23,13 @@
|
||||||
|
|
||||||
#include "../common_avr/board_avr.h"
|
#include "../common_avr/board_avr.h"
|
||||||
|
|
||||||
|
|
||||||
//Mods for futur use ? Beta tester love it
|
//Mods for futur use ? Beta tester love it
|
||||||
//#define ROTENC_DIV2 // rotenc resolution/2
|
//#define ROTENC_DIV2 // rotenc resolution/2
|
||||||
|
|
||||||
|
// Board driver
|
||||||
|
void boardInit(void);
|
||||||
|
#define boardOff() pwrOff()
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
#define KEYS_GPIO_REG_MENU pinl
|
#define KEYS_GPIO_REG_MENU pinl
|
||||||
#define KEYS_GPIO_PIN_MENU (1<<4)
|
#define KEYS_GPIO_PIN_MENU (1<<4)
|
||||||
|
|
|
@ -120,6 +120,10 @@ uint16_t getTmr2MHz()
|
||||||
|
|
||||||
void simuInit()
|
void simuInit()
|
||||||
{
|
{
|
||||||
|
#if defined(CPUSTM32)
|
||||||
|
RCC->CSR = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i <= 17; i++) {
|
for (int i = 0; i <= 17; i++) {
|
||||||
simuSetSwitch(i, 0);
|
simuSetSwitch(i, 0);
|
||||||
simuSetKey(i, false); // a little dirty, but setting keys that don't exist is perfectly OK here
|
simuSetKey(i, false); // a little dirty, but setting keys that don't exist is perfectly OK here
|
||||||
|
@ -1361,8 +1365,8 @@ void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct) { }
|
||||||
void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState) { }
|
void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState) { }
|
||||||
void USART_DMACmd(USART_TypeDef* USARTx, uint16_t USART_DMAReq, FunctionalState NewState) { }
|
void USART_DMACmd(USART_TypeDef* USARTx, uint16_t USART_DMAReq, FunctionalState NewState) { }
|
||||||
void USART_ITConfig(USART_TypeDef* USARTx, uint16_t USART_IT, FunctionalState NewState) { }
|
void USART_ITConfig(USART_TypeDef* USARTx, uint16_t USART_IT, FunctionalState NewState) { }
|
||||||
void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct) { }
|
// void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct) { }
|
||||||
void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) { }
|
// void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) { }
|
||||||
void TIM_DMAConfig(TIM_TypeDef* TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength) { }
|
void TIM_DMAConfig(TIM_TypeDef* TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength) { }
|
||||||
void TIM_DMACmd(TIM_TypeDef* TIMx, uint16_t TIM_DMASource, FunctionalState NewState) { }
|
void TIM_DMACmd(TIM_TypeDef* TIMx, uint16_t TIM_DMASource, FunctionalState NewState) { }
|
||||||
void TIM_CtrlPWMOutputs(TIM_TypeDef* TIMx, FunctionalState NewState) { }
|
void TIM_CtrlPWMOutputs(TIM_TypeDef* TIMx, FunctionalState NewState) { }
|
||||||
|
|
|
@ -396,11 +396,11 @@ extern uint8_t eeprom[];
|
||||||
extern const char * eepromFile;
|
extern const char * eepromFile;
|
||||||
void eepromReadBlock (uint8_t * pointer_ram, uint32_t address, uint32_t size);
|
void eepromReadBlock (uint8_t * pointer_ram, uint32_t address, uint32_t size);
|
||||||
|
|
||||||
|
#if !defined(CPUARM)
|
||||||
#define wdt_disable(...) sleep(1/*ms*/)
|
#define wdt_disable(...) sleep(1/*ms*/)
|
||||||
#define wdt_enable(...) sleep(1/*ms*/)
|
#define wdt_enable(...) sleep(1/*ms*/)
|
||||||
#define wdt_reset() sleep(1/*ms*/)
|
#define wdt_reset() sleep(1/*ms*/)
|
||||||
#define boardInit()
|
#endif
|
||||||
#define boardOff()
|
|
||||||
|
|
||||||
#define OS_MutexID pthread_mutex_t
|
#define OS_MutexID pthread_mutex_t
|
||||||
extern OS_MutexID audioMutex;
|
extern OS_MutexID audioMutex;
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
#ifdef AR9X
|
|
||||||
|
#if defined(AR9X)
|
||||||
#include "i2c_driver.h"
|
#include "i2c_driver.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -370,7 +371,7 @@ void opentxBootloader();
|
||||||
|
|
||||||
// Set up for volume control (TWI0)
|
// Set up for volume control (TWI0)
|
||||||
// Need PA3 and PA4 set to peripheral A
|
// Need PA3 and PA4 set to peripheral A
|
||||||
#ifndef AR9X
|
#if !defined(AR9X)
|
||||||
void i2cInit()
|
void i2cInit()
|
||||||
{
|
{
|
||||||
register Pio *pioptr;
|
register Pio *pioptr;
|
||||||
|
@ -489,6 +490,10 @@ void boardInit()
|
||||||
|
|
||||||
init_SDcard();
|
init_SDcard();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void boardInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t temperature = 0; // Raw temp reading
|
uint8_t temperature = 0; // Raw temp reading
|
||||||
|
|
|
@ -31,6 +31,11 @@ extern uint16_t ResetReason;
|
||||||
#define FIRMWARE_SIZE (256*1024)
|
#define FIRMWARE_SIZE (256*1024)
|
||||||
#define FIRMWARE_ADDRESS 0x00400000
|
#define FIRMWARE_ADDRESS 0x00400000
|
||||||
|
|
||||||
|
// Board driver
|
||||||
|
void boardInit(void);
|
||||||
|
#define boardOff() pwrOff()
|
||||||
|
|
||||||
|
// Keys
|
||||||
#if defined(REVA)
|
#if defined(REVA)
|
||||||
#define KEYS_GPIO_REG_MENU PIOB->PIO_PDSR
|
#define KEYS_GPIO_REG_MENU PIOB->PIO_PDSR
|
||||||
#define KEYS_GPIO_REG_EXIT PIOA->PIO_PDSR
|
#define KEYS_GPIO_REG_EXIT PIOA->PIO_PDSR
|
||||||
|
@ -197,7 +202,11 @@ void disable_dsm2(uint32_t port);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// WDT driver
|
// WDT driver
|
||||||
#if !defined(SIMU)
|
#if defined(SIMU)
|
||||||
|
#define wdt_disable()
|
||||||
|
#define wdt_enable(x)
|
||||||
|
#define wdt_reset()
|
||||||
|
#else
|
||||||
#define wdt_disable()
|
#define wdt_disable()
|
||||||
#define wdt_enable(x) WDT->WDT_MR = 0x3FFF207F
|
#define wdt_enable(x) WDT->WDT_MR = 0x3FFF207F
|
||||||
#define wdt_reset() WDT->WDT_CR = 0xA5000001
|
#define wdt_reset() WDT->WDT_CR = 0xA5000001
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(SIMU)
|
#if defined(__cplusplus) && !defined(SIMU)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -110,22 +110,24 @@ extern "C" void INTERRUPT_5MS_IRQHandler()
|
||||||
interrupt5ms() ;
|
interrupt5ms() ;
|
||||||
DEBUG_INTERRUPT(INT_5MS);
|
DEBUG_INTERRUPT(INT_5MS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
#define PWR_PRESS_DURATION_MIN 200 // 2s
|
#define PWR_PRESS_DURATION_MIN 200 // 2s
|
||||||
#define PWR_PRESS_DURATION_MAX 500 // 5s
|
#define PWR_PRESS_DURATION_MAX 500 // 5s
|
||||||
|
|
||||||
const pm_uchar bmp_startup[] PROGMEM = {
|
const pm_uchar bmp_startup[] PROGMEM = {
|
||||||
#include "../../bitmaps/taranis/startup.lbm"
|
#include "../../bitmaps/taranis/startup.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
const pm_uchar bmp_lock[] PROGMEM = {
|
const pm_uchar bmp_lock[] PROGMEM = {
|
||||||
#include "../../bitmaps/taranis/lock.lbm"
|
#include "../../bitmaps/taranis/lock.lbm"
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void boardInit()
|
void boardInit()
|
||||||
{
|
{
|
||||||
|
#if !defined(SIMU)
|
||||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | KEYS_RCC_AHB1Periph | LCD_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph | ADC_RCC_AHB1Periph | I2C_RCC_AHB1Periph | SD_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph | INTMODULE_RCC_AHB1Periph | EXTMODULE_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TRAINER_RCC_AHB1Periph | HEARTBEAT_RCC_AHB1Periph, ENABLE);
|
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | KEYS_RCC_AHB1Periph | LCD_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph | ADC_RCC_AHB1Periph | I2C_RCC_AHB1Periph | SD_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph | INTMODULE_RCC_AHB1Periph | EXTMODULE_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TRAINER_RCC_AHB1Periph | HEARTBEAT_RCC_AHB1Periph, ENABLE);
|
||||||
RCC_APB1PeriphClockCmd(LCD_RCC_APB1Periph | AUDIO_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph | INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SD_RCC_APB1Periph | TRAINER_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph | SERIAL_RCC_APB1Periph, ENABLE);
|
RCC_APB1PeriphClockCmd(LCD_RCC_APB1Periph | AUDIO_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph | INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SD_RCC_APB1Periph | TRAINER_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph | SERIAL_RCC_APB1Periph, ENABLE);
|
||||||
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE);
|
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE);
|
||||||
|
@ -202,6 +204,7 @@ void boardInit()
|
||||||
#else
|
#else
|
||||||
backlightInit();
|
backlightInit();
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !defined(SIMU)
|
||||||
}
|
}
|
||||||
|
|
||||||
void boardOff()
|
void boardOff()
|
||||||
|
@ -222,9 +225,6 @@ void boardOff()
|
||||||
pwrOff();
|
pwrOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #if !defined(SIMU)
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||||
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||||
|
|
||||||
|
|
|
@ -136,11 +136,17 @@ extern uint16_t sessionTimer;
|
||||||
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_GPIO_DETECT, TRAINER_GPIO_PIN_DETECT) == Bit_RESET)
|
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_GPIO_DETECT, TRAINER_GPIO_PIN_DETECT) == Bit_RESET)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Board driver
|
||||||
|
void boardInit(void);
|
||||||
|
void boardOff(void);
|
||||||
|
|
||||||
|
// Delays driver
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void delaysInit(void);
|
void delaysInit(void);
|
||||||
void delay_01us(uint16_t nb);
|
void delay_01us(uint16_t nb);
|
||||||
|
void delay_us(uint16_t nb);
|
||||||
void delay_ms(uint32_t ms);
|
void delay_ms(uint32_t ms);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -227,8 +233,7 @@ void checkRotaryEncoder(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// WDT driver
|
// WDT driver
|
||||||
#if !defined(SIMU)
|
#if defined(WATCHDOG_DISABLED) || defined(SIMU)
|
||||||
#if defined(WATCHDOG_DISABLED)
|
|
||||||
#define wdt_enable(x)
|
#define wdt_enable(x)
|
||||||
#define wdt_reset()
|
#define wdt_reset()
|
||||||
#else
|
#else
|
||||||
|
@ -240,7 +245,6 @@ void watchdogInit(unsigned int duration);
|
||||||
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
|
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
|
||||||
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
|
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
|
||||||
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF))
|
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF))
|
||||||
#endif
|
|
||||||
|
|
||||||
// ADC driver
|
// ADC driver
|
||||||
enum Analogs {
|
enum Analogs {
|
||||||
|
|
|
@ -136,17 +136,26 @@ extern uint8_t telemetryProtocol;
|
||||||
#define IS_FRSKY_SPORT_PROTOCOL() (false)
|
#define IS_FRSKY_SPORT_PROTOCOL() (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUSTM32)
|
#if defined(PCBFLAMENCO)
|
||||||
|
inline uint8_t modelTelemetryProtocol()
|
||||||
|
{
|
||||||
|
return g_model.telemetryProtocol;
|
||||||
|
}
|
||||||
|
#elif defined(CPUSTM32)
|
||||||
inline uint8_t modelTelemetryProtocol()
|
inline uint8_t modelTelemetryProtocol()
|
||||||
{
|
{
|
||||||
#if defined(CROSSFIRE)
|
#if defined(CROSSFIRE)
|
||||||
if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_CROSSFIRE)
|
if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_CROSSFIRE) {
|
||||||
return PROTOCOL_PULSES_CROSSFIRE;
|
return PROTOCOL_PULSES_CROSSFIRE;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) {
|
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) {
|
||||||
return g_model.telemetryProtocol;
|
return g_model.telemetryProtocol;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
} else if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE) {
|
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE) {
|
||||||
if (g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol == MM_RF_PROTO_DSM2)
|
if (g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol == MM_RF_PROTO_DSM2)
|
||||||
return PROTOCOL_SPEKTRUM;
|
return PROTOCOL_SPEKTRUM;
|
||||||
else if ((g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol == MM_RF_PROTO_FRSKY) && (g_model.moduleData[EXTERNAL_MODULE].subType == 1))
|
else if ((g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol == MM_RF_PROTO_FRSKY) && (g_model.moduleData[EXTERNAL_MODULE].subType == 1))
|
||||||
|
@ -154,10 +163,11 @@ inline uint8_t modelTelemetryProtocol()
|
||||||
return PROTOCOL_FRSKY_D;
|
return PROTOCOL_FRSKY_D;
|
||||||
else
|
else
|
||||||
return PROTOCOL_FRSKY_SPORT;
|
return PROTOCOL_FRSKY_SPORT;
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
return PROTOCOL_FRSKY_SPORT;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// default choice
|
||||||
|
return PROTOCOL_FRSKY_SPORT;
|
||||||
}
|
}
|
||||||
#define MODEL_TELEMETRY_PROTOCOL() modelTelemetryProtocol()
|
#define MODEL_TELEMETRY_PROTOCOL() modelTelemetryProtocol()
|
||||||
#elif defined(CPUARM)
|
#elif defined(CPUARM)
|
||||||
|
|
|
@ -842,7 +842,7 @@ extern const pm_char STR_BLCOLOR[];
|
||||||
#define STR_EXPONAME STR_NAME
|
#define STR_EXPONAME STR_NAME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBHORUS)
|
#if defined(COLORLCD)
|
||||||
#define TR_PHASES_HEADERS { TR_PHASES_HEADERS_NAME, TR_PHASES_HEADERS_SW, TR_PHASES_HEADERS_RUD_TRIM, TR_PHASES_HEADERS_ELE_TRIM, TR_PHASES_HEADERS_THT_TRIM, TR_PHASES_HEADERS_AIL_TRIM, TR_PHASES_HEADERS_CH5_TRIM, TR_PHASES_HEADERS_CH6_TRIM, TR_PHASES_HEADERS_FAD_IN, TR_PHASES_HEADERS_FAD_OUT }
|
#define TR_PHASES_HEADERS { TR_PHASES_HEADERS_NAME, TR_PHASES_HEADERS_SW, TR_PHASES_HEADERS_RUD_TRIM, TR_PHASES_HEADERS_ELE_TRIM, TR_PHASES_HEADERS_THT_TRIM, TR_PHASES_HEADERS_AIL_TRIM, TR_PHASES_HEADERS_CH5_TRIM, TR_PHASES_HEADERS_CH6_TRIM, TR_PHASES_HEADERS_FAD_IN, TR_PHASES_HEADERS_FAD_OUT }
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
#define TR_PHASES_HEADERS { HINT(TR_PHASES_HEADERS_NAME), HINT(TR_PHASES_HEADERS_SW), HINT(TR_PHASES_HEADERS_RUD_TRIM), HINT(TR_PHASES_HEADERS_ELE_TRIM), HINT(TR_PHASES_HEADERS_THT_TRIM), HINT(TR_PHASES_HEADERS_AIL_TRIM), HINT(TR_PHASES_HEADERS_FAD_IN), HINT(TR_PHASES_HEADERS_FAD_OUT) }
|
#define TR_PHASES_HEADERS { HINT(TR_PHASES_HEADERS_NAME), HINT(TR_PHASES_HEADERS_SW), HINT(TR_PHASES_HEADERS_RUD_TRIM), HINT(TR_PHASES_HEADERS_ELE_TRIM), HINT(TR_PHASES_HEADERS_THT_TRIM), HINT(TR_PHASES_HEADERS_AIL_TRIM), HINT(TR_PHASES_HEADERS_FAD_IN), HINT(TR_PHASES_HEADERS_FAD_OUT) }
|
||||||
|
|
|
@ -32,11 +32,11 @@ def createFontBitmap(filename, fontname, fontsize, fontbold, foreground, backgro
|
||||||
extraFilename = "fonts/extra_%dpx.png" % fontsize
|
extraFilename = "fonts/extra_%dpx.png" % fontsize
|
||||||
extraImage = QtGui.QImage(extraFilename)
|
extraImage = QtGui.QImage(extraFilename)
|
||||||
if extraImage.isNull():
|
if extraImage.isNull():
|
||||||
print("No extra font file", extraFilename)
|
# print("No extra font file", extraFilename)
|
||||||
extraImage = None
|
extraImage = None
|
||||||
extraWidth = 0
|
extraWidth, extraHeight = 0, 0
|
||||||
else:
|
else:
|
||||||
extraWidth = extraImage.size().width() / COUNT_EXTRA_CHARS
|
extraWidth, extraHeight = extraImage.size().width() / COUNT_EXTRA_CHARS, extraImage.size().height()
|
||||||
|
|
||||||
def getCharWidth(c):
|
def getCharWidth(c):
|
||||||
if c in chars_extra:
|
if c in chars_extra:
|
||||||
|
@ -78,9 +78,14 @@ def createFontBitmap(filename, fontname, fontsize, fontbold, foreground, backgro
|
||||||
width = 0
|
width = 0
|
||||||
for c in chars:
|
for c in chars:
|
||||||
coords.append(width)
|
coords.append(width)
|
||||||
|
painter.setOpacity(1.0)
|
||||||
if c in chars_extra:
|
if c in chars_extra:
|
||||||
if extraImage and c == chars_extra[0]:
|
if extraImage and c == chars_extra[0]:
|
||||||
painter.drawImage(QtCore.QPoint(width, 0), extraImage)
|
for x in range(extraWidth * COUNT_EXTRA_CHARS):
|
||||||
|
for y in range(extraHeight):
|
||||||
|
rgb = extraImage.pixel(x, y)
|
||||||
|
painter.setOpacity(1.0 - float(QtGui.qGray(rgb)) / 256)
|
||||||
|
painter.drawPoint(x+width, y)
|
||||||
elif c == " ":
|
elif c == " ":
|
||||||
pass
|
pass
|
||||||
elif c == "." and fontsize <= 8:
|
elif c == "." and fontsize <= 8:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue