Improve repeater reliability and build tooling
This commit is contained in:
1 parent
2b4aed4ef1
commit
da00a00436
31 files changed
+1079
-229
No files matched your search
+3
-1
@@ -120,6 +120,7 @@ bool Utils::isHexChar(char c) {
|
||||
}
|
||||
|
||||
bool Utils::fromHex(uint8_t* dest, int dest_size, const char *src_hex) {
|
||||
if (dest == NULL || src_hex == NULL || dest_size < 0) return false;
|
||||
int len = strlen(src_hex);
|
||||
if (len != dest_size*2) return false; // incorrect length
|
||||
|
||||
@@ -127,6 +128,7 @@ bool Utils::fromHex(uint8_t* dest, int dest_size, const char *src_hex) {
|
||||
while (dp - dest < dest_size) {
|
||||
char ch = *src_hex++;
|
||||
char cl = *src_hex++;
|
||||
if (!isHexChar(ch) || !isHexChar(cl)) return false;
|
||||
*dp++ = (hexVal(ch) << 4) | hexVal(cl);
|
||||
}
|
||||
return true;
|
||||
@@ -150,4 +152,4 @@ int Utils::parseTextParts(char* text, const char* parts[], int max_num, char sep
|
||||
return num;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user