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
|
https://github.com/JChristensen/Timezone
|
||||||
olikraus/U8g2
|
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]
|
[env:esp32-wroom32-release]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
|
@ -169,6 +187,25 @@ platform = espressif32
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = -D RELEASE -std=gnu++14 -DENA_SSD1306
|
build_flags = -D RELEASE -std=gnu++14 -DENA_SSD1306
|
||||||
build_unflags = -std=gnu++11
|
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
|
||||||
|
|
||||||
|
[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 =
|
monitor_filters =
|
||||||
;default ; Remove typical terminal control codes from input
|
;default ; Remove typical terminal control codes from input
|
||||||
time ; Add timestamp with milliseconds for each new line
|
time ; Add timestamp with milliseconds for each new line
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
/* esp8266 : SCL = 5, SDA = 4 */
|
/* esp8266 : SCL = 5, SDA = 4 */
|
||||||
/* ewsp32 : SCL = 22, SDA = 21 */
|
/* 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>
|
#include <U8g2lib.h>
|
||||||
#ifdef ENA_NOKIA
|
#ifdef ENA_NOKIA
|
||||||
#define DISP_PROGMEM U8X8_PROGMEM
|
#define DISP_PROGMEM U8X8_PROGMEM
|
||||||
#else // ENA_SSD1306
|
#else // ENA_SSD1306 || ENA_SH1106
|
||||||
#define DISP_PROGMEM PROGMEM
|
#define DISP_PROGMEM PROGMEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -16,6 +16,27 @@
|
||||||
#include "../../utils/helper.h"
|
#include "../../utils/helper.h"
|
||||||
#include "../../hm/hmSystem.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 = {
|
static uint8_t bmp_arrow[] DISP_PROGMEM = {
|
||||||
B00000000, B00011100, B00011100, B00001110, B00001110, B11111110, B01111111,
|
B00000000, B00011100, B00011100, B00001110, B00001110, B11111110, B01111111,
|
||||||
B01110000, B01110000, B00110000, B00111000, B00011000, B01111111, B00111111,
|
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>
|
template<class HMSYSTEM>
|
||||||
class MonochromeDisplay {
|
class MonochromeDisplay {
|
||||||
public:
|
public:
|
||||||
#if defined(ENA_NOKIA)
|
#ifdef ENA_NOKIA
|
||||||
MonochromeDisplay() : mDisplay(U8G2_R0, 5, 4, 16), mCE(CEST, CET) {
|
MonochromeDisplay() : mDisplay(U8G2_R0, 5, 4, 16), mCE(CEST, CET) {
|
||||||
mNewPayload = false;
|
mNewPayload = false;
|
||||||
mExtra = 0;
|
mExtra = 0;
|
||||||
}
|
}
|
||||||
#else // ENA_SSD1306
|
#else // ENA_SSD1306 || ENA_SH1106
|
||||||
MonochromeDisplay() : mDisplay(U8G2_R0, SCL, SDA, U8X8_PIN_NONE), mCE(CEST, CET) {
|
MonochromeDisplay() : mDisplay(U8G2_R0, SCL, SDA, U8X8_PIN_NONE), mCE(CEST, CET) {
|
||||||
mNewPayload = false;
|
mNewPayload = false;
|
||||||
mExtra = 0;
|
mExtra = 0;
|
||||||
|
@ -146,17 +167,27 @@ class MonochromeDisplay {
|
||||||
do {
|
do {
|
||||||
#ifdef ENA_NOKIA
|
#ifdef ENA_NOKIA
|
||||||
if(ucnt) {
|
if(ucnt) {
|
||||||
|
//=====> Actual Production
|
||||||
mDisplay.drawXBMP(10,1,8,17,bmp_arrow);
|
mDisplay.drawXBMP(10,1,8,17,bmp_arrow);
|
||||||
mDisplay.setFont(u8g2_font_logisoso16_tr);
|
mDisplay.setFont(u8g2_font_logisoso16_tr);
|
||||||
mDisplay.setCursor(25,17);
|
mDisplay.setCursor(25,17);
|
||||||
sprintf(fmtText,"%3.0f",totalActual);
|
if (totalActual>999){
|
||||||
mDisplay.print(String(fmtText)+F(" W"));
|
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
|
else
|
||||||
{
|
{
|
||||||
|
//=====> Offline
|
||||||
mDisplay.setFont(u8g2_font_logisoso16_tr );
|
mDisplay.setFont(u8g2_font_logisoso16_tr );
|
||||||
mDisplay.setCursor(10,17);
|
mDisplay.setCursor(10,17);
|
||||||
mDisplay.print(String(F("offline")));
|
mDisplay.print(String(F("offline")));
|
||||||
|
//<=======================
|
||||||
|
|
||||||
}
|
}
|
||||||
mDisplay.drawHLine(2,20,78);
|
mDisplay.drawHLine(2,20,78);
|
||||||
mDisplay.setFont(u8g2_font_5x8_tr);
|
mDisplay.setFont(u8g2_font_5x8_tr);
|
||||||
|
@ -191,7 +222,7 @@ class MonochromeDisplay {
|
||||||
mDisplay.print(timeStr);
|
mDisplay.print(timeStr);
|
||||||
}
|
}
|
||||||
#else // ENA_SSD1306
|
#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.setFont(u8g2_font_ncenB08_tr);
|
||||||
mDisplay.setCursor(90,63);
|
mDisplay.setCursor(90,63);
|
||||||
mDisplay.print(F("AHOY"));
|
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.setFont(u8g2_font_ncenB10_tr);
|
||||||
mDisplay.setCursor(5,36);
|
mDisplay.setCursor(5,36);
|
||||||
if (( num_inv < 2 ) || !(mExtra%2))
|
if (( num_inv < 2 ) || !(mExtra%2))
|
||||||
|
@ -264,15 +295,17 @@ class MonochromeDisplay {
|
||||||
#endif
|
#endif
|
||||||
mDisplay.sendBuffer();
|
mDisplay.sendBuffer();
|
||||||
} while( mDisplay.nextPage() );
|
} while( mDisplay.nextPage() );
|
||||||
delay(2000);
|
delay(500);
|
||||||
mExtra++;
|
mExtra++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private member variables
|
// private member variables
|
||||||
#if defined(ENA_NOKIA)
|
#ifdef ENA_NOKIA
|
||||||
U8G2_PCD8544_84X48_1_4W_HW_SPI mDisplay;
|
U8G2_PCD8544_84X48_1_4W_HW_SPI mDisplay;
|
||||||
#else // ENA_SSD1306
|
#elif defined(ENA_SSD1306)
|
||||||
U8G2_SSD1306_128X64_NONAME_1_HW_I2C mDisplay;
|
U8G2_SSD1306_128X64_NONAME_1_HW_I2C mDisplay;
|
||||||
|
#elif defined(ENA_SH1106)
|
||||||
|
U8G2_SH1106_128X64_NONAME_1_HW_I2C mDisplay;
|
||||||
#endif
|
#endif
|
||||||
int mExtra;
|
int mExtra;
|
||||||
bool mNewPayload;
|
bool mNewPayload;
|
||||||
|
|
Loading…
Add table
Reference in a new issue