/*
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Multiprotocol is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Multiprotocol. If not, see .
*/
// Compatible with WPL "Basic" TX models D12, D12KM, D22, D32, D42, D14
#if defined(WPL_NRF24L01_INO)
#include "iface_xn297.h"
#define FORCE_WPL_ORIGINAL_ID
#define WPL_PACKET_PERIOD 9875
#define WPL_RF_NUM_CHANNELS 4
#define WPL_PAYLOAD_SIZE 16
#define WPL_BIND_COUNT 303 //3sec
static void __attribute__((unused)) WPL_send_packet()
{
#if 0
debug("no:%d, rf:%d, ",hopping_frequency_no + (IS_BIND_IN_PROGRESS?0:4),hopping_frequency[hopping_frequency_no + (IS_BIND_IN_PROGRESS?0:4)]);
#endif
XN297_Hopping(hopping_frequency_no + (IS_BIND_IN_PROGRESS?0:4) );
hopping_frequency_no++;
hopping_frequency_no &= WPL_RF_NUM_CHANNELS-1; // 4 RF channels
memset(&packet[8],0,7);
packet[0] = 0x94; //??
packet[1] = 0x16; //??
packet[2] = 0xCC; //??
if(IS_BIND_IN_PROGRESS)
{
memcpy(&packet[3],rx_tx_addr,5);
packet[9] = 0x08; // ?? Not bound + Headlights on
}
else
{
packet[3 ] = convert_channel_s8b(CH1); // Throttle
packet[4 ] = convert_channel_s8b(CH2); // Steering
packet[5 ] = convert_channel_16b_limit(CH3,0x22,0x5E); // Steering trim
packet[6 ] = rx_tx_addr[3]; // 0x32??
packet[7 ] = convert_channel_s8b(CH4); // Aux
packet[9 ] = 0x80 // ?? Bound
| GET_FLAG(CH5_SW, 0x08) // Headlights 100%=on
| GET_FLAG(CH6_SW, 0x04) // Throttle rate 100%=high
| GET_FLAG(CH7_SW, 0x02); // Steering rate 100%=high
}
uint8_t sum = 0x66;
for(uint8_t i=0;i no idea where they come from...
Timing: 9875µs
Payload 16 bytes: 94 16 CC 80 80 38 32 80 00 88 00 00 00 00 00 4E
P[0] = 94 ??
P[1] = 16 ??
P[2] = CC ??
P[3] = Throttle, not enough data on dumps... Same coding as Steering?
P[4] = Steering, not enough data on dumps, looks like one side goes from 7F to 00 and the other 80 to FF which would be s8b
P[5] = Steering trim 22..5E, mid gives 40 not 38... Was the trim centered on the other dumps with value 38?
P[6] = 32 ?? Left over from the bind packet TX_ADDR[3]?
P[7] = 80 ?? Additional channel? It moves at the same time as the trim but my guess is that it is an unconnected channel.
P[8] = 00 ??
P[9] = 80 ?? bound?, Throttle and Steering rate low, Headlights off
|02 -> Steering rate high
|04 -> Throttle rate high
|08 -> Headlights on
P[10..14] = 00 ??
P[15] = sum(P[0..14])+66 why 66...
*/