mirror of https://github.com/arendst/Tasmota.git
Serialsend6
* Adds serialsend6, allowing sending of binary data with comma-delimited string of decimal numbers.
This commit is contained in:
parent
2c6198f27c
commit
63242de249
|
@ -906,6 +906,17 @@ void SerialSendRaw(char *codes)
|
|||
}
|
||||
}
|
||||
|
||||
// values is a comma-delimited string: e.g. "72,101,108,108,111,32,87,111,114,108,100,33,10"
|
||||
void SerialSendDecimal(char *values)
|
||||
{
|
||||
char* &p;
|
||||
uint8_t code;
|
||||
for (str = strtok_r(values, ",", &p); str; str = strtok_r(nullptr, ",", &p)) {
|
||||
code = (uint8_t)atoi(str);
|
||||
Serial.write(code);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t GetHash(const char *buffer, size_t size)
|
||||
{
|
||||
uint32_t hash = 0;
|
||||
|
|
|
@ -1354,6 +1354,9 @@ void CmndSerialSend(void)
|
|||
else if (5 == XdrvMailbox.index) {
|
||||
SerialSendRaw(RemoveSpace(XdrvMailbox.data)); // "AA004566" as hex values
|
||||
}
|
||||
else if (6 == XdrvMailbox.index) {
|
||||
SerialSendDecimal(XdrvMailbox.data);
|
||||
}
|
||||
ResponseCmndDone();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue