Sbus decoding

This commit is contained in:
Pawel Spychalski (DzikuVx)
2017-12-14 14:54:17 +01:00
parent c97c5f2b22
commit baf8e54d1a
8 changed files with 97 additions and 23 deletions

View File

@@ -97,11 +97,11 @@ void decodeRxHealthPayload(QspConfiguration_t *qsp, RxDeviceState_t *rxDeviceSta
/**
* Encode 10 RC channels
*/
void encodeRcDataPayload(QspConfiguration_t *qsp, PPMReader *ppmSource, uint8_t noOfChannels)
void encodeRcDataPayload(QspConfiguration_t *qsp, int channels[], uint8_t noOfChannels)
{
for (uint8_t i = 0; i < noOfChannels; i++)
{
int cV = constrain(ppmSource->get(i), 1000, 2000);
int cV = constrain(channels[i], 1000, 2000);
uint16_t channelValue10 = map(cV, 1000, 2000, 0, 1000) & 0x03ff;
uint8_t channelValue8 = map(cV, 1000, 2000, 0, 255) & 0xff;