Cli fixes
This commit is contained in:
+1
-1
@@ -272,7 +272,7 @@ int cliExecLine(char * line)
|
||||
void cliTask(void * pdata)
|
||||
{
|
||||
char line[CLI_COMMAND_MAX_LEN+1];
|
||||
uint8_t pos = 0;
|
||||
int pos = 0;
|
||||
|
||||
cliPrompt();
|
||||
|
||||
|
||||
+10
-2
@@ -42,6 +42,14 @@
|
||||
#include "dump.h"
|
||||
#include "cli.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
uint8_t serial2TracesEnabled();
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
typedef void (*traceCallbackFunc)(const char * text);
|
||||
extern traceCallbackFunc traceCallback;
|
||||
@@ -49,9 +57,9 @@ void debugPrintf(const char * format, ...);
|
||||
#elif defined(DEBUG) && defined(CLI) && defined(USB_SERIAL)
|
||||
#define debugPrintf(...) do { if (cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
|
||||
#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)
|
||||
#define debugPrintf(...) do { if (serialTracesEnabled()) serialPrintf(__VA_ARGS__); } while(0)
|
||||
#define debugPrintf(...) do { if (serial2TracesEnabled()) serialPrintf(__VA_ARGS__); } while(0)
|
||||
#else
|
||||
#define debugPrintf(...)
|
||||
#endif
|
||||
|
||||
@@ -40,24 +40,6 @@ uint8_t currentSpeakerVolume = 255;
|
||||
uint8_t requiredSpeakerVolume = 255;
|
||||
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()
|
||||
{
|
||||
#if defined(PCBTARANIS) && !defined(SIMU)
|
||||
@@ -129,9 +111,6 @@ void perMain()
|
||||
handleUsbConnection();
|
||||
checkTrainerSettings();
|
||||
checkBattery();
|
||||
#if defined(USB_SERIAL)
|
||||
handleCli();
|
||||
#endif
|
||||
|
||||
uint8_t evt = getEvent(false);
|
||||
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);
|
||||
|
||||
// Second UART driver
|
||||
#define serialTracesEnabled() false
|
||||
#define serial2TracesEnabled() false
|
||||
void serial2TelemetryInit(unsigned int protocol);
|
||||
bool telemetrySecondPortReceive(uint8_t & data);
|
||||
|
||||
|
||||
@@ -323,8 +323,6 @@ void hapticOff(void);
|
||||
|
||||
// Second serial port driver
|
||||
#define DEBUG_BAUDRATE 115200
|
||||
extern uint8_t serial2Mode;
|
||||
#define serialTracesEnabled() (serial2Mode == 0)
|
||||
void serial2Init(unsigned int mode, unsigned int protocol);
|
||||
void serial2Putc(char c);
|
||||
#define serial2TelemetryInit(protocol) serial2Init(UART_MODE_TELEMETRY, protocol)
|
||||
|
||||
@@ -113,6 +113,11 @@ void serial2Stop()
|
||||
USART_DeInit(SERIAL_USART);
|
||||
}
|
||||
|
||||
uint8_t serial2TracesEnabled()
|
||||
{
|
||||
return (serial2Mode == 0);
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" void SERIAL_USART_IRQHandler(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user