mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-12 16:36:38 +02:00
* added patch from @Argafal
* Updated readme to refer library versions
This commit is contained in:
parent
7844ea2946
commit
6a1a3b86d2
3 changed files with 17 additions and 10 deletions
|
@ -54,7 +54,11 @@ For now the following inverters should work out of the box:
|
|||
|
||||
## USED LIBRARIES
|
||||
|
||||
- `Time`
|
||||
- `RF24`
|
||||
- `PubSubClient`
|
||||
- `ESP8266WiFi` 1.0
|
||||
- `DNSServer` 1.1.0
|
||||
- `Ticker` 1.0
|
||||
- `ESP8266HTTPUpdateServer` 1.0
|
||||
- `Time` 1.6.1
|
||||
- `RF24` 1.4.2
|
||||
- `PubSubClient` 2.8
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ app::app() : Main() {
|
|||
mSerialTicker = 0xffff;
|
||||
mSerialInterval = 0;
|
||||
mMqttActive = false;
|
||||
mMqttNewDataAvail = false;
|
||||
|
||||
mTicker = 0;
|
||||
mRxTicker = 0;
|
||||
|
@ -181,7 +182,7 @@ void app::loop(void) {
|
|||
mMqtt.loop();
|
||||
|
||||
if(checkTicker(&mTicker, 1000)) {
|
||||
if(mMqttActive) {
|
||||
if(mMqttNewDataAvail) {
|
||||
if(++mMqttTicker >= mMqttInterval) {
|
||||
mMqttTicker = 0;
|
||||
mMqtt.isConnected(true);
|
||||
|
@ -190,17 +191,17 @@ void app::loop(void) {
|
|||
Inverter<> *iv = mSys->getInverterByPos(id);
|
||||
if(NULL != iv) {
|
||||
for(uint8_t i = 0; i < iv->listLen; i++) {
|
||||
if(0.0f != iv->getValue(i)) {
|
||||
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);
|
||||
yield();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
snprintf(val, 10, "%d", ESP.getFreeHeap());
|
||||
mMqtt.sendMsg("free_heap", val);
|
||||
mMqttNewDataAvail = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,6 +343,7 @@ void app::processPayload(bool retransmit) {
|
|||
iv->addValue(i, payload);
|
||||
}
|
||||
iv->doCalculations();
|
||||
mMqttNewDataAvail = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ class app : public Main {
|
|||
bool mMqttActive;
|
||||
uint16_t mSerialTicker;
|
||||
uint16_t mSerialInterval;
|
||||
bool mMqttNewDataAvail;
|
||||
};
|
||||
|
||||
#endif /*__APP_H__*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue