mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-05 21:25:54 +02:00
Update MonoDisplay
This commit is contained in:
parent
329995da65
commit
a60980d38a
2 changed files with 81 additions and 11 deletions
|
@ -125,6 +125,24 @@ lib_deps =
|
|||
https://github.com/JChristensen/Timezone
|
||||
olikraus/U8g2
|
||||
|
||||
[env:esp8266-sh1106]
|
||||
platform = espressif8266
|
||||
board = esp12e
|
||||
board_build.f_cpu = 80000000L
|
||||
build_flags = -D RELEASE -DENA_SH1106
|
||||
monitor_filters =
|
||||
;default ; Remove typical terminal control codes from input
|
||||
time ; Add timestamp with milliseconds for each new line
|
||||
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
|
||||
lib_deps =
|
||||
https://github.com/yubox-node-org/ESPAsyncWebServer
|
||||
nrf24/RF24
|
||||
paulstoffregen/Time
|
||||
https://github.com/bertmelis/espMqttClient#v1.3.3
|
||||
bblanchon/ArduinoJson
|
||||
https://github.com/JChristensen/Timezone
|
||||
olikraus/U8g2
|
||||
|
||||
[env:esp32-wroom32-release]
|
||||
platform = espressif32
|
||||
board = lolin_d32
|
||||
|
@ -182,3 +200,22 @@ lib_deps =
|
|||
https://github.com/ThingPulse/esp8266-oled-ssd1306.git
|
||||
https://github.com/JChristensen/Timezone
|
||||
olikraus/U8g2
|
||||
|
||||
[env:esp32-wroom32-sh1106]
|
||||
platform = espressif32
|
||||
board = lolin_d32
|
||||
build_flags = -D RELEASE -std=gnu++14 -DENA_SH1106
|
||||
build_unflags = -std=gnu++11
|
||||
monitor_filters =
|
||||
;default ; Remove typical terminal control codes from input
|
||||
time ; Add timestamp with milliseconds for each new line
|
||||
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
|
||||
lib_deps =
|
||||
https://github.com/yubox-node-org/ESPAsyncWebServer
|
||||
nrf24/RF24
|
||||
paulstoffregen/Time
|
||||
https://github.com/bertmelis/espMqttClient#v1.3.3
|
||||
bblanchon/ArduinoJson
|
||||
https://github.com/ThingPulse/esp8266-oled-ssd1306.git
|
||||
https://github.com/JChristensen/Timezone
|
||||
olikraus/U8g2
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
/* esp8266 : SCL = 5, SDA = 4 */
|
||||
/* ewsp32 : SCL = 22, SDA = 21 */
|
||||
#if defined(ENA_NOKIA) || defined(ENA_SSD1306)
|
||||
#if defined(ENA_NOKIA) || defined(ENA_SSD1306) || defined(ENA_SH1106)
|
||||
#include <U8g2lib.h>
|
||||
#ifdef ENA_NOKIA
|
||||
#define DISP_PROGMEM U8X8_PROGMEM
|
||||
#else // ENA_SSD1306
|
||||
#else // ENA_SSD1306 || ENA_SH1106
|
||||
#define DISP_PROGMEM PROGMEM
|
||||
#endif
|
||||
|
||||
|
@ -16,6 +16,27 @@
|
|||
#include "../../utils/helper.h"
|
||||
#include "../../hm/hmSystem.h"
|
||||
|
||||
|
||||
static uint8_t bmp_logo[] PROGMEM = {
|
||||
B00000000,B00000000, // ................
|
||||
B11101100,B00110111, // ..##.######.##..
|
||||
B11101100,B00110111, // ..##.######.##..
|
||||
B11100000,B00000111, // .....######.....
|
||||
B11010000,B00001011, // ....#.####.#....
|
||||
B10011000,B00011001, // ...##..##..##...
|
||||
B10000000,B00000001, // .......##.......
|
||||
B00000000,B00000000, // ................
|
||||
B01111000,B00011110, // ...####..####...
|
||||
B11111100,B00111111, // ..############..
|
||||
B01111100,B00111110, // ..#####..#####..
|
||||
B00000000,B00000000, // ................
|
||||
B11111100,B00111111, // ..############..
|
||||
B11111110,B01111111, // .##############.
|
||||
B01111110,B01111110, // .######..######.
|
||||
B00000000,B00000000 // ................
|
||||
};
|
||||
|
||||
|
||||
static uint8_t bmp_arrow[] DISP_PROGMEM = {
|
||||
B00000000, B00011100, B00011100, B00001110, B00001110, B11111110, B01111111,
|
||||
B01110000, B01110000, B00110000, B00111000, B00011000, B01111111, B00111111,
|
||||
|
@ -27,12 +48,12 @@ static TimeChangeRule CET = {"CET ", Last, Sun, Oct, 3, 60}; // Central Eu
|
|||
template<class HMSYSTEM>
|
||||
class MonochromeDisplay {
|
||||
public:
|
||||
#if defined(ENA_NOKIA)
|
||||
#ifdef ENA_NOKIA
|
||||
MonochromeDisplay() : mDisplay(U8G2_R0, 5, 4, 16), mCE(CEST, CET) {
|
||||
mNewPayload = false;
|
||||
mExtra = 0;
|
||||
}
|
||||
#else // ENA_SSD1306
|
||||
#else // ENA_SSD1306 || ENA_SH1106
|
||||
MonochromeDisplay() : mDisplay(U8G2_R0, SCL, SDA, U8X8_PIN_NONE), mCE(CEST, CET) {
|
||||
mNewPayload = false;
|
||||
mExtra = 0;
|
||||
|
@ -146,17 +167,27 @@ class MonochromeDisplay {
|
|||
do {
|
||||
#ifdef ENA_NOKIA
|
||||
if(ucnt) {
|
||||
//=====> Actual Production
|
||||
mDisplay.drawXBMP(10,1,8,17,bmp_arrow);
|
||||
mDisplay.setFont(u8g2_font_logisoso16_tr);
|
||||
mDisplay.setCursor(25,17);
|
||||
if (totalActual>999){
|
||||
sprintf(fmtText,"%3.0f",(totalActual/1000));
|
||||
mDisplay.print(String(fmtText)+F(" kW"));
|
||||
} else {
|
||||
sprintf(fmtText,"%3.0f",totalActual);
|
||||
mDisplay.print(String(fmtText)+F(" W"));
|
||||
}
|
||||
//<=======================
|
||||
}
|
||||
else
|
||||
{
|
||||
//=====> Offline
|
||||
mDisplay.setFont(u8g2_font_logisoso16_tr );
|
||||
mDisplay.setCursor(10,17);
|
||||
mDisplay.print(String(F("offline")));
|
||||
//<=======================
|
||||
|
||||
}
|
||||
mDisplay.drawHLine(2,20,78);
|
||||
mDisplay.setFont(u8g2_font_5x8_tr);
|
||||
|
@ -191,7 +222,7 @@ class MonochromeDisplay {
|
|||
mDisplay.print(timeStr);
|
||||
}
|
||||
#else // ENA_SSD1306
|
||||
//mDisplay.drawXBM(100,5,16,16,bmp_logo);
|
||||
mDisplay.drawXBM(106,5,16,16,bmp_logo);
|
||||
mDisplay.setFont(u8g2_font_ncenB08_tr);
|
||||
mDisplay.setCursor(90,63);
|
||||
mDisplay.print(F("AHOY"));
|
||||
|
@ -226,7 +257,7 @@ class MonochromeDisplay {
|
|||
}
|
||||
//<=======================
|
||||
}
|
||||
mDisplay.drawLine(1, 23, 123, 23);
|
||||
mDisplay.drawLine(2, 23, 123, 23);
|
||||
mDisplay.setFont(u8g2_font_ncenB10_tr);
|
||||
mDisplay.setCursor(5,36);
|
||||
if (( num_inv < 2 ) || !(mExtra%2))
|
||||
|
@ -264,15 +295,17 @@ class MonochromeDisplay {
|
|||
#endif
|
||||
mDisplay.sendBuffer();
|
||||
} while( mDisplay.nextPage() );
|
||||
delay(2000);
|
||||
delay(500);
|
||||
mExtra++;
|
||||
}
|
||||
|
||||
// private member variables
|
||||
#if defined(ENA_NOKIA)
|
||||
#ifdef ENA_NOKIA
|
||||
U8G2_PCD8544_84X48_1_4W_HW_SPI mDisplay;
|
||||
#else // ENA_SSD1306
|
||||
#elif defined(ENA_SSD1306)
|
||||
U8G2_SSD1306_128X64_NONAME_1_HW_I2C mDisplay;
|
||||
#elif defined(ENA_SH1106)
|
||||
U8G2_SH1106_128X64_NONAME_1_HW_I2C mDisplay;
|
||||
#endif
|
||||
int mExtra;
|
||||
bool mNewPayload;
|
||||
|
|
Loading…
Add table
Reference in a new issue