fix build mqtt path
This commit is contained in:
2
Config.h
2
Config.h
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define NUKI_HUB_VERSION "8.24-pre-1"
|
#define NUKI_HUB_VERSION "8.24-pre-3"
|
||||||
|
|
||||||
#define MQTT_QOS_LEVEL 1
|
#define MQTT_QOS_LEVEL 1
|
||||||
#define MQTT_CLEAN_SESSIONS false
|
#define MQTT_CLEAN_SESSIONS false
|
||||||
|
|||||||
@@ -521,10 +521,11 @@ void Network::initTopic(const char *prefix, const char *path, const char *value)
|
|||||||
void Network::buildMqttPath(char* outPath, std::initializer_list<const char*> paths)
|
void Network::buildMqttPath(char* outPath, std::initializer_list<const char*> paths)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
int pathCount = 0;
|
||||||
|
|
||||||
for(const char* path : paths)
|
for(const char* path : paths)
|
||||||
{
|
{
|
||||||
if(path[0] != '/')
|
if(pathCount > 0 && path[0] != '/')
|
||||||
{
|
{
|
||||||
outPath[offset] = '/';
|
outPath[offset] = '/';
|
||||||
++offset;
|
++offset;
|
||||||
@@ -537,6 +538,7 @@ void Network::buildMqttPath(char* outPath, std::initializer_list<const char*> pa
|
|||||||
++offset;
|
++offset;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
++pathCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
outPath[offset] = 0x00;
|
outPath[offset] = 0x00;
|
||||||
|
|||||||
Reference in New Issue
Block a user