ESP32 / ESP8266 & BME280 / SHT2x sensor with InfluxDB support
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DebugLog.h 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * DebugLog.h
  3. *
  4. * ESP8266 / ESP32 Environmental Sensor
  5. *
  6. * ----------------------------------------------------------------------------
  7. * "THE BEER-WARE LICENSE" (Revision 42):
  8. * <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  9. * you can do whatever you want with this stuff. If we meet some day, and you
  10. * think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  11. * ----------------------------------------------------------------------------
  12. */
  13. #ifndef _DEBUG_LOG_H_
  14. #define _DEBUG_LOG_H_
  15. #include <Arduino.h>
  16. #ifdef ENABLE_DEBUGLOG
  17. #include <CircularBuffer.h>
  18. #define DEBUG_LOG_HISTORY_SIZE 1024
  19. #endif // ENABLE_DEBUGLOG
  20. class DebugLog {
  21. public:
  22. #ifdef ENABLE_DEBUGLOG
  23. String getBuffer(void);
  24. #endif // ENABLE_DEBUGLOG
  25. void write(char c);
  26. void print(String s);
  27. void print(int n);
  28. void println(void);
  29. void println(String s);
  30. void println(int n);
  31. size_t printf(const char * format, ...) __attribute__ ((format (printf, 2, 3)));
  32. size_t printf(const char * format, va_list args);
  33. private:
  34. void sendToTargets(String s);
  35. #ifdef ENABLE_DEBUGLOG
  36. void addToBuffer(String s);
  37. CircularBuffer<char, DEBUG_LOG_HISTORY_SIZE> buffer;
  38. #endif // ENABLE_DEBUGLOG
  39. };
  40. extern DebugLog debug;
  41. #endif // _DEBUG_LOG_H_