fix string conversion functions
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#define NUKI_HUB_VERSION "9.03"
|
#define NUKI_HUB_VERSION "9.03"
|
||||||
#define NUKI_HUB_BUILD "unknownbuildnr"
|
#define NUKI_HUB_BUILD "unknownbuildnr"
|
||||||
#define NUKI_HUB_DATE "2024-11-28"
|
#define NUKI_HUB_DATE "2024-11-29"
|
||||||
|
|
||||||
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
|
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
|
||||||
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"
|
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"
|
||||||
|
|||||||
@@ -1126,7 +1126,7 @@ void NukiNetwork::publishUInt(const char* prefix, const char *topic, const unsig
|
|||||||
void NukiNetwork::publishULong(const char* prefix, const char *topic, const unsigned long value, bool retain)
|
void NukiNetwork::publishULong(const char* prefix, const char *topic, const unsigned long value, bool retain)
|
||||||
{
|
{
|
||||||
char str[30];
|
char str[30];
|
||||||
utoa(value, str, 10);
|
ultoa(value, str, 10);
|
||||||
char path[200] = {0};
|
char path[200] = {0};
|
||||||
buildMqttPath(path, { prefix, topic });
|
buildMqttPath(path, { prefix, topic });
|
||||||
publish(path, str, retain);
|
publish(path, str, retain);
|
||||||
@@ -1134,23 +1134,11 @@ void NukiNetwork::publishULong(const char* prefix, const char *topic, const unsi
|
|||||||
|
|
||||||
void NukiNetwork::publishLongLong(const char* prefix, const char *topic, int64_t value, bool retain)
|
void NukiNetwork::publishLongLong(const char* prefix, const char *topic, int64_t value, bool retain)
|
||||||
{
|
{
|
||||||
static char result[21] = "";
|
char str[30];
|
||||||
memset(&result[0], 0, sizeof(result));
|
lltoa(value, str, 10);
|
||||||
char temp[21] = "";
|
|
||||||
char c;
|
|
||||||
uint8_t base = 10;
|
|
||||||
|
|
||||||
while (value)
|
|
||||||
{
|
|
||||||
int num = value % base;
|
|
||||||
value /= base;
|
|
||||||
c = '0' + num;
|
|
||||||
sprintf(temp, "%c%s", c, result);
|
|
||||||
strcpy(result, temp);
|
|
||||||
}
|
|
||||||
char path[200] = {0};
|
char path[200] = {0};
|
||||||
buildMqttPath(path, { prefix, topic });
|
buildMqttPath(path, { prefix, topic });
|
||||||
publish(path, result, retain);
|
publish(path, str, retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NukiNetwork::publishBool(const char* prefix, const char *topic, const bool value, bool retain)
|
void NukiNetwork::publishBool(const char* prefix, const char *topic, const bool value, bool retain)
|
||||||
|
|||||||
Reference in New Issue
Block a user