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:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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); });
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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_
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user