11 for(uint8_t i = 0; i < 5; i++) {
31 for(uint8_t i = 0; i < 5; i++) {
45 for(uint8_t i = 0; i < 5; i++) {
46 _deviceId[i] = lastId[i];
52 _radio->openWritingPipe(_deviceId);
53 _radio->openReadingPipe(1, _remoteId);
100 _radio->setPALevel(RF24_PA_LOW);
116 _radio->openReadingPipe(1, _remoteId);
125 _radio->read(&deviceId, 5);
134 _radio->read(settings, 32);
150 uint8_t settings[32];
151 uint8_t testData = 0;
156 _isConnected =
false;
159 _radio->setPALevel(RF24_PA_LOW);
164 _radio->openReadingPipe(1, _remoteId);
174 _radio->read(&_deviceId, 5);
184 _radio->openWritingPipe(_deviceId);
191 if(
_radio->write(const_cast<uint8_t*>(&
_ACK), 1) ==
false) {
195 if(
_radio->write(const_cast<uint8_t*>(&
_NACK), 1) ==
false) {
204 _radio->setPALevel(RF24_PA_HIGH);
213 if(
_radio->write(const_cast<uint8_t*>(&
_TEST), 1) ==
false) {
218 _radio->read(&testData, 1);
220 if(testData !=
_TEST) {
230 if(
_radio->write(const_cast<uint8_t*>(&
_TEST), 1) ==
false) {
244 _radio->read(&testData, 1);
246 if(testData !=
_TEST) {
268 int8_t RemoteProtocol::send_packet(
void* data, uint8_t dataSize,
269 void* telemetry, uint8_t telemetrySize) {
273 if(
_radio->write(data, dataSize)) {
276 if(telemetry &&
_radio->isAckPayloadAvailable()) {
278 _radio->read(telemetry, telemetrySize);
307 packet[i] = (channels[(i - 1) / 2] >> 8) & 0x00FF;
308 packet[i + 1] = channels[(i - 1) / 2] & 0x00FF;
317 int8_t status = send_packet(packet,
323 if(millis() - _timer > _timerDelay && status >= 0) {
327 while(millis() - _timer < _timerDelay) {
357 _isConnected =
false;
#define RC_ERROR_PACKET_NOT_SENT
#define RC_CONNECT_TIMEOUT
#define RC_ERROR_BAD_DATA
const uint8_t _PAIR_ADDRESS[5]
const uint8_t _PACKET_CHANNELS
int8_t update(uint16_t channels[], uint8_t telemetry[]=NULL)
void apply_settings(RCSettings *settings)
void setSettings(const uint8_t *settings)
#define RC_INFO_TICK_TOO_SHORT
RemoteProtocol(RF24 *tranceiver, const uint8_t remoteId[])
int8_t disconnect(setLastConnection setLastConnection)
const uint8_t _PACKET_DISCONNECT
int8_t wait_till_available(unsigned long timeout)
#define RC_ERROR_LOST_CONNECTION
uint8_t getCommsFrequency()
void() getLastConnection(uint8_t *id)
void() saveSettings(const uint8_t *id, const uint8_t *settings)
int8_t force_send(void *buf, uint8_t size, unsigned long timeout)
#define RC_ERROR_ALREADY_CONNECTED
#define RC_ERROR_NOT_CONNECTED
void() setLastConnection(const uint8_t *id)
const uint8_t _DISCONNECT[5]
int8_t pair(saveSettings saveSettings)
int8_t begin(getLastConnection getLastConnection, checkIfValid checkIfValid)
bool getEnableAckPayload()
#define RC_ERROR_CONNECTION_REFUSED
bool() checkIfValid(const uint8_t *id, uint8_t *settings)
RCSettings * getSettings()
int8_t connect(checkIfValid checkIfValid, setLastConnection setLastConnection)
const uint8_t _PACKET_RECONNECT