DIY fertilizer mixer and plant watering machine https://www.xythobuz.de/giessomat.html
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

DebugLog.h 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2021 Thomas Buck <thomas@xythobuz.de>
  3. *
  4. * This file is part of Giess-o-mat.
  5. *
  6. * Giess-o-mat is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Giess-o-mat is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Giess-o-mat. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _DEBUG_LOG_H_
  20. #define _DEBUG_LOG_H_
  21. #include <Arduino.h>
  22. #ifdef PLATFORM_ESP
  23. #include <CircularBuffer.h>
  24. #define DEBUG_LOG_HISTORY_SIZE 1024
  25. #endif // PLATFORM_ESP
  26. class DebugLog {
  27. public:
  28. #ifdef PLATFORM_ESP
  29. String getBuffer(void);
  30. #endif // PLATFORM_ESP
  31. void print(String s);
  32. void print(int n);
  33. void println(void);
  34. void println(String s);
  35. void println(int n);
  36. private:
  37. void sendToTargets(String s);
  38. #ifdef PLATFORM_ESP
  39. void addToBuffer(String s);
  40. CircularBuffer<char, DEBUG_LOG_HISTORY_SIZE> buffer;
  41. #endif // PLATFORM_ESP
  42. };
  43. extern DebugLog debug;
  44. #endif // _DEBUG_LOG_H_