Browse Source

0.8.970004-zero

pull/1535/head
Patrick Amrhein 10 months ago
parent
commit
0dae65bbd4
  1. 5
      src/app.cpp
  2. 2
      src/defines.h
  3. 7
      src/hm/Communication.h
  4. 776
      src/plugins/zeroExport/zeroExport.h
  5. 3
      src/web/html/setup.html
  6. 6
      src/web/lang.json

5
src/app.cpp

@ -93,6 +93,11 @@ void app::setup() {
mZeroExport.resetWaitRebootAck(iv); mZeroExport.resetWaitRebootAck(iv);
}); });
#endif /*PLUGIN_ZEROEXPORT*/ #endif /*PLUGIN_ZEROEXPORT*/
#if defined(PLUGIN_ZEROEXPORT)
mCommunication.addNewDataListener([this] (Inverter<> *iv) {
mZeroExport.newDataAvailable(iv);
});
#endif /*PLUGIN_ZEROEXPORT*/
mSys.setup(&mTimestamp, &mConfig->inst, this); mSys.setup(&mTimestamp, &mConfig->inst, this);
for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) { for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 970003 #define VERSION_PATCH 970004
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

7
src/hm/Communication.h

@ -19,6 +19,7 @@ typedef std::function<void(uint8_t, Inverter<> *)> payloadListenerType;
typedef std::function<void(Inverter<> *)> powerLimitAckListenerType; typedef std::function<void(Inverter<> *)> powerLimitAckListenerType;
typedef std::function<void(Inverter<> *)> powerPowerAckListenerType; typedef std::function<void(Inverter<> *)> powerPowerAckListenerType;
typedef std::function<void(Inverter<> *)> powerRebootAckListenerType; typedef std::function<void(Inverter<> *)> powerRebootAckListenerType;
typedef std::function<void(Inverter<> *)> newDataListenerType;
typedef std::function<void(Inverter<> *)> alarmListenerType; typedef std::function<void(Inverter<> *)> alarmListenerType;
class Communication : public CommQueue<> { class Communication : public CommQueue<> {
@ -51,6 +52,10 @@ class Communication : public CommQueue<> {
mCbPwrRebootAck = cb; mCbPwrRebootAck = cb;
} }
void addNewDataListener(newDataListenerType cb) {
mCbNewData = cb;
}
void addAlarmListener(alarmListenerType cb) { void addAlarmListener(alarmListenerType cb) {
mCbAlarm = cb; mCbAlarm = cb;
} }
@ -601,6 +606,7 @@ class Communication : public CommQueue<> {
for (uint8_t i = 0; i < rec->length; i++) { for (uint8_t i = 0; i < rec->length; i++) {
q->iv->addValue(i, mPayload.data(), rec); q->iv->addValue(i, mPayload.data(), rec);
} }
(mCbNewData)(q->iv);
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; rec->mqttSentStatus = MqttSentStatus::NEW_DATA;
q->iv->rssi = rssi; q->iv->rssi = rssi;
@ -1057,6 +1063,7 @@ class Communication : public CommQueue<> {
powerLimitAckListenerType mCbPwrAck = NULL; powerLimitAckListenerType mCbPwrAck = NULL;
powerPowerAckListenerType mCbPwrPowerAck = NULL; powerPowerAckListenerType mCbPwrPowerAck = NULL;
powerRebootAckListenerType mCbPwrRebootAck = NULL; powerRebootAckListenerType mCbPwrRebootAck = NULL;
newDataListenerType mCbNewData = NULL;
alarmListenerType mCbAlarm = NULL; alarmListenerType mCbAlarm = NULL;
Heuristic mHeu; Heuristic mHeu;
uint32_t mLastEmptyQueueMillis = 0; uint32_t mLastEmptyQueueMillis = 0;

776
src/plugins/zeroExport/zeroExport.h

File diff suppressed because it is too large

3
src/web/html/setup.html

@ -1363,7 +1363,8 @@
divRow("{#ZE_GROUP_TAB_POWERMETER_TYPE}", divRow("{#ZE_GROUP_TAB_POWERMETER_TYPE}",
ml("select", {name: "pm_type", class: "text", id: "pm_type"}, null), ml("select", {name: "pm_type", class: "text", id: "pm_type"}, null),
), ),
divRow("{#ZE_GROUP_TAB_POWERMETER_URL}", [ // TODO: URL -> IP
divRow("{#ZE_GROUP_TAB_POWERMETER_IP}", [
ml("input", {name: "pm_url", class: "text", type: "text", value: obj.pm_url, maxlength: "100"}, null), ml("input", {name: "pm_url", class: "text", type: "text", value: obj.pm_url, maxlength: "100"}, null),
]), ]),
divRow("{#ZE_GROUP_TAB_POWERMETER_JSONPATH}", [ divRow("{#ZE_GROUP_TAB_POWERMETER_JSONPATH}", [

6
src/web/lang.json

@ -854,9 +854,9 @@
"de": "Typ:" "de": "Typ:"
}, },
{ {
"token": "ZE_GROUP_TAB_POWERMETER_URL", "token": "ZE_GROUP_TAB_POWERMETER_IP",
"en": "Url:", "en": "IP:",
"de": "Url:" "de": "IP:"
}, },
{ {
"token": "ZE_GROUP_TAB_POWERMETER_JSONPATH", "token": "ZE_GROUP_TAB_POWERMETER_JSONPATH",

Loading…
Cancel
Save