From 55d20f0f652c47e9990cb524f97fd4582495cfe9 Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Mon, 28 Sep 2026 23:30:24 +0200 Subject: [PATCH] [Commands] UdpPort argument processing fix --- src/src/Commands/Common.cpp | 11 +++++------ src/src/Commands/Common.h | 10 +++++----- src/src/Commands/UDP.cpp | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/src/Commands/Common.cpp b/src/src/Commands/Common.cpp index 82a6b6183..e44e96a9e 100644 --- a/src/src/Commands/Common.cpp +++ b/src/src/Commands/Common.cpp @@ -213,10 +213,10 @@ String Command_GetORSetETH(struct EventStruct *event, } #endif -String Command_GetORSetInt8_t(struct EventStruct *event, +String Command_GetORSetUInt32_t(struct EventStruct *event, const __FlashStringHelper * targetDescription, const char *Line, - int8_t *value, + uint32_t *value, int arg) { bool hasArgument = false; @@ -226,11 +226,10 @@ String Command_GetORSetInt8_t(struct EventStruct *event, if (GetArgv(Line, TmpStr1, arg + 1)) { hasArgument = true; - TmpStr1.toLowerCase(); - int32_t tmp_int = 0; - if (validIntFromString(TmpStr1, tmp_int)) { - *value = static_cast(tmp_int); + uint32_t tmp_int{}; + if (validUIntFromString(TmpStr1, tmp_int)) { + *value = tmp_int; } } } diff --git a/src/src/Commands/Common.h b/src/src/Commands/Common.h index 55c096d24..481c02eed 100644 --- a/src/src/Commands/Common.h +++ b/src/src/Commands/Common.h @@ -62,11 +62,11 @@ String Command_GetORSetETH(struct EventStruct *event, int arg); #endif -String Command_GetORSetInt8_t(struct EventStruct *event, - const __FlashStringHelper * targetDescription, - const char *Line, - int8_t *value, - int arg); +String Command_GetORSetUInt32_t(struct EventStruct *event, + const __FlashStringHelper * targetDescription, + const char *Line, + uint32_t *value, + int arg); String Command_GetORSetFloatMinMax(struct EventStruct *event, const __FlashStringHelper * targetDescription, diff --git a/src/src/Commands/UDP.cpp b/src/src/Commands/UDP.cpp index f00496bb7..2076d92f8 100644 --- a/src/src/Commands/UDP.cpp +++ b/src/src/Commands/UDP.cpp @@ -11,10 +11,10 @@ String Command_UDP_Port(struct EventStruct *event, const char *Line) { - return Command_GetORSetBool(event, F("UDPPort:"), - Line, - (bool *)&Settings.UDPPort, - 1); + return Command_GetORSetUInt32_t(event, F("UDPPort:"), + Line, + &Settings.UDPPort, + 1); } #if FEATURE_ESPEASY_P2P