mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-06 12:41:37 +02:00
0.8.54
* added minimal version (without: MqTT, Display, History), WebUI is not changed! * added simulator (must be activated before compile, standard: off) * changed communication attempts back to 5
This commit is contained in:
parent
ca6ebfe0fe
commit
60111d0696
17 changed files with 421 additions and 42 deletions
2
.github/workflows/compile_development.yml
vendored
2
.github/workflows/compile_development.yml
vendored
|
@ -25,11 +25,13 @@ jobs:
|
|||
- esp8266-prometheus
|
||||
- esp8285
|
||||
- esp32-wroom32
|
||||
- esp32-wroom32-minimal
|
||||
- esp32-wroom32-prometheus
|
||||
- esp32-wroom32-ethernet
|
||||
- esp32-s2-mini
|
||||
- esp32-c3-mini
|
||||
- opendtufusion
|
||||
- opendtufusion-minimal
|
||||
- opendtufusion-ethernet
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
# Development Changes
|
||||
|
||||
## 0.8.54 - 2024-01-13
|
||||
* added minimal version (without: MqTT, Display, History), WebUI is not changed!
|
||||
* added simulator (must be activated before compile, standard: off)
|
||||
* changed communication attempts back to 5
|
||||
|
||||
## 0.8.53 - 2024-01-12
|
||||
* fix history graph
|
||||
* fix MqTT yield day #1331
|
||||
|
|
29
src/app.cpp
29
src/app.cpp
|
@ -52,7 +52,9 @@ void app::setup() {
|
|||
|
||||
mCommunication.setup(&mTimestamp, &mConfig->serial.debug, &mConfig->serial.privacyLog, &mConfig->serial.printWholeTrace, &mConfig->inst.gapMs);
|
||||
mCommunication.addPayloadListener(std::bind(&app::payloadEventListener, this, std::placeholders::_1, std::placeholders::_2));
|
||||
#if defined(ENABLE_MQTT)
|
||||
mCommunication.addPowerLimitAckListener([this] (Inverter<> *iv) { mMqtt.setPowerLimitAck(iv); });
|
||||
#endif
|
||||
mSys.setup(&mTimestamp, &mConfig->inst, this);
|
||||
for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
|
||||
initInverter(i);
|
||||
|
@ -65,6 +67,7 @@ void app::setup() {
|
|||
|
||||
// when WiFi is in client mode, then enable mqtt broker
|
||||
#if !defined(AP_ONLY)
|
||||
#if defined(ENABLE_MQTT)
|
||||
mMqttEnabled = (mConfig->mqtt.broker[0] > 0);
|
||||
if (mMqttEnabled) {
|
||||
mMqtt.setup(&mConfig->mqtt, mConfig->sys.deviceName, mVersion, &mSys, &mTimestamp, &mUptime);
|
||||
|
@ -72,6 +75,7 @@ void app::setup() {
|
|||
mCommunication.addAlarmListener([this](Inverter<> *iv) { mMqtt.alarmEvent(iv); });
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
setupLed();
|
||||
|
||||
mWeb.setup(this, &mSys, mConfig);
|
||||
|
@ -92,7 +96,9 @@ void app::setup() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_HISTORY)
|
||||
mHistory.setup(this, &mSys, mConfig, &mTimestamp);
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
|
||||
mPubSerial.setup(mConfig, &mSys, &mTimestamp);
|
||||
|
||||
|
@ -100,6 +106,13 @@ void app::setup() {
|
|||
//mImprov.setup(this, mConfig->sys.deviceName, mVersion);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_SIMULATOR)
|
||||
mSimulator.setup(&mSys, &mTimestamp, 0);
|
||||
mSimulator.addPayloadListener([this](uint8_t cmd, Inverter<> *iv) {
|
||||
payloadEventListener(cmd, iv);
|
||||
});
|
||||
#endif /*ENABLE_SIMULATOR*/
|
||||
|
||||
regularTickers();
|
||||
}
|
||||
|
||||
|
@ -115,8 +128,10 @@ void app::loop(void) {
|
|||
ah::Scheduler::loop();
|
||||
mCommunication.loop();
|
||||
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (mMqttEnabled && mNetworkConnected)
|
||||
mMqtt.loop();
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -152,7 +167,13 @@ void app::regularTickers(void) {
|
|||
//everySec([this]() { mImprov.tickSerial(); }, "impro");
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_HISTORY)
|
||||
everySec(std::bind(&HistoryType::tickerSecond, &mHistory), "hist");
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
|
||||
#if defined(ENABLE_SIMULATOR)
|
||||
every(std::bind(&SimulatorType::tick, &mSimulator), 5, "sim");
|
||||
#endif /*ENABLE_SIMULATOR*/
|
||||
}
|
||||
|
||||
#if defined(ETHERNET)
|
||||
|
@ -168,11 +189,13 @@ void app::onNtpUpdate(bool gotTime) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::updateNtp(void) {
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (mMqttReconnect && mMqttEnabled) {
|
||||
mMqtt.tickerSecond();
|
||||
everySec(std::bind(&PubMqttType::tickerSecond, &mMqtt), "mqttS");
|
||||
everyMin(std::bind(&PubMqttType::tickerMinute, &mMqtt), "mqttM");
|
||||
}
|
||||
#endif /*ENABLE_MQTT*/
|
||||
|
||||
// only install schedulers once even if NTP wasn't successful in first loop
|
||||
if (mMqttReconnect) { // @TODO: mMqttReconnect is variable which scope has changed
|
||||
|
@ -287,15 +310,19 @@ void app::tickIVCommunication(void) {
|
|||
//-----------------------------------------------------------------------------
|
||||
void app::tickSun(void) {
|
||||
// only used and enabled by MQTT (see setup())
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (!mMqtt.tickerSun(mSunrise, mSunset, mConfig->sun.offsetSecMorning, mConfig->sun.offsetSecEvening))
|
||||
once(std::bind(&app::tickSun, this), 1, "mqSun"); // MQTT not connected, retry
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::tickSunrise(void) {
|
||||
// only used and enabled by MQTT (see setup())
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (!mMqtt.tickerSun(mSunrise, mSunset, mConfig->sun.offsetSecMorning, mConfig->sun.offsetSecEvening, true))
|
||||
once(std::bind(&app::tickSun, this), 1, "mqSun"); // MQTT not connected, retry
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -340,8 +367,10 @@ void app::tickMidnight(void) {
|
|||
if (mConfig->inst.rstYieldMidNight) {
|
||||
zeroIvValues(!CHECK_AVAIL, !SKIP_YIELD_DAY);
|
||||
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (mMqttEnabled)
|
||||
mMqtt.tickerMidnight();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
47
src/app.h
47
src/app.h
|
@ -17,14 +17,18 @@
|
|||
#if defined(ESP32)
|
||||
#include "hms/hmsRadio.h"
|
||||
#endif
|
||||
#if defined(ENABLE_MQTT)
|
||||
#include "publisher/pubMqtt.h"
|
||||
#endif /*ENABLE_MQTT*/
|
||||
#include "publisher/pubSerial.h"
|
||||
#include "utils/crc.h"
|
||||
#include "utils/dbg.h"
|
||||
#include "utils/scheduler.h"
|
||||
#include "utils/syslog.h"
|
||||
#include "web/RestApi.h"
|
||||
#if defined(ENABLE_HISTORY)
|
||||
#include "plugins/history.h"
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
#include "web/web.h"
|
||||
#include "hm/Communication.h"
|
||||
#if defined(ETHERNET)
|
||||
|
@ -34,6 +38,10 @@
|
|||
#include "utils/improv.h"
|
||||
#endif /* defined(ETHERNET) */
|
||||
|
||||
#if defined(ENABLE_SIMULATOR)
|
||||
#include "hm/simulator.h"
|
||||
#endif /*ENABLE_SIMULATOR*/
|
||||
|
||||
#include <RF24.h> // position is relevant since version 1.4.7 of this library
|
||||
|
||||
|
||||
|
@ -46,9 +54,16 @@
|
|||
typedef HmSystem<MAX_NUM_INVERTERS> HmSystemType;
|
||||
typedef Web<HmSystemType> WebType;
|
||||
typedef RestApi<HmSystemType> RestApiType;
|
||||
#if defined(ENABLE_MQTT)
|
||||
typedef PubMqtt<HmSystemType> PubMqttType;
|
||||
#endif /*ENABLE_MQTT*/
|
||||
typedef PubSerial<HmSystemType> PubSerialType;
|
||||
#if defined(ENABLE_HISTORY)
|
||||
typedef HistoryData<HmSystemType> HistoryType;
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
#if defined (ENABLE_SIMULATOR)
|
||||
typedef Simulator<HmSystemType> SimulatorType;
|
||||
#endif /*ENABLE_SIMULATOR*/
|
||||
|
||||
// PLUGINS
|
||||
#if defined(PLUGIN_DISPLAY)
|
||||
|
@ -190,19 +205,33 @@ class app : public IApp, public ah::Scheduler {
|
|||
}
|
||||
|
||||
void setMqttDiscoveryFlag() {
|
||||
#if defined(ENABLE_MQTT)
|
||||
once(std::bind(&PubMqttType::sendDiscoveryConfig, &mMqtt), 1, "disCf");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool getMqttIsConnected() {
|
||||
#if defined(ENABLE_MQTT)
|
||||
return mMqtt.isConnected();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t getMqttTxCnt() {
|
||||
#if defined(ENABLE_MQTT)
|
||||
return mMqtt.getTxCnt();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t getMqttRxCnt() {
|
||||
#if defined(ENABLE_MQTT)
|
||||
return mMqtt.getRxCnt();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool getProtection(AsyncWebServerRequest *request) {
|
||||
|
@ -253,11 +282,19 @@ class app : public IApp, public ah::Scheduler {
|
|||
}
|
||||
|
||||
uint16_t getHistoryValue(uint8_t type, uint16_t i) {
|
||||
#if defined(ENABLE_HISTORY)
|
||||
return mHistory.valueAt((HistoryStorageType)type, i);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint16_t getHistoryMaxDay() {
|
||||
#if defined(ENABLE_HISTORY)
|
||||
return mHistory.getMaximumDay();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -269,8 +306,10 @@ class app : public IApp, public ah::Scheduler {
|
|||
|
||||
void payloadEventListener(uint8_t cmd, Inverter<> *iv) {
|
||||
#if !defined(AP_ONLY)
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (mMqttEnabled)
|
||||
mMqtt.payloadEventListener(cmd, iv);
|
||||
#endif /*ENABLE_MQTT*/
|
||||
#endif
|
||||
#if defined(PLUGIN_DISPLAY)
|
||||
if(mConfig->plugin.display.type != 0)
|
||||
|
@ -359,7 +398,9 @@ class app : public IApp, public ah::Scheduler {
|
|||
bool mNetworkConnected;
|
||||
|
||||
// mqtt
|
||||
#if defined(ENABLE_MQTT)
|
||||
PubMqttType mMqtt;
|
||||
#endif /*ENABLE_MQTT*/
|
||||
bool mMqttReconnect;
|
||||
bool mMqttEnabled;
|
||||
|
||||
|
@ -372,7 +413,13 @@ class app : public IApp, public ah::Scheduler {
|
|||
DisplayType mDisplay;
|
||||
DisplayData mDispData;
|
||||
#endif
|
||||
#if defined(ENABLE_HISTORY)
|
||||
HistoryType mHistory;
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
|
||||
#if defined(ENABLE_SIMULATOR)
|
||||
SimulatorType mSimulator;
|
||||
#endif /*ENABLE_SIMULATOR*/
|
||||
};
|
||||
|
||||
#endif /*__APP_H__*/
|
||||
|
|
|
@ -32,12 +32,33 @@
|
|||
// timeout for automatic logoff (20 minutes)
|
||||
#define LOGOUT_TIMEOUT (20 * 60)
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
// MODULE SELECTOR - done by platform.ini
|
||||
//-------------------------------------
|
||||
|
||||
// MqTT connection
|
||||
//#define ENABLE_MQTT
|
||||
|
||||
// display plugin
|
||||
//#define PLUGIN_DISPLAY
|
||||
|
||||
// history graph (WebUI)
|
||||
//#define ENABLE_HISTORY
|
||||
|
||||
// inverter simulation
|
||||
//#define ENABLE_SIMULATOR
|
||||
|
||||
// to enable the syslog logging (will disable web-serial)
|
||||
//#define ENABLE_SYSLOG
|
||||
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
// CONFIGURATION - COMPILE TIME
|
||||
//-------------------------------------
|
||||
|
||||
// ethernet
|
||||
|
||||
#if defined(ETHERNET)
|
||||
#define ETH_SPI_HOST SPI2_HOST
|
||||
#define ETH_SPI_CLOCK_MHZ 25
|
||||
|
@ -184,7 +205,7 @@
|
|||
#define INVERTER_OFF_THRES_SEC 15*60
|
||||
|
||||
// threshold of minimum power on which the inverter is marked as inactive
|
||||
#define INACT_PWR_THRESH 3
|
||||
#define INACT_PWR_THRESH 1
|
||||
|
||||
// Timezone
|
||||
#define TIMEZONE 1
|
||||
|
@ -222,6 +243,15 @@
|
|||
// reconnect delay
|
||||
#define MQTT_RECONNECT_DELAY 5000
|
||||
|
||||
|
||||
// syslog settings
|
||||
#ifdef ENABLE_SYSLOG
|
||||
#define SYSLOG_HOST "<hostname-or-ip-address-of-syslog-server>"
|
||||
#define SYSLOG_APP "ahoy"
|
||||
#define SYSLOG_FACILITY FAC_USER
|
||||
#define SYSLOG_PORT 514
|
||||
#endif
|
||||
|
||||
#if __has_include("config_override.h")
|
||||
#include "config_override.h"
|
||||
#endif
|
||||
|
|
|
@ -35,13 +35,5 @@
|
|||
// #define ENABLE_PROMETHEUS_EP
|
||||
|
||||
|
||||
// to enable the syslog logging (will disable web-serial)
|
||||
//#define ENABLE_SYSLOG
|
||||
#ifdef ENABLE_SYSLOG
|
||||
#define SYSLOG_HOST "<hostname-or-ip-address-of-syslog-server>"
|
||||
#define SYSLOG_APP "ahoy"
|
||||
#define SYSLOG_FACILITY FAC_USER
|
||||
#define SYSLOG_PORT 514
|
||||
#endif
|
||||
|
||||
#endif /*__CONFIG_OVERRIDE_H__*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_PATCH 53
|
||||
#define VERSION_PATCH 54
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
@ -94,7 +94,6 @@ enum {MQTT_STATUS_OFFLINE = 0, MQTT_STATUS_PARTIAL, MQTT_STATUS_ONLINE};
|
|||
|
||||
#define MQTT_MAX_PACKET_SIZE 384
|
||||
|
||||
#define PLUGIN_DISPLAY
|
||||
|
||||
typedef struct {
|
||||
uint32_t rxFail;
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
#include "hmInverter.h"
|
||||
#include "../utils/dbg.h"
|
||||
|
||||
#define DEFAULT_ATTEMPS 10
|
||||
#define MORE_ATTEMPS_ALARMDATA 15
|
||||
#define MORE_ATTEMPS_GRIDONPROFILEPARA 15
|
||||
// needs a '+1' because the comparison does not send if attempts is equal 0
|
||||
#define DEFAULT_ATTEMPS 5 + 1
|
||||
#define MORE_ATTEMPS_ALARMDATA 15 + 1
|
||||
#define MORE_ATTEMPS_GRIDONPROFILEPARA 15 + 1
|
||||
|
||||
template <uint8_t N=100>
|
||||
class CommQueue {
|
||||
|
|
|
@ -152,9 +152,9 @@ class Communication : public CommQueue<> {
|
|||
|
||||
while(!q->iv->radio->mBufCtrl.empty()) {
|
||||
packet_t *p = &q->iv->radio->mBufCtrl.front();
|
||||
printRxInfo(q, p);
|
||||
|
||||
if(validateIvSerial(&p->packet[1], q->iv)) {
|
||||
printRxInfo(q, p);
|
||||
q->iv->radioStatistics.frmCnt++;
|
||||
q->iv->mDtuRxCnt++;
|
||||
|
||||
|
@ -302,11 +302,11 @@ class Communication : public CommQueue<> {
|
|||
CP_U32_BigEndian(tmp, iv->radioId.u64 >> 8);
|
||||
for(uint8_t i = 0; i < 4; i++) {
|
||||
if(tmp[i] != buf[i]) {
|
||||
DPRINT(DBG_WARN, F("Inverter serial does not match, got: 0x"));
|
||||
/*DPRINT(DBG_WARN, F("Inverter serial does not match, got: 0x"));
|
||||
DHEX(buf[0]);DHEX(buf[1]);DHEX(buf[2]);DHEX(buf[3]);
|
||||
DBGPRINT(F(", expected: 0x"));
|
||||
DHEX(tmp[0]);DHEX(tmp[1]);DHEX(tmp[2]);DHEX(tmp[3]);
|
||||
DBGPRINTLN("");
|
||||
DBGPRINTLN("");*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
175
src/hm/simulator.h
Normal file
175
src/hm/simulator.h
Normal file
|
@ -0,0 +1,175 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 2024 Ahoy, https://github.com/lumpapu/ahoy
|
||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __SIMULATOR_H__
|
||||
#define __SIMULATOR_H__
|
||||
|
||||
#if defined(ENABLE_SIMULATOR)
|
||||
|
||||
#include "../defines.h"
|
||||
#include "../utils/dbg.h"
|
||||
#include "../utils/helper.h"
|
||||
#include "hmSystem.h"
|
||||
#include "hmInverter.h"
|
||||
#include "Communication.h"
|
||||
|
||||
template<class HMSYSTEM>
|
||||
class Simulator {
|
||||
public:
|
||||
void setup(HMSYSTEM *sys, uint32_t *ts, uint8_t ivId = 0) {
|
||||
mTimestamp = ts;
|
||||
mSys = sys;
|
||||
mIvId = ivId;
|
||||
}
|
||||
|
||||
void addPayloadListener(payloadListenerType cb) {
|
||||
mCbPayload = cb;
|
||||
}
|
||||
|
||||
void tick() {
|
||||
uint8_t cmd, len;
|
||||
uint8_t *payload;
|
||||
getPayload(&cmd, &payload, &len);
|
||||
|
||||
Inverter<> *iv = mSys->getInverterByPos(mIvId);
|
||||
if (NULL == iv)
|
||||
return;
|
||||
|
||||
DPRINT(DBG_INFO, F("add payload with cmd: 0x"));
|
||||
DBGHEXLN(cmd);
|
||||
|
||||
if(GridOnProFilePara == cmd) {
|
||||
iv->addGridProfile(payload, len);
|
||||
return;
|
||||
}
|
||||
|
||||
record_t<> *rec = iv->getRecordStruct(cmd);
|
||||
rec->ts = *mTimestamp;
|
||||
for (uint8_t i = 0; i < rec->length; i++) {
|
||||
iv->addValue(i, payload, rec);
|
||||
yield();
|
||||
}
|
||||
iv->doCalculations();
|
||||
|
||||
if((nullptr != mCbPayload) && (GridOnProFilePara != cmd))
|
||||
(mCbPayload)(cmd, iv);
|
||||
}
|
||||
|
||||
private:
|
||||
inline void getPayload(uint8_t *cmd, uint8_t *payload[], uint8_t *len) {
|
||||
switch(payloadCtrl) {
|
||||
default: *cmd = RealTimeRunData_Debug; break;
|
||||
case 1: *cmd = SystemConfigPara; break;
|
||||
case 3: *cmd = InverterDevInform_All; break;
|
||||
case 5: *cmd = InverterDevInform_Simple; break;
|
||||
case 7: *cmd = GridOnProFilePara; break;
|
||||
}
|
||||
|
||||
if(payloadCtrl < 8)
|
||||
payloadCtrl++;
|
||||
|
||||
switch(*cmd) {
|
||||
default:
|
||||
case RealTimeRunData_Debug:
|
||||
*payload = plRealtime;
|
||||
modifyAcPwr();
|
||||
*len = 62;
|
||||
break;
|
||||
case InverterDevInform_All:
|
||||
*payload = plFirmware;
|
||||
*len = 14;
|
||||
break;
|
||||
case InverterDevInform_Simple:
|
||||
*payload = plPart;
|
||||
*len = 14;
|
||||
break;
|
||||
case SystemConfigPara:
|
||||
*payload = plLimit;
|
||||
*len = 14;
|
||||
break;
|
||||
case AlarmData:
|
||||
*payload = plAlarm;
|
||||
*len = 26;
|
||||
break;
|
||||
case GridOnProFilePara:
|
||||
*payload = plGrid;
|
||||
*len = 70;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void modifyAcPwr() {
|
||||
uint16_t cur = (plRealtime[50] << 8) | plRealtime[51];
|
||||
uint16_t change = cur ^ 0xa332;
|
||||
if(0 == change)
|
||||
change = 140;
|
||||
else if(change > 200)
|
||||
change = (change % 200) + 1;
|
||||
|
||||
if(cur > 7000)
|
||||
cur -= change;
|
||||
else
|
||||
cur += change;
|
||||
|
||||
plRealtime[50] = (cur >> 8) & 0xff;
|
||||
plRealtime[51] = (cur ) & 0xff;
|
||||
}
|
||||
|
||||
private:
|
||||
HMSYSTEM *mSys;
|
||||
uint8_t mIvId;
|
||||
uint32_t *mTimestamp;
|
||||
payloadListenerType mCbPayload = nullptr;
|
||||
uint8_t payloadCtrl = 0;
|
||||
|
||||
private:
|
||||
uint8_t plRealtime[62] = {
|
||||
0x00, 0x01, 0x01, 0x24, 0x00, 0x22, 0x00, 0x23,
|
||||
0x00, 0x63, 0x00, 0x65, 0x00, 0x08, 0x5c, 0xbb,
|
||||
0x00, 0x09, 0x6f, 0x08, 0x00, 0x0c, 0x00, 0x0c,
|
||||
0x01, 0x1e, 0x00, 0x22, 0x00, 0x21, 0x00, 0x60,
|
||||
0x00, 0x5f, 0x00, 0x08, 0xdd, 0x84, 0x00, 0x09,
|
||||
0x13, 0x6f, 0x00, 0x0b, 0x00, 0x0b, 0x09, 0x27,
|
||||
0x13, 0x8c, 0x01, 0x75, 0x00, 0xc2, 0x00, 0x10,
|
||||
0x03, 0x77, 0x00, 0x61, 0x00, 0x02
|
||||
};
|
||||
|
||||
uint8_t plPart[14] = {
|
||||
0x27, 0x1c, 0x10, 0x12, 0x10, 0x01, 0x01, 0x00,
|
||||
0x0a, 0x00, 0x20, 0x01, 0x00, 0x00
|
||||
};
|
||||
|
||||
uint8_t plFirmware[14] = {
|
||||
0x00, 0x01, 0x80, 0x01, 0x00, 0x01, 0x60, 0x42,
|
||||
0x60, 0x42, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
uint8_t plLimit[14] = {
|
||||
0x00, 0x01, 0x03, 0xe8, 0x00, 0x00, 0x03, 0xe8,
|
||||
0xff, 0xff, 0xff, 0xff, 0x01, 0x68
|
||||
};
|
||||
|
||||
uint8_t plGrid[70] = {
|
||||
0x0D, 0x00, 0x20, 0x00, 0x00, 0x08, 0x08, 0xFC,
|
||||
0x07, 0x30, 0x00, 0x01, 0x0A, 0x55, 0x00, 0x01,
|
||||
0x09, 0xE2, 0x10, 0x00, 0x13, 0x88, 0x12, 0x8E,
|
||||
0x00, 0x01, 0x14, 0x1E, 0x00, 0x01, 0x20, 0x00,
|
||||
0x00, 0x01, 0x30, 0x07, 0x01, 0x2C, 0x0A, 0x55,
|
||||
0x07, 0x30, 0x14, 0x1E, 0x12, 0x8E, 0x00, 0x32,
|
||||
0x00, 0x1E, 0x40, 0x00, 0x07, 0xD0, 0x00, 0x10,
|
||||
0x50, 0x00, 0x00, 0x01, 0x13, 0x9C, 0x01, 0x90,
|
||||
0x00, 0x10, 0x70, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
uint8_t plAlarm[26] = {
|
||||
0x00, 0x01, 0x80, 0x01, 0x00, 0x01, 0x51, 0xc7,
|
||||
0x51, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02,
|
||||
0x00, 0x02, 0xa6, 0xc9, 0xa6, 0xc9, 0x65, 0x3e,
|
||||
0x47, 0x21
|
||||
};
|
||||
};
|
||||
|
||||
#endif /*ENABLE_SIMULATOR*/
|
||||
#endif /*__SIMULATOR_H__*/
|
|
@ -46,6 +46,9 @@ board = esp12e
|
|||
board_build.f_cpu = 80000000L
|
||||
build_flags = ${env.build_flags}
|
||||
-DEMC_MIN_FREE_MEMORY=4096
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
;-Wl,-Map,output.map
|
||||
monitor_filters =
|
||||
esp8266_exception_decoder
|
||||
|
@ -57,6 +60,9 @@ board_build.f_cpu = 80000000L
|
|||
build_flags = ${env.build_flags}
|
||||
-DEMC_MIN_FREE_MEMORY=4096
|
||||
-DLANG_DE
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
;-Wl,-Map,output.map
|
||||
monitor_filters =
|
||||
esp8266_exception_decoder
|
||||
|
@ -66,8 +72,11 @@ platform = espressif8266
|
|||
board = esp12e
|
||||
board_build.f_cpu = 80000000L
|
||||
build_flags = ${env.build_flags}
|
||||
-DENABLE_PROMETHEUS_EP
|
||||
-DEMC_MIN_FREE_MEMORY=4096
|
||||
-DENABLE_PROMETHEUS_EP
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp8266_exception_decoder
|
||||
|
||||
|
@ -76,9 +85,12 @@ platform = espressif8266
|
|||
board = esp12e
|
||||
board_build.f_cpu = 80000000L
|
||||
build_flags = ${env.build_flags}
|
||||
-DENABLE_PROMETHEUS_EP
|
||||
-DEMC_MIN_FREE_MEMORY=4096
|
||||
-DENABLE_PROMETHEUS_EP
|
||||
-DLANG_DE
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp8266_exception_decoder
|
||||
|
||||
|
@ -89,6 +101,9 @@ board_build.ldscript = eagle.flash.1m64.ld
|
|||
board_build.f_cpu = 80000000L
|
||||
build_flags = ${env.build_flags}
|
||||
-DEMC_MIN_FREE_MEMORY=4096
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp8266_exception_decoder
|
||||
|
||||
|
@ -100,12 +115,26 @@ board_build.f_cpu = 80000000L
|
|||
build_flags = ${env.build_flags}
|
||||
-DEMC_MIN_FREE_MEMORY=4096
|
||||
-DLANG_DE
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp8266_exception_decoder
|
||||
|
||||
[env:esp32-wroom32]
|
||||
platform = espressif32@6.5.0
|
||||
board = lolin_d32
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp32_exception_decoder
|
||||
|
||||
[env:esp32-wroom32-minimal]
|
||||
platform = espressif32@6.5.0
|
||||
board = lolin_d32
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
monitor_filters =
|
||||
|
@ -116,6 +145,9 @@ platform = espressif32@6.5.0
|
|||
board = lolin_d32
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DLANG_DE
|
||||
monitor_filters =
|
||||
esp32_exception_decoder
|
||||
|
@ -126,6 +158,9 @@ board = lolin_d32
|
|||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_PROMETHEUS_EP
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp32_exception_decoder
|
||||
|
||||
|
@ -134,8 +169,11 @@ platform = espressif32@6.5.0
|
|||
board = lolin_d32
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_PROMETHEUS_EP
|
||||
-DLANG_DE
|
||||
-DENABLE_PROMETHEUS_EP
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp32_exception_decoder
|
||||
|
||||
|
@ -156,8 +194,9 @@ build_flags = ${env.build_flags}
|
|||
-D ETHERNET
|
||||
-DRELEASE
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DLOG_LOCAL_LEVEL=ESP_LOG_INFO
|
||||
-DDEBUG_LEVEL=DBG_INFO
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp32_exception_decoder
|
||||
|
||||
|
@ -179,8 +218,9 @@ build_flags = ${env.build_flags}
|
|||
-DRELEASE
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DLANG_DE
|
||||
-DLOG_LOCAL_LEVEL=ESP_LOG_INFO
|
||||
-DDEBUG_LEVEL=DBG_INFO
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
monitor_filters =
|
||||
esp32_exception_decoder
|
||||
|
||||
|
@ -189,6 +229,9 @@ platform = espressif32@6.5.0
|
|||
board = lolin_s2_mini
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_NRF_CS_PIN=12
|
||||
-DDEF_NRF_CE_PIN=3
|
||||
-DDEF_NRF_IRQ_PIN=5
|
||||
|
@ -208,6 +251,9 @@ platform = espressif32@6.5.0
|
|||
board = lolin_s2_mini
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_NRF_CS_PIN=12
|
||||
-DDEF_NRF_CE_PIN=3
|
||||
-DDEF_NRF_IRQ_PIN=5
|
||||
|
@ -228,6 +274,9 @@ platform = espressif32@6.5.0
|
|||
board = lolin_c3_mini
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_NRF_CS_PIN=5
|
||||
-DDEF_NRF_CE_PIN=0
|
||||
-DDEF_NRF_IRQ_PIN=1
|
||||
|
@ -247,6 +296,9 @@ platform = espressif32@6.5.0
|
|||
board = lolin_c3_mini
|
||||
build_flags = ${env.build_flags}
|
||||
-DUSE_HSPI_FOR_EPD
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_NRF_CS_PIN=5
|
||||
-DDEF_NRF_CE_PIN=0
|
||||
-DDEF_NRF_IRQ_PIN=1
|
||||
|
@ -267,6 +319,37 @@ platform = espressif32@6.5.0
|
|||
board = esp32-s3-devkitc-1
|
||||
upload_protocol = esp-builtin
|
||||
build_flags = ${env.build_flags}
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_NRF_CS_PIN=37
|
||||
-DDEF_NRF_CE_PIN=38
|
||||
-DDEF_NRF_IRQ_PIN=47
|
||||
-DDEF_NRF_MISO_PIN=48
|
||||
-DDEF_NRF_MOSI_PIN=35
|
||||
-DDEF_NRF_SCLK_PIN=36
|
||||
-DDEF_CMT_CSB=4
|
||||
-DDEF_CMT_FCSB=21
|
||||
-DDEF_CMT_IRQ=8
|
||||
-DDEF_CMT_SDIO=5
|
||||
-DDEF_CMT_SCLK=6
|
||||
-DDEF_LED0=18
|
||||
-DDEF_LED1=17
|
||||
-DLED_ACTIVE_HIGH
|
||||
-DARDUINO_USB_MODE=1
|
||||
#-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
monitor_filters =
|
||||
esp32_exception_decoder, colorize
|
||||
|
||||
[env:opendtufusion-de]
|
||||
platform = espressif32@6.5.0
|
||||
board = esp32-s3-devkitc-1
|
||||
upload_protocol = esp-builtin
|
||||
build_flags = ${env.build_flags}
|
||||
-DLANG_DE
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_NRF_CS_PIN=37
|
||||
-DDEF_NRF_CE_PIN=38
|
||||
-DDEF_NRF_IRQ_PIN=47
|
||||
|
@ -285,7 +368,7 @@ build_flags = ${env.build_flags}
|
|||
monitor_filters =
|
||||
esp32_exception_decoder, colorize
|
||||
|
||||
[env:opendtufusion-de]
|
||||
[env:opendtufusion-minimal]
|
||||
platform = espressif32@6.5.0
|
||||
board = esp32-s3-devkitc-1
|
||||
upload_protocol = esp-builtin
|
||||
|
@ -305,7 +388,6 @@ build_flags = ${env.build_flags}
|
|||
-DDEF_LED1=17
|
||||
-DLED_ACTIVE_HIGH
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DLANG_DE
|
||||
monitor_filters =
|
||||
esp32_exception_decoder, colorize
|
||||
|
||||
|
@ -326,6 +408,9 @@ upload_protocol = esp-builtin
|
|||
build_flags = ${env.build_flags}
|
||||
-DETHERNET
|
||||
-DSPI_HAL
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_ETH_CS_PIN=42
|
||||
-DDEF_ETH_SCK_PIN=39
|
||||
-DDEF_ETH_MISO_PIN=41
|
||||
|
@ -368,6 +453,10 @@ upload_protocol = esp-builtin
|
|||
build_flags = ${env.build_flags}
|
||||
-DETHERNET
|
||||
-DSPI_HAL
|
||||
-DLANG_DE
|
||||
-DENABLE_MQTT
|
||||
-DPLUGIN_DISPLAY
|
||||
-DENABLE_HISTORY
|
||||
-DDEF_ETH_CS_PIN=42
|
||||
-DDEF_ETH_SCK_PIN=39
|
||||
-DDEF_ETH_MISO_PIN=41
|
||||
|
@ -390,6 +479,5 @@ build_flags = ${env.build_flags}
|
|||
-DLED_ACTIVE_HIGH
|
||||
-DARDUINO_USB_MODE=1
|
||||
#-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DLANG_DE
|
||||
monitor_filters =
|
||||
esp32_exception_decoder, colorize
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __DISPLAY__
|
||||
#define __DISPLAY__
|
||||
|
||||
#if defined(PLUGIN_DISPLAY)
|
||||
|
||||
#include <Timezone.h>
|
||||
#include <U8g2lib.h>
|
||||
|
||||
|
@ -238,4 +240,6 @@ class Display {
|
|||
DisplayMono *mMono;
|
||||
};
|
||||
|
||||
#endif /*PLUGIN_DISPLAY*/
|
||||
|
||||
#endif /*__DISPLAY__*/
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#ifndef __HISTORY_DATA_H__
|
||||
#define __HISTORY_DATA_H__
|
||||
|
||||
#if defined(ENABLE_HISTORY)
|
||||
|
||||
#include <array>
|
||||
#include "../appInterface.h"
|
||||
#include "../hm/hmSystem.h"
|
||||
|
@ -122,4 +124,5 @@ class HistoryData {
|
|||
uint16_t mMaximumDay = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
#endif /*__HISTORY_DATA_H__*/
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#ifndef __PUB_MQTT_H__
|
||||
#define __PUB_MQTT_H__
|
||||
|
||||
#if defined(ENABLE_MQTT)
|
||||
#ifdef ESP8266
|
||||
#include <ESP8266WiFi.h>
|
||||
#elif defined(ESP32)
|
||||
|
@ -623,4 +624,5 @@ class PubMqtt {
|
|||
discovery_t mDiscovery;
|
||||
};
|
||||
|
||||
#endif /*ENABLE_MQTT*/
|
||||
#endif /*__PUB_MQTT_H__*/
|
||||
|
|
|
@ -202,8 +202,6 @@ class RestApi {
|
|||
ep[F("setup")] = url + F("setup");
|
||||
ep[F("system")] = url + F("system");
|
||||
ep[F("live")] = url + F("live");
|
||||
ep[F("powerHistory")] = url + F("powerHistory");
|
||||
ep[F("yieldDayHistory")] = url + F("yieldDayHistory");
|
||||
}
|
||||
|
||||
|
||||
|
@ -791,6 +789,7 @@ class RestApi {
|
|||
|
||||
void getPowerHistory(AsyncWebServerRequest *request, JsonObject obj) {
|
||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||
#if defined(ENABLE_HISTORY)
|
||||
obj[F("refresh")] = mConfig->inst.sendInterval;
|
||||
uint16_t max = 0;
|
||||
for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) {
|
||||
|
@ -801,10 +800,12 @@ class RestApi {
|
|||
}
|
||||
obj[F("max")] = max;
|
||||
obj[F("maxDay")] = mApp->getHistoryMaxDay();
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
}
|
||||
|
||||
void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) {
|
||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||
#if defined(ENABLE_HISTORY)
|
||||
obj[F("refresh")] = 86400; // 1 day
|
||||
uint16_t max = 0;
|
||||
for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) {
|
||||
|
@ -814,6 +815,7 @@ class RestApi {
|
|||
max = value;
|
||||
}
|
||||
obj[F("max")] = max;
|
||||
#endif /*ENABLE_HISTORY*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -141,11 +141,11 @@
|
|||
<legend class="des">{#INVERTER}</legend>
|
||||
<div id="inverter"></div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-8 my-2">{#INTERVAL}</div>
|
||||
<div class="col-8 my-2">{#INTERVAL} [s]</div>
|
||||
<div class="col-4"><input type="number" name="invInterval" title="Invalid input"/></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-8 my-2">{#INV_GAP}</div>
|
||||
<div class="col-8 my-2">{#INV_GAP} [ms]</div>
|
||||
<div class="col-4"><input type="number" name="invGap" title="Invalid input"/></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
|
|
|
@ -265,8 +265,8 @@
|
|||
},
|
||||
{
|
||||
"token": "INTERVAL",
|
||||
"en": "Interval [s]",
|
||||
"de": "Intervall [s]"
|
||||
"en": "Interval",
|
||||
"de": "Intervall"
|
||||
},
|
||||
{
|
||||
"token": "INV_GAP",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue