Remove wrong space- MQTT payload, more memory ctrl

This commit is contained in:
2022-01-21 01:01:46 +03:00
parent 2b3c77bf03
commit b7c6eaaff1
2 changed files with 13 additions and 2 deletions

View File

@@ -887,6 +887,11 @@ int Item::Ctrl(itemCmd cmd, char* subItem, bool allowRecursion)
} }
if (itemType==CH_GROUP) if (itemType==CH_GROUP)
{ {
if (fr<350)
{
errorSerial<<F("Not enough memory for group operation")<<endl;
return -1;
}
if (allowRecursion && itemArg->type == aJson_Array && operation) if (allowRecursion && itemArg->type == aJson_Array && operation)
{ {
digGroup(itemArg,&cmd,subItem); digGroup(itemArg,&cmd,subItem);

View File

@@ -1076,13 +1076,18 @@ char * itemCmd::toString(char * Buffer, int bufLen, int sendFlags, bool scale100
{ {
int len; int len;
strncpy_P(Buffer, commands_P[cmd.cmdCode], bufLen); strncpy_P(Buffer, commands_P[cmd.cmdCode], bufLen);
strncat(Buffer, " ", bufLen); //strncat(Buffer, " ", bufLen);
len=strlen(Buffer); len=strlen(Buffer);
argPtr+=len; argPtr+=len;
bufLen-=len; bufLen-=len;
bufLen--; bufLen--;
} }
if (sendFlags & SEND_PARAMETERS) if (isValue() && (sendFlags & SEND_PARAMETERS))
{
strncat(Buffer, " ", bufLen);
bufLen--;
argPtr++;
switch (cmd.itemArgType) switch (cmd.itemArgType)
{ short colorTemp; { short colorTemp;
@@ -1142,6 +1147,7 @@ char * itemCmd::toString(char * Buffer, int bufLen, int sendFlags, bool scale100
default: default:
; ;
} }
}
return Buffer; return Buffer;
} }