[NV14] Add range check button and power level choice (#857)
* add range and high power to MV14 * remove spaces * fix compilation * compilation fix 2 * Whitespace cleanup and placate git Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
@@ -1300,6 +1300,11 @@ class ModuleWindow : public FormGroup {
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
moduleState[moduleIdx].mode = MODULE_MODE_RANGECHECK;
|
moduleState[moduleIdx].mode = MODULE_MODE_RANGECHECK;
|
||||||
|
#if defined(AFHDS2)
|
||||||
|
if (isModuleFlySky(moduleIdx)) {
|
||||||
|
resetPulsesAFHDS2();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
auto rssiDialog = new DynamicMessageDialog(
|
auto rssiDialog = new DynamicMessageDialog(
|
||||||
this, "Range Test",
|
this, "Range Test",
|
||||||
[=]() {
|
[=]() {
|
||||||
@@ -1312,6 +1317,11 @@ class ModuleWindow : public FormGroup {
|
|||||||
rssiDialog->setCloseHandler([this]() {
|
rssiDialog->setCloseHandler([this]() {
|
||||||
rangeButton->check(false);
|
rangeButton->check(false);
|
||||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||||
|
#if defined(AFHDS2)
|
||||||
|
if (isModuleFlySky(moduleIdx)) {
|
||||||
|
resetPulsesAFHDS2();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1322,6 +1332,19 @@ class ModuleWindow : public FormGroup {
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(AFHDS2) && defined(PCBNV14)
|
||||||
|
if (isModuleAFHDS2A(moduleIdx) && getNV14RfFwVersion() >= 0x1000E) {
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), STR_MULTI_RFPOWER);
|
||||||
|
new Choice(this, grid.getFieldSlot(), "\007""Default""High", 0, 1,
|
||||||
|
GET_DEFAULT(g_model.moduleData[moduleIdx].flysky.rfPower),
|
||||||
|
[=](int32_t newValue) -> void {
|
||||||
|
g_model.moduleData[moduleIdx].flysky.rfPower = newValue;
|
||||||
|
resetPulsesAFHDS2();
|
||||||
|
});
|
||||||
|
grid.nextLine();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Failsafe
|
// Failsafe
|
||||||
if (isModuleFailsafeAvailable(moduleIdx)) {
|
if (isModuleFailsafeAvailable(moduleIdx)) {
|
||||||
hasFailsafe = true;
|
hasFailsafe = true;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ static uint32_t rfRxCount = 0;
|
|||||||
static uint8_t lastState = STATE_IDLE;
|
static uint8_t lastState = STATE_IDLE;
|
||||||
static uint32_t set_loop_cnt = 0;
|
static uint32_t set_loop_cnt = 0;
|
||||||
|
|
||||||
uint32_t NV14internalModuleFwVersion;
|
uint32_t NV14internalModuleFwVersion = 0;
|
||||||
|
|
||||||
static rf_info_t rf_info = {
|
static rf_info_t rf_info = {
|
||||||
.bind_power = BIND_LOW_POWER,
|
.bind_power = BIND_LOW_POWER,
|
||||||
|
|||||||
@@ -32,6 +32,10 @@
|
|||||||
#include "telemetry/multi.h"
|
#include "telemetry/multi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBNV14)
|
||||||
|
extern uint32_t NV14internalModuleFwVersion;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CROSSFIRE_CHANNELS_COUNT 16
|
#define CROSSFIRE_CHANNELS_COUNT 16
|
||||||
#define GHOST_CHANNELS_COUNT 16
|
#define GHOST_CHANNELS_COUNT 16
|
||||||
|
|
||||||
@@ -612,11 +616,25 @@ inline bool isModuleBindRangeAvailable(uint8_t moduleIdx)
|
|||||||
isModuleFlySky(moduleIdx);
|
isModuleFlySky(moduleIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint32_t getNV14RfFwVersion()
|
||||||
|
{
|
||||||
|
#if defined(PCBNV14)
|
||||||
|
return NV14internalModuleFwVersion;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline bool isModuleRangeAvailable(uint8_t moduleIdx)
|
inline bool isModuleRangeAvailable(uint8_t moduleIdx)
|
||||||
{
|
{
|
||||||
return isModuleBindRangeAvailable(moduleIdx)
|
bool ret = isModuleBindRangeAvailable(moduleIdx) && !IS_RX_MULTI(moduleIdx);
|
||||||
&& !IS_RX_MULTI(moduleIdx)
|
#if defined(PCBNV14)
|
||||||
&& !isModuleFlySky(moduleIdx);
|
ret = ret &&
|
||||||
|
(!isModuleFlySky(moduleIdx) || NV14internalModuleFwVersion >= 0x1000E);
|
||||||
|
#else
|
||||||
|
ret = ret && (!isModuleFlySky(moduleIdx));
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr uint8_t MAX_RXNUM = 63;
|
constexpr uint8_t MAX_RXNUM = 63;
|
||||||
|
|||||||
@@ -936,3 +936,7 @@ const char STR_ABOUTUS[] = TR_ABOUTUS;
|
|||||||
const char STR_AUTH_FAILURE[] = TR_AUTH_FAILURE;
|
const char STR_AUTH_FAILURE[] = TR_AUTH_FAILURE;
|
||||||
const char STR_PROTOCOL[] = TR_PROTOCOL;
|
const char STR_PROTOCOL[] = TR_PROTOCOL;
|
||||||
const char STR_RACING_MODE[] = TR_RACING_MODE;
|
const char STR_RACING_MODE[] = TR_RACING_MODE;
|
||||||
|
|
||||||
|
#if defined(PCBNV14)
|
||||||
|
const char STR_RFPOWER_AFHDS2[] = TR_RFPOWER_AFHDS2;
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -190,6 +190,10 @@
|
|||||||
#define LEN_PWR_OFF_DELAYS "\002"
|
#define LEN_PWR_OFF_DELAYS "\002"
|
||||||
#define TR_PWR_OFF_DELAYS "0s""1s""2s""4s"
|
#define TR_PWR_OFF_DELAYS "0s""1s""2s""4s"
|
||||||
|
|
||||||
|
#if defined(PCBNV14)
|
||||||
|
#define TR_RFPOWER_AFHDS2 "\007" "Default\0""High\0"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TR_SENSOR_RSSI "RSSI"
|
#define TR_SENSOR_RSSI "RSSI"
|
||||||
#define TR_SENSOR_R9PW "R9PW"
|
#define TR_SENSOR_R9PW "R9PW"
|
||||||
#define TR_SENSOR_RAS "SWR"
|
#define TR_SENSOR_RAS "SWR"
|
||||||
|
|||||||
Reference in New Issue
Block a user