updated firmware

This commit is contained in:
2021-08-23 17:12:02 +02:00
parent 5a5f977a5f
commit 0c79764922
13 changed files with 45 additions and 1678 deletions

View File

@@ -5,6 +5,28 @@ bool initOK = false;
OLEDDisplayUi ui(&display);
int screenW = 128;
int screenH = 64;
int clockCenterX = screenW / 2;
int clockCenterY = ((screenH - 16) / 2) + 16; // top yellow part is 16 px height
int clockRadius = 23;
// utility function for digital clock display: prints leading 0
String twoDigits(int digits)
{
if (digits < 10)
{
String i = '0' + String(digits);
return i;
}
else
{
return String(digits);
}
}
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
{
@@ -74,7 +96,7 @@ void initDisplay(void)
// but that won't give you much time for anything else
// run it in 160Mhz mode or just set it to 30 fps
ui.setTargetFPS(30);
display.init();
// Customize the active and inactive symbol
//ui.setActiveSymbol(activeSymbol);
//ui.setInactiveSymbol(inactiveSymbol);

View File

@@ -73,7 +73,7 @@ void handleDSMR(void)
String getElecDelivered(void)
{
String tmpstr("Cons: ");
tmpstr += data.power_delivered;
tmpstr += data.power_delivered.int_val();
tmpstr += " kwh";
return tmpstr;
}
@@ -81,7 +81,7 @@ String getElecDelivered(void)
String getElecReturned(void)
{
String tmpstr("Prod: ");
tmpstr += data.power_returned;
tmpstr += data.power_returned.int_val();
tmpstr += " kwh";
return tmpstr;
}
@@ -89,7 +89,7 @@ String getElecReturned(void)
String getGasDelivered(void)
{
String tmpstr("Cons: ");
tmpstr += data.gas_delivered;
tmpstr += data.gas_delivered.int_val();
tmpstr += " m3";
return tmpstr;
}

View File

@@ -65,11 +65,12 @@ using DSMRData = ParsedData<
/* uint16_t */ water_device_type,
/* String */ water_equipment_id,
/* uint8_t */ water_valve_position,
/* TimestampedFixedValue */ water_delivered,
/* uint16_t */ slave_device_type,
/* String */ slave_equipment_id,
/* uint8_t */ slave_valve_position,
/* TimestampedFixedValue */ slave_delivered>;
/* TimestampedFixedValue */ water_delivered
// /* uint16_t */ slave_device_type,
// /* String */ slave_equipment_id,
// /* uint8_t */ slave_valve_position,
// /* TimestampedFixedValue */ slave_delivered>
>;
struct Printer
{

View File

@@ -1,7 +1,9 @@
#pragma once
#include "Arduino.h"
#define WiFi_Logo_width 60
#define WiFi_Logo_height 36
const uint8_t WiFi_Logo_bits[] PROGMEM = {
const uint8_t WiFi_Logo_bits[] {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF,
@@ -28,7 +30,7 @@ const uint8_t WiFi_Logo_bits[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t activeSymbol[] PROGMEM = {
const uint8_t activeSymbol[] = {
B00000000,
B00000000,
B00011000,
@@ -39,7 +41,7 @@ const uint8_t activeSymbol[] PROGMEM = {
B00011000
};
const uint8_t inactiveSymbol[] PROGMEM = {
const uint8_t inactiveSymbol[] = {
B00000000,
B00000000,
B00000000,

View File

@@ -4,69 +4,21 @@
#include "connection.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
delay(500);
delay(1000);
Serial.print("hello ESP8266");
delay(1000);
initDisplay();
initConnection();
initDSMR();
// Include custom images
#include "images.h"
// Use the corresponding display class:
// Initialize the OLED display using SPI
// D5 -> CLK
// D7 -> MOSI (DOUT)
// D0 -> RES
// D2 -> DC
// D8 -> CS
// SSD1306Spi display(D0, D2, D8);
// or
// SH1106Spi display(D0, D2);
// Initialize the OLED display using brzo_i2c
// D3 -> SDA
// D5 -> SCL
// SSD1306Brzo display(0x3c, D3, D5);
// or
// SH1106Brzo display(0x3c, D3, D5);
// Initialize the OLED display using Wire library
SSD1306Wire display(0x3c, SDA, SCL);
// SH1106 display(0x3c, D3, D5);
OLEDDisplayUi ui(&display);
int screenW = 128;
int screenH = 64;
int clockCenterX = screenW / 2;
int clockCenterY = ((screenH - 16) / 2) + 16; // top yellow part is 16 px height
int clockRadius = 23;
// utility function for digital clock display: prints leading 0
String twoDigits(int digits)
{
if (digits < 10)
{
String i = '0' + String(digits);
return i;
}
else
{
return String(digits);
}
}
void clockOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
{
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print(".");
Serial.print(".|.ß");
handleDisplay();
handleConnection();
}