mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Allow CLI to be compiled out.
First cut, as proof-of-concept. This allows CJMCU target to be built without CLI and with Blackbox.
This commit is contained in:
parent
67c6967da7
commit
d0a9d14b87
15 changed files with 35 additions and 6 deletions
|
@ -346,11 +346,13 @@ void serialInit(serialConfig_t *initialSerialConfig, bool softserialEnabled)
|
||||||
|
|
||||||
void handleSerial(void)
|
void handleSerial(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_CLI
|
||||||
// in cli mode, all serial stuff goes to here. enter cli mode by sending #
|
// in cli mode, all serial stuff goes to here. enter cli mode by sending #
|
||||||
if (cliMode) {
|
if (cliMode) {
|
||||||
cliProcess();
|
cliProcess();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mspProcess();
|
mspProcess();
|
||||||
}
|
}
|
||||||
|
@ -366,9 +368,14 @@ void cliEnter(serialPort_t *serialPort);
|
||||||
|
|
||||||
void evaluateOtherData(serialPort_t *serialPort, uint8_t receivedChar)
|
void evaluateOtherData(serialPort_t *serialPort, uint8_t receivedChar)
|
||||||
{
|
{
|
||||||
|
#ifndef USE_CLI
|
||||||
|
UNUSED(serialPort);
|
||||||
|
#else
|
||||||
if (receivedChar == '#') {
|
if (receivedChar == '#') {
|
||||||
cliEnter(serialPort);
|
cliEnter(serialPort);
|
||||||
} else if (receivedChar == serialConfig->reboot_character) {
|
}
|
||||||
|
#endif
|
||||||
|
if (receivedChar == serialConfig->reboot_character) {
|
||||||
systemResetToBootloader();
|
systemResetToBootloader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,12 @@
|
||||||
|
|
||||||
#include "serial_cli.h"
|
#include "serial_cli.h"
|
||||||
|
|
||||||
|
// FIXME remove this for targets that don't need a CLI. Perhaps use a no-op macro when USE_CLI is not enabled
|
||||||
|
// signal that we're in cli mode
|
||||||
|
uint8_t cliMode = 0;
|
||||||
|
|
||||||
|
#ifdef USE_CLI
|
||||||
|
|
||||||
extern uint16_t cycleTime; // FIXME dependency on mw.c
|
extern uint16_t cycleTime; // FIXME dependency on mw.c
|
||||||
|
|
||||||
void gpsEnablePassthrough(serialPort_t *gpsPassthroughPort);
|
void gpsEnablePassthrough(serialPort_t *gpsPassthroughPort);
|
||||||
|
@ -132,9 +138,6 @@ static void cliFlashWrite(char *cmdline);
|
||||||
static void cliFlashRead(char *cmdline);
|
static void cliFlashRead(char *cmdline);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// signal that we're in cli mode
|
|
||||||
uint8_t cliMode = 0;
|
|
||||||
|
|
||||||
// buffer
|
// buffer
|
||||||
static char cliBuffer[48];
|
static char cliBuffer[48];
|
||||||
static uint32_t bufferIndex = 0;
|
static uint32_t bufferIndex = 0;
|
||||||
|
@ -1767,3 +1770,4 @@ void cliInit(serialConfig_t *serialConfig)
|
||||||
{
|
{
|
||||||
UNUSED(serialConfig);
|
UNUSED(serialConfig);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -347,7 +347,10 @@ void init(void)
|
||||||
imuInit();
|
imuInit();
|
||||||
|
|
||||||
mspInit(&masterConfig.serialConfig);
|
mspInit(&masterConfig.serialConfig);
|
||||||
|
|
||||||
|
#ifdef USE_CLI
|
||||||
cliInit(&masterConfig.serialConfig);
|
cliInit(&masterConfig.serialConfig);
|
||||||
|
#endif
|
||||||
|
|
||||||
failsafeInit(&masterConfig.rxConfig);
|
failsafeInit(&masterConfig.rxConfig);
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@
|
||||||
//#define DISPLAY
|
//#define DISPLAY
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
||||||
#define SPEKTRUM_BIND
|
#define SPEKTRUM_BIND
|
||||||
// USART2, PA3
|
// USART2, PA3
|
||||||
|
|
|
@ -113,6 +113,7 @@
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
||||||
#if defined(OPBL)
|
#if defined(OPBL)
|
||||||
#undef AUTOTUNE // disabled for OPBL build due to code size.
|
#undef AUTOTUNE // disabled for OPBL build due to code size.
|
||||||
|
|
|
@ -123,3 +123,4 @@
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
|
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
//#define USE_SERVOS
|
//#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
||||||
#define SPEKTRUM_BIND
|
#define SPEKTRUM_BIND
|
||||||
// USART2, PA3
|
// USART2, PA3
|
||||||
|
@ -68,6 +69,10 @@
|
||||||
// Since the CJMCU PCB has holes for 4 motors in each corner we can save same flash space by disabling support for other mixers.
|
// Since the CJMCU PCB has holes for 4 motors in each corner we can save same flash space by disabling support for other mixers.
|
||||||
#define USE_QUAD_MIXER_ONLY
|
#define USE_QUAD_MIXER_ONLY
|
||||||
|
|
||||||
|
|
||||||
#if (FLASH_SIZE > 64)
|
#if (FLASH_SIZE > 64)
|
||||||
#define BLACKBOX
|
#define BLACKBOX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#undef USE_CLI
|
||||||
|
//#define BLACKBOX
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
||||||
#define SPEKTRUM_BIND
|
#define SPEKTRUM_BIND
|
||||||
// USART2, PA3
|
// USART2, PA3
|
||||||
|
|
|
@ -165,6 +165,7 @@
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
||||||
#define SPEKTRUM_BIND
|
#define SPEKTRUM_BIND
|
||||||
// USART2, PA3
|
// USART2, PA3
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
||||||
#define SPEKTRUM_BIND
|
#define SPEKTRUM_BIND
|
||||||
// USART2, PA3
|
// USART2, PA3
|
||||||
|
|
|
@ -112,3 +112,4 @@
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define BLACKBOX
|
#define BLACKBOX
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
|
@ -136,3 +136,4 @@
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
|
@ -109,11 +109,12 @@
|
||||||
|
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define BLACKBOX
|
#define BLACKBOX
|
||||||
|
#define TELEMETRY
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define GPS
|
#define GPS
|
||||||
#define DISPLAY
|
#define DISPLAY
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
#define TELEMETRY
|
#define USE_CLI
|
||||||
|
|
||||||
#define LED_STRIP
|
#define LED_STRIP
|
||||||
#if 1
|
#if 1
|
||||||
|
|
|
@ -153,3 +153,4 @@
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define DISPLAY
|
#define DISPLAY
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
|
@ -97,3 +97,4 @@
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
|
#define USE_CLI
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue