diff --git a/code/espurna/rfbridge.ino b/code/espurna/rfbridge.ino index d2d41598..5d9d2fd5 100644 --- a/code/espurna/rfbridge.ino +++ b/code/espurna/rfbridge.ino @@ -54,6 +54,32 @@ Ticker _rfbTicker; // PRIVATES // ----------------------------------------------------------------------------- +/* + From an hexa char array ("A220EE...") to a byte array (half the size) + */ +static int _rfbToArray(const char * in, byte * out, int length = RF_MESSAGE_SIZE * 2) { + int n = strlen(in); + if (n > RF_MAX_MESSAGE_SIZE*2 || (length > 0 && n != length)) return 0; + char tmp[3] = {0,0,0}; + n /= 2; + for (unsigned char p = 0; p RF_MAX_MESSAGE_SIZE*2 || (length > 0 && n != length)) return 0; - char tmp[3] = {0,0,0}; - n /= 2; - for (unsigned char p = 0; p