PXX2 continued
This commit is contained in:
+17
-13
@@ -21,17 +21,23 @@
|
||||
#include "opentx.h"
|
||||
#include "pulses/pxx2.h"
|
||||
|
||||
uint8_t Pxx2Pulses::addFlag1(uint8_t module)
|
||||
uint8_t Pxx2Pulses::addFlag0(uint8_t module)
|
||||
{
|
||||
uint8_t flag1 = g_model.header.modelId[module] & 0x3F;
|
||||
uint8_t flag0 = g_model.header.modelId[module] & 0x3F;
|
||||
if (g_model.moduleData[module].failsafeMode != FAILSAFE_NOT_SET && g_model.moduleData[module].failsafeMode != FAILSAFE_RECEIVER) {
|
||||
if (failsafeCounter[module]-- == 0) {
|
||||
failsafeCounter[module] = 1000;
|
||||
flag1 |= PXX2_FLAG1_FAILSAFE;
|
||||
flag0 |= PXX2_FLAG0_FAILSAFE;
|
||||
}
|
||||
}
|
||||
Pxx2Transport::addByte(flag0);
|
||||
return flag0;
|
||||
}
|
||||
|
||||
void Pxx2Pulses::addFlag1(uint8_t module)
|
||||
{
|
||||
uint8_t flag1 = 0;
|
||||
Pxx2Transport::addByte(flag1);
|
||||
return flag1;
|
||||
}
|
||||
|
||||
void Pxx2Pulses::setupFrame(uint8_t module)
|
||||
@@ -40,20 +46,18 @@ void Pxx2Pulses::setupFrame(uint8_t module)
|
||||
|
||||
addFrameType(PXX2_TYPE_C_MODULE, PXX2_TYPE_ID_CHANNELS);
|
||||
|
||||
// Model ID
|
||||
// TODO addByte(g_model.header.modelId[port]);
|
||||
// FLAG0
|
||||
uint8_t flag0 = addFlag0(module);
|
||||
|
||||
// Flag1
|
||||
uint8_t flag1 = addFlag1(module);
|
||||
|
||||
// Flag2 = Extra flags
|
||||
// TODO addExtraFlags(module);
|
||||
// FLAG1
|
||||
addFlag1(module);
|
||||
|
||||
// Channels
|
||||
addChannels(module, flag1 & PXX2_FLAG1_FAILSAFE, 0);
|
||||
addChannels(module, flag1 & PXX2_FLAG1_FAILSAFE, 1);
|
||||
addChannels(module, flag0 & PXX2_FLAG0_FAILSAFE, 0);
|
||||
addChannels(module, flag0 & PXX2_FLAG0_FAILSAFE, 1);
|
||||
|
||||
#if 0
|
||||
// TODO PXX15
|
||||
if (outputTelemetryBufferTrigger != 0x7E && outputTelemetryBufferSize > 0) {
|
||||
// primID (1 byte) + dataID (2 bytes) + value (4 bytes)
|
||||
addByte(outputTelemetryBufferTrigger);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#define PXX2_TYPE_C_OTA 0xFE
|
||||
|
||||
#define PXX2_FLAG1_FAILSAFE (1 << 6)
|
||||
#define PXX2_FLAG0_FAILSAFE (1 << 6)
|
||||
|
||||
|
||||
// should not be used anymore
|
||||
@@ -91,7 +91,9 @@ class Pxx2Pulses: public PxxPulses<Pxx2Transport> {
|
||||
Pxx2Transport::addByte(type_id);
|
||||
}
|
||||
|
||||
uint8_t addFlag1(uint8_t module);
|
||||
uint8_t addFlag0(uint8_t module);
|
||||
|
||||
void addFlag1(uint8_t module);
|
||||
|
||||
void addCrc()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user