mirror of
https://github.com/opentx/opentx.git
synced 2025-07-20 14:55:13 +03:00
Cli fixes
This commit is contained in:
parent
6356fbb2f4
commit
17cb8f9459
6 changed files with 17 additions and 27 deletions
|
@ -272,7 +272,7 @@ int cliExecLine(char * line)
|
||||||
void cliTask(void * pdata)
|
void cliTask(void * pdata)
|
||||||
{
|
{
|
||||||
char line[CLI_COMMAND_MAX_LEN+1];
|
char line[CLI_COMMAND_MAX_LEN+1];
|
||||||
uint8_t pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
cliPrompt();
|
cliPrompt();
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,14 @@
|
||||||
#include "dump.h"
|
#include "dump.h"
|
||||||
#include "cli.h"
|
#include "cli.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
uint8_t serial2TracesEnabled();
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SIMU)
|
#if defined(SIMU)
|
||||||
typedef void (*traceCallbackFunc)(const char * text);
|
typedef void (*traceCallbackFunc)(const char * text);
|
||||||
extern traceCallbackFunc traceCallback;
|
extern traceCallbackFunc traceCallback;
|
||||||
|
@ -49,9 +57,9 @@ void debugPrintf(const char * format, ...);
|
||||||
#elif defined(DEBUG) && defined(CLI) && defined(USB_SERIAL)
|
#elif defined(DEBUG) && defined(CLI) && defined(USB_SERIAL)
|
||||||
#define debugPrintf(...) do { if (cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
|
#define debugPrintf(...) do { if (cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
|
||||||
#elif defined(DEBUG) && defined(CLI)
|
#elif defined(DEBUG) && defined(CLI)
|
||||||
#define debugPrintf(...) do { if (serialTracesEnabled() && cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
|
#define debugPrintf(...) do { if (serial2TracesEnabled() && cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
|
||||||
#elif defined(DEBUG) && defined(CPUARM)
|
#elif defined(DEBUG) && defined(CPUARM)
|
||||||
#define debugPrintf(...) do { if (serialTracesEnabled()) serialPrintf(__VA_ARGS__); } while(0)
|
#define debugPrintf(...) do { if (serial2TracesEnabled()) serialPrintf(__VA_ARGS__); } while(0)
|
||||||
#else
|
#else
|
||||||
#define debugPrintf(...)
|
#define debugPrintf(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,24 +40,6 @@ uint8_t currentSpeakerVolume = 255;
|
||||||
uint8_t requiredSpeakerVolume = 255;
|
uint8_t requiredSpeakerVolume = 255;
|
||||||
uint8_t requestScreenshot = false;
|
uint8_t requestScreenshot = false;
|
||||||
|
|
||||||
|
|
||||||
#if defined(USB_SERIAL)
|
|
||||||
|
|
||||||
Fifo<64> cliRxFifo;
|
|
||||||
|
|
||||||
void handleCli()
|
|
||||||
{
|
|
||||||
uint8_t c;
|
|
||||||
|
|
||||||
while(cliRxFifo.pop(c)) {
|
|
||||||
//send back
|
|
||||||
usbSerialPutc(c);
|
|
||||||
usbSerialPutc('+');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void handleUsbConnection()
|
void handleUsbConnection()
|
||||||
{
|
{
|
||||||
#if defined(PCBTARANIS) && !defined(SIMU)
|
#if defined(PCBTARANIS) && !defined(SIMU)
|
||||||
|
@ -129,9 +111,6 @@ void perMain()
|
||||||
handleUsbConnection();
|
handleUsbConnection();
|
||||||
checkTrainerSettings();
|
checkTrainerSettings();
|
||||||
checkBattery();
|
checkBattery();
|
||||||
#if defined(USB_SERIAL)
|
|
||||||
handleCli();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t evt = getEvent(false);
|
uint8_t evt = getEvent(false);
|
||||||
if (evt && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) backlightOn(); // on keypress turn the light on
|
if (evt && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) backlightOn(); // on keypress turn the light on
|
||||||
|
|
|
@ -290,7 +290,7 @@ uint32_t telemetryTransmitPending();
|
||||||
void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size);
|
void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size);
|
||||||
|
|
||||||
// Second UART driver
|
// Second UART driver
|
||||||
#define serialTracesEnabled() false
|
#define serial2TracesEnabled() false
|
||||||
void serial2TelemetryInit(unsigned int protocol);
|
void serial2TelemetryInit(unsigned int protocol);
|
||||||
bool telemetrySecondPortReceive(uint8_t & data);
|
bool telemetrySecondPortReceive(uint8_t & data);
|
||||||
|
|
||||||
|
|
|
@ -323,8 +323,6 @@ void hapticOff(void);
|
||||||
|
|
||||||
// Second serial port driver
|
// Second serial port driver
|
||||||
#define DEBUG_BAUDRATE 115200
|
#define DEBUG_BAUDRATE 115200
|
||||||
extern uint8_t serial2Mode;
|
|
||||||
#define serialTracesEnabled() (serial2Mode == 0)
|
|
||||||
void serial2Init(unsigned int mode, unsigned int protocol);
|
void serial2Init(unsigned int mode, unsigned int protocol);
|
||||||
void serial2Putc(char c);
|
void serial2Putc(char c);
|
||||||
#define serial2TelemetryInit(protocol) serial2Init(UART_MODE_TELEMETRY, protocol)
|
#define serial2TelemetryInit(protocol) serial2Init(UART_MODE_TELEMETRY, protocol)
|
||||||
|
|
|
@ -113,6 +113,11 @@ void serial2Stop()
|
||||||
USART_DeInit(SERIAL_USART);
|
USART_DeInit(SERIAL_USART);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t serial2TracesEnabled()
|
||||||
|
{
|
||||||
|
return (serial2Mode == 0);
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
extern "C" void SERIAL_USART_IRQHandler(void)
|
extern "C" void SERIAL_USART_IRQHandler(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue