Compare commits
2 Commits
c04e5c8d56
...
29b30aeb0b
| Author | SHA1 | Date | |
|---|---|---|---|
|
29b30aeb0b
|
|||
|
a2429d4dbc
|
@ -15,8 +15,10 @@ Each packet is constructed as follows:
|
||||
- `uint8_t`: A basic XOR checksum of all the previous bytes, XORed with `0x55`.
|
||||
- `null`: A null terminator (0x00).
|
||||
|
||||
The firmware can also send logs by sending the initial character `/`, followed by ASCII text, then a null terminator (`0x00`)
|
||||
|
||||
### Commands:
|
||||
- Connect (`0x01`): Used to get the firmware into its ready state, and out of it's initial mode of repeating `WHSPAH\n`. Responds with `0x01`.
|
||||
- Connect (`0x01`): Used to get the firmware into its ready state, and out of it's initial mode of repeating `/WHSPAH\x00`. Responds with `0x01`.
|
||||
- Ping (`0x02`): Needs to be send at least once every 500ms, otherwise the firmware will reset into its initial mode. Responds with `0x02`.
|
||||
- Transmit (`0x10`): Transmits a CaiXianlin packet. The command's arguments are as follows:
|
||||
- `uint16_t`: Transmitter ID
|
||||
|
||||
@ -47,7 +47,7 @@ namespace {
|
||||
}
|
||||
checksum ^= 0x55;
|
||||
Serial.write(checksum);
|
||||
Serial.write(0x00);
|
||||
Serial.write((char) 0x00);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,8 @@ void CMDProcessor::process() {
|
||||
CMDProcessor::connected = false;
|
||||
reset();
|
||||
} else if (!CMDProcessor::connected && millis() - lastPing > 250) {
|
||||
Serial.print("WHSPAH\n");
|
||||
Serial.print("/WHSPAH");
|
||||
Serial.print((char) 0x00);
|
||||
lastPing = millis();
|
||||
}
|
||||
|
||||
|
||||
@ -2,3 +2,9 @@
|
||||
#include "./CaiXianlin.h"
|
||||
|
||||
CaiXianlin::Transmitter* RFTransmitter = nullptr;
|
||||
|
||||
void sendLog(char* message) {
|
||||
Serial.write("/");
|
||||
Serial.write(message);
|
||||
Serial.write((char) 0x00);
|
||||
}
|
||||
|
||||
@ -4,5 +4,6 @@
|
||||
#include "./CaiXianlin.h"
|
||||
|
||||
extern CaiXianlin::Transmitter* RFTransmitter;
|
||||
void sendLog(char* message);
|
||||
|
||||
#endif // Header define
|
||||
|
||||
Reference in New Issue
Block a user