1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

Cosmetics

This commit is contained in:
Bertrand Songis 2019-02-25 13:43:54 +01:00
parent db930f28e4
commit a7311810d3
3 changed files with 5 additions and 3 deletions

View file

@ -544,7 +544,7 @@ bool isExternalModuleAvailable(int module)
} }
#endif #endif
#if !defined(PXX2) #if !defined(PXX2)
if (module == MODULE_TYPE_XJT2) { if (module == MODULE_TYPE_XJT2 || module == MODULE_TYPE_R9M2) {
return false; return false;
} }
#endif #endif

View file

@ -25,8 +25,9 @@
#define PXX2_BAUDRATE 230400 #define PXX2_BAUDRATE 230400
#define PXX2_PERIOD 4 // 4ms #define PXX2_PERIOD 4 // 4ms
#define PXX2_FRAME_MAXLENGTH 32
class ModuleFifo : public Fifo<uint8_t, 32> { class ModuleFifo : public Fifo<uint8_t, PXX2_FRAME_MAXLENGTH> {
public: public:
bool getFrame(uint8_t * frame) bool getFrame(uint8_t * frame)
{ {
@ -45,6 +46,7 @@ class ModuleFifo : public Fifo<uint8_t, 32> {
uint32_t next = nextIndex(ridx); uint32_t next = nextIndex(ridx);
uint8_t len = fifo[next]; uint8_t len = fifo[next];
if (unsigned(len + 4 /* 2 bytes header + 2 bytes CRC */) > size()) { if (unsigned(len + 4 /* 2 bytes header + 2 bytes CRC */) > size()) {
// frame not fully received
return false; return false;
} }

View file

@ -211,7 +211,7 @@ void telemetryWakeup()
#endif #endif
#if defined(INTMODULE_USART) || defined(EXTMODULE_USART) #if defined(INTMODULE_USART) || defined(EXTMODULE_USART)
uint8_t frame[32]; uint8_t frame[PXX2_FRAME_MAXLENGTH];
#if defined(INTMODULE_USART) #if defined(INTMODULE_USART)
if (intmoduleFifo.getFrame(frame)) { if (intmoduleFifo.getFrame(frame)) {