1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

Compilation fixes

This commit is contained in:
Bertrand Songis 2019-03-20 16:32:58 +01:00
parent 683a737c99
commit 04ba9e5c68
32 changed files with 110 additions and 71 deletions

View file

@ -190,7 +190,7 @@ enum BeeperMode {
enum ModuleIndex { enum ModuleIndex {
INTERNAL_MODULE, INTERNAL_MODULE,
EXTERNAL_MODULE, EXTERNAL_MODULE,
FLASHING_MODULE, SPORT_MODULE,
}; };
enum TrainerMode { enum TrainerMode {
TRAINER_MODE_MASTER_TRAINER_JACK, TRAINER_MODE_MASTER_TRAINER_JACK,
@ -208,7 +208,8 @@ enum BeeperMode {
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
enum ModuleIndex { enum ModuleIndex {
EXTERNAL_MODULE, EXTERNAL_MODULE,
EXTRA_MODULE EXTRA_MODULE,
SPORT_MODULE
}; };
#endif #endif

View file

@ -944,8 +944,8 @@ static inline void check_struct()
CHKSIZE(RadioData, 880); CHKSIZE(RadioData, 880);
CHKSIZE(ModelData, 6422); CHKSIZE(ModelData, 6422);
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
CHKSIZE(RadioData, 727); CHKSIZE(RadioData, 735);
CHKSIZE(ModelData, 5188); CHKSIZE(ModelData, 5101);
#elif defined(PCBHORUS) #elif defined(PCBHORUS)
CHKSIZE(RadioData, 855); CHKSIZE(RadioData, 855);
CHKSIZE(ModelData, 9771); CHKSIZE(ModelData, 9771);

View file

@ -1181,7 +1181,7 @@ void menuModelSetup(event_t event)
CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsStart, 32-8-moduleData.channelsCount); CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsStart, 32-8-moduleData.channelsCount);
break; break;
case 1: case 1:
CHECK_INCDEC_MODELVAR_CHECK(event, moduleData.channelsCount, -4, min<int8_t>(maxModuleChannels_M8(moduleIdx), 32-8-moduleData.channelsStart), isInternalModuleChannelCountAvailable); CHECK_INCDEC_MODELVAR_CHECK(event, moduleData.channelsCount, -4, min<int8_t>(maxModuleChannels_M8(moduleIdx), 32-8-moduleData.channelsStart), moduleData.type == MODULE_TYPE_XJT2 ? isPXX2ChannelsCountAllowed : nullptr);
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM)) { if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM)) {
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx); SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
} }

View file

@ -152,7 +152,7 @@ void onSdManagerMenu(const char * result)
} }
else if (result == STR_FLASH_EXTERNAL_DEVICE) { else if (result == STR_FLASH_EXTERNAL_DEVICE) {
getSelectionFullPath(lfn); getSelectionFullPath(lfn);
DeviceFirmwareUpdate device(FLASHING_MODULE); DeviceFirmwareUpdate device(SPORT_MODULE);
device.flashFile(lfn); device.flashFile(lfn);
} }
#if defined(LUA) #if defined(LUA)

View file

@ -29,7 +29,14 @@ if(SDCARD)
${GUI_SRC} ${GUI_SRC}
../common/stdlcd/radio_sdmanager.cpp ../common/stdlcd/radio_sdmanager.cpp
../common/stdlcd/radio_tools.cpp ../common/stdlcd/radio_tools.cpp
)
endif()
if(PXX2)
set(GUI_SRC
${GUI_SRC}
../common/stdlcd/radio_spectrum_analyser.cpp ../common/stdlcd/radio_spectrum_analyser.cpp
../common/stdlcd/radio_power_meter.cpp ../common/stdlcd/radio_power_meter.cpp
) )
endif() endif()

View file

@ -153,7 +153,7 @@ void onSdManagerMenu(const char * result)
} }
else if (result == STR_FLASH_EXTERNAL_DEVICE) { else if (result == STR_FLASH_EXTERNAL_DEVICE) {
getSelectionFullPath(lfn); getSelectionFullPath(lfn);
DeviceFirmwareUpdate device(FLASHING_MODULE); DeviceFirmwareUpdate device(SPORT_MODULE);
device.flashFile(lfn); device.flashFile(lfn);
} }
#endif #endif

View file

@ -37,6 +37,8 @@ void menuRadioTools(event_t event)
{ {
SIMPLE_MENU("TOOLS", menuTabGeneral, MENU_RADIO_TOOLS, HEADER_LINE + 2); SIMPLE_MENU("TOOLS", menuTabGeneral, MENU_RADIO_TOOLS, HEADER_LINE + 2);
#if defined(PXX2)
addRadioTool(0, "Spectrum Analyser", menuRadioSpectrumAnalyser, event); addRadioTool(0, "Spectrum Analyser", menuRadioSpectrumAnalyser, event);
addRadioTool(1, "Power Meter", menuRadioPowerMeter, event); addRadioTool(1, "Power Meter", menuRadioPowerMeter, event);
#endif
} }

View file

@ -56,7 +56,7 @@ bool isSwitchAvailableInTimers(int swtch);
bool isR9MModeAvailable(int mode); bool isR9MModeAvailable(int mode);
bool isR9ModuleRunning(int module); bool isR9ModuleRunning(int module);
bool isR9MMFlex(int module); bool isR9MMFlex(int module);
bool isInternalModuleChannelCountAvailable(int module); bool isPXX2ChannelsCountAllowed(int channels);
bool isExternalModuleAvailable(int module); bool isExternalModuleAvailable(int module);
bool isInternalModuleAvailable(int module); bool isInternalModuleAvailable(int module);
bool isRfProtocolAvailable(int protocol); bool isRfProtocolAvailable(int protocol);

View file

@ -515,14 +515,9 @@ bool isR9MMFlex(int module)
return g_model.moduleData[module].r9m.region == MODULE_R9M_REGION_FLEX; return g_model.moduleData[module].r9m.region == MODULE_R9M_REGION_FLEX;
} }
bool isInternalModuleChannelCountAvailable(int channels) bool isPXX2ChannelsCountAllowed(int channels)
{ {
if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT2) { return (channels % 8 == 0);
if ( channels % 8 != 0)
return false;
}
return true;
} }
bool isInternalModuleAvailable(int module) bool isInternalModuleAvailable(int module)

View file

@ -71,8 +71,8 @@ void DeviceFirmwareUpdate::processFrame(const uint8_t * frame)
void DeviceFirmwareUpdate::startup() void DeviceFirmwareUpdate::startup()
{ {
switch(module) { switch(module) {
case INTERNAL_MODULE:
#if defined(INTMODULE_USART) #if defined(INTMODULE_USART)
case INTERNAL_MODULE:
intmoduleSerialStart(57600, true); intmoduleSerialStart(57600, true);
break; break;
#endif #endif
@ -138,8 +138,8 @@ const uint8_t * DeviceFirmwareUpdate::readHalfDuplexFrame(uint32_t timeout)
const uint8_t * DeviceFirmwareUpdate::readFrame(uint32_t timeout) const uint8_t * DeviceFirmwareUpdate::readFrame(uint32_t timeout)
{ {
switch(module) { switch(module) {
case INTERNAL_MODULE:
#if defined(INTMODULE_USART) #if defined(INTMODULE_USART)
case INTERNAL_MODULE:
return readFullDuplexFrame(intmoduleFifo, timeout); return readFullDuplexFrame(intmoduleFifo, timeout);
#endif #endif
@ -177,7 +177,7 @@ void DeviceFirmwareUpdate::startFrame(uint8_t command)
// TODO merge this function // TODO merge this function
void DeviceFirmwareUpdate::sendFrame() void DeviceFirmwareUpdate::sendFrame()
{ {
uint8_t * ptr = outputTelemetryBuffer; uint8_t * ptr = outputTelemetryBuffer.data;
*ptr++ = 0x7E; *ptr++ = 0x7E;
*ptr++ = 0xFF; *ptr++ = 0xFF;
frame[7] = crc16(frame, 7); frame[7] = crc16(frame, 7);
@ -192,13 +192,13 @@ void DeviceFirmwareUpdate::sendFrame()
} }
switch(module) { switch(module) {
case INTERNAL_MODULE:
#if defined(INTMODULE_USART) #if defined(INTMODULE_USART)
return intmoduleSendBuffer(outputTelemetryBuffer, ptr-outputTelemetryBuffer); case INTERNAL_MODULE:
return intmoduleSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data);
#endif #endif
default: default:
return sportSendBuffer(outputTelemetryBuffer, ptr-outputTelemetryBuffer); return sportSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data);
} }
} }

View file

@ -22,17 +22,17 @@
bool isSportOutputBufferAvailable() bool isSportOutputBufferAvailable()
{ {
return (outputTelemetryBufferSize == 0 && outputTelemetryBufferTrigger == 0x7E); return (outputTelemetryBuffer.size == 0 && outputTelemetryBuffer.trigger == 0x7E);
} }
void sportOutputPushByte(uint8_t byte) void sportOutputPushByte(uint8_t byte)
{ {
if (byte == 0x7E || byte == 0x7D) { if (byte == 0x7E || byte == 0x7D) {
telemetryOutputPushByte(0x7D); outputTelemetryBuffer.push(0x7D);
telemetryOutputPushByte(0x20 ^ byte); outputTelemetryBuffer.push(0x20 ^ byte);
} }
else { else {
telemetryOutputPushByte(byte); outputTelemetryBuffer.push(byte);
} }
} }
@ -49,6 +49,7 @@ void sportOutputPushPacket(SportTelemetryPacket * packet)
crc &= 0x00ff; crc &= 0x00ff;
} }
telemetryOutputPushByte(0xFF-crc); outputTelemetryBuffer.push(0xFF - crc);
telemetryOutputSetTrigger(packet->raw[0]); // physicalId outputTelemetryBuffer.setTrigger(packet->raw[0]); // physicalId
outputTelemetryBuffer.setDestination(SPORT_MODULE);
} }

View file

@ -306,9 +306,11 @@ void generalDefault()
theme->init(); theme->init();
#endif #endif
#if defined(PXX2)
for (uint8_t i=0; i<PXX2_LEN_REGISTRATION_ID; i++) { for (uint8_t i=0; i<PXX2_LEN_REGISTRATION_ID; i++) {
g_eeGeneral.ownerRegistrationID[i] = (cpu_uid[1 + i] & 0x3f) - 26; g_eeGeneral.ownerRegistrationID[i] = (cpu_uid[1 + i] & 0x3f) - 26;
} }
#endif
g_eeGeneral.chkSum = 0xFFFF; g_eeGeneral.chkSum = 0xFFFF;
} }

View file

@ -148,7 +148,7 @@ void setupPulsesDSM2()
dsmDat[0] |= DSM2_SEND_RANGECHECK; dsmDat[0] |= DSM2_SEND_RANGECHECK;
} }
else { else {
moduleSettings[port].mode = 0; moduleSettings[EXTERNAL_MODULE].mode = 0;
} }
#else #else
if (moduleSettings[EXTERNAL_MODULE].mode == MODULE_MODE_BIND) { if (moduleSettings[EXTERNAL_MODULE].mode == MODULE_MODE_BIND) {

View file

@ -48,7 +48,6 @@ inline bool isModuleMultimoduleDSM2(uint8_t)
} }
#endif #endif
#if defined(PCBHORUS) || defined(PCBTARANIS)
inline bool isModuleXJT(uint8_t idx) inline bool isModuleXJT(uint8_t idx)
{ {
return g_model.moduleData[idx].type == MODULE_TYPE_XJT; return g_model.moduleData[idx].type == MODULE_TYPE_XJT;
@ -64,12 +63,6 @@ inline bool isModuleXJTVariant(uint8_t idx)
return g_model.moduleData[idx].type == MODULE_TYPE_XJT || g_model.moduleData[idx].type == MODULE_TYPE_XJT2; return g_model.moduleData[idx].type == MODULE_TYPE_XJT || g_model.moduleData[idx].type == MODULE_TYPE_XJT2;
} }
#else
inline bool isModuleXJT(uint8_t idx)
{
return idx == EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_XJT;
}
#endif
#if defined(CROSSFIRE) #if defined(CROSSFIRE)
inline bool isModuleCrossfire(uint8_t idx) inline bool isModuleCrossfire(uint8_t idx)

View file

@ -65,7 +65,7 @@ void setupPulsesPPMTrainer()
setupPulsesPPM<trainer_pulse_duration_t>(&trainerPulsesData.ppm, g_model.trainerData.channelsStart, g_model.trainerData.channelsCount, g_model.trainerData.frameLength); setupPulsesPPM<trainer_pulse_duration_t>(&trainerPulsesData.ppm, g_model.trainerData.channelsStart, g_model.trainerData.channelsCount, g_model.trainerData.frameLength);
} }
#if defined(PCBSKY9X) || defined(TARANIS_INTERNAL_PPM) #if defined(PCBTARANIS) && defined(TARANIS_INTERNAL_PPM)
void setupPulsesPPMInternalModule() void setupPulsesPPMInternalModule()
{ {
setupPulsesPPM(&intmodulePulsesData.ppm, g_model.moduleData[INTERNAL_MODULE].channelsStart, g_model.moduleData[INTERNAL_MODULE].channelsCount, g_model.moduleData[INTERNAL_MODULE].ppm.frameLength); setupPulsesPPM(&intmodulePulsesData.ppm, g_model.moduleData[INTERNAL_MODULE].channelsStart, g_model.moduleData[INTERNAL_MODULE].channelsCount, g_model.moduleData[INTERNAL_MODULE].ppm.frameLength);

View file

@ -31,9 +31,11 @@ TrainerPulsesData trainerPulsesData __DMA;
uint8_t getModuleType(uint8_t module) uint8_t getModuleType(uint8_t module)
{ {
uint8_t type = g_model.moduleData[module].type; uint8_t type = g_model.moduleData[module].type;
#if defined(PCBTARANIS) || defined(PCBHORUS)
if (module == INTERNAL_MODULE && isInternalModuleAvailable(type)) { if (module == INTERNAL_MODULE && isInternalModuleAvailable(type)) {
return type; return type;
} }
#endif
if (module == EXTERNAL_MODULE && isExternalModuleAvailable(type)) { if (module == EXTERNAL_MODULE && isExternalModuleAvailable(type)) {
return type; return type;
} }
@ -255,7 +257,7 @@ void setupPulsesInternalModule(uint8_t protocol)
break; break;
#endif #endif
#if defined(PCBSKY9X) || defined(TARANIS_INTERNAL_PPM) #if defined(PCBTARANIS) && defined(TARANIS_INTERNAL_PPM)
case PROTOCOL_CHANNELS_PPM: case PROTOCOL_CHANNELS_PPM:
setupPulsesPPM(&extmodulePulsesData.ppm, g_model.moduleData[INTERNAL_MODULE].channelsStart, g_model.moduleData[INTERNAL_MODULE].channelsCount, g_model.moduleData[INTERNAL_MODULE].ppm.frameLength); setupPulsesPPM(&extmodulePulsesData.ppm, g_model.moduleData[INTERNAL_MODULE].channelsStart, g_model.moduleData[INTERNAL_MODULE].channelsCount, g_model.moduleData[INTERNAL_MODULE].ppm.frameLength);
scheduleNextMixerCalculation(INTERNAL_MODULE, PPM_PERIOD(INTERNAL_MODULE)); scheduleNextMixerCalculation(INTERNAL_MODULE, PPM_PERIOD(INTERNAL_MODULE));
@ -332,9 +334,11 @@ void setupPulsesExternalModule(uint8_t protocol)
void setupPulses(uint8_t module, uint8_t protocol) void setupPulses(uint8_t module, uint8_t protocol)
{ {
switch (module) { switch (module) {
#if defined(PCBTARANIS) && defined(PCBHORUS)
case INTERNAL_MODULE: case INTERNAL_MODULE:
setupPulsesInternalModule(protocol); setupPulsesInternalModule(protocol);
break; break;
#endif
case EXTERNAL_MODULE: case EXTERNAL_MODULE:
setupPulsesExternalModule(protocol); setupPulsesExternalModule(protocol);

View file

@ -550,7 +550,7 @@ PACK(typedef struct {
#define MODELDATA_EXTRA_217 \ #define MODELDATA_EXTRA_217 \
uint8_t spare:6; \ uint8_t spare:6; \
uint8_t potsWarnMode:2; \ uint8_t potsWarnMode:2; \
ModuleData moduleData[NUM_MODULES+1]; \ ModuleData_v217 moduleData[NUM_MODULES+1]; \
uint8_t potsWarnEnabled; \ uint8_t potsWarnEnabled; \
int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; \ int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; \
uint8_t rxBattAlarms[2]; uint8_t rxBattAlarms[2];

View file

@ -56,19 +56,23 @@ void convertModelData_218_to_219(ModelData &model)
} }
} }
#if !defined(PCBSKY9X)
newModel.trainerData.mode = oldModel.trainerMode; newModel.trainerData.mode = oldModel.trainerMode;
#endif
newModel.trainerData.channelsStart = oldModel.moduleData[NUM_MODULES].channelsStart; newModel.trainerData.channelsStart = oldModel.moduleData[NUM_MODULES].channelsStart;
newModel.trainerData.channelsCount = oldModel.moduleData[NUM_MODULES].channelsCount; newModel.trainerData.channelsCount = oldModel.moduleData[NUM_MODULES].channelsCount;
newModel.trainerData.frameLength = oldModel.moduleData[NUM_MODULES].ppm.frameLength; newModel.trainerData.frameLength = oldModel.moduleData[NUM_MODULES].ppm.frameLength;
newModel.trainerData.delay = oldModel.moduleData[NUM_MODULES].ppm.delay; newModel.trainerData.delay = oldModel.moduleData[NUM_MODULES].ppm.delay;
newModel.trainerData.pulsePol = oldModel.moduleData[NUM_MODULES].ppm.pulsePol; newModel.trainerData.pulsePol = oldModel.moduleData[NUM_MODULES].ppm.pulsePol;
#if !defined(PCBSKY9X)
memcpy(newModel.scriptsData, oldModel.scriptsData, memcpy(newModel.scriptsData, oldModel.scriptsData,
sizeof(newModel.scriptsData) + sizeof(newModel.scriptsData) +
sizeof(newModel.inputNames) + sizeof(newModel.inputNames) +
sizeof(newModel.potsWarnEnabled) + sizeof(newModel.potsWarnEnabled) +
sizeof(newModel.potsWarnPosition) + sizeof(newModel.potsWarnPosition) +
sizeof(oldModel.telemetrySensors)); sizeof(oldModel.telemetrySensors));
#endif
#if defined(PCBX9E) #if defined(PCBX9E)
newModel.toplcdTimer = oldModel.toplcdTimer; newModel.toplcdTimer = oldModel.toplcdTimer;

View file

@ -456,7 +456,7 @@ PACK(typedef struct {
uint8_t templateSetup; // RETA order for receiver channels uint8_t templateSetup; // RETA order for receiver channels
int8_t PPM_Multiplier; int8_t PPM_Multiplier;
int8_t hapticLength; int8_t hapticLength;
N_HORUS_FIELD(N_TARANIS_FIELD(N_PCBSTD_FIELD(uint8_t reNavigation))); N_HORUS_FIELD(N_TARANIS_FIELD(uint8_t reNavigation));
N_HORUS_FIELD(N_TARANIS_FIELD(uint8_t stickReverse)); N_HORUS_FIELD(N_TARANIS_FIELD(uint8_t stickReverse));
int8_t beepLength:3; int8_t beepLength:3;
int8_t hapticStrength:3; int8_t hapticStrength:3;

View file

@ -23,6 +23,7 @@
#include <string.h> #include <string.h>
#include "opentx.h" #include "opentx.h"
#include "timers.h" #include "timers.h"
#include "conversions/conversions.h"
#define EEPROM_MARK 0x84697771 /* thanks ;) */ #define EEPROM_MARK 0x84697771 /* thanks ;) */
#define EEPROM_ZONE_SIZE (8*1024) #define EEPROM_ZONE_SIZE (8*1024)
@ -584,7 +585,7 @@ const char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
#if defined(EEPROM_CONVERSIONS) #if defined(EEPROM_CONVERSIONS)
if (version < EEPROM_VER) { if (version < EEPROM_VER) {
convertModel(i_fileDst, version); convertModelData(i_fileDst, version);
eeLoadModel(g_eeGeneral.currModel); eeLoadModel(g_eeGeneral.currModel);
} }
#endif #endif

View file

@ -141,7 +141,6 @@ set(SRC
tasks.cpp tasks.cpp
audio.cpp audio.cpp
io/frsky_sport.cpp io/frsky_sport.cpp
io/frsky_device_firmware_update.cpp
telemetry/telemetry.cpp telemetry/telemetry.cpp
telemetry/telemetry_holders.cpp telemetry/telemetry_holders.cpp
telemetry/telemetry_sensors.cpp telemetry/telemetry_sensors.cpp

View file

@ -135,6 +135,12 @@ void intmoduleSendNextFrame()
switch(moduleSettings[INTERNAL_MODULE].protocol) { switch(moduleSettings[INTERNAL_MODULE].protocol) {
#if defined(PXX2) #if defined(PXX2)
case PROTOCOL_CHANNELS_PXX2: case PROTOCOL_CHANNELS_PXX2:
#if defined(LUA)
if (outputTelemetryBuffer.size > 0 && outputTelemetryBuffer.destination == INTERNAL_MODULE) {
intmoduleSendBuffer(outputTelemetryBuffer.data, outputTelemetryBuffer.size);
break;
}
#endif
intmoduleSendBuffer(intmodulePulsesData.pxx2.getData(), intmodulePulsesData.pxx2.getSize()); intmoduleSendBuffer(intmodulePulsesData.pxx2.getData(), intmodulePulsesData.pxx2.getSize());
break; break;
#endif #endif

View file

@ -146,6 +146,7 @@ add_definitions(-DBLUETOOTH)
set(SRC set(SRC
${SRC} ${SRC}
bluetooth.cpp bluetooth.cpp
io/frsky_device_firmware_update.cpp
) )
set(STM32LIB_SRC set(STM32LIB_SRC

View file

@ -176,8 +176,8 @@ extern "C" void TELEMETRY_DMA_TX_IRQHandler(void)
DMA_ClearITPendingBit(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC); DMA_ClearITPendingBit(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC);
TELEMETRY_USART->CR1 |= USART_CR1_TCIE; TELEMETRY_USART->CR1 |= USART_CR1_TCIE;
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) { if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) {
outputTelemetryBufferSize = 0; outputTelemetryBuffer.size = 0;
outputTelemetryBufferTrigger = 0x7E; outputTelemetryBuffer.trigger = 0x7E;
} }
} }
} }
@ -207,8 +207,8 @@ extern "C" void TELEMETRY_USART_IRQHandler(void)
#if defined(LUA) #if defined(LUA)
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) { if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) {
static uint8_t prevdata; static uint8_t prevdata;
if (prevdata == 0x7E && outputTelemetryBufferSize > 0 && data == outputTelemetryBufferTrigger) { if (prevdata == 0x7E && outputTelemetryBuffer.size > 0 && data == outputTelemetryBuffer.trigger && outputTelemetryBuffer.destination == SPORT_MODULE) {
sportSendBuffer(outputTelemetryBuffer, outputTelemetryBufferSize); sportSendBuffer(outputTelemetryBuffer.data, outputTelemetryBuffer.size);
} }
prevdata = data; prevdata = data;
} }

View file

@ -263,6 +263,7 @@ void init_serial(uint32_t port, uint32_t baudrate, uint32_t period_half_us);
void disable_serial(uint32_t port); void disable_serial(uint32_t port);
void init_module_timer( uint32_t module_index, uint32_t period, uint8_t state); void init_module_timer( uint32_t module_index, uint32_t period, uint8_t state);
void disable_module_timer( uint32_t module_index); void disable_module_timer( uint32_t module_index);
void extmoduleSendNextFrame();
// SD driver // SD driver
#if defined(SIMU) #if defined(SIMU)

View file

@ -265,6 +265,10 @@ void disable_serial(uint32_t port)
} }
} }
void extmoduleSendNextFrame()
{
}
#if !defined(SIMU) #if !defined(SIMU)
extern "C" void PWM_IRQHandler(void) extern "C" void PWM_IRQHandler(void)
{ {

View file

@ -202,6 +202,11 @@ endif()
add_definitions(-DPCBTARANIS) add_definitions(-DPCBTARANIS)
add_definitions(-DAUDIO -DVOICE -DRTCLOCK) add_definitions(-DAUDIO -DVOICE -DRTCLOCK)
set(SRC
${SRC}
io/frsky_device_firmware_update.cpp
)
set(GUI_SRC set(GUI_SRC
${GUI_SRC} ${GUI_SRC}
model_input_edit.cpp model_input_edit.cpp

View file

@ -128,8 +128,7 @@ extern "C" void TELEMETRY_DMA_TX_IRQHandler(void)
DMA_ClearITPendingBit(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC); DMA_ClearITPendingBit(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC);
TELEMETRY_USART->CR1 |= USART_CR1_TCIE; TELEMETRY_USART->CR1 |= USART_CR1_TCIE;
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || telemetryProtocol == PROTOCOL_TELEMETRY_PXX2) { if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || telemetryProtocol == PROTOCOL_TELEMETRY_PXX2) {
outputTelemetryBufferSize = 0; outputTelemetryBuffer.reset();
outputTelemetryBufferTrigger = 0x7E;
} }
} }
} }
@ -159,8 +158,8 @@ extern "C" void TELEMETRY_USART_IRQHandler(void)
#if defined(LUA) #if defined(LUA)
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) { if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) {
static uint8_t prevdata; static uint8_t prevdata;
if (prevdata == 0x7E && outputTelemetryBufferSize > 0 && data == outputTelemetryBufferTrigger) { if (prevdata == 0x7E && outputTelemetryBuffer.size > 0 && data == outputTelemetryBuffer.trigger && outputTelemetryBuffer.destination == SPORT_MODULE) {
sportSendBuffer(outputTelemetryBuffer, outputTelemetryBufferSize); sportSendBuffer(outputTelemetryBuffer.data, outputTelemetryBuffer.size);
} }
prevdata = data; prevdata = data;
} }

View file

@ -89,9 +89,11 @@ void sendSynchronousPulses()
{ {
for (uint8_t module = 0; module < NUM_MODULES; module++) { for (uint8_t module = 0; module < NUM_MODULES; module++) {
if (isModuleSynchronous(module) && setupPulses(module)) { if (isModuleSynchronous(module) && setupPulses(module)) {
#if defined(PCBHORUS) || defined(PCBTARAHIS)
if (module == INTERNAL_MODULE) if (module == INTERNAL_MODULE)
intmoduleSendNextFrame(); intmoduleSendNextFrame();
else #endif
if (module == EXTERNAL_MODULE)
extmoduleSendNextFrame(); extmoduleSendNextFrame();
} }
} }

View file

@ -290,15 +290,13 @@ void telemetryInit(uint8_t protocol)
else if (protocol == PROTOCOL_TELEMETRY_PXX2) { else if (protocol == PROTOCOL_TELEMETRY_PXX2) {
telemetryPortInit(PXX2_ON_SPORT_BAUDRATE, TELEMETRY_SERIAL_WITHOUT_DMA); telemetryPortInit(PXX2_ON_SPORT_BAUDRATE, TELEMETRY_SERIAL_WITHOUT_DMA);
#if defined(LUA) #if defined(LUA)
outputTelemetryBufferSize = 0; outputTelemetryBuffer.reset();
outputTelemetryBufferTrigger = 0x7E;
#endif #endif
} }
else { else {
telemetryPortInit(FRSKY_SPORT_BAUDRATE, TELEMETRY_SERIAL_WITHOUT_DMA); telemetryPortInit(FRSKY_SPORT_BAUDRATE, TELEMETRY_SERIAL_WITHOUT_DMA);
#if defined(LUA) #if defined(LUA)
outputTelemetryBufferSize = 0; outputTelemetryBuffer.reset();
outputTelemetryBufferTrigger = 0x7E;
#endif #endif
} }
@ -333,9 +331,7 @@ void logTelemetryWriteByte(uint8_t data)
} }
#endif #endif
uint8_t outputTelemetryBuffer[TELEMETRY_OUTPUT_FIFO_SIZE] __DMA; OutputTelemetryBuffer outputTelemetryBuffer __DMA;
uint8_t outputTelemetryBufferSize = 0;
uint8_t outputTelemetryBufferTrigger = 0;
#if defined(LUA) #if defined(LUA)
Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo = NULL; Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo = NULL;

View file

@ -156,20 +156,35 @@ void logTelemetryWriteByte(uint8_t data);
#endif #endif
#define TELEMETRY_OUTPUT_FIFO_SIZE 20 #define TELEMETRY_OUTPUT_FIFO_SIZE 20
extern uint8_t outputTelemetryBuffer[TELEMETRY_OUTPUT_FIFO_SIZE] __DMA;
extern uint8_t outputTelemetryBufferSize;
extern uint8_t outputTelemetryBufferTrigger;
inline void telemetryOutputPushByte(uint8_t byte) class OutputTelemetryBuffer {
{ public:
outputTelemetryBuffer[outputTelemetryBufferSize++] = byte; void push(uint8_t byte) {
data[size++] = byte;
} }
inline void telemetryOutputSetTrigger(uint8_t byte) void setTrigger(uint8_t byte) {
{ trigger = byte;
outputTelemetryBufferTrigger = byte;
} }
void setDestination(uint8_t module) {
destination = module;
}
void reset() {
size = 0;
trigger = 0x7E;
}
public:
uint8_t data[TELEMETRY_OUTPUT_FIFO_SIZE];
uint8_t size;
uint8_t trigger;
uint8_t destination;
};
extern OutputTelemetryBuffer outputTelemetryBuffer __DMA;
#if defined(LUA) #if defined(LUA)
#define LUA_TELEMETRY_INPUT_FIFO_SIZE 256 #define LUA_TELEMETRY_INPUT_FIFO_SIZE 256
extern Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo; extern Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo;

View file

@ -538,11 +538,12 @@
#define TR_OK TR_ENTER #define TR_OK TR_ENTER
#else #else
#define TR_EXIT "[EXIT]" #define TR_EXIT "[EXIT]"
#define TR_OK TR("\010" "\010" "\010" "[OK]", "\010" "\010" "\010" "\010" "\010" "[OK]")
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define TR_POPUPS_ENTER_EXIT TR(TR_EXIT "\010" TR_ENTER, TR_EXIT "\010" "\010" "\010" "\010" TR_ENTER) #define TR_POPUPS_ENTER_EXIT TR(TR_EXIT "\010" TR_ENTER, TR_EXIT "\010" "\010" "\010" "\010" TR_ENTER)
#define TR_OK TR("\010" "\010" "\010" "[OK]", "\010" "\010" "\010" "\010" "\010" "[OK]")
#else #else
#define TR_POPUPS_ENTER_EXIT TR_ENTER "\010" TR_EXIT #define TR_POPUPS_ENTER_EXIT TR_ENTER "\010" TR_EXIT
#define OFS_EXIT sizeof(TR_ENTER) #define OFS_EXIT sizeof(TR_ENTER)