mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-10-27 06:21:26 +00:00
[Command] Use new CommandArgParser for all commands to parse int args
This commit is contained in:
1 parent
26147d9964
commit
16e280188d
2 files changed
+13
-15
No files matched your search
@@ -206,19 +206,6 @@ bool ExecuteCommand(ExecuteCommandArgs&& args, bool addToQueue)
|
||||
// Maybe ExecuteCommand can be scheduled?
|
||||
delay(0);
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLogMove(LOG_LEVEL_DEBUG, strformat(
|
||||
F("Par1: %d Par2: %d Par3: %d Par4: %d Par5: %d"),
|
||||
TempEvent.Par1,
|
||||
TempEvent.Par2,
|
||||
TempEvent.Par3,
|
||||
TempEvent.Par4,
|
||||
TempEvent.Par5));
|
||||
}
|
||||
#endif // ifndef BUILD_NO_DEBUG
|
||||
|
||||
|
||||
if (args._tryInternal) {
|
||||
InternalCommands internalCommands(cmd.c_str(), &TempEvent, args._Line.c_str());
|
||||
|
||||
@@ -1106,7 +1106,18 @@ void parseCommandString(struct EventStruct *event, const String& string)
|
||||
checkRAM(F("parseCommandString"));
|
||||
#endif // ifndef BUILD_NO_RAM_TRACKER
|
||||
|
||||
for (uint8_t i = 0; i < 5; ++i) {
|
||||
event->ParN[i] = parseCommandArgumentInt(string, i + 1);
|
||||
CommandArgParser args;
|
||||
args.readCommand(string);
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
args.debug(F("parseCommandString"), LOG_LEVEL_DEBUG);
|
||||
#endif // ifndef BUILD_NO_DEBUG
|
||||
|
||||
|
||||
constexpr uint8_t nrInts = NR_ELEMENTS(event->ParN);
|
||||
|
||||
for (uint8_t i = 0; i < nrInts; ++i) {
|
||||
event->ParN[i] = args.getArgInt(i);
|
||||
// parseCommandArgumentInt(string, i + 1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user