Distanz-/Tiefenmesser mit JSN-SR40T
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Display.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Display.h
  3. *
  4. * Wrapper class for Adafruit OLED display.
  5. *
  6. * Created on: 05.01.2026
  7. * Author: FSmilari
  8. */
  9. #ifndef DISPLAY_H_
  10. #define DISPLAY_H_
  11. #include <Adafruit_ST7735.h>
  12. #include "images/SFToolsLogo.h"
  13. #include "Status.h"
  14. #define SCREEN_WIDTH 160
  15. #define SCREEN_HEIGHT 128
  16. #define SCREEN_ADDRESS 0x3C
  17. class Display {
  18. private:
  19. Adafruit_ST7735 tft; // @suppress("Abstract class cannot be instantiated")
  20. String configText;
  21. String configOption;
  22. float configValue;
  23. String configUnit;
  24. bool refreshScreen;
  25. bool doMeasureAnimation;
  26. unsigned long starttime;
  27. float airTemp;
  28. float waterTemp;
  29. int environment;
  30. uint16_t distance;
  31. void drawBitmap(int x, int y, int w, int h, const uint8_t bitmap[], uint16_t col);
  32. void drawRGBBitmap(int x, int y, int w, int h, const uint16_t bitmap[]);
  33. void redrawFrame();
  34. void redrawGrid();
  35. void redrawIdleStatus();
  36. void redrawConfigStatus();
  37. void redrawEnvIcon();
  38. void redrawIdleIcon();
  39. void redrawDistance();
  40. public:
  41. Display();
  42. void init(void);
  43. void display(void);
  44. void clearDisplay(void);
  45. void setRefreshScreen();
  46. void showBrand(int16_t x, int16_t y);
  47. void showInitialization(void);
  48. void showFrame(Status status);
  49. void drawXCenteredText(String txt, const GFXfont *font, uint8_t s, uint16_t c, int16_t y);
  50. void drawRightAlignedText(String txt, const GFXfont *font, uint8_t s, uint16_t c, int16_t xOffset, int16_t y);
  51. void drawText(String txt, const GFXfont *font, uint8_t s, uint16_t c, int16_t x, int16_t y);
  52. void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
  53. void setStatusValues(float airTemp, float waterTemp);
  54. void setEnvironment(int environment);
  55. void setDistance(uint32_t distance);
  56. void runMeasureAnimation(bool run);
  57. };
  58. #endif /* DISPLAY_H_ */