mirror of
https://github.com/anklimov/lighthub
synced 2025-12-09 21:29:49 +03:00
pre-release, save2flash, mdns bugs, dmx, .....
This commit is contained in:
@@ -1,34 +1,41 @@
|
||||
#pragma once
|
||||
#include <Print.h>
|
||||
#include <Arduino.h>
|
||||
#include <HardwareSerial.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined (STM32)
|
||||
#include <USBSerial.h>
|
||||
#endif
|
||||
|
||||
#ifndef LOGBUFFER_SIZE
|
||||
#define LOGBUFFER_SIZE 80
|
||||
#endif
|
||||
|
||||
#ifdef SYSLOG_ENABLE
|
||||
#include <Syslog.h>
|
||||
static char logBuffer[LOGBUFFER_SIZE];
|
||||
static int logBufferPos=0;
|
||||
#endif
|
||||
|
||||
extern uint8_t serialDebugLevel;
|
||||
extern uint8_t udpDebugLevel;
|
||||
|
||||
|
||||
#ifndef SerialPortType
|
||||
#define SerialPortType HardwareSerial
|
||||
#endif
|
||||
|
||||
#define LOG_DEBUG 7
|
||||
#define LOG_INFO 6
|
||||
#define LOG_INFO 6
|
||||
#define LOG_ERROR 3
|
||||
|
||||
static uint8_t serialDebugLevel = 7;
|
||||
static uint8_t udpDebugLevel =7;
|
||||
|
||||
class Streamlog : public Print
|
||||
{
|
||||
public:
|
||||
#ifdef SYSLOG_ENABLE
|
||||
Streamlog (HardwareSerial * _serialPort, int _severity = LOG_DEBUG, Syslog * _syslog = NULL, uint8_t _ledPattern = 0);
|
||||
Streamlog (SerialPortType * _serialPort, uint8_t _severity = LOG_DEBUG, Syslog * _syslog = NULL, uint8_t _ledPattern = 0);
|
||||
#else
|
||||
Streamlog (HardwareSerial * _serialPort, int _severity = LOG_DEBUG, uint8_t _ledPattern = 0);
|
||||
Streamlog (SerialPortType * _serialPort, uint8_t _severity = LOG_DEBUG, uint8_t _ledPattern = 0);
|
||||
#endif
|
||||
// {serialPort=_serialPort;severity=_severity; syslog=_syslog; }
|
||||
void begin(unsigned long speed);
|
||||
void end() ;
|
||||
|
||||
@@ -40,8 +47,8 @@ class Streamlog : public Print
|
||||
using Print::write; // pull in write(str) and write(buf, size) from Print
|
||||
operator bool() {return true;};
|
||||
private:
|
||||
uint16_t severity;
|
||||
HardwareSerial *serialPort;
|
||||
uint8_t severity;
|
||||
SerialPortType *serialPort;
|
||||
#ifdef SYSLOG_ENABLE
|
||||
Syslog * syslog;
|
||||
uint8_t ledPattern;
|
||||
|
||||
Reference in New Issue
Block a user