[Crossfire] Now the pulses frame is encoded the same way than other Crossfire frames
This commit is contained in:
@@ -18,9 +18,8 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#define CROSSFIRE_START_BYTE 0x0F
|
|
||||||
#define CROSSFIRE_CH_CENTER 0x3E0
|
#define CROSSFIRE_CH_CENTER 0x3E0
|
||||||
#define CROSSFIRE_CH_BITS 11
|
#define CROSSFIRE_CH_BITS 11
|
||||||
|
|
||||||
@@ -28,7 +27,9 @@
|
|||||||
void createCrossfireFrame(uint8_t * frame, int16_t * pulses)
|
void createCrossfireFrame(uint8_t * frame, int16_t * pulses)
|
||||||
{
|
{
|
||||||
uint8_t * buf = frame;
|
uint8_t * buf = frame;
|
||||||
*buf++ = CROSSFIRE_START_BYTE;
|
*buf++ = BROADCAST_ADDRESS;
|
||||||
|
*buf++ = 24; // 1(ID) + 22 + 1(CRC)
|
||||||
|
*buf++ = CHANNELS_ID;
|
||||||
|
|
||||||
uint32_t bits = 0;
|
uint32_t bits = 0;
|
||||||
uint8_t bitsavailable = 0;
|
uint8_t bitsavailable = 0;
|
||||||
@@ -41,6 +42,5 @@ void createCrossfireFrame(uint8_t * frame, int16_t * pulses)
|
|||||||
bitsavailable -= 8;
|
bitsavailable -= 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*buf++ = 0;
|
*buf = crc8(&frame[2], 24);
|
||||||
*buf++ = crc16(frame, 24);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ PACK(struct Dsm2PulsesData {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CROSSFIRE_BAUDRATE 400000
|
#define CROSSFIRE_BAUDRATE 400000
|
||||||
#define CROSSFIRE_FRAME_LEN 25
|
#define CROSSFIRE_FRAME_LEN (3+22+1)
|
||||||
#define CROSSFIRE_CHANNELS_COUNT 16
|
#define CROSSFIRE_CHANNELS_COUNT 16
|
||||||
PACK(struct CrossfirePulsesData {
|
PACK(struct CrossfirePulsesData {
|
||||||
uint8_t pulses[CROSSFIRE_FRAME_LEN];
|
uint8_t pulses[CROSSFIRE_FRAME_LEN];
|
||||||
|
|||||||
@@ -21,7 +21,10 @@
|
|||||||
#ifndef _CROSSFIRE_H_
|
#ifndef _CROSSFIRE_H_
|
||||||
#define _CROSSFIRE_H_
|
#define _CROSSFIRE_H_
|
||||||
|
|
||||||
#define LINK_STATS_ID 0x14
|
#define BROADCAST_ADDRESS 0x00
|
||||||
|
|
||||||
|
#define LINK_STATS_ID 0x14
|
||||||
|
#define CHANNELS_ID 0x16
|
||||||
|
|
||||||
void processCrossfireTelemetryData(uint8_t data);
|
void processCrossfireTelemetryData(uint8_t data);
|
||||||
void crossfireSetDefault(int index, uint8_t id, uint8_t subId);
|
void crossfireSetDefault(int index, uint8_t id, uint8_t subId);
|
||||||
|
|||||||
Reference in New Issue
Block a user