feat: Flysky PL18 Support (#4105)
Co-authored-by: raphaelcoeffic <raphael.coeffic@frafos.com> Co-authored-by: rotorman <risto.koiva@web.de> Co-authored-by: Xy201207 <yaoxu@flysky.com> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
raphaelcoeffic
rotorman
Xy201207
Peter Feerick
parent
5153aaeea0
commit
cc17046e7a
@@ -93,7 +93,7 @@ void RadioCalibrationPage::buildBody(FormWindow * window)
|
||||
deco->setSlidersVisible(true);
|
||||
deco->setFlightModeVisible(false);
|
||||
|
||||
#if defined(PCBNV14)
|
||||
#if defined(PCBNV14) || defined(PCBPL18)
|
||||
new TextButton(window, {LCD_W - 120, LCD_H - 140, 90, 40}, "Next",
|
||||
[=]() -> uint8_t {
|
||||
nextStep();
|
||||
|
||||
@@ -177,7 +177,7 @@ class AnaCalibratedViewWindow: public AnaViewWindow {
|
||||
}, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_grid_cell(lbl->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 5, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
#if !defined(SIMU) && !defined(PCBNV14)
|
||||
#if !defined(SIMU) && !defined(PCBNV14) && !defined(PCBPL18)
|
||||
line = newLine(grid);
|
||||
auto lbl2 = new StaticText(line, rect_t{}, std::string("Touch GT911 FW ver: ") + std::to_string(touchGT911fwver), COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_grid_cell(lbl2->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 5, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
|
||||
#include "hal/rotary_encoder.h"
|
||||
|
||||
#if defined(PCBPL18)
|
||||
static const uint8_t _trimMap[MAX_TRIMS * 2] = {8, 9, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 0, 1, 6, 7};
|
||||
#else
|
||||
static const uint8_t _trimMap[MAX_TRIMS * 2] = {6, 7, 4, 5, 2, 3, 0, 1, 8, 9, 10, 11};
|
||||
#endif
|
||||
|
||||
static EnumKeys get_ith_key(uint8_t i)
|
||||
{
|
||||
@@ -122,8 +126,13 @@ class RadioKeyDiagsWindow : public Window
|
||||
for (uint8_t i = 0; i < keysGetMaxTrims() * 2; i++) {
|
||||
coord_t y = 1 + FH + FH * (i / 2);
|
||||
if (i & 1) {
|
||||
#if defined(PCBPL18)
|
||||
dc->drawText(TRIM_COLUMN, y, "TR", COLOR_THEME_PRIMARY1);
|
||||
dc->drawNumber(TRIM_COLUMN + 20, y, i / 2 + 1, COLOR_THEME_PRIMARY1);
|
||||
#else
|
||||
dc->drawText(TRIM_COLUMN, y, "T", COLOR_THEME_PRIMARY1);
|
||||
dc->drawNumber(TRIM_COLUMN + 10, y, i / 2 + 1, COLOR_THEME_PRIMARY1);
|
||||
#endif
|
||||
}
|
||||
displayTrimState(dc, i & 1 ? TRIM_PLUS_COLUMN : TRIM_MINUS_COLUMN, y, _trimMap[i]);
|
||||
}
|
||||
|
||||
@@ -110,12 +110,14 @@ static void ghostmoduleconfig_cb(lv_event_t* e)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS) && !defined(PCBPL18)
|
||||
void RadioGhostModuleConfig::onCancel()
|
||||
{
|
||||
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYLEFT;
|
||||
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||
}
|
||||
#endif
|
||||
|
||||
RadioGhostModuleConfig::RadioGhostModuleConfig(uint8_t moduleIdx) :
|
||||
Page(ICON_RADIO_TOOLS),
|
||||
@@ -144,7 +146,7 @@ void RadioGhostModuleConfig::buildBody(FormWindow * window)
|
||||
new GhostModuleConfigWindow(window, {0, 0, LCD_W, LCD_H - MENU_HEADER_HEIGHT - 5});
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
#if defined(HARDWARE_KEYS) && !defined(PCBPL18)
|
||||
void RadioGhostModuleConfig::onEvent(event_t event)
|
||||
{
|
||||
switch (event) {
|
||||
|
||||
@@ -28,7 +28,7 @@ class RadioGhostModuleConfig: public Page
|
||||
public:
|
||||
explicit RadioGhostModuleConfig(uint8_t moduleIdx);
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
#if defined(HARDWARE_KEYS) && !defined(PCBPL18)
|
||||
void onEvent(event_t event) override;
|
||||
void checkEvents() override;
|
||||
void onCancel() override;
|
||||
|
||||
@@ -77,13 +77,14 @@ class VersionDialog : public Dialog
|
||||
memclear(&reusableBuffer.hardwareAndSettings.modules,
|
||||
sizeof(reusableBuffer.hardwareAndSettings.modules));
|
||||
reusableBuffer.hardwareAndSettings.updateTime = get_tmr10ms();
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
// Query modules
|
||||
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) && modulePortPowered(EXTERNAL_MODULE)) {
|
||||
moduleState[EXTERNAL_MODULE].readModuleInformation(
|
||||
@@ -165,11 +166,13 @@ class VersionDialog : public Dialog
|
||||
|
||||
void update()
|
||||
{
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
updateModule(INTERNAL_MODULE,
|
||||
int_name,
|
||||
int_module_status_w, int_status,
|
||||
int_rx_name_w, int_rx_name,
|
||||
int_rx_status_w, int_rx_status);
|
||||
#endif
|
||||
updateModule(EXTERNAL_MODULE,
|
||||
ext_name,
|
||||
ext_module_status_w, ext_status,
|
||||
@@ -309,11 +312,13 @@ class VersionDialog : public Dialog
|
||||
{
|
||||
if (get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) {
|
||||
// Query modules
|
||||
#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) && modulePortPowered(EXTERNAL_MODULE)) {
|
||||
moduleState[EXTERNAL_MODULE].readModuleInformation(
|
||||
&reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE],
|
||||
@@ -332,7 +337,7 @@ RadioVersionPage::RadioVersionPage():
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(PCBNV14)
|
||||
#if defined(PCBNV14) || defined(PCBPL18)
|
||||
extern const char* boardLcdType;
|
||||
#endif
|
||||
|
||||
@@ -355,7 +360,7 @@ void RadioVersionPage::build(FormWindow * window)
|
||||
version += options[i];
|
||||
}
|
||||
|
||||
#if defined(PCBNV14) && !defined(SIMU)
|
||||
#if (defined(PCBNV14) || defined(PCBPL18)) && !defined(SIMU)
|
||||
version += nl;
|
||||
version += "LCD: ";
|
||||
version += boardLcdType;
|
||||
|
||||
@@ -180,20 +180,21 @@ class SpecialFunctionEditPage : public Page
|
||||
case FUNC_PLAY_TRACK:
|
||||
case FUNC_BACKGND_MUSIC:
|
||||
case FUNC_PLAY_SCRIPT:
|
||||
case FUNC_RGB_LED:
|
||||
new StaticText(line, rect_t{}, STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new FileChoice(
|
||||
line, rect_t{},
|
||||
func == FUNC_PLAY_SCRIPT
|
||||
? SCRIPTS_FUNCS_PATH
|
||||
func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED
|
||||
? (func == FUNC_PLAY_SCRIPT ? SCRIPTS_FUNCS_PATH : SCRIPTS_RGB_PATH)
|
||||
: std::string(SOUNDS_PATH, SOUNDS_PATH_LNG_OFS) +
|
||||
std::string(currentLanguagePack->id, 2),
|
||||
func == FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT,
|
||||
(func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED) ? SCRIPTS_EXT : SOUNDS_EXT,
|
||||
sizeof(cfn->play.name),
|
||||
[=]() { return std::string(cfn->play.name, ZLEN(cfn->play.name)); },
|
||||
[=](std::string newValue) {
|
||||
strncpy(cfn->play.name, newValue.c_str(), sizeof(cfn->play.name));
|
||||
SET_DIRTY();
|
||||
if (func == FUNC_PLAY_SCRIPT)
|
||||
if (func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED)
|
||||
LUA_LOAD_MODEL_SCRIPTS();
|
||||
},
|
||||
true); // strip extension
|
||||
|
||||
Reference in New Issue
Block a user