Minor Update:

- DeviceCore:
  - Initialise params in header file
- JSONparseCore:
  - Increase Read buffer to handle large queries
- UtilCore:
  - Bug fix: handle NULL seperator in Hex conversions
This commit is contained in:
Charl Wentzel
2019-05-28 09:22:28 +02:00
parent 316b27b19f
commit ac649bf4fb
4 changed files with 21 additions and 32 deletions

View File

@@ -75,7 +75,7 @@ char * BytesToHexStr( const char * Bytes, const int Len, const char * Separator,
// Print Hex values of individual bytes
for (int i=0; i<Len; i++) {
sprintf( BufPos, "%s%02X", ((First)? "" : Separator), (unsigned char)Bytes[i] );
sprintf( BufPos, "%s%02X", ((First || !Separator)? "" : Separator), (unsigned char)Bytes[i] );
BufPos += (First)? 2 : 2+SepLen;
First = false;
}
@@ -105,7 +105,7 @@ char * BytesToBinStr( const char * Bytes, const int Len, const char * Separator,
// Print each byte as 8-bit binary
for (int i=0; i<Len; i++) {
sprintf( BufPos, "%s%c%c%c%c%c%c%c%c", ((First)? "" : Separator),
sprintf( BufPos, "%s%c%c%c%c%c%c%c%c", ((First || !Separator)? "" : Separator),
(Bytes[i] & 0x80)?'1':'0', (Bytes[i] & 0x40)?'1':'0', (Bytes[i] & 0x20)?'1':'0', (Bytes[i] & 0x10)?'1':'0',
(Bytes[i] & 0x08)?'1':'0', (Bytes[i] & 0x04)?'1':'0', (Bytes[i] & 0x02)?'1':'0', (Bytes[i] & 0x01)?'1':'0' );
BufPos += (First)? 8 : 8+SepLen;