platform: use Static<> init for serial printer, remove carriage return

This commit is contained in:
Torrie Fischer 2023-12-11 08:06:22 +01:00
parent 63a705ddd4
commit 7418172f79

View File

@ -23,13 +23,14 @@ NTPClient timeClient(wifiUdp, "pool.ntp.org", 3600 * -7);
#ifdef PLATFORM_PHOTON #ifdef PLATFORM_PHOTON
STARTUP(BootOptions::initPins()); STARTUP(BootOptions::initPins());
#else #else
#include "inputs/Serial.h"
#ifdef CONFIG_MQTT #ifdef CONFIG_MQTT
#include "platform/arduino/MQTTTelemetry.h" #include "platform/arduino/MQTTTelemetry.h"
#endif #endif
void printNewline(Print* logOutput, int logLevel) void printNewline(Print* logOutput, int logLevel)
{ {
(void)logLevel; // unused (void)logLevel; // unused
logOutput->print("\r\n"); logOutput->print("\n");
} }
int printEspLog(const char* fmt, va_list args) int printEspLog(const char* fmt, va_list args)
{ {
@ -101,7 +102,7 @@ Platform::preSetup()
Log.begin(LOG_LEVEL_TRACE, Static<MQTTTelemetry>::instance()->logPrinter()); Log.begin(LOG_LEVEL_TRACE, Static<MQTTTelemetry>::instance()->logPrinter());
Static<MQTTTelemetry>::instance()->setSequencer(Static<Sequencer>::instance()); Static<MQTTTelemetry>::instance()->setSequencer(Static<Sequencer>::instance());
#else #else
Log.begin(LOG_LEVEL_TRACE, &Serial); Log.begin(LOG_LEVEL_TRACE, Static<SerialInput>::instance()->logPrinter());
#endif #endif
Log.setSuffix(printNewline); Log.setSuffix(printNewline);
#endif #endif