V.Subtle error.... recvRetNumber(uint32_t number, uint32_t timeout) function Line 67
number = ((uint32_t)temp[4] << 24) | ((uint32_t)temp[3] << 16) | (temp[2] << 8) | (temp[1]);
should be
*number = ((uint32_t)temp[4] << 24) | ((uint32_t)temp[3] << 16) | ((uint32_t)temp[2] << 8) | (temp[1]);
<<8 on temp[2] can blow a uint8 as part of that calc
V.Subtle error.... recvRetNumber(uint32_t number, uint32_t timeout) function Line 67 number = ((uint32_t)temp[4] << 24) | ((uint32_t)temp[3] << 16) | (temp[2] << 8) | (temp[1]); should be *number = ((uint32_t)temp[4] << 24) | ((uint32_t)temp[3] << 16) | ((uint32_t)temp[2] << 8) | (temp[1]); <<8 on temp[2] can blow a uint8 as part of that calc