Added analog values to telemetry packet that could be used for LIPO voltage

This commit is contained in:
Dennis 2017-04-19 18:27:29 -04:00
parent 76f1ec65f0
commit 8a56be3d23

View File

@ -38,6 +38,7 @@ Multiprotocol is distributed in the hope that it will be useful,
#define CABELL_RADIO_CHANNELS 9 // This is 1/5 of the total number of radio channels used for FHSS #define CABELL_RADIO_CHANNELS 9 // This is 1/5 of the total number of radio channels used for FHSS
#define CABELL_RADIO_MIN_CHANNEL_NUM 3 // Channel 0 is right on the boarder of allowed frequency range, so move up to avoid bleeding over #define CABELL_RADIO_MIN_CHANNEL_NUM 3 // Channel 0 is right on the boarder of allowed frequency range, so move up to avoid bleeding over
#define CABELL_TELEMETRY_PACKET_LENGTH 4
#define CABELL_BIND_RADIO_ADDR 0xA4B7C123F7LL #define CABELL_BIND_RADIO_ADDR 0xA4B7C123F7LL
@ -121,10 +122,12 @@ static void __attribute__((unused)) CABELL_get_telemetry()
// Process incomming telementry packet of it was recieved // Process incomming telementry packet of it was recieved
if (NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_RX_DR)) { // data received from model if (NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_RX_DR)) { // data received from model
unsigned long telemetryProcessingStart = micros(); unsigned long telemetryProcessingStart = micros();
NRF24L01_ReadPayload(packet, 2); NRF24L01_ReadPayload(packet, CABELL_TELEMETRY_PACKET_LENGTH);
if ((packet[0] & 0x7F) == CABELL_RxTxPacket_t::RxMode_t::telemetryResponse) // ignore first bit in compare becasue it toggles with each packet if ((packet[0] & 0x7F) == CABELL_RxTxPacket_t::RxMode_t::telemetryResponse) // ignore first bit in compare becasue it toggles with each packet
{ {
RX_RSSI = packet[1]; RX_RSSI = packet[1]; // Packet rate 0 to 255 where 255 is 100% packet rate
v_lipo1 = packet[2]; // Directly from analog input of reciever, but reduced to 8-bit depth (0 to 255). Scaling depends on the input to the analog pin of the reciever.
v_lipo2 = packet[3]; // Directly from analog input of reciever, but reduced to 8-bit depth (0 to 255). Scaling depends on the input to the analog pin of the reciever.
telemetry_counter++; telemetry_counter++;
if(telemetry_lost==0) telemetry_link=1; if(telemetry_lost==0) telemetry_link=1;
telemetryProcessingTime = micros() - telemetryProcessingStart; telemetryProcessingTime = micros() - telemetryProcessingStart;