Added a mcfg.telemetry_switch for CLI
If telemetry_switch=1 it change baudrate and protocol using aux channel, either it switch when armed/disarmed. This allows to keep MSP serial while armed for BT dongle if needed.
This commit is contained in:
parent
0d974e2882
commit
7bd2db04be
|
@ -132,6 +132,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "gps_baudrate", VAR_INT8, &mcfg.gps_baudrate, -1, 4 },
|
{ "gps_baudrate", VAR_INT8, &mcfg.gps_baudrate, -1, 4 },
|
||||||
{ "serialrx_type", VAR_UINT8, &mcfg.serialrx_type, 0, 2 },
|
{ "serialrx_type", VAR_UINT8, &mcfg.serialrx_type, 0, 2 },
|
||||||
{ "telemetry_softserial", VAR_UINT8, &mcfg.telemetry_softserial, 0, 1 },
|
{ "telemetry_softserial", VAR_UINT8, &mcfg.telemetry_softserial, 0, 1 },
|
||||||
|
{ "telemetry_switch", VAR_UINT8, &mcfg.telemetry_switch, 0, 1 },
|
||||||
{ "vbatscale", VAR_UINT8, &mcfg.vbatscale, 10, 200 },
|
{ "vbatscale", VAR_UINT8, &mcfg.vbatscale, 10, 200 },
|
||||||
{ "vbatmaxcellvoltage", VAR_UINT8, &mcfg.vbatmaxcellvoltage, 10, 50 },
|
{ "vbatmaxcellvoltage", VAR_UINT8, &mcfg.vbatmaxcellvoltage, 10, 50 },
|
||||||
{ "vbatmincellvoltage", VAR_UINT8, &mcfg.vbatmincellvoltage, 10, 50 },
|
{ "vbatmincellvoltage", VAR_UINT8, &mcfg.vbatmincellvoltage, 10, 50 },
|
||||||
|
|
|
@ -193,6 +193,7 @@ static void resetConf(void)
|
||||||
mcfg.power_adc_channel = 0;
|
mcfg.power_adc_channel = 0;
|
||||||
mcfg.serialrx_type = 0;
|
mcfg.serialrx_type = 0;
|
||||||
mcfg.telemetry_softserial = 0;
|
mcfg.telemetry_softserial = 0;
|
||||||
|
mcfg.telemetry_switch = 0;
|
||||||
mcfg.midrc = 1500;
|
mcfg.midrc = 1500;
|
||||||
mcfg.mincheck = 1100;
|
mcfg.mincheck = 1100;
|
||||||
mcfg.maxcheck = 1900;
|
mcfg.maxcheck = 1900;
|
||||||
|
|
2
src/mw.h
2
src/mw.h
|
@ -280,7 +280,7 @@ typedef struct master_t {
|
||||||
uint8_t softserial_inverted; // use inverted softserial input and output signals
|
uint8_t softserial_inverted; // use inverted softserial input and output signals
|
||||||
|
|
||||||
uint8_t telemetry_softserial; // Serial to use for Telemetry. 0:USART1, 1:SoftSerial1 (Enable FEATURE_SOFTSERIAL first)
|
uint8_t telemetry_softserial; // Serial to use for Telemetry. 0:USART1, 1:SoftSerial1 (Enable FEATURE_SOFTSERIAL first)
|
||||||
|
uint8_t telemetry_switch; // Use aux channel to change serial output & baudrate( MSP / Telemetry ). It disables automatic switching to Telemetry when armed.
|
||||||
config_t profile[3]; // 3 separate profiles
|
config_t profile[3]; // 3 separate profiles
|
||||||
uint8_t current_profile; // currently loaded profile
|
uint8_t current_profile; // currently loaded profile
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ void serialInit(uint32_t baudrate)
|
||||||
if (feature(FEATURE_INFLIGHT_ACC_CAL))
|
if (feature(FEATURE_INFLIGHT_ACC_CAL))
|
||||||
availableBoxes[idx++] = BOXCALIB;
|
availableBoxes[idx++] = BOXCALIB;
|
||||||
availableBoxes[idx++] = BOXOSD;
|
availableBoxes[idx++] = BOXOSD;
|
||||||
if (feature(FEATURE_TELEMETRY))
|
if (feature(FEATURE_TELEMETRY && mcfg.telemetry_switch))
|
||||||
availableBoxes[idx++] = BOXTELEMETRY;
|
availableBoxes[idx++] = BOXTELEMETRY;
|
||||||
numberBoxItems = idx;
|
numberBoxItems = idx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,11 @@ void initTelemetry(void)
|
||||||
|
|
||||||
void updateTelemetryState(void)
|
void updateTelemetryState(void)
|
||||||
{
|
{
|
||||||
bool State = mcfg.telemetry_softserial != TELEMETRY_UART ? true : (f.ARMED || rcOptions[BOXTELEMETRY]);
|
bool State;
|
||||||
|
if (!mcfg.telemetry_switch)
|
||||||
|
State = mcfg.telemetry_softserial != TELEMETRY_UART ? true : f.ARMED;
|
||||||
|
else
|
||||||
|
State = mcfg.telemetry_softserial != TELEMETRY_UART ? true : rcOptions[BOXTELEMETRY];
|
||||||
|
|
||||||
if (State != telemetryEnabled) {
|
if (State != telemetryEnabled) {
|
||||||
if (mcfg.telemetry_softserial == TELEMETRY_UART) {
|
if (mcfg.telemetry_softserial == TELEMETRY_UART) {
|
||||||
|
@ -246,7 +250,7 @@ static uint8_t cycleNum = 0;
|
||||||
|
|
||||||
void sendTelemetry(void)
|
void sendTelemetry(void)
|
||||||
{
|
{
|
||||||
if (mcfg.telemetry_softserial == TELEMETRY_UART && !f.ARMED && !rcOptions[BOXTELEMETRY])
|
if ((mcfg.telemetry_softserial == TELEMETRY_UART && !f.ARMED && !mcfg.telemetry_switch) || ( mcfg.telemetry_switch && !rcOptions[BOXTELEMETRY]))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (serialTotalBytesWaiting(core.telemport) != 0)
|
if (serialTotalBytesWaiting(core.telemport) != 0)
|
||||||
|
|
Loading…
Reference in New Issue