Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prioritize module with higher update rates when internal and external module are active #2920

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2a3ae56
chore: Set codename
pfeerick Sep 26, 2022
6ee647f
chore: Add EL18 specific firmware naming (#2609)
richardclli Nov 2, 2022
86d2b47
chore(el18): Change default switch cfg to match production (#2675)
richardclli Nov 5, 2022
9dc75fa
initial working commit
mha1 Dec 20, 2022
cde02eb
added showing the real update rates in the radio version/modules rx v…
mha1 Dec 21, 2022
78bad86
cleanup
mha1 Dec 21, 2022
a4083d5
changed functions to use a module ID (index) rather than explicit names
mha1 Dec 21, 2022
8cfaea5
Generalised sync logic for N modules
raphaelcoeffic Dec 22, 2022
93b9e64
Added unit tests
raphaelcoeffic Dec 22, 2022
f3296ea
- simu crash: set divider default to 1 for the case where is no synce…
mha1 Dec 23, 2022
113dc36
fixed wrong argument for radio/src/gui/212x64/model_setup.cpp:1096
mha1 Dec 23, 2022
d49e448
set defaults for period too
mha1 Dec 23, 2022
7a8cc27
Run mixer task at double the masters sync frequency and have the puls…
mha1 Dec 24, 2022
25fadff
updated two cycle processing in mixer task
mha1 Dec 24, 2022
c67e793
first attempt to integrate heart beat sync into the general mixer tas…
mha1 Dec 26, 2022
732aa36
unit test update
mha1 Dec 27, 2022
0a09d71
update unit test
mha1 Dec 27, 2022
95cd9af
when calculating the divider don't round up to the next integer when …
mha1 Dec 27, 2022
f811843
fixed error in divider calc
mha1 Dec 27, 2022
0544389
updated unit test
mha1 Dec 27, 2022
4a24537
set default period if period == 0
mha1 Dec 28, 2022
f555a2c
Commit after module/serial API nuke
mha1 May 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
strategy:
matrix:
target:
- nv14
- nv14;el18
- t12
- t16
- t18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
target:
- nv14
- nv14;el18
- t12
- t16
- t18
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ cmake_minimum_required(VERSION 3.13)
project(EdgeTX)

set(VERSION_MAJOR "2")
set(VERSION_MINOR "8")
set(VERSION_MINOR "9")
set(VERSION_REVISION "0")
set(CODENAME "dev")
set(CODENAME "FlyingDutchman")

if(MINGW OR WIN32)
set(CMAKE_OBJECT_PATH_MAX 200)
Expand Down
2 changes: 1 addition & 1 deletion fw.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"targets": [
["BETAFPV LiteRadio 3 Pro", "lr3pro-"],
["Flysky EL18", "nv14-"],
["Flysky EL18", "el18-"],
["Flysky NV14", "nv14-"],
["FrSky Horus X10", "x10-"],
["FrSky Horus X10 Access", "x10-access-"],
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/128x64/model_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_SERIALSTATUS:
#endif
lcdDrawText(INDENT_WIDTH, y, STR_STATUS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 1000000 / getMixerSchedulerPeriod(), LEFT | attr);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 1000000 / getMixerSchedulerRealPeriod(moduleIdx), LEFT | attr);
lcdDrawText(lcdNextPos, y, "Hz ", attr);
lcdDrawNumber(lcdNextPos, y, telemetryErrors, attr);
lcdDrawText(lcdNextPos + 1, y, "Err", attr);
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/212x64/model_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ void menuModelSetup(event_t event)

case ITEM_MODEL_SETUP_EXTERNAL_MODULE_SERIALSTATUS:
lcdDrawText(INDENT_WIDTH, y, STR_STATUS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 1000000 / getMixerSchedulerPeriod(), LEFT | attr);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 1000000 / getMixerSchedulerRealPeriod(EXTERNAL_MODULE), LEFT | attr);
lcdDrawText(lcdNextPos, y, "Hz ", attr);
lcdDrawNumber(lcdNextPos, y, telemetryErrors, attr);
lcdDrawText(lcdNextPos + 1, y, "Err", attr);
Expand Down
3 changes: 1 addition & 2 deletions radio/src/gui/colorlcd/crossfire_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ 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);
snprintf(msg, 64, "%d Hz", 1000000 / getMixerSchedulerRealPeriod(moduleIdx));
return std::string(msg);
});
}
33 changes: 23 additions & 10 deletions radio/src/gui/colorlcd/radio_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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};
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -176,16 +181,16 @@ 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)
// CRSF is able to provide status
if (isModuleCrossfire(module)) {
char statusText[64];
char statusText[64];

snprintf(statusText, 64, "%d Hz", 1000000 / getMixerSchedulerRealPeriod(module));

auto hz = 1000000 / getMixerSchedulerPeriod();
snprintf(statusText, 64, "%d Hz %" PRIu32 " Err", hz, telemetryErrors);
status->setText(statusText);
lv_obj_clear_flag(module_status_w->getLvObj(), LV_OBJ_FLAG_HIDDEN);
}
Expand All @@ -207,9 +212,12 @@ class VersionDialog : public Dialog
#if defined(MULTIMODULE)
// MPM is able to provide status
if (isModuleMultimodule(module)) {
char statusText[64];
char mpmStatusText[20];
char statusText[40];

getMultiModuleStatus(module).getStatusString(mpmStatusText);
snprintf(statusText, 40, "%s %d Hz", mpmStatusText, 1000000 / getMixerSchedulerRealPeriod(module));

getMultiModuleStatus(module).getStatusString(statusText);
status->setText(statusText);
lv_obj_clear_flag(module_status_w->getLvObj(), LV_OBJ_FLAG_HIDDEN);
}
Expand Down Expand Up @@ -242,6 +250,9 @@ class VersionDialog : public Dialog
mod_ver += " ";
mod_ver += variants[variant];
}

snprintf(tmp, 20, " %d Hz", 1000000 / getMixerSchedulerRealPeriod(module));
mod_ver += tmp;
}
status->setText(mod_ver);
lv_obj_clear_flag(module_status_w->getLvObj(), LV_OBJ_FLAG_HIDDEN);
Expand Down Expand Up @@ -292,16 +303,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);
Expand All @@ -311,6 +323,7 @@ class VersionDialog : public Dialog
update();
Dialog::checkEvents();
}
#endif
};

RadioVersionPage::RadioVersionPage():
Expand Down
42 changes: 29 additions & 13 deletions radio/src/gui/common/stdlcd/radio_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include "opentx.h"
#include "options.h"
#include "hal/module_port.h"

#if defined(CROSSFIRE)
#include "mixer_scheduler.h"
#endif
Expand Down Expand Up @@ -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;
}

Expand All @@ -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*/;
}
Expand All @@ -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;
Expand All @@ -151,8 +171,7 @@ void menuRadioModulesVersion(event_t event)
#if defined(CROSSFIRE)
if (isModuleCrossfire(module)) {
char statusText[64] = "";
sprintf(statusText, "%d Hz %zu Err",
1000000 / getMixerSchedulerPeriod(), (size_t)telemetryErrors);
snprintf(statusText, 64, "%d Hz", 1000000 / getMixerSchedulerRealPeriod(module));
lcdDrawText(COLUMN2_X, y, statusText);
y += FH;
continue;
Expand Down Expand Up @@ -250,10 +269,7 @@ void menuRadioVersion(event_t event)

coord_t y = MENU_HEADER_HEIGHT + 2;
lcdDrawText(FW, y, vers_stamp, SMLSIZE);
y += 5 * (FH - 1);


y += 2;
y += 5 * (FH - 1) + 2;

#if defined(PCBTARANIS)
lcdDrawText(INDENT_WIDTH, y, BUTTON(TR_FIRMWARE_OPTIONS), menuVerticalPosition == ITEM_RADIO_FIRMWARE_OPTIONS ? INVERS : 0);
Expand Down
Loading