Linux: Serial minor update (#1053)
- The symlink name for the PTY device is set using --my-serial-port making --my-serial-pty deprecated - Replace MY_LINUX_IS_SERIAL_PTY with MY_LINUX_SERIAL_IS_PTY - MY_DEBUGDEVICE can be used to print debug messages from MySensors (as it is currently in the other architectures) - Rename SerialSimulator class to StdInOutStream - Remove old deprecated option --my-radio
This commit is contained in:
@@ -165,8 +165,37 @@ void hwPinMode(uint8_t pin, uint8_t mode)
|
||||
|
||||
void hwDebugPrint(const char *fmt, ...)
|
||||
{
|
||||
#ifndef MY_DISABLED_SERIAL
|
||||
#ifdef MY_DEBUGDEVICE
|
||||
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%" PRIu8 ";0;%" PRIu8 ";%" PRIu32 " "),
|
||||
C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
||||
MY_DEBUGDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
// prepend timestamp
|
||||
MY_DEBUGDEVICE.print(hwMillis());
|
||||
MY_DEBUGDEVICE.print(" ");
|
||||
#endif
|
||||
va_list args;
|
||||
va_start (args, fmt );
|
||||
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// Truncate message if this is gateway node
|
||||
fmtBuffer[sizeof(fmtBuffer) - 2] = '\n';
|
||||
fmtBuffer[sizeof(fmtBuffer) - 1] = '\0';
|
||||
#endif
|
||||
va_end (args);
|
||||
MY_DEBUGDEVICE.print(fmtBuffer);
|
||||
MY_DEBUGDEVICE.flush();
|
||||
#else
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vlogDebug(fmt, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
#else
|
||||
(void)fmt;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
#include <cstdlib>
|
||||
#include <pthread.h>
|
||||
#include "SerialPort.h"
|
||||
#include "SerialSimulator.h"
|
||||
#include "StdInOutStream.h"
|
||||
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
#ifdef MY_LINUX_IS_SERIAL_PTY
|
||||
SerialPort Serial = SerialPort(MY_LINUX_SERIAL_PTY, true);
|
||||
#ifdef MY_LINUX_SERIAL_PORT
|
||||
#ifdef MY_LINUX_SERIAL_IS_PTY
|
||||
SerialPort Serial = SerialPort(MY_LINUX_SERIAL_PORT, true);
|
||||
#else
|
||||
SerialPort Serial = SerialPort(MY_LINUX_SERIAL_PORT);
|
||||
SerialPort Serial = SerialPort(MY_LINUX_SERIAL_PORT, false);
|
||||
#endif
|
||||
#else
|
||||
SerialSimulator Serial = SerialSimulator();
|
||||
StdInOutStream Serial = StdInOutStream();
|
||||
#endif
|
||||
|
||||
#ifndef MY_SERIALDEVICE
|
||||
|
||||
Reference in New Issue
Block a user