chore: New module/serial API (#3055)

* WiP: new module interface

* WiP: softserial timer DMA

* WiP: setup() and send() in one step

and remove methods specific to internal or external module

* fixes and extra port config

* horus targets

* module ports have moved

* T8 support (only internal module)

* fix nv14

* stupid GCC....

* disable BT

* remove nv14 telem driver

* remove old aux serial driver

* Move module buffers out of pulses.h

* Soft serial fixes and PXX1 support

* Fixed PPM module output

* Fixed CLI

* compilation fixes

* Ported bluetooth and flysky gimbal to new serial driver

* Re-enable soft-serial RX

* fixes and cleanup

* nv14 fixes

* Fix flysky gimbals

* Ghost module

* 16 bytes of RAM

* Remove getByte from module API

* Ghost cleanup

* fix: _half_duplex_input() must be called after usart init

* WiP

* more cleanup

* Remove board specific settings from PXX1 / PXX2 drivers

* A bit of PXX2 header cleanup

* Add support for OVER8 and ONEBIT

* Add some support for inverters (NV14 / EL18)

* Support NV14 power fixes in generic board

* Fix polarity handling

* Fix RX DMA

* Fix mixer not running

* Add soft-serial polarity control

* Quick fix for telemetry polling while module port is changed

* Fix bootloader DEBUG

* Fix MPM telemetry

* Fix pulse start

* DSM2 soft-serial fallback

* DSMP async module restart

* Fix CRSF LUA upstream

* Remove global variable telemetryProtocol

* Use HAL/LL constants

* Fix various issue with AFHDS3 and NV14/EL18 internal module

* Fixed S.PORT unit tests

* fix: update widx after writing at current index

* fix: init error condition

* Fix: possible infinite loop in _find_port()

* Add support for bidir S.PORT init

* Add support for "getLastByte" in HW serial driver

* PXX1: Add support for S.PORT based on IDLE callback

* Fix rebase error

* Fix softserial _rx_fifo_push()

* Add softserial support for waitForTxCompleted()

* Fix MPM flashing (internal / external)

* Fixed external MPM

* Activate RX DMA on internal module

Seems to work with serial passthrough without issues, at least on the L3R PRO.

* Fix softserial DMA on stdlcd F4 targets

* Add softserial support for 32bit timers (mostly TIM2)

* More precise soft-serial

* Fix MPM update using inverters & HW uart

* Raise S.PORT DMA/USART IRQ prio to achieve faster switching to input

* Remove useless delays

* Fix flashing external ELRS module

* Added a retry mechanism for FrSky S.PORT update

* Remove useless enableRx()

* External FrSky modules are all flashed via S.PORT

* Remove power management unit update

This was only used on the first batch of X-lite.
This commit is contained in:
Raphael Coeffic
2023-02-09 19:44:32 +10:00
committed by GitHub
parent d80adc6c4d
commit 72193eda82
189 changed files with 7960 additions and 8364 deletions
+22 -15
View File
@@ -500,9 +500,13 @@ void menuModelSetup(event_t event)
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) {
memclear(&reusableBuffer.moduleSetup, sizeof(reusableBuffer.moduleSetup));
#if defined(HARDWARE_EXTERNAL_MODULE)
reusableBuffer.moduleSetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
reusableBuffer.moduleSetup.previousType = g_model.moduleData[EXTERNAL_MODULE].type;
reusableBuffer.moduleSetup.newType = g_model.moduleData[EXTERNAL_MODULE].type;
#endif
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
reusableBuffer.moduleSetup.antennaMode = g_model.moduleData[INTERNAL_MODULE].pxx.antennaMode;
#endif
@@ -1004,10 +1008,11 @@ void menuModelSetup(event_t event)
lcdDrawTextAlignedLeft(y, INDENT TR_MODE);
lcdDrawTextAtIndex(
MODEL_SETUP_2ND_COLUMN, y,
moduleIdx == EXTERNAL_MODULE ? STR_EXTERNAL_MODULE_PROTOCOLS
: STR_INTERNAL_MODULE_PROTOCOLS,
moduleIdx == EXTERNAL_MODULE ? reusableBuffer.moduleSetup.newType
: g_model.moduleData[moduleIdx].type,
STR_MODULE_PROTOCOLS,
#if defined(HARDWARE_EXTERNAL_MODULE)
moduleIdx == EXTERNAL_MODULE ? reusableBuffer.moduleSetup.newType :
#endif
g_model.moduleData[moduleIdx].type,
menuHorizontalPosition == 0 ? attr : 0);
if (isModuleXJT(moduleIdx))
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS,
@@ -1031,6 +1036,7 @@ void menuModelSetup(event_t event)
lcdNextPos + 3, y, STR_CRSF_BAUDRATE,
CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate), 0);
#if defined(HARDWARE_EXTERNAL_MODULE)
if (attr && menuHorizontalPosition == 0 &&
moduleIdx == EXTERNAL_MODULE) {
if (s_editMode > 0) {
@@ -1048,6 +1054,7 @@ void menuModelSetup(event_t event)
reusableBuffer.moduleSetup.newType;
}
}
#endif
if (attr) {
if (s_editMode > 0) {
switch (menuHorizontalPosition) {
@@ -1177,17 +1184,17 @@ void menuModelSetup(event_t event)
lcdDrawText(INDENT_WIDTH, y, STR_STATUS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 1000000 / getMixerSchedulerPeriod(), LEFT | attr);
lcdDrawText(lcdNextPos, y, "Hz ", attr);
lcdDrawNumber(lcdNextPos, y, telemetryErrors, attr);
lcdDrawText(lcdNextPos + 1, y, "Err", attr);
if (attr) {
s_editMode = 0;
if (event == EVT_KEY_LONG(KEY_ENTER)) {
START_NO_HIGHLIGHT();
telemetryErrors = 0;
AUDIO_WARNING1();
killEvents(event);
}
}
// lcdDrawNumber(lcdNextPos, y, telemetryErrors, attr);
// lcdDrawText(lcdNextPos + 1, y, "Err", attr);
// if (attr) {
// s_editMode = 0;
// if (event == EVT_KEY_LONG(KEY_ENTER)) {
// START_NO_HIGHLIGHT();
// telemetryErrors = 0;
// AUDIO_WARNING1();
// killEvents(event);
// }
// }
break;
#endif
+7 -4
View File
@@ -61,10 +61,10 @@ enum MenuModelTelemetryFrskyItems {
#define VARIO_ROWS
#endif
#if defined(PCBTARANIS)
#if defined(HARDWARE_EXTERNAL_MODULE)
#define TELEMETRY_TYPE_ROW (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
#else
#define TELEMETRY_TYPE_ROW (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
#define TELEMETRY_TYPE_ROW HIDDEN_ROW
#endif
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_ROW,
@@ -174,9 +174,12 @@ void menuModelTelemetry(event_t event)
switch (k) {
case ITEM_TELEMETRY_PROTOCOL_TYPE:
lcdDrawTextAlignedLeft(y, STR_TELEMETRY_TYPE);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS,
g_model.telemetryProtocol, attr);
if (attr) {
g_model.telemetryProtocol = checkIncDec(event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable);
g_model.telemetryProtocol = checkIncDec(
event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST,
PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable);
}
break;
+20 -17
View File
@@ -26,7 +26,7 @@ enum SensorFields {
SENSOR_FIELD_TYPE,
SENSOR_FIELD_ID,
SENSOR_FIELD_FORMULA = SENSOR_FIELD_ID,
SENSOR_FILED_RECEIVER_NAME,
// SENSOR_FIELD_RECEIVER_NAME,
SENSOR_FIELD_UNIT,
SENSOR_FIELD_PRECISION,
SENSOR_FIELD_PARAM1,
@@ -54,7 +54,7 @@ void menuModelSensor(event_t event)
0, // Name
0, // Type
sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, // ID / Formula
sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : READONLY_ROW, // Receiver name
// sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : READONLY_ROW, // Receiver name
((sensor->type == TELEM_TYPE_CALCULATED && (sensor->formula == TELEM_FORMULA_DIST)) || sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW), // Unit
(sensor->isPrecConfigurable() && sensor->unit != UNIT_FAHRENHEIT ? (uint8_t)0 : HIDDEN_ROW), // Precision
(sensor->unit >= UNIT_FIRST_VIRTUAL ? HIDDEN_ROW : (uint8_t)0), // Param1
@@ -145,21 +145,24 @@ void menuModelSensor(event_t event)
}
break;
case SENSOR_FILED_RECEIVER_NAME:
lcdDrawTextAlignedLeft(y, STR_SOURCE);
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT && sensor->frskyInstance.rxIndex != TELEMETRY_ENDPOINT_SPORT) {
drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, 0);
}
#if defined(HARDWARE_INTERNAL_MODULE)
else if (isModuleUsingSport(INTERNAL_MODULE, g_model.moduleData[INTERNAL_MODULE].type)) {
// far from perfect
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
}
#endif
else {
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_EXTERNAL_MODULE);
}
break;
// TODO: this needs to be known from the sensor data alone!
// case SENSOR_FIELD_RECEIVER_NAME:
// lcdDrawTextAlignedLeft(y, STR_SOURCE);
// if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT &&
// sensor->frskyInstance.rxIndex != TELEMETRY_ENDPOINT_SPORT) {
// drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2,
// sensor->frskyInstance.rxIndex & 0x03, 0);
// }
// #if defined(HARDWARE_INTERNAL_MODULE)
// else if (isModuleUsingSport(INTERNAL_MODULE, g_model.moduleData[INTERNAL_MODULE].type)) {
// // far from perfect
// lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
// }
// #endif
// else {
// lcdDrawText(SENSOR_2ND_COLUMN, y, STR_EXTERNAL_MODULE);
// }
// break;
case SENSOR_FIELD_UNIT:
lcdDrawTextAlignedLeft(y, STR_UNIT);
+3 -2
View File
@@ -22,6 +22,7 @@
#define LANGUAGE_PACKS_DEFINITION
#include "opentx.h"
#include "tasks/mixer_task.h"
const unsigned char sticks[] = {
#include "sticks.lbm"
@@ -693,10 +694,10 @@ void menuRadioSetup(event_t event)
CHECK_INCDEC_GENVAR(event, reusableBuffer.generalSettings.stickMode, 0, 3);
}
else if (reusableBuffer.generalSettings.stickMode != g_eeGeneral.stickMode) {
pausePulses();
mixerTaskStop();
g_eeGeneral.stickMode = reusableBuffer.generalSettings.stickMode;
checkThrottleStick();
resumePulses();
mixerTaskStart();
waitKeysReleased();
}
break;
+10 -5
View File
@@ -20,6 +20,11 @@
*/
#include "opentx.h"
#include "tasks.h"
#if defined(BLUETOOTH)
#include "bluetooth_driver.h"
#endif
#define STATS_1ST_COLUMN 1
#define STATS_2ND_COLUMN 7*FW+FW/2
@@ -228,9 +233,9 @@ void menuStatisticsDebug2(event_t event)
title(STR_MENUDEBUG);
switch(event) {
case EVT_KEY_FIRST(KEY_ENTER):
telemetryErrors = 0;
break;
// case EVT_KEY_FIRST(KEY_ENTER):
// telemetryErrors = 0;
// break;
case EVT_KEY_FIRST(KEY_UP):
#if defined(KEYS_GPIO_REG_PAGEDN)
@@ -258,8 +263,8 @@ void menuStatisticsDebug2(event_t event)
uint8_t y = FH + 1;
lcdDrawTextAlignedLeft(y, "Tlm RX Err");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, telemetryErrors, RIGHT);
// lcdDrawTextAlignedLeft(y, "Tlm RX Err");
// lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, telemetryErrors, RIGHT);
y += FH;
#if defined(BLUETOOTH)
+13 -13
View File
@@ -923,7 +923,7 @@ void menuModelSetup(event_t event)
{
lcdDrawTextAlignedLeft(y, INDENT TR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y,
STR_INTERNAL_MODULE_PROTOCOLS,
STR_MODULE_PROTOCOLS,
g_model.moduleData[INTERNAL_MODULE].type,
menuHorizontalPosition == 0 ? attr : 0);
if (isModuleXJT(INTERNAL_MODULE))
@@ -977,7 +977,7 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_TYPE:
lcdDrawTextAlignedLeft(y, INDENT TR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_EXTERNAL_MODULE_PROTOCOLS, reusableBuffer.moduleSetup.newType, menuHorizontalPosition==0 ? attr : 0);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MODULE_PROTOCOLS, reusableBuffer.moduleSetup.newType, menuHorizontalPosition==0 ? attr : 0);
if (isModuleXJT(EXTERNAL_MODULE))
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
else if (isModuleDSM2(EXTERNAL_MODULE))
@@ -1110,17 +1110,17 @@ void menuModelSetup(event_t event)
lcdDrawText(INDENT_WIDTH, y, STR_STATUS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 1000000 / getMixerSchedulerPeriod(), LEFT | attr);
lcdDrawText(lcdNextPos, y, "Hz ", attr);
lcdDrawNumber(lcdNextPos, y, telemetryErrors, attr);
lcdDrawText(lcdNextPos + 1, y, "Err", attr);
if (attr) {
s_editMode = 0;
if (event == EVT_KEY_LONG(KEY_ENTER)) {
START_NO_HIGHLIGHT();
telemetryErrors = 0;
AUDIO_WARNING1();
killEvents(event);
}
}
// lcdDrawNumber(lcdNextPos, y, telemetryErrors, attr);
// lcdDrawText(lcdNextPos + 1, y, "Err", attr);
// if (attr) {
// s_editMode = 0;
// if (event == EVT_KEY_LONG(KEY_ENTER)) {
// START_NO_HIGHLIGHT();
// telemetryErrors = 0;
// AUDIO_WARNING1();
// killEvents(event);
// }
// }
break;
#endif
+1 -9
View File
@@ -143,14 +143,6 @@ void menuModelTelemetry(event_t event)
lcdDrawText(TELEM_COL2, y, "---", 0); // TODO shortcut
}
TelemetrySensor * sensor = & g_model.telemetrySensors[index];
#if defined(MULTIMODULE)
if (IS_SPEKTRUM_PROTOCOL()) {
// Spektrum does not (yet?) really support multiple sensor of the same type. But a lot of
// different sensor display the same information (e.g. voltage, capacity). Show the id
// of the sensor in the overview to ease figuring out what sensors belong together
lcdDrawHexNumber(TELEM_COL3, y, sensor->id, LEFT);
} else
#endif
if (sensor->type == TELEM_TYPE_CUSTOM && !g_model.ignoreSensorIds) {
lcdDrawNumber(TELEM_COL3, y, sensor->instance, LEFT);
}
@@ -183,7 +175,7 @@ void menuModelTelemetry(event_t event)
case ITEM_TELEMETRY_SENSORS_LABEL:
lcdDrawTextAlignedLeft(y, STR_TELEMETRY_SENSORS);
lcdDrawText(TELEM_COL2, y, STR_VALUE, 0);
if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL()) {
if (!g_model.ignoreSensorIds /*&& !IS_SPEKTRUM_PROTOCOL()*/) {
lcdDrawText(TELEM_COL3, y, STR_ID, 0);
}
break;
+18 -15
View File
@@ -26,7 +26,7 @@ enum SensorFields {
SENSOR_FIELD_TYPE,
SENSOR_FIELD_ID,
SENSOR_FIELD_FORMULA=SENSOR_FIELD_ID,
SENSOR_FILED_RECEIVER_NAME,
// SENSOR_FIELD_RECEIVER_NAME,
SENSOR_FIELD_UNIT,
SENSOR_FIELD_PRECISION,
SENSOR_FIELD_PARAM1,
@@ -69,7 +69,7 @@ void menuModelSensor(event_t event)
0, //Name
0, // Type
sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, // ID / Formula
sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : READONLY_ROW, // Receiver name
// sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : READONLY_ROW, // Receiver name
SENSOR_UNIT_ROWS,
SENSOR_PREC_ROWS,
SENSOR_PARAM1_ROWS,
@@ -151,19 +151,22 @@ void menuModelSensor(event_t event)
}
break;
case SENSOR_FILED_RECEIVER_NAME:
lcdDrawTextAlignedLeft(y, STR_SOURCE);
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT && sensor->frskyInstance.rxIndex != TELEMETRY_ENDPOINT_SPORT) {
drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, 0);
}
else if (isModuleUsingSport(INTERNAL_MODULE, g_model.moduleData[INTERNAL_MODULE].type)) {
// far from perfect
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
}
else {
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_EXTERNAL_MODULE);
}
break;
// case SENSOR_FIELD_RECEIVER_NAME:
// lcdDrawTextAlignedLeft(y, STR_SOURCE);
// // TODO: this needs to be known from the sensor data alone!
// if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT &&
// sensor->frskyInstance.rxIndex != TELEMETRY_ENDPOINT_SPORT) {
// drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2,
// sensor->frskyInstance.rxIndex & 0x03, 0);
// }
// else if (isModuleUsingSport(INTERNAL_MODULE, g_model.moduleData[INTERNAL_MODULE].type)) {
// // far from perfect
// lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
// }
// else {
// lcdDrawText(SENSOR_2ND_COLUMN, y, STR_EXTERNAL_MODULE);
// }
// break;
case SENSOR_FIELD_UNIT:
lcdDrawTextAlignedLeft(y, STR_UNIT);
+3 -2
View File
@@ -22,6 +22,7 @@
#define LANGUAGE_PACKS_DEFINITION
#include "opentx.h"
#include "tasks/mixer_task.h"
const unsigned char sticks[] = {
#include "sticks.lbm"
@@ -623,10 +624,10 @@ void menuRadioSetup(event_t event)
CHECK_INCDEC_GENVAR(event, reusableBuffer.generalSettings.stickMode, 0, 3);
}
else if (reusableBuffer.generalSettings.stickMode != g_eeGeneral.stickMode) {
pausePulses();
mixerTaskStop();
g_eeGeneral.stickMode = reusableBuffer.generalSettings.stickMode;
checkThrottleStick();
resumePulses();
mixerTaskStart();
waitKeysReleased();
}
break;
+7 -6
View File
@@ -20,6 +20,7 @@
*/
#include "opentx.h"
#include "tasks.h"
#define STATS_1ST_COLUMN FW/2
#define STATS_2ND_COLUMN 12*FW+FW/2
@@ -112,7 +113,7 @@ void menuStatisticsDebug(event_t event)
warningResult = 0;
// do a user requested watchdog test
TRACE("Performing watchdog test");
pausePulses();
pulsesStop();
}
#endif
@@ -232,14 +233,14 @@ void menuStatisticsDebug2(event_t event)
chainMenu(menuMainView);
break;
case EVT_KEY_LONG(KEY_ENTER):
telemetryErrors = 0;
break;
// case EVT_KEY_LONG(KEY_ENTER):
// telemetryErrors = 0;
// break;
}
// UART statistics
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW1, "Tlm RX Err");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, telemetryErrors, RIGHT);
// lcdDrawTextAlignedLeft(MENU_DEBUG_ROW1, "Tlm RX Err");
// lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, telemetryErrors, RIGHT);
lcdDrawText(LCD_W/2, 7*FH+1, STR_MENUTORESET, CENTERED);
@@ -61,8 +61,9 @@ CrossfireSettings::CrossfireSettings(Window* parent, const FlexGridLayout& g,
new StaticText(line, rect_t{}, STR_STATUS, 0, COLOR_THEME_PRIMARY1);
new DynamicText(line, rect_t{}, [=] {
char msg[64] = "";
sprintf(msg, "%d Hz %" PRIu32 " Err", 1000000 / getMixerSchedulerPeriod(),
telemetryErrors);
// sprintf(msg, "%d Hz %" PRIu32 " Err", 1000000 / getMixerSchedulerPeriod(),
// telemetryErrors);
sprintf(msg, "%d Hz", 1000000 / getMixerSchedulerPeriod());
return std::string(msg);
});
}
+8 -53
View File
@@ -376,7 +376,8 @@ void drawGPSSensorValue(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem &
drawGPSPosition(dc, x, y, telemetryItem.gps.longitude, telemetryItem.gps.latitude, flags);
}
void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags)
void drawSensorCustomValue(BitmapBuffer* dc, coord_t x, coord_t y,
uint8_t sensor, int32_t value, LcdFlags flags)
{
if (sensor >= MAX_TELEMETRY_SENSORS) {
// Lua luaLcdDrawChannel() can call us with a bad value
@@ -392,65 +393,19 @@ void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sens
else if (telemetrySensor.unit == UNIT_GPS) {
drawGPSSensorValue(dc, x, y, telemetryItem, flags);
}
else if (telemetrySensor.unit == UNIT_BITFIELD) {
if (IS_FRSKY_SPORT_PROTOCOL()) {
if (telemetrySensor.id >= RBOX_STATE_FIRST_ID && telemetrySensor.id <= RBOX_STATE_LAST_ID) {
if (telemetrySensor.subId == 0) {
if (value == 0) {
dc->drawText(x, y, "OK", flags);
}
else {
for (uint8_t i=0; i<16; i++) {
if (value & (1 << i)) {
char s[] = "CH__ KO";
strAppendUnsigned(&s[2], i+1, 2);
dc->drawText(x, flags & FONT(XL) ? y+1 : y, s, flags & ~FONT(XL));
break;
}
}
}
}
else {
if (value == 0) {
dc->drawText(x, flags & FONT(XL) ? y+1 : y, "Rx OK", flags & ~FONT(XL));
}
else {
static const char * const RXS_STATUS[] = {
"Rx1 Ovl",
"Rx2 Ovl",
"SBUS Ovl",
"Rx1 FS",
"Rx1 LF",
"Rx2 FS",
"Rx2 LF",
"Rx1 Lost",
"Rx2 Lost",
"Rx1 NS",
"Rx2 NS",
};
for (uint8_t i=0; i<DIM(RXS_STATUS); i++) {
if (value & (1<<i)) {
dc->drawText(x, flags & FONT(XL) ? y+1 : y, RXS_STATUS[i], flags & ~FONT(XL));
break;
}
}
}
}
}
}
}
else if (telemetrySensor.unit == UNIT_TEXT) {
dc->drawSizedText(x, flags & FONT(XL) ? y+1 : y, telemetryItem.text, sizeof(telemetryItem.text), flags & ~FONT(XL));
}
else {
dc->drawSizedText(x, flags & FONT(XL) ? y + 1 : y, telemetryItem.text,
sizeof(telemetryItem.text), flags & ~FONT(XL));
} else {
if (telemetrySensor.prec > 0) {
flags |= (telemetrySensor.prec==1 ? PREC1 : PREC2);
}
drawValueWithUnit(dc, x, y, value, telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit, flags);
drawValueWithUnit(dc, x, y, value,
telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit,
flags);
}
}
void drawTimer(BitmapBuffer * dc, coord_t x, coord_t y, int32_t tme, LcdFlags flags)
{
char str[LEN_TIMER_STRING];
+1 -1
View File
@@ -47,7 +47,7 @@ InternalModuleWindow::InternalModuleWindow(Window *parent) :
lv_obj_set_style_grid_cell_x_align(box->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
auto internalModule = new Choice(
box, rect_t{}, STR_INTERNAL_MODULE_PROTOCOLS, MODULE_TYPE_NONE,
box, rect_t{}, STR_MODULE_PROTOCOLS, MODULE_TYPE_NONE,
MODULE_TYPE_COUNT - 1, GET_DEFAULT(g_eeGeneral.internalModule),
[=](int type) { return setModuleType(type); });
+7 -6
View File
@@ -29,6 +29,7 @@
#include "input_mix_group.h"
#include "input_mix_button.h"
#include "tasks/mixer_task.h"
#include <algorithm>
#define SET_DIRTY() storageDirty(EE_MODEL)
@@ -52,7 +53,7 @@ uint8_t getExposCount()
//
void copyExpo(uint8_t source, uint8_t dest, uint8_t input)
{
pauseMixerCalculations();
mixerTaskStop();
ExpoData sourceExpo;
memcpy(&sourceExpo, expoAddress(source), sizeof(ExpoData));
ExpoData *expo = expoAddress(dest);
@@ -60,13 +61,13 @@ void copyExpo(uint8_t source, uint8_t dest, uint8_t input)
memmove(expo + 1, expo, trailingExpos * sizeof(ExpoData));
memcpy(expo, &sourceExpo, sizeof(ExpoData));
expo->chn = input;
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
void deleteExpo(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
ExpoData * expo = expoAddress(idx);
int input = expo->chn;
memmove(expo, expo+1, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
@@ -74,7 +75,7 @@ void deleteExpo(uint8_t idx)
if (!isInputAvailable(input)) {
memclear(&g_model.inputNames[input], LEN_INPUT_NAME);
}
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
@@ -85,7 +86,7 @@ int8_t s_copySrcRow;
void insertExpo(uint8_t idx, uint8_t input)
{
pauseMixerCalculations();
mixerTaskStop();
ExpoData * expo = expoAddress(idx);
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memclear(expo, sizeof(ExpoData));
@@ -94,7 +95,7 @@ void insertExpo(uint8_t idx, uint8_t input)
expo->mode = 3; // pos+neg
expo->chn = input;
expo->weight = 100;
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
+10 -8
View File
@@ -31,6 +31,8 @@
#include "input_mix_button.h"
#include "mixer_edit.h"
#include "tasks/mixer_task.h"
#define SET_DIRTY() storageDirty(EE_MODEL)
#define PASTE_BEFORE -2
#define PASTE_AFTER -1
@@ -66,7 +68,7 @@ uint8_t getMixesCount()
void insertMix(uint8_t idx, uint8_t channel)
{
pauseMixerCalculations();
mixerTaskStop();
MixData *mix = mixAddress(idx);
memmove(mix + 1, mix, (MAX_MIXERS - (idx + 1)) * sizeof(MixData));
memclear(mix, sizeof(MixData));
@@ -80,17 +82,17 @@ void insertMix(uint8_t idx, uint8_t channel)
}
}
mix->weight = 100;
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
void deleteMix(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
MixData * mix = mixAddress(idx);
memmove(mix, mix + 1, (MAX_MIXERS - (idx + 1)) * sizeof(MixData));
memclear(&g_model.mixData[MAX_MIXERS - 1], sizeof(MixData));
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
@@ -106,7 +108,7 @@ void insertMix(uint8_t idx)
void copyMix(uint8_t source, uint8_t dest, int8_t ch)
{
pauseMixerCalculations();
mixerTaskStop();
MixData sourceMix;
memcpy(&sourceMix, mixAddress(source), sizeof(MixData));
MixData *mix = mixAddress(dest);
@@ -114,7 +116,7 @@ void copyMix(uint8_t source, uint8_t dest, int8_t ch)
memmove(mix + 1, mix, trailingMixes * sizeof(MixData));
memcpy(mix, &sourceMix, sizeof(MixData));
mix->destCh = ch;
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
@@ -153,9 +155,9 @@ bool swapMixes(uint8_t &idx, uint8_t up)
return true;
}
pauseMixerCalculations();
mixerTaskStop();
memswap(x, y, sizeof(MixData));
resumeMixerCalculations();
mixerTaskStart();
idx = tgt_idx;
return true;
+2 -49
View File
@@ -187,9 +187,7 @@ class SensorButton : public Button {
lv_obj_set_grid_cell(v->getLvObj(), LV_GRID_ALIGN_STRETCH, 2, 2, LV_GRID_ALIGN_CENTER, 0, 1);
TelemetrySensor * sensor = & g_model.telemetrySensors[index];
if (IS_SPEKTRUM_PROTOCOL()) {
sprintf(s, "%x", sensor->id);
} else if (sensor->type == TELEM_TYPE_CUSTOM && !g_model.ignoreSensorIds) {
if (sensor->type == TELEM_TYPE_CUSTOM && !g_model.ignoreSensorIds) {
sprintf(s, "%d", sensor->instance);
}
@@ -589,7 +587,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
new StaticText(line, rect_t{}, STR_NAME, 0, FONT(XS) | COLOR_THEME_PRIMARY1);
grid2.nextCell();
new StaticText(line, rect_t{}, STR_VALUE, 0, FONT(XS) | COLOR_THEME_PRIMARY1);
if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL()) {
if (!g_model.ignoreSensorIds) {
new StaticText(line, rect_t{}, STR_ID, 0, FONT(XS) | COLOR_THEME_PRIMARY1);
}
}
@@ -821,51 +819,6 @@ std::string getSensorCustomValue(uint8_t sensor, int32_t value, LcdFlags flags)
else if (telemetrySensor.unit == UNIT_GPS) {
return getGPSSensorValue(telemetryItem, flags);
}
else if (telemetrySensor.unit == UNIT_BITFIELD) {
if (IS_FRSKY_SPORT_PROTOCOL()) {
if (telemetrySensor.id >= RBOX_STATE_FIRST_ID && telemetrySensor.id <= RBOX_STATE_LAST_ID) {
if (telemetrySensor.subId == 0) {
if (value == 0) {
return std::string("OK");
}
else {
for (uint8_t i=0; i<16; i++) {
if (value & (1 << i)) {
char s[] = "CH__ KO";
strAppendUnsigned(&s[2], i+1, 2);
return std::string(s);
}
}
}
}
else {
if (value == 0) {
return std::string("Rx OK");
}
else {
static const char * const RXS_STATUS[] = {
"Rx1 Ovl",
"Rx2 Ovl",
"SBUS Ovl",
"Rx1 FS",
"Rx1 LF",
"Rx2 FS",
"Rx2 LF",
"Rx1 Lost",
"Rx2 Lost",
"Rx1 NS",
"Rx2 NS",
};
for (uint8_t i=0; i<DIM(RXS_STATUS); i++) {
if (value & (1<<i)) {
return std::string(RXS_STATUS[i]);
}
}
}
}
}
}
}
else if (telemetrySensor.unit == UNIT_TEXT) {
return std::string(telemetryItem.text);
}
+1 -1
View File
@@ -751,7 +751,7 @@ ModulePage::ModulePage(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
lv_obj_set_width(box->getLvObj(), LV_SIZE_CONTENT);
ModuleData* md = &g_model.moduleData[moduleIdx];
auto moduleChoice = new Choice(box, rect_t{}, STR_INTERNAL_MODULE_PROTOCOLS,
auto moduleChoice = new Choice(box, rect_t{}, STR_MODULE_PROTOCOLS,
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
GET_DEFAULT(md->type));
+1 -1
View File
@@ -29,7 +29,7 @@
// #endif
#if defined(RADIO_FAMILY_T16) || defined(PCBNV14)
#include "../../targets/horus/flyskyHallStick_driver.h"
#include "flysky_gimbal_driver.h"
#endif
#define STATSDEPTH 8 // ideally a value of power of 2
+1 -1
View File
@@ -26,7 +26,7 @@
#include "opentx.h"
#include "libopenui.h"
#include "hal/adc_driver.h"
#include "aux_serial_driver.h"
#include "hw_intmodule.h"
#include "hw_extmodule.h"
#include "hw_serial.h"
+14 -21
View File
@@ -255,10 +255,11 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
[=]() { BootloaderUpdate(fullpath); });
}
} else if (!READ_ONLY() && !strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
if (HAS_SPORT_UPDATE_CONNECTOR()) {
menu->addLine(STR_FLASH_EXTERNAL_DEVICE,
[=]() { FrSkyFirmwareUpdate(fullpath, SPORT_MODULE); });
}
// TODO
// if (HAS_SPORT_UPDATE_CONNECTOR()) {
// menu->addLine(STR_FLASH_EXTERNAL_DEVICE,
// [=]() { FrSkyFirmwareUpdate(fullpath, SPORT_MODULE); });
// }
menu->addLine(STR_FLASH_INTERNAL_MODULE,
[=]() { FrSkyFirmwareUpdate(fullpath, INTERNAL_MODULE); });
menu->addLine(STR_FLASH_EXTERNAL_MODULE,
@@ -279,15 +280,15 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
}
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER ||
information.productFamily == FIRMWARE_FAMILY_SENSOR) {
if (HAS_SPORT_UPDATE_CONNECTOR()) {
menu->addLine(STR_FLASH_EXTERNAL_DEVICE, [=]() {
FrSkyFirmwareUpdate(fullpath, SPORT_MODULE);
});
} else {
menu->addLine(STR_FLASH_EXTERNAL_MODULE, [=]() {
FrSkyFirmwareUpdate(fullpath, EXTERNAL_MODULE);
});
}
// if (HAS_SPORT_UPDATE_CONNECTOR()) {
// menu->addLine(STR_FLASH_EXTERNAL_DEVICE, [=]() {
// FrSkyFirmwareUpdate(fullpath, SPORT_MODULE);
// });
// } else {
menu->addLine(STR_FLASH_EXTERNAL_MODULE, [=]() {
FrSkyFirmwareUpdate(fullpath, EXTERNAL_MODULE);
});
// }
}
#if _NYI_ // Not yet implemented
#if defined(PXX2)
@@ -325,14 +326,6 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
});
}
#endif
#if defined(HARDWARE_POWER_MANAGEMENT_UNIT)
if (information.productFamily ==
FIRMWARE_FAMILY_POWER_MANAGEMENT_UNIT) {
menu->addLine(STR_FLASH_POWER_MANAGEMENT_UNIT, [=]() {
FrSkyFirmwareUpdate(fullpath, STR_FLASH_POWER_MANAGEMENT_UNIT);
});
}
#endif
#endif // _NYI_
}
}
+4 -2
View File
@@ -25,6 +25,8 @@
#include "opentx.h"
#include "libopenui.h"
#include "tasks/mixer_task.h"
#define SET_DIRTY() storageDirty(EE_GENERAL)
static const lv_coord_t col_two_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
@@ -777,11 +779,11 @@ void RadioSetupPage::build(FormWindow * window)
grid.setColSpan(2);
choice = new Choice(line, rect_t{}, 0, 3, GET_DEFAULT(g_eeGeneral.stickMode),
[=](uint8_t newValue) {
pausePulses();
mixerTaskStop();
g_eeGeneral.stickMode = newValue;
SET_DIRTY();
checkThrottleStick();
resumePulses();
mixerTaskStart();
});
choice->setTextHandler([](uint8_t value) {
return std::to_string(1 + value) + ": " + STR_LEFT_STICK + " = " +
@@ -281,15 +281,21 @@ void RadioSpectrumAnalyser::start()
void RadioSpectrumAnalyser::stop()
{
#if defined(PXX2)
if (isModulePXX2(moduleIdx)) {
moduleState[moduleIdx].readModuleInformation(
&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID,
PXX2_HW_INFO_TX_ID);
} else if (isModuleMultimodule(moduleIdx)) {
}
#endif
#if defined(MULTIMODULE)
if (isModuleMultimodule(moduleIdx)) {
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
if (reusableBuffer.spectrumAnalyser.moduleOFF)
setModuleType(INTERNAL_MODULE, MODULE_TYPE_NONE);
}
#endif
/* wait 1s to resume normal operation before leaving */
// watchdogSuspend(1000);
// RTOS_WAIT_MS(1000);
+4 -1
View File
@@ -27,6 +27,7 @@
#include "libopenui.h"
#include "lua/lua_api.h"
#include "standalone_lua.h"
#include "hal/module_port.h"
extern uint8_t g_moduleIdx;
@@ -44,7 +45,7 @@ void RadioToolsPage::build(FormWindow * window)
#if defined(PXX2)
for (uint8_t module = 0; module < NUM_MODULES; module++) {
if (isModulePXX2(module) && (module == INTERNAL_MODULE ? IS_INTERNAL_MODULE_ON() : IS_EXTERNAL_MODULE_ON())) {
if (isModulePXX2(module) && (module == INTERNAL_MODULE ? modulePortPowered(INTERNAL_MODULE) : modulePortPowered(EXTERNAL_MODULE))) {
waiting |= (1 << module);
moduleState[module].readModuleInformation(&reusableBuffer.radioTools.modules[module], PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
}
@@ -56,6 +57,7 @@ void RadioToolsPage::build(FormWindow * window)
void RadioToolsPage::checkEvents()
{
#if defined(PXX2)
bool refresh = false;
for (uint8_t module = 0; module < NUM_MODULES; module++) {
@@ -68,6 +70,7 @@ void RadioToolsPage::checkEvents()
if (refresh) {
rebuild(window);
}
#endif
PageTab::checkEvents();
}
+14 -6
View File
@@ -24,11 +24,13 @@
#include "options.h"
#include "libopenui.h"
#include "fw_version.h"
#include "hal/module_port.h"
#if defined(CROSSFIRE)
#include "mixer_scheduler.h"
#endif
#if defined(PXX2)
char *getVersion(char *str, PXX2Version version)
{
if (version.major == 0xFF && version.minor == 0x0F &&
@@ -40,6 +42,7 @@ char *getVersion(char *str, PXX2Version version)
return str;
}
}
#endif
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
@@ -70,22 +73,24 @@ class VersionDialog : public Dialog
VersionDialog(Window *parent) :
Dialog(parent, STR_MODULES_RX_VERSION, rect_t{ 0, 0, 200, 100 })
{
#if defined(PXX2)
memclear(&reusableBuffer.hardwareAndSettings.modules,
sizeof(reusableBuffer.hardwareAndSettings.modules));
reusableBuffer.hardwareAndSettings.updateTime = get_tmr10ms();
// Query modules
if (isModulePXX2(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) {
if (isModulePXX2(INTERNAL_MODULE) && modulePortPowered(INTERNAL_MODULE)) {
moduleState[INTERNAL_MODULE].readModuleInformation(
&reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE],
PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
}
if (isModulePXX2(EXTERNAL_MODULE) && IS_EXTERNAL_MODULE_ON()) {
if (isModulePXX2(EXTERNAL_MODULE) && modulePortPowered(EXTERNAL_MODULE)) {
moduleState[EXTERNAL_MODULE].readModuleInformation(
&reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE],
PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
}
#endif
setCloseWhenClickOutside(true);
@@ -176,7 +181,7 @@ class VersionDialog : public Dialog
// initialize to module does not provide status
// PXX2 will overwrite name
// CRSF, MPM, NV14 and PXX2 will overwrite status
name->setText(STR_INTERNAL_MODULE_PROTOCOLS[g_model.moduleData[module].type]);
name->setText(STR_MODULE_PROTOCOLS[g_model.moduleData[module].type]);
lv_obj_add_flag(module_status_w->getLvObj(), LV_OBJ_FLAG_HIDDEN);
#if defined(CROSSFIRE)
@@ -185,7 +190,8 @@ class VersionDialog : public Dialog
char statusText[64];
auto hz = 1000000 / getMixerSchedulerPeriod();
snprintf(statusText, 64, "%d Hz %" PRIu32 " Err", hz, telemetryErrors);
// snprintf(statusText, 64, "%d Hz %" PRIu32 " Err", hz, telemetryErrors);
snprintf(statusText, 64, "%d Hz", hz);
status->setText(statusText);
lv_obj_clear_flag(module_status_w->getLvObj(), LV_OBJ_FLAG_HIDDEN);
}
@@ -292,16 +298,17 @@ class VersionDialog : public Dialog
#endif
}
#if defined(PXX2)
void checkEvents() override
{
if (get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) {
// Query modules
if (isModulePXX2(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) {
if (isModulePXX2(INTERNAL_MODULE) && modulePortPowered(INTERNAL_MODULE)) {
moduleState[INTERNAL_MODULE].readModuleInformation(
&reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE],
PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
}
if (isModulePXX2(EXTERNAL_MODULE) && IS_EXTERNAL_MODULE_ON()) {
if (isModulePXX2(EXTERNAL_MODULE) && modulePortPowered(EXTERNAL_MODULE)) {
moduleState[EXTERNAL_MODULE].readModuleInformation(
&reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE],
PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
@@ -311,6 +318,7 @@ class VersionDialog : public Dialog
update();
Dialog::checkEvents();
}
#endif
};
RadioVersionPage::RadioVersionPage():
@@ -24,6 +24,9 @@
#include "opentx.h"
#include "draw_functions.h"
#include "tasks.h"
#include "tasks/mixer_task.h"
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
LV_GRID_FR(1), LV_GRID_FR(1),
LV_GRID_TEMPLATE_LAST};
+6 -79
View File
@@ -440,89 +440,16 @@ void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value,
else if (telemetrySensor.unit == UNIT_GPS) {
drawGPSSensorValue(x, y, telemetryItem, flags);
}
else if (telemetrySensor.unit == UNIT_BITFIELD) {
if (IS_FRSKY_SPORT_PROTOCOL()) {
if (telemetrySensor.id >= RBOX_STATE_FIRST_ID && telemetrySensor.id <= RBOX_STATE_LAST_ID) {
if (telemetrySensor.subId == 0) {
if (value == 0) {
lcdDrawText(x, y, "OK", flags);
}
else {
for (uint8_t i = 0; i < 16; i++) {
if (value & (1u << i)) {
char s[] = "CH__ KO";
strAppendUnsigned(&s[2], i + 1, 2);
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, s, flags & ~DBLSIZE);
break;
}
}
}
}
else {
if (value == 0) {
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, "Rx OK", flags & ~DBLSIZE);
}
else {
static const char * const RXS_STATUS[] = {
"Rx1 Ovl",
"Rx2 Ovl",
"SBUS Ovl",
"Rx1 FS",
"Rx1 LF",
"Rx2 FS",
"Rx2 LF",
"Rx1 Lost",
"Rx2 Lost",
"Rx1 NS",
"Rx2 NS",
"Rx3 FS",
"Rx3 LF",
"Rx3 Lost",
"Rx3 NS"
};
for (uint8_t i = 0; i < DIM(RXS_STATUS); i++) {
if (value & (1u << i)) {
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, RXS_STATUS[i], flags & ~DBLSIZE);
break;
}
}
}
}
}
else if (telemetrySensor.id >= RB3040_OUTPUT_FIRST_ID && telemetrySensor.id <= RB3040_OUTPUT_LAST_ID) {
if (telemetrySensor.subId == 0) {
if (value == 0) {
lcdDrawText(x, y, "OK", flags);
}
else {
for (uint8_t i = 0; i < 9; i++) {
if (value & (1u << i)) {
if (i < 8) {
char s[] = "CH__ KO";
strAppendUnsigned(&s[2], i + 17, 2);
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, s, flags & ~DBLSIZE);
break;
}
else {
char s[] = "S.P Ovl";
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, s, flags & ~DBLSIZE);
break;
}
}
}
}
}
}
}
}
else if (telemetrySensor.unit == UNIT_TEXT) {
lcdDrawSizedText(x, flags & DBLSIZE ? y + 1 : y, telemetryItem.text, sizeof(telemetryItem.text), flags & ~DBLSIZE);
}
else {
lcdDrawSizedText(x, flags & DBLSIZE ? y + 1 : y, telemetryItem.text,
sizeof(telemetryItem.text), flags & ~DBLSIZE);
} else {
if (telemetrySensor.prec > 0) {
flags |= (telemetrySensor.prec == 1 ? PREC1 : PREC2);
}
drawValueWithUnit(x, y, value, telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit, flags);
drawValueWithUnit(x, y, value,
telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit,
flags);
}
}
+9 -8
View File
@@ -20,6 +20,7 @@
*/
#include "opentx.h"
#include "tasks/mixer_task.h"
#define _STR_MAX(x) "/" #x
#define STR_MAX(x) _STR_MAX(x)
@@ -51,7 +52,7 @@ bool reachExposLimit()
int8_t s_currCh;
void insertExpo(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
ExpoData * expo = expoAddress(idx);
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memclear(expo, sizeof(ExpoData));
@@ -65,16 +66,16 @@ void insertExpo(uint8_t idx)
expo->mode = 3; // pos+neg
expo->chn = s_currCh - 1;
expo->weight = 100;
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
void copyExpo(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
ExpoData * expo = expoAddress(idx);
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
@@ -112,9 +113,9 @@ bool swapExpos(uint8_t & idx, uint8_t up)
return true;
}
pauseMixerCalculations();
mixerTaskStop();
memswap(x, y, sizeof(ExpoData));
resumeMixerCalculations();
mixerTaskStart();
idx = tgt_idx;
return true;
@@ -122,7 +123,7 @@ bool swapExpos(uint8_t & idx, uint8_t up)
void deleteExpo(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
ExpoData * expo = expoAddress(idx);
int input = expo->chn;
memmove(expo, expo+1, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
@@ -130,7 +131,7 @@ void deleteExpo(uint8_t idx)
if (!isInputAvailable(input)) {
memclear(&g_model.inputNames[input], LEN_INPUT_NAME);
}
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
+9 -8
View File
@@ -20,6 +20,7 @@
*/
#include "opentx.h"
#include "tasks/mixer_task.h"
#define _STR_MAX(x) "/" #x
#define STR_MAX(x) _STR_MAX(x)
@@ -49,17 +50,17 @@ bool reachMixesLimit()
void deleteMix(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
MixData * mix = mixAddress(idx);
memmove(mix, mix+1, (MAX_MIXERS-(idx+1))*sizeof(MixData));
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
void insertMix(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
MixData * mix = mixAddress(idx);
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
memclear(mix, sizeof(MixData));
@@ -72,16 +73,16 @@ void insertMix(uint8_t idx)
}
}
mix->weight = 100;
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
void copyMix(uint8_t idx)
{
pauseMixerCalculations();
mixerTaskStop();
MixData * mix = mixAddress(idx);
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
resumeMixerCalculations();
mixerTaskStart();
storageDirty(EE_MODEL);
}
@@ -120,9 +121,9 @@ bool swapMixes(uint8_t & idx, uint8_t up)
return true;
}
pauseMixerCalculations();
mixerTaskStop();
memswap(x, y, sizeof(MixData));
resumeMixerCalculations();
mixerTaskStart();
idx = tgt_idx;
return true;
@@ -21,9 +21,9 @@
#include "opentx.h"
#if defined(GHOST)
#include "telemetry/ghost.h"
#endif
#if defined(GHOST) && defined(HARDWARE_EXTERNAL_MODULE)
#include "telemetry/ghost.h"
void menuGhostModuleConfig(event_t event)
{
@@ -126,3 +126,5 @@ void menuGhostModuleConfig(event_t event)
}
}
}
#endif
+14 -10
View File
@@ -21,12 +21,15 @@
#include <opentx.h>
#include "hal/adc_driver.h"
#include "aux_serial_driver.h"
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#endif
#if defined(BLUETOOTH)
#include "bluetooth_driver.h"
#endif
#if defined(PCBTARANIS)
enum {
ITEM_RADIO_HARDWARE_LABEL_STICKS,
@@ -532,7 +535,7 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE: {
g_eeGeneral.internalModule =
editChoice(HW_SETTINGS_COLUMN2, y, STR_TYPE,
STR_INTERNAL_MODULE_PROTOCOLS,
STR_MODULE_PROTOCOLS,
g_eeGeneral.internalModule, MODULE_TYPE_NONE,
MODULE_TYPE_MAX, attr, event, isInternalModuleSupported);
if (g_model.moduleData[INTERNAL_MODULE].type !=
@@ -663,14 +666,15 @@ void menuRadioHardware(event_t event)
lcdDrawText(lcdNextPos, y, "---");
break;
#if defined(SPORT_UPDATE_PWR_GPIO)
case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
if (attr && checkIncDec_Ret) {
SPORT_UPDATE_POWER_INIT();
}
break;
#endif
// TODO: this is board specific, do something about it!
// #if defined(SPORT_UPDATE_PWR_GPIO)
// case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
// g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
// if (attr && checkIncDec_Ret) {
// SPORT_UPDATE_POWER_INIT();
// }
// break;
// #endif
case ITEM_RADIO_HARDWARE_DEBUG:
lcdDrawTextAlignedLeft(y, STR_DEBUG);
+37 -39
View File
@@ -92,6 +92,9 @@ void onSdFormatConfirm(const char * result)
}
#if defined(PXX2)
#include "pulses/pxx2_ota.h"
void onUpdateConfirmation(const char * result)
{
if (result == STR_OK) {
@@ -108,26 +111,19 @@ void onUpdateStateChanged()
{
if (reusableBuffer.sdManager.otaUpdateInformation.step == BIND_INFO_REQUEST) {
uint8_t modelId = reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.modelID;
if (modelId > 0 && modelId < DIM(PXX2ReceiversNames)) {
if (isPXX2ReceiverOptionAvailable(modelId, RECEIVER_OPTION_OTA)) {
POPUP_CONFIRMATION(getPXX2ReceiverName(modelId), onUpdateConfirmation);
char *tmp = strAppend(reusableBuffer.sdManager.otaReceiverVersion, TR_CURRENT_VERSION);
tmp = strAppendUnsigned(tmp, 1 + reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.major);
*tmp++ = '.';
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.minor);
*tmp++ = '.';
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.revision);
SET_WARNING_INFO(reusableBuffer.sdManager.otaReceiverVersion, tmp - reusableBuffer.sdManager.otaReceiverVersion, 0);
}
else {
POPUP_WARNING(STR_OTA_UPDATE_ERROR);
SET_WARNING_INFO(STR_UNSUPPORTED_RX, sizeof(TR_UNSUPPORTED_RX) - 1, 0);
moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode = MODULE_MODE_NORMAL;
}
if (isPXX2ReceiverOptionAvailable(modelId, RECEIVER_OPTION_OTA)) {
POPUP_CONFIRMATION(getPXX2ReceiverName(modelId), onUpdateConfirmation);
char *tmp = strAppend(reusableBuffer.sdManager.otaReceiverVersion, TR_CURRENT_VERSION);
tmp = strAppendUnsigned(tmp, 1 + reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.major);
*tmp++ = '.';
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.minor);
*tmp++ = '.';
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.revision);
SET_WARNING_INFO(reusableBuffer.sdManager.otaReceiverVersion, tmp - reusableBuffer.sdManager.otaReceiverVersion, 0);
}
else {
POPUP_WARNING(STR_OTA_UPDATE_ERROR);
SET_WARNING_INFO(STR_UNKNOWN_RX, sizeof(TR_UNKNOWN_RX) - 1, 0);
SET_WARNING_INFO(STR_UNSUPPORTED_RX, sizeof(TR_UNSUPPORTED_RX) - 1, 0);
moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode = MODULE_MODE_NORMAL;
}
}
@@ -220,12 +216,14 @@ void onSdManagerMenu(const char * result)
FrskyDeviceFirmwareUpdate device(INTERNAL_MODULE);
device.flashFirmware(lfn, drawProgressScreen);
}
#if defined(HARDWARE_EXTERNAL_MODULE)
else if (result == STR_FLASH_EXTERNAL_MODULE) {
// needed on X-Lite (as the R9M needs 2S while the external device flashing port only provides 5V)
getSelectionFullPath(lfn);
FrskyDeviceFirmwareUpdate device(EXTERNAL_MODULE);
device.flashFirmware(lfn, drawProgressScreen);
}
#endif
else if (result == STR_FLASH_EXTERNAL_DEVICE) {
getSelectionFullPath(lfn);
FrskyDeviceFirmwareUpdate device(SPORT_MODULE);
@@ -239,6 +237,7 @@ void onSdManagerMenu(const char * result)
device.flashFirmware(lfn, drawProgressScreen);
}
#endif
#if defined(HARDWARE_EXTERNAL_MODULE)
else if (result == STR_FLASH_EXTERNAL_MULTI) {
getSelectionFullPath(lfn);
MultiDeviceFirmwareUpdate device(EXTERNAL_MODULE, MULTI_TYPE_MULTIMODULE);
@@ -250,20 +249,14 @@ void onSdManagerMenu(const char * result)
device.flashFirmware(lfn, drawProgressScreen);
}
#endif
#endif
#if defined(BLUETOOTH)
else if (result == STR_FLASH_BLUETOOTH_MODULE) {
getSelectionFullPath(lfn);
bluetooth.flashFirmware(lfn, drawProgressScreen);
}
#endif
#if defined(HARDWARE_POWER_MANAGEMENT_UNIT)
else if (result == STR_FLASH_POWER_MANAGEMENT_UNIT) {
getSelectionFullPath(lfn);
FrskyChipFirmwareUpdate device;
device.flashFirmware(lfn, drawProgressScreen);
}
#endif
#if defined(PXX2)
#if defined(PXX2) && defined(HARDWARE_EXTERNAL_MODULE)
else if (result == STR_FLASH_RECEIVER_BY_INTERNAL_MODULE_OTA || result == STR_FLASH_RECEIVER_BY_EXTERNAL_MODULE_OTA) {
memclear(&reusableBuffer.sdManager.otaUpdateInformation, sizeof(OtaUpdateInformation));
getSelectionFullPath(reusableBuffer.sdManager.otaUpdateInformation.filename);
@@ -432,29 +425,38 @@ void menuRadioSdManager(event_t _event)
}
}
else if (!READ_ONLY() && !strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
if (HAS_SPORT_UPDATE_CONNECTOR())
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
if (mod_desc && mod_desc->set_pwr)
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
#if defined(INTERNAL_MODULE_PXX1) || defined(INTERNAL_MODULE_PXX2)
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
#endif
if (g_eeGeneral.internalModule == MODULE_TYPE_XJT_PXX1 ||
g_eeGeneral.internalModule == MODULE_TYPE_ISRM_PXX2)
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
}
else if (!READ_ONLY() && !strcasecmp(ext, FRSKY_FIRMWARE_EXT)) {
FrSkyFirmwareInformation information;
if (readFrSkyFirmwareInformation(line, information) == nullptr) {
#if defined(INTERNAL_MODULE_PXX1) || defined(INTERNAL_MODULE_PXX2)
if (information.productFamily == FIRMWARE_FAMILY_INTERNAL_MODULE)
if (information.productFamily == FIRMWARE_FAMILY_INTERNAL_MODULE &&
(g_eeGeneral.internalModule == MODULE_TYPE_XJT_PXX1 ||
g_eeGeneral.internalModule == MODULE_TYPE_ISRM_PXX2))
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
#endif
if (information.productFamily == FIRMWARE_FAMILY_EXTERNAL_MODULE)
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER || information.productFamily == FIRMWARE_FAMILY_SENSOR) {
if (HAS_SPORT_UPDATE_CONNECTOR())
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER ||
information.productFamily == FIRMWARE_FAMILY_SENSOR) {
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
if (mod_desc && mod_desc->set_pwr)
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
else
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
}
#if defined(PXX2)
#if defined(PXX2) && defined(HARDWARE_EXTERNAL_MODULE)
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER) {
if (isReceiverOTAEnabledFromModule(INTERNAL_MODULE, information.productId))
POPUP_MENU_ADD_ITEM(STR_FLASH_RECEIVER_BY_INTERNAL_MODULE_OTA);
@@ -469,10 +471,6 @@ void menuRadioSdManager(event_t _event)
#if defined(BLUETOOTH)
if (information.productFamily == FIRMWARE_FAMILY_BLUETOOTH_CHIP)
POPUP_MENU_ADD_ITEM(STR_FLASH_BLUETOOTH_MODULE);
#endif
#if defined(HARDWARE_POWER_MANAGEMENT_UNIT)
if (information.productFamily == FIRMWARE_FAMILY_POWER_MANAGEMENT_UNIT)
POPUP_MENU_ADD_ITEM(STR_FLASH_POWER_MANAGEMENT_UNIT);
#endif
}
}
@@ -44,7 +44,9 @@ void menuRadioSpectrumAnalyser(event_t event)
if (menuEvent) {
lcdDrawCenteredText(LCD_H/2, STR_STOPPING);
lcdRefresh();
#if defined(PXX2)
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
#endif
/* wait 1s to resume normal operation before leaving */
watchdogSuspend(500 /*5s*/);
RTOS_WAIT_MS(1000);
+19 -3
View File
@@ -22,6 +22,7 @@
#include <algorithm>
#include <vector>
#include "opentx.h"
#include "hal/module_port.h"
extern uint8_t g_moduleIdx;
@@ -104,7 +105,7 @@ void menuRadioTools(event_t event)
memclear(&reusableBuffer.radioTools, sizeof(reusableBuffer.radioTools));
#if defined(PXX2)
for (uint8_t module = 0; module < NUM_MODULES; module++) {
if (isModulePXX2(module) && (module == INTERNAL_MODULE ? IS_INTERNAL_MODULE_ON() : IS_EXTERNAL_MODULE_ON())) {
if (isModulePXX2(module) && (module == INTERNAL_MODULE ? modulePortPowered(INTERNAL_MODULE) : modulePortPowered(EXTERNAL_MODULE))) {
moduleState[module].readModuleInformation(&reusableBuffer.radioTools.modules[module], PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
}
}
@@ -161,12 +162,25 @@ void menuRadioTools(event_t event)
if (isPXX2ModuleOptionAvailable(reusableBuffer.radioTools.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
addRadioModuleTool(index++, STR_POWER_METER_INT, menuRadioPowerMeter, INTERNAL_MODULE);
#endif
#if defined(HARDWARE_INTERNAL_MODULE) && defined(MULTIMODULE)
if (g_eeGeneral.internalModule == MODULE_TYPE_MULTIMODULE)
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_INT, menuRadioSpectrumAnalyser, INTERNAL_MODULE);
#endif
#if defined(PXX2) || defined(MULTIMODULE)
if (isPXX2ModuleOptionAvailable(reusableBuffer.radioTools.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER) || isModuleMultimodule(EXTERNAL_MODULE))
#if defined(HARDWARE_EXTERNAL_MODULE)
#if (defined(PXX2) || defined(MULTIMODULE))
bool has_spectrum_analyser = false;
#if defined(PXX2)
if (isPXX2ModuleOptionAvailable(reusableBuffer.radioTools.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER))
has_spectrum_analyser = true;
#endif
#if defined(MULTIMODULE)
if (isModuleMultimodule(EXTERNAL_MODULE))
has_spectrum_analyser = true;
#endif
if (has_spectrum_analyser)
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_EXT, menuRadioSpectrumAnalyser, EXTERNAL_MODULE);
#endif
#if defined(PXX2)
@@ -177,6 +191,8 @@ void menuRadioTools(event_t event)
#if defined(GHOST)
if (isModuleGhost(EXTERNAL_MODULE))
addRadioModuleTool(index++, "Ghost Menu", menuGhostModuleConfig, EXTERNAL_MODULE);
#endif
#endif
if (index == 0) {
+28 -8
View File
@@ -21,6 +21,8 @@
#include "opentx.h"
#include "options.h"
#include "hal/module_port.h"
#if defined(CROSSFIRE)
#include "mixer_scheduler.h"
#endif
@@ -95,8 +97,9 @@ void drawPXX2FullVersion(coord_t x, coord_t y, PXX2Version hwVersion, PXX2Versio
void menuRadioModulesVersion(event_t event)
{
if (menuEvent) {
moduleState[INTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
moduleState[EXTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
for (uint8_t i = 0; i < MAX_MODULES; i++) {
moduleState[i].mode = MODULE_MODE_NORMAL;
}
return;
}
@@ -107,13 +110,18 @@ void menuRadioModulesVersion(event_t event)
}
if (event == EVT_ENTRY || get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) {
if (isModulePXX2(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) {
#if defined(HARDWARE_INTERNAL_MODULE)
if (isModulePXX2(INTERNAL_MODULE) && modulePortPowered(INTERNAL_MODULE)) {
moduleState[INTERNAL_MODULE].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE], PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
}
#endif
if (isModulePXX2(EXTERNAL_MODULE) && IS_EXTERNAL_MODULE_ON()) {
#if defined(HARDWARE_EXTERNAL_MODULE)
if (isModulePXX2(EXTERNAL_MODULE) && modulePortPowered(EXTERNAL_MODULE)) {
moduleState[EXTERNAL_MODULE].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE], PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
}
#endif
reusableBuffer.hardwareAndSettings.updateTime = get_tmr10ms() + 1000 /* 10s*/;
}
@@ -123,18 +131,30 @@ void menuRadioModulesVersion(event_t event)
for (uint8_t module=0; module<NUM_MODULES; module++) {
// Label
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
#if defined(HARDWARE_INTERNAL_MODULE)
if (module == INTERNAL_MODULE)
lcdDrawTextAlignedLeft(y, STR_INTERNAL_MODULE);
else if (module == EXTERNAL_MODULE)
#endif
#if defined(HARDWARE_EXTERNAL_MODULE)
if (module == EXTERNAL_MODULE)
lcdDrawTextAlignedLeft(y, STR_EXTERNAL_MODULE);
#endif
}
y += FH;
// Module model
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
lcdDrawText(INDENT_WIDTH, y, STR_MODULE);
if ((module == INTERNAL_MODULE && !IS_INTERNAL_MODULE_ON()) ||
(module == EXTERNAL_MODULE && !IS_EXTERNAL_MODULE_ON())) {
bool module_off = true;
#if defined(HARDWARE_INTERNAL_MODULE)
if (module == INTERNAL_MODULE && modulePortPowered(INTERNAL_MODULE))
module_off = false;
#endif
#if defined(HARDWARE_EXTERNAL_MODULE)
if (module == EXTERNAL_MODULE && modulePortPowered(EXTERNAL_MODULE))
module_off = false;
#endif
if (module_off) {
lcdDrawText(COLUMN2_X, y, STR_OFF);
y += FH;
continue;
@@ -152,7 +172,7 @@ void menuRadioModulesVersion(event_t event)
if (isModuleCrossfire(module)) {
char statusText[64] = "";
sprintf(statusText, "%d Hz %zu Err",
1000000 / getMixerSchedulerPeriod(), (size_t)telemetryErrors);
1000000 / getMixerSchedulerPeriod(), (size_t)0/*telemetryErrors*/);
lcdDrawText(COLUMN2_X, y, statusText);
y += FH;
continue;
+16 -11
View File
@@ -20,10 +20,7 @@
*/
#include "opentx.h"
#if defined(PXX2)
#include "extmodule_serial_driver.h"
#endif
#include "hal/module_port.h"
#if defined(PCBFRSKY) || defined(PCBFLYSKY)
uint8_t switchToMix(uint8_t source)
@@ -726,12 +723,16 @@ bool isModuleUsingSport(uint8_t moduleBay, uint8_t moduleType)
// External XJT has a physical switch to disable S.PORT
case MODULE_TYPE_R9M_PXX1:
// R9M telemetry is disabled by pulses (pxx1.cpp)
#if defined(HARDWARE_EXTERNAL_MODULE)
if (moduleBay == EXTERNAL_MODULE)
return false;
#endif
case MODULE_TYPE_CROSSFIRE:
#if defined(HARDWARE_INTERNAL_MODULE)
if (moduleBay == INTERNAL_MODULE)
return false;
#endif
default:
return true;
@@ -785,7 +786,7 @@ bool isInternalModuleAvailable(int moduleType)
if (g_eeGeneral.internalModule != moduleType)
return false;
#if defined(INTERNAL_MODULE_PXX1)
#if defined(INTERNAL_MODULE_PXX1) && defined(HARDWARE_EXTERNAL_MODULE)
if ((moduleType == MODULE_TYPE_XJT_PXX1) &&
isModuleUsingSport(EXTERNAL_MODULE,
g_model.moduleData[EXTERNAL_MODULE].type)) {
@@ -793,7 +794,7 @@ bool isInternalModuleAvailable(int moduleType)
}
#endif
#if defined(INTERNAL_MODULE_PXX2)
#if defined(INTERNAL_MODULE_PXX2) && defined(HARDWARE_EXTERNAL_MODULE)
if ((moduleType == MODULE_TYPE_ISRM_PXX2) &&
areModulesConflicting(moduleType,
g_model.moduleData[EXTERNAL_MODULE].type)) {
@@ -854,7 +855,8 @@ bool isExternalModuleAvailable(int moduleType)
moduleType == MODULE_TYPE_R9M_LITE_PRO_PXX2) {
#if defined(PXX2)
return extmoduleGetSerialPort() != nullptr;
return modulePortFind(EXTERNAL_MODULE, ETX_MOD_TYPE_SERIAL,
ETX_MOD_PORT_UART, ETX_Pol_Normal);
#else
return false;
#endif
@@ -916,22 +918,25 @@ bool isExternalModuleAvailable(int moduleType)
bool isRfProtocolAvailable(int protocol)
{
#if defined(CROSSFIRE)
#if defined(CROSSFIRE) && defined(HARDWARE_EXTERNAL_MODULE)
if (protocol != MODULE_SUBTYPE_PXX1_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_CROSSFIRE) {
return false;
}
#endif
#if defined(GHOST)
#if defined(GHOST) && defined(HARDWARE_EXTERNAL_MODULE)
if (protocol != MODULE_SUBTYPE_PXX1_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_GHOST) {
return false;
}
#endif
#if !defined(MODULE_PROTOCOL_D8)
if (protocol == MODULE_SUBTYPE_PXX1_ACCST_D8) {
return false;
}
#endif
#if defined(PCBTARANIS) || defined(PCBHORUS)
#if (defined(PCBTARANIS) || defined(PCBHORUS)) && defined(HARDWARE_EXTERNAL_MODULE)
if (protocol != MODULE_SUBTYPE_PXX1_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_R9M_PXX1) {
return false;
}
@@ -1029,7 +1034,7 @@ bool isTrainerModeAvailable(int mode)
return false;
#endif
#if !defined(MULTIMODULE)
#if !defined(MULTIMODULE) || !defined(HARDWARE_INTERNAL_MODULE) || !defined(HARDWARE_EXTERNAL_MODULE)
if (mode == TRAINER_MODE_MULTI)
return false;
#else