feat: ELRS bind command support (#4907)
This commit is contained in:
@@ -102,6 +102,8 @@ class ModuleWindow : public Window
|
||||
void startRSSIDialog(std::function<void()> closeHandler = nullptr);
|
||||
|
||||
void updateIDStaticText(int mdIdx);
|
||||
|
||||
void checkEvents() override;
|
||||
};
|
||||
|
||||
struct FailsafeChoice : public Window {
|
||||
@@ -156,6 +158,19 @@ ModuleWindow::ModuleWindow(Window* parent, uint8_t moduleIdx) :
|
||||
lv_obj_add_event_cb(lvobj, mw_refresh_cb, LV_EVENT_REFRESH, this);
|
||||
}
|
||||
|
||||
void ModuleWindow::checkEvents()
|
||||
{
|
||||
if (bindButton != nullptr) {
|
||||
if (TELEMETRY_STREAMING() && isModuleELRS(moduleIdx))
|
||||
bindButton->setText(STR_MODULE_UNBIND);
|
||||
else if (isModuleELRS(moduleIdx))
|
||||
bindButton->setText(STR_MODULE_BIND);
|
||||
|
||||
bindButton->show(isModuleBindRangeAvailable(moduleIdx));
|
||||
}
|
||||
Window::checkEvents();
|
||||
}
|
||||
|
||||
void ModuleWindow::updateIDStaticText(int mdIdx)
|
||||
{
|
||||
if (idUnique == nullptr) return;
|
||||
@@ -280,7 +295,7 @@ void ModuleWindow::updateModule()
|
||||
}
|
||||
});
|
||||
|
||||
if (isModuleBindRangeAvailable(moduleIdx)) {
|
||||
if (isModuleBindRangeAvailable(moduleIdx) || isModuleCrossfire(moduleIdx)) {
|
||||
bindButton = new TextButton(box, rect_t{}, STR_MODULE_BIND);
|
||||
bindButton->setPressHandler([=]() -> uint8_t {
|
||||
if (moduleState[moduleIdx].mode == MODULE_MODE_RANGECHECK) {
|
||||
@@ -312,6 +327,8 @@ void ModuleWindow::updateModule()
|
||||
}
|
||||
#endif
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_BIND;
|
||||
if (isModuleELRS(moduleIdx))
|
||||
AUDIO_PLAY(AU_SPECIAL_SOUND_CHEEP); // Since ELRS bind is just one frame, we need to play the sound manually
|
||||
#if defined(AFHDS2)
|
||||
if (isModuleAFHDS2A(moduleIdx)) {
|
||||
resetPulsesAFHDS2();
|
||||
|
||||
@@ -126,7 +126,7 @@ class VersionDialog : public BaseDialog
|
||||
new StaticText(int_rx_name_w, rect_t{}, "");
|
||||
int_rx_name_w->hide();
|
||||
|
||||
// internal reciever status
|
||||
// internal receiver status
|
||||
int_rx_status_w = form->newLine(grid);
|
||||
new StaticText(int_rx_status_w, rect_t{}, STR_STATUS);
|
||||
int_rx_status =
|
||||
@@ -195,6 +195,8 @@ class VersionDialog : public BaseDialog
|
||||
// snprintf(statusText, 64, "%d Hz %" PRIu32 " Err", hz, telemetryErrors);
|
||||
snprintf(statusText, 64, "%d Hz", hz);
|
||||
status->setText(statusText);
|
||||
snprintf(statusText, 64, "%s V%u.%u.%u", crossfireModuleStatus[module].name, crossfireModuleStatus[module].major, crossfireModuleStatus[module].minor, crossfireModuleStatus[module].revision);
|
||||
name->setText(statusText);
|
||||
module_status_w->show();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user