corridor_control/fan_control/include/serial.hpp
2021-07-04 19:32:01 +03:00

32 lines
803 B
C++

#include <Arduino.h>
#include <list>
class WsSerial{
std::list<String> debug;
public:
inline void print(const String& line){ println(line); }
inline void println(const String& line){
// enable debug the debugging
Serial.println(line.c_str());
if(debug.size() > 100 ) debug.pop_back();
debug.push_front(line);
}
inline void println(const float num){ println(String(num)) ; };
inline const String& first(){ return debug.front();};
inline void pop(){ return debug.pop_front();};
inline bool empty(){ return debug.empty();};
inline void clear(){ debug.clear();}
};
extern WsSerial debug_out;
#if(false)
#define DEBUG_OUT Serial
#define DEBUG_SERIAL true
#else
#define DEBUG_SERIAL false
#define DEBUG_OUT debug_out
#endif