-
-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update OpenDTU ePaper with SW-SPI to be able to
use the other SPI channels for Inverter communication. adjust the Display Class, there is now a Display main Class and another Class for ePapers and MonoDisplays.
- Loading branch information
Showing
21 changed files
with
1,440 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include "Display_helper.h" | ||
#include "defaults.h" | ||
#include <Arduino.h> | ||
|
||
class DisplayClass { | ||
public: | ||
void init(DisplayType_t _type, uint8_t _data, uint8_t _clk, uint8_t _cs, uint8_t _reset, uint8_t _busy, uint8_t _dc); | ||
void loop(); | ||
|
||
bool enablePowerSafe; | ||
bool enableScreensaver; | ||
void setContrast(uint8_t contrast); | ||
void setOrientation(uint8_t rotation = DISPLAY_ROTATION); | ||
void setLanguage(uint8_t language); | ||
void setUpdatePeriod(uint16_t updatePeriod); | ||
|
||
private: | ||
DisplayType_t _display_type = DisplayType_t::None; | ||
uint32_t _lastDisplayUpdate = 0; | ||
time_t now = time(nullptr); | ||
uint16_t counterEPaper; | ||
uint16_t _setUpdatePeriod; // Achtung, max 65535 | ||
}; | ||
|
||
extern DisplayClass Display; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include "Display_helper.h" | ||
#include "defaults.h" | ||
#include <U8g2lib.h> | ||
|
||
class DisplayMonoClass { | ||
public: | ||
DisplayMonoClass(); | ||
~DisplayMonoClass(); | ||
|
||
void init(DisplayType_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, uint8_t _BUSY, uint8_t _SCK, uint8_t _MOSI); | ||
void loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod); | ||
|
||
void setContrast(uint8_t contrast); | ||
void setOrientation(uint8_t rotation); | ||
void setLanguage(uint8_t language); | ||
void setStartupDisplay(); | ||
|
||
bool enablePowerSafe = true; | ||
bool enableScreensaver = true; | ||
|
||
private: | ||
void calcLineHeights(); | ||
void setFont(uint8_t line); | ||
void printText(const char* text, uint8_t line, uint8_t dispX); | ||
|
||
U8G2* _display; | ||
|
||
bool _mIsLarge = false; | ||
uint8_t mLoopCnt; | ||
uint32_t* mUtcTs; | ||
uint8_t mLineOffsets[5]; | ||
|
||
uint16_t _dispY = 0; | ||
uint32_t _previousMillis = 0; | ||
uint8_t _display_language = DISPLAY_LANGUAGE; | ||
|
||
uint8_t _mExtra; | ||
uint16_t _mTimeout; // interval at which to power save (milliseconds) | ||
char _fmtText[32]; | ||
|
||
const u8g2_cb_t* disp_rotation = U8G2_R2; | ||
uint8_t contrast = 60; | ||
}; | ||
|
||
extern DisplayMonoClass DisplayMono; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
// uncomment next line to use HSPI for EPD (and VSPI for SD), e.g. with Waveshare ESP32 Driver Board | ||
// #define USE_HSPI_FOR_EPD | ||
#define USE_HSPI_FOR_DCMT | ||
|
||
/// uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX, to use less code and ram | ||
// #include <GFX.h> | ||
// base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code | ||
// enable GxEPD2_GFX base class | ||
#define ENABLE_GxEPD2_GFX 1 | ||
|
||
#include <SPI.h> | ||
#include <map> | ||
|
||
#include <GxEPD2_3C.h> | ||
#include <GxEPD2_BW.h> | ||
// FreeFonts from Adafruit_GFX | ||
#include <Fonts/FreeSans12pt7b.h> | ||
#include <Fonts/FreeSans18pt7b.h> | ||
#include <Fonts/FreeSans24pt7b.h> | ||
#include <Fonts/FreeSans9pt7b.h> | ||
|
||
#include "Display_helper.h" | ||
#include "imagedata.h" | ||
|
||
// GDEW027C44 2.7 " b/w/r 176x264, IL91874 | ||
// GDEH0154D67 1.54" b/w 200x200 | ||
|
||
class DisplayEPaperClass { | ||
public: | ||
DisplayEPaperClass(); | ||
~DisplayEPaperClass(); | ||
void fullRefresh(); | ||
void init(DisplayType_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, uint8_t _BUSY, uint8_t _SCK, uint8_t _MOSI); | ||
void loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod); | ||
void setOrientation(uint8_t rotation); | ||
|
||
private: | ||
void headlineIP(); | ||
void actualPowerPaged(float _totalPower, float _totalYieldDay, float _totalYieldTotal, uint8_t _isprod); | ||
void lastUpdatePaged(); | ||
|
||
uint8_t _displayRotation = 2; | ||
bool _changed = false; | ||
char _fmtText[35]; | ||
const char* _settedIP; | ||
uint8_t headfootline = 16; | ||
GxEPD2_GFX* _display; | ||
}; | ||
|
||
extern DisplayEPaperClass DisplayEPaper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
enum DisplayType_t | ||
{ | ||
None, | ||
PCD8544, | ||
SSD1306, | ||
SH1106, | ||
SSD1309, | ||
ePaper154 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
extern const unsigned char AhoyLogo[]; | ||
extern const unsigned char OpenDTULogo[]; | ||
extern const unsigned char myHoy[]; | ||
extern const unsigned char mySigma[]; | ||
extern const unsigned char mySun[]; | ||
extern const unsigned char myToday[]; | ||
extern const unsigned char myWR[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.