Fix double digit numbers not being supported

This commit is contained in:
GHOSCHT 2022-02-05 21:05:04 +01:00
parent 22c93557fd
commit 61b57c8a9e
No known key found for this signature in database
GPG key ID: A35BD466B8871994

View file

@ -35,16 +35,21 @@ __SIZE_TYPE__ StreamCommunicator::calculateMessageOutSize(__SIZE_TYPE__ numberOf
void StreamCommunicator::parseIDs(const int values[], __SIZE_TYPE__ numberOfValues, char *output)
{
String out = "";
__SIZE_TYPE__ outputSize = calculateMessageOutSize(numberOfValues);
__SIZE_TYPE__ outputCharPointer = 0;
output[outputSize - 1] = '\0';
for (__SIZE_TYPE__ i = 0; i < numberOfValues; i++)
{
output[outputCharPointer++] = values[i] + '0';
out += values[i];
outputCharPointer++;
if (outputCharPointer < outputSize - 1)
output[outputCharPointer++] = ',';
{
out += ',';
outputCharPointer++;
}
}
strcpy(output, out.c_str());
}
char *StreamCommunicator::getBuffer()