Fix implicit cast and non-const char pointer warnings

This commit is contained in:
Thomas Barnekov 2022-10-05 21:59:30 +02:00
parent fe7be81f1e
commit ad78ff3082
3 changed files with 15 additions and 15 deletions

View File

@ -1122,7 +1122,7 @@ void WiFi_connect() {
void mqttMessageReceived(String &topic, String &payload) {
debugI("Received message for topic %s", topic.c_str() );
if(meterConfig.source == METER_SOURCE_MQTT) {
DataParserContext ctx = {payload.length()/2};
DataParserContext ctx = {static_cast<uint8_t>(payload.length()/2)};
fromHex(hanBuffer, payload, ctx.length);
uint16_t pos = unwrapData(hanBuffer, ctx);
// TODO: Run through DLMS/DMSR parser and apply AmsData

View File

@ -4,12 +4,12 @@
#include "Arduino.h"
struct HomeAssistantSensor {
char* name;
char* topic;
char* path;
char* uom;
char* devcl;
char* stacl;
const char* name;
const char* topic;
const char* path;
const char* uom;
const char* devcl;
const char* stacl;
};

View File

@ -1007,7 +1007,7 @@ void AmsWebServer::handleSetup() {
server.sendHeader("Location", String("/"), true);
server.send (302, MIME_PLAIN, "");
} else {
SystemConfig sys { server.arg("board").toInt() };
SystemConfig sys { static_cast<uint8_t>(server.arg("board").toInt()) };
DebugConfig debugConfig;
config->getDebugConfig(debugConfig);
@ -1277,11 +1277,11 @@ void AmsWebServer::handleSave() {
if(server.hasArg("dc") && server.arg("dc") == "true") {
printD("Received Domoticz config");
DomoticzConfig domo {
server.arg("elidx").toInt(),
server.arg("vl1idx").toInt(),
server.arg("vl2idx").toInt(),
server.arg("vl3idx").toInt(),
server.arg("cl1idx").toInt()
static_cast<uint16_t>(server.arg("elidx").toInt()),
static_cast<uint16_t>(server.arg("vl1idx").toInt()),
static_cast<uint16_t>(server.arg("vl2idx").toInt()),
static_cast<uint16_t>(server.arg("vl3idx").toInt()),
static_cast<uint16_t>(server.arg("cl1idx").toInt())
};
config->setDomoticzConfig(domo);
}
@ -1358,8 +1358,8 @@ void AmsWebServer::handleSave() {
NtpConfig ntp {
server.hasArg("n") && server.arg("n") == "true",
server.hasArg("nd") && server.arg("nd") == "true",
server.arg("o").toInt() / 10,
server.arg("so").toInt() / 10
static_cast<int16_t>(server.arg("o").toInt() / 10),
static_cast<int16_t>(server.arg("so").toInt() / 10)
};
strcpy(ntp.server, server.arg("ns").c_str());
config->setNtpConfig(ntp);