diff --git a/lighthub/item.cpp b/lighthub/item.cpp index 482c6ef..4ec5c63 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -358,13 +358,6 @@ int Item::getArg(short n) //Return arg int or first array element if Arg is arra float Item::getFloatArg(short n) //Return arg float or first array element if Arg is array { if (!itemArg) return 0;//-1; - if (!n) - { - if (itemArg->type == aJson_Int) return itemArg->valueint; - else if (itemArg->type == aJson_Float) return itemArg->valuefloat; - else return 0; - } - if ((itemArg->type == aJson_Array) && ( n < aJson.getArraySize(itemArg))) { aJsonObject * obj = aJson.getArrayItem(itemArg, n); @@ -373,7 +366,12 @@ float Item::getFloatArg(short n) //Return arg float or first array element if Ar return 0; } - else return 0;//-2; + else if (!n) + { + if (itemArg->type == aJson_Int) return itemArg->valueint; + else if (itemArg->type == aJson_Float) return itemArg->valuefloat; + } + return 0; } short Item::getArgCount() @@ -910,7 +908,7 @@ int Item::Ctrl(itemCmd cmd, char* subItem, bool allowRecursion) case S_SET: { long limit = limitSetValue(); - if (limit && suffixCode==S_NOTFOUND) limit = 100; + //if (limit && suffixCode==S_NOTFOUND) limit = 100; if (cmd.incrementPercents(step,limit)) { status2Send |= SEND_PARAMETERS | SEND_DEFFERED; diff --git a/lighthub/main.cpp b/lighthub/main.cpp index 09d14d6..c18f291 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -1495,14 +1495,17 @@ if (arg_cnt>1) #endif #if defined(__SAM3X8E__) - char* outBuf = (char*) malloc(MAX_JSON_CONF_SIZE); /* XXX: Dynamic size. */ - if (outBuf == NULL) + long configBufSize = min(MAX_JSON_CONF_SIZE,freeRam()-1024); + debugSerial<<"Allocate "<