-
-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(X10/X12S) Int/Ext Antenna UI (#1765)
* feature(colorlcd): antenna selection * fix: let's assume all internal XJT modules used in horus targets are either X10 or X12S type * fix NV14 compilation Co-authored-by: Raphael Coeffic <[email protected]>
- Loading branch information
1 parent
324c8e9
commit e90cd0f
Showing
11 changed files
with
271 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (C) EdgeTX | ||
* | ||
* Based on code named | ||
* opentx - https://github.com/opentx/opentx | ||
* th9x - http://code.google.com/p/th9x | ||
* er9x - http://code.google.com/p/er9x | ||
* gruvin9x - http://code.google.com/p/gruvin9x | ||
* | ||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#include "pxx1_settings.h" | ||
#include "choice.h" | ||
|
||
#include "opentx.h" | ||
|
||
#define SET_DIRTY() storageDirty(EE_MODEL) | ||
|
||
PXX1AntennaSettings::PXX1AntennaSettings(Window* parent, | ||
const FlexGridLayout& g, | ||
uint8_t moduleIdx) : | ||
FormGroup(parent, rect_t{}), md(&g_model.moduleData[moduleIdx]) | ||
{ | ||
FlexGridLayout grid(g); | ||
setFlexLayout(); | ||
|
||
auto line = newLine(&grid); | ||
new StaticText(line, rect_t{}, STR_ANTENNA, 0, COLOR_THEME_PRIMARY1); | ||
|
||
if (md->pxx.antennaMode == ANTENNA_MODE_PER_MODEL) { | ||
md->pxx.antennaMode = ANTENNA_MODE_INTERNAL; | ||
SET_DIRTY(); | ||
} | ||
|
||
auto antennaChoice = new Choice( | ||
line, rect_t{}, STR_ANTENNA_MODES, ANTENNA_MODE_INTERNAL, | ||
ANTENNA_MODE_EXTERNAL, GET_DEFAULT(md->pxx.antennaMode), | ||
[=](int32_t antenna) -> void { | ||
if (!isExternalAntennaEnabled() && (antenna == ANTENNA_MODE_EXTERNAL)) { | ||
if (confirmationDialog(STR_ANTENNACONFIRM1, STR_ANTENNACONFIRM2)) { | ||
md->pxx.antennaMode = antenna; | ||
SET_DIRTY(); | ||
} | ||
} else { | ||
md->pxx.antennaMode = antenna; | ||
SET_DIRTY(); | ||
checkExternalAntenna(); | ||
} | ||
}); | ||
|
||
antennaChoice->setAvailableHandler( | ||
[=](int8_t mode) { return mode != ANTENNA_MODE_PER_MODEL; }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C) EdgeTX | ||
* | ||
* Based on code named | ||
* opentx - https://github.com/opentx/opentx | ||
* th9x - http://code.google.com/p/th9x | ||
* er9x - http://code.google.com/p/er9x | ||
* gruvin9x - http://code.google.com/p/gruvin9x | ||
* | ||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "form.h" | ||
#include "module_setup.h" | ||
|
||
struct ModuleData; | ||
|
||
class PXX1AntennaSettings : public FormGroup, public ModuleOptions | ||
{ | ||
ModuleData* md; | ||
|
||
void update() override {} | ||
|
||
public: | ||
PXX1AntennaSettings(Window* parent, const FlexGridLayout& g, uint8_t moduleIdx); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.