Bsongis/xlite pxx (#5856)

Pulses refactoring
This commit is contained in:
Bertrand Songis
2018-04-29 22:55:29 +02:00
committed by GitHub
parent 6ec64b227c
commit cfc02f67eb
22 changed files with 209 additions and 217 deletions
+9 -13
View File
@@ -24,15 +24,12 @@
// see https://github.com/pascallanger/DIY-Multiprotocol-TX-Module
// file Multiprotocol/multiprotocol.h
#define MULTI_SEND_BIND (1 << 7)
#define MULTI_SEND_RANGECHECK (1 << 5)
#define MULTI_SEND_AUTOBIND (1 << 6)
#define MULTI_CHANS 16
#define MULTI_CHAN_BITS 11
#define MULTI_CHANS 16
#define MULTI_CHAN_BITS 11
static void sendFrameProtocolHeader(uint8_t port, bool failsafe);
@@ -40,15 +37,15 @@ void sendChannels(uint8_t port);
static void sendSetupFrame()
{
// Old multi firmware will mark config messsages as invalid frame and throw them away
sendByteSbus('M');
sendByteSbus('P');
sendByteSbus(0x80); // Module Configuration
sendByteSbus(1); // 1 byte data
uint8_t config = 0x1 | 0x2; // inversion + multi_telemetry
sendByteSbus(0x80); // Module Configuration
sendByteSbus(1); // 1 byte data
uint8_t config = 0x01 | 0x02; // inversion + multi_telemetry
#if !defined(PPM_PIN_SERIAL)
config |= 0x04; //input synchronsisation
// TODO why PPM_PIN_SERIAL would change MULTI protocol?
config |= 0x04; // input synchronsisation
#endif
sendByteSbus(config);
@@ -68,7 +65,6 @@ static void sendFailsafeChannels(uint8_t port)
if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES)
failsafeValue = FAILSAFE_CHANNEL_NOPULSE;
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
pulseValue = 0;
}
@@ -87,13 +83,13 @@ static void sendFailsafeChannels(uint8_t port)
bits >>= 8;
bitsavailable -= 8;
}
}
}
void setupPulsesMultimodule(uint8_t port)
{
static int counter=0;
static int counter = 0;
#if defined(PPM_PIN_SERIAL)
modulePulsesData[EXTERNAL_MODULE].dsm2.serialByte = 0 ;
modulePulsesData[EXTERNAL_MODULE].dsm2.serialBitCount = 0 ;