mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-12 16:36:38 +02:00
#288 MQTT Topic Länge zu kurz
This commit is contained in:
parent
12d8ff5949
commit
e2d193e591
1 changed files with 3 additions and 3 deletions
|
@ -390,7 +390,7 @@ void app::processPayload(bool retransmit) {
|
|||
// MQTT send out
|
||||
if(mMqttActive) {
|
||||
record_t<> *recRealtime = iv->getRecordStruct(RealTimeRunData_Debug);
|
||||
char topic[30], val[10];
|
||||
char topic[32 + MAX_NAME_LENGTH], val[10];
|
||||
float total[4];
|
||||
memset(total, 0, sizeof(float) * 4);
|
||||
for (uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
||||
|
@ -398,7 +398,7 @@ void app::processPayload(bool retransmit) {
|
|||
if (NULL != iv) {
|
||||
if (iv->isAvailable(mTimestamp, rec)) {
|
||||
for (uint8_t i = 0; i < rec->length; i++) {
|
||||
snprintf(topic, 30, "%s/ch%d/%s", iv->name, rec->assign[i].ch, fields[rec->assign[i].fieldId]);
|
||||
snprintf(topic, 32 + MAX_NAME_LENGTH, "%s/ch%d/%s", iv->name, rec->assign[i].ch, fields[rec->assign[i].fieldId]);
|
||||
snprintf(val, 10, "%.3f", iv->getValue(i, rec));
|
||||
mMqtt.sendMsg(topic, val);
|
||||
if(recRealtime == rec) {
|
||||
|
@ -428,7 +428,7 @@ void app::processPayload(bool retransmit) {
|
|||
case 2: fieldId = FLD_YD; break;
|
||||
case 3: fieldId = FLD_PDC; break;
|
||||
}
|
||||
snprintf(topic, 30, "total/%s", fields[fieldId]);
|
||||
snprintf(topic, 32 + MAX_NAME_LENGTH, "total/%s", fields[fieldId]);
|
||||
snprintf(val, 10, "%.3f", total[i]);
|
||||
mMqtt.sendMsg(topic, val);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue