Merge branch 'main' into dev

# Conflicts:
#	tools/esp8266/defines.h
#	tools/esp8266/hmSystem.h
This commit is contained in:
lumapu 2022-04-29 20:49:50 +02:00
commit c8a05efadc
33 changed files with 3714 additions and 17 deletions

View file

@ -13,6 +13,13 @@ This code can be compiled using Arduino. The settings were:
- Board: Generic ESP8266 Module
- Flash-Size: 1MB (FS: none, OTA: 502kB)
### Optional Configuration before compilation
- number of supported inverters (set to 3 by default) `defines.h`
- enable channel hopping `hmRadio.h`
- DTU radio id `hmRadio.h`
- unformated list in webbrowser `/livedata` `defines.h`, `LIVEDATA_VISUALIZED`
## Flash ESP with firmware
@ -21,12 +28,12 @@ This code can be compiled using Arduino. The settings were:
3. the ESP will start as access point (AP) if there is no network config stored in its eeprom
4. connect to the AP, you will be forwarded to the setup page
5. configure your WiFi settings, save, repower
6. check your router for the IP address of the module
6. check your router or serial console for the IP address of the module. You can try ping the configured device name as well.
## Usage
Connect the ESP to power and to your serial console. The webinterface has the following abilities:
Connect the ESP to power and to your serial console (optional). The webinterface has the following abilities:
- OTA Update (over the air update)
- Configuration (Wifi, inverter(s), Pinout, MQTT)
@ -40,11 +47,14 @@ The serial console will print the converted values which were read out of the in
For now the following inverters should work out of the box:
- HM400
- HM600
- HM800
- HM1200
## USED LIBRARIES
- `Time`
- `RF24`
- `PubSubClient`

View file

@ -164,7 +164,7 @@ void app::loop(void) {
if(NULL != inv) {
mSys->Radio.sendTimePacket(inv->radioId.u64, mTimestamp);
yield();
delay(100);
//delay(100);
}
}
}
@ -184,7 +184,7 @@ void app::loop(void) {
snprintf(topic, 30, "%s/ch%d/%s", iv->name, iv->assign[i].ch, fields[iv->assign[i].fieldId]);
snprintf(val, 10, "%.3f", iv->getValue(i));
mMqtt.sendMsg(topic, val);
delay(20);
//delay(20);
yield();
}
}
@ -409,6 +409,8 @@ void app::showLiveData(void) {
case INV_TYPE_HM1200: modNum = 4; break;
}
modHtml += "<div class=\"ch-group\"><h3>" + String(iv->name) + "</h3>";
for(uint8_t ch = 1; ch <= modNum; ch ++) {
modHtml += "<div class=\"ch\"><span class=\"head\">CHANNEL " + String(ch) + "</span>";
for(uint8_t j = 0; j < 5; j++) {
@ -427,6 +429,8 @@ void app::showLiveData(void) {
}
modHtml += "</div>";
}
modHtml += "</div>";
#else
// dump all data to web frontend
modHtml = "<pre>";

View file

@ -25,7 +25,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 11
#define VERSION_PATCH 12
//-------------------------------------

View file

@ -26,9 +26,9 @@ enum {CH0 = 0, CH1, CH2, CH3, CH4};
// received command ids, special command CMDFF for calculations
enum {CMD01 = 0x01, CMD02, CMD03, CMD82 = 0x82, CMD83, CMD84, CMDFF=0xff};
enum {INV_TYPE_HM600 = 0, INV_TYPE_HM1200, INV_TYPE_HM400};
const char* const invTypes[] = {"HM600", "HM1200 / HM1500", "HM400"};
#define NUM_INVERTER_TYPES 3
enum {INV_TYPE_HM600 = 0, INV_TYPE_HM1200, INV_TYPE_HM400, INV_TYPE_HM800};
const char* const invTypes[] = {"HM600", "HM1200 / HM1500", "HM400", "HM800"};
#define NUM_INVERTER_TYPES 4
typedef struct {
uint8_t fieldId; // field id
@ -54,7 +54,7 @@ const byteAssign_t hm400assignment[] = {
{ FLD_IDC, UNIT_A, CH1, CMD01, 5, 2, 100 },
{ FLD_PDC, UNIT_W, CH1, CMD01, 7, 2, 10 },
{ FLD_YT, UNIT_KWH, CH1, CMD01, 9, 4, 1000 },
{ FLD_YD, UNIT_WH, CH1, CMD01, 13, 2, 1000 },
{ FLD_YD, UNIT_WH, CH1, CMD01, 13, 2, 1 },
{ FLD_UAC, UNIT_V, CH0, CMD01, 15, 2, 10 },
{ FLD_F, UNIT_HZ, CH0, CMD82, 1, 2, 100 },
{ FLD_PAC, UNIT_W, CH0, CMD82, 3, 2, 10 },
@ -86,6 +86,30 @@ const byteAssign_t hm600assignment[] = {
#define HM600_LIST_LEN (sizeof(hm600assignment) / sizeof(byteAssign_t))
//-------------------------------------
// HM800
//-------------------------------------
const byteAssign_t hm800assignment[] = {
{ FLD_UDC, UNIT_V, CH1, CMD01, 3, 2, 10 },
{ FLD_IDC, UNIT_A, CH1, CMD01, 5, 2, 100 },
{ FLD_PDC, UNIT_W, CH1, CMD01, 7, 2, 10 },
{ FLD_UDC, UNIT_V, CH2, CMD01, 9, 2, 10 },
{ FLD_IDC, UNIT_A, CH2, CMD01, 11, 2, 100 },
{ FLD_PDC, UNIT_W, CH2, CMD01, 13, 2, 10 },
{ FLD_YW, UNIT_WH, CH0, CMD02, 1, 2, 1 },
{ FLD_YT, UNIT_KWH, CH0, CMD02, 3, 4, 1000 },
{ FLD_YD, UNIT_WH, CH1, CMD02, 7, 2, 1 },
{ FLD_YD, UNIT_WH, CH2, CMD02, 9, 2, 1 },
{ FLD_UAC, UNIT_V, CH0, CMD02, 11, 2, 10 },
{ FLD_F, UNIT_HZ, CH0, CMD02, 13, 2, 100 },
{ FLD_PAC, UNIT_W, CH0, CMD02, 15, 2, 10 },
{ FLD_IAC, UNIT_A, CH0, CMD83, 3, 2, 100 },
{ FLD_T, UNIT_C, CH0, CMD83, 7, 2, 10 }
};
#define HM800_LIST_LEN (sizeof(hm800assignment) / sizeof(byteAssign_t))
//-------------------------------------
// HM1200, HM1500
//-------------------------------------

View file

@ -81,21 +81,26 @@ class Inverter {
}
void getAssignment(void) {
if(INV_TYPE_HM600 == type) {
if(INV_TYPE_HM400 == type) {
listLen = (uint8_t)(HM400_LIST_LEN);
assign = (byteAssign_t*)hm400assignment;
channels = 1;
}
else if(INV_TYPE_HM600 == type) {
listLen = (uint8_t)(HM600_LIST_LEN);
assign = (byteAssign_t*)hm600assignment;
channels = 2;
}
else if(INV_TYPE_HM800 == p->type) {
listLen = (uint8_t)(HM800_LIST_LEN);
assign = (byteAssign_t*)hm800assignment;
channels = 2;
}
else if(INV_TYPE_HM1200 == type) {
listLen = (uint8_t)(HM1200_LIST_LEN);
assign = (byteAssign_t*)hm1200assignment;
channels = 4;
}
else if(INV_TYPE_HM400 == type) {
listLen = (uint8_t)(HM400_LIST_LEN);
assign = (byteAssign_t*)hm400assignment;
channels = 1;
}
else {
listLen = 0;
channels = 0;

View file

@ -1,4 +1,4 @@
#ifndef __STYLE_H__
#define __STYLE_H__
const char style_css[] PROGMEM = "h1 {margin:0;padding:20pt;font-size:22pt;color:#fff;background-color:#006ec0;display:block;text-transform:uppercase;}html, body {font-family:Arial;margin:0;padding:0;}p {text-align:justify;font-size:13pt;}.des {margin-top:35px;font-size:14pt;color:#006ec0;}.subdes {font-size:13pt;color:#006ec0;margin-left:7px;}.fw {width:60px;display:block;float:left;}.color {width:50px;height:50px;border:1px solid #ccc;}.range {width:300px;}a:link, a:visited {text-decoration:none;font-size:13pt;color:#006ec0;}a:hover, a:focus {color:#f00;}a.erase {background-color:#006ec0;color:#fff;padding:7px;display:inline-block;margin-top:30px;float:right;}#content {padding:15px 15px 60px 15px;}#footer {position:fixed;bottom:0px;height:45px;background-color:#006ec0;width:100%;}#footer p {color:#fff;padding-left:20px;padding-right:20px;font-size:10pt !important;}#footer a {color:#fff;}div.content {background-color:#fff;padding-bottom:65px;overflow:hidden;}input, select {padding:7px;font-size:13pt;}input.text, select {width:70%;box-sizing:border-box;margin-bottom:10px;border:1px solid #ccc;}input.btn {background-color:#006ec0;color:#fff;border:0px;float:right;margin:10px 0 30px;text-transform:uppercase;}input.cb {margin-bottom:20px;}label {width:20%;display:inline-block;font-size:12pt;padding-right:10px;margin-left:10px;}.left {float:left;}.right {float:right;}div.ch {width:250px;height:410px;background-color:#006ec0;display:inline-block;margin-right:20px;margin-bottom:20px;}div.ch .value, div.ch .info, div.ch .head {color:#fff;display:block;width:100%;text-align:center;}div.ch .unit {font-size:19px;margin-left:10px;}div.ch .value {margin-top:20px;font-size:30px;}div.ch .info {margin-top:3px;font-size:10px;}div.ch .head {background-color:#003c80;padding:10px 0 10px 0;}";
const char style_css[] PROGMEM = "h1 {margin:0;padding:20pt;font-size:22pt;color:#fff;background-color:#006ec0;display:block;text-transform:uppercase;}html, body {font-family:Arial;margin:0;padding:0;}p {text-align:justify;font-size:13pt;}.des {margin-top:35px;font-size:14pt;color:#006ec0;}.subdes {font-size:13pt;color:#006ec0;margin-left:7px;}.fw {width:60px;display:block;float:left;}.color {width:50px;height:50px;border:1px solid #ccc;}.range {width:300px;}a:link, a:visited {text-decoration:none;font-size:13pt;color:#006ec0;}a:hover, a:focus {color:#f00;}a.erase {background-color:#006ec0;color:#fff;padding:7px;display:inline-block;margin-top:30px;float:right;}#content {padding:15px 15px 60px 15px;}#footer {position:fixed;bottom:0px;height:45px;background-color:#006ec0;width:100%;}#footer p {color:#fff;padding-left:20px;padding-right:20px;font-size:10pt !important;}#footer a {color:#fff;}div.content {background-color:#fff;padding-bottom:65px;overflow:hidden;}input, select {padding:7px;font-size:13pt;}input.text, select {width:70%;box-sizing:border-box;margin-bottom:10px;border:1px solid #ccc;}input.btn {background-color:#006ec0;color:#fff;border:0px;float:right;margin:10px 0 30px;text-transform:uppercase;}input.cb {margin-bottom:20px;}label {width:20%;display:inline-block;font-size:12pt;padding-right:10px;margin-left:10px;}.left {float:left;}.right {float:right;}div.ch-group {display:inline-block;}div.ch {width:250px;height:410px;background-color:#006ec0;display:inline-block;margin-right:20px;margin-bottom:20px;}div.ch .value, div.ch .info, div.ch .head {color:#fff;display:block;width:100%;text-align:center;}div.ch .unit {font-size:19px;margin-left:10px;}div.ch .value {margin-top:20px;font-size:30px;}div.ch .info {margin-top:3px;font-size:10px;}div.ch .head {background-color:#003c80;padding:10px 0 10px 0;}";
#endif /*__STYLE_H__*/

View file

@ -136,6 +136,10 @@ label {
float: right;
}
div.ch-group {
display: inline-block;
}
div.ch {
width: 250px;
height: 410px;