mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-01 18:21:39 +02:00
parent
7050a34868
commit
db8b17502e
2 changed files with 10 additions and 1 deletions
|
@ -2,3 +2,4 @@
|
|||
|
||||
## 0.6.1 - 2023-04-01
|
||||
* merge LED fix - LED1 shows MqTT state, LED configureable active high/low #839
|
||||
* only publish new inverter data #826
|
||||
|
|
|
@ -49,6 +49,7 @@ class PubMqtt {
|
|||
mTxCnt = 0;
|
||||
mSubscriptionCb = NULL;
|
||||
memset(mLastIvState, MQTT_STATUS_NOT_AVAIL_NOT_PROD, MAX_NUM_INVERTERS);
|
||||
memset(mIvLastRTRpub, 0, MAX_NUM_INVERTERS * 4);
|
||||
mLastAnyAvail = false;
|
||||
}
|
||||
|
||||
|
@ -522,7 +523,13 @@ class PubMqtt {
|
|||
void sendData(Inverter<> *iv, uint8_t curInfoCmd) {
|
||||
record_t<> *rec = iv->getRecordStruct(curInfoCmd);
|
||||
|
||||
if (iv->getLastTs(rec) > 0) {
|
||||
uint32_t lastTs = iv->getLastTs(rec);
|
||||
bool pubData = (lastTs > 0);
|
||||
if (curInfoCmd == RealTimeRunData_Debug)
|
||||
pubData &= (lastTs != mIvLastRTRpub[iv->id]);
|
||||
|
||||
if (pubData) {
|
||||
mIvLastRTRpub[iv->id] = lastTs;
|
||||
for (uint8_t i = 0; i < rec->length; i++) {
|
||||
bool retained = false;
|
||||
if (curInfoCmd == RealTimeRunData_Debug) {
|
||||
|
@ -653,6 +660,7 @@ class PubMqtt {
|
|||
subscriptionCb mSubscriptionCb;
|
||||
bool mLastAnyAvail;
|
||||
uint8_t mLastIvState[MAX_NUM_INVERTERS];
|
||||
uint32_t mIvLastRTRpub[MAX_NUM_INVERTERS];
|
||||
uint16_t mIntervalTimeout;
|
||||
|
||||
// last will topic and payload must be available trough lifetime of 'espMqttClient'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue