Add uint32 support to the MODE_ARRAY CLI parameter type (#8556)

Add uint32 support to the MODE_ARRAY CLI parameter type
This commit is contained in:
Michael Keller 2019-07-25 23:52:48 +12:00 committed by GitHub
commit 7a84a5cf73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -485,6 +485,11 @@ static void printValuePointer(const clivalue_t *var, const void *valuePointer, b
// int16_t array
cliPrintf("%d", ((int16_t *)valuePointer)[i]);
break;
case VAR_UINT32:
// uin32_t array
cliPrintf("%u", ((uint32_t *)valuePointer)[i]);
break;
}
if (i < var->config.array.length - 1) {
@ -4324,6 +4329,15 @@ STATIC_UNIT_TESTED void cliSet(char *cmdline)
*data = (int16_t)atoi((const char*) valPtr);
}
break;
case VAR_UINT32:
{
// fetch data pointer
uint32_t *data = (uint32_t *)cliGetValuePointer(val) + i;
// store value
*data = (uint32_t)strtoul((const char*) valPtr, NULL, 10);
}
break;
}