Merge pull request #3346 from mikeller/fix_rcsplit_box_id
Removed 'boxId' from 'rcsplitSwitchState_t', cleaned up naming.
This commit is contained in:
commit
b77b866c2d
|
@ -40,8 +40,8 @@
|
||||||
|
|
||||||
// communicate with camera device variables
|
// communicate with camera device variables
|
||||||
serialPort_t *rcSplitSerialPort = NULL;
|
serialPort_t *rcSplitSerialPort = NULL;
|
||||||
rcsplit_switch_state_t switchStates[BOXCAMERA3 - BOXCAMERA1 + 1];
|
rcsplitSwitchState_t switchStates[BOXCAMERA3 - BOXCAMERA1 + 1];
|
||||||
rcsplit_state_e cameraState = RCSPLIT_STATE_UNKNOWN;
|
rcsplitState_e cameraState = RCSPLIT_STATE_UNKNOWN;
|
||||||
|
|
||||||
static uint8_t crc_high_first(uint8_t *ptr, uint8_t len)
|
static uint8_t crc_high_first(uint8_t *ptr, uint8_t len)
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,6 @@ bool rcSplitInit(void)
|
||||||
// set init value to true, to avoid the action auto run when the flight board start and the switch is on.
|
// set init value to true, to avoid the action auto run when the flight board start and the switch is on.
|
||||||
for (boxId_e i = BOXCAMERA1; i <= BOXCAMERA3; i++) {
|
for (boxId_e i = BOXCAMERA1; i <= BOXCAMERA3; i++) {
|
||||||
uint8_t switchIndex = i - BOXCAMERA1;
|
uint8_t switchIndex = i - BOXCAMERA1;
|
||||||
switchStates[switchIndex].boxId = 1 << i;
|
|
||||||
switchStates[switchIndex].isActivated = true;
|
switchStates[switchIndex].isActivated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,14 @@
|
||||||
#include "fc/fc_msp.h"
|
#include "fc/fc_msp.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t boxId;
|
|
||||||
bool isActivated;
|
bool isActivated;
|
||||||
} rcsplit_switch_state_t;
|
} rcsplitSwitchState_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RCSPLIT_STATE_UNKNOWN = 0,
|
RCSPLIT_STATE_UNKNOWN = 0,
|
||||||
RCSPLIT_STATE_INITIALIZING,
|
RCSPLIT_STATE_INITIALIZING,
|
||||||
RCSPLIT_STATE_IS_READY,
|
RCSPLIT_STATE_IS_READY,
|
||||||
} rcsplit_state_e;
|
} rcsplitState_e;
|
||||||
|
|
||||||
// packet header and tail
|
// packet header and tail
|
||||||
#define RCSPLIT_PACKET_HEADER 0x55
|
#define RCSPLIT_PACKET_HEADER 0x55
|
||||||
|
@ -51,6 +50,6 @@ bool rcSplitInit(void);
|
||||||
void rcSplitProcess(timeUs_t currentTimeUs);
|
void rcSplitProcess(timeUs_t currentTimeUs);
|
||||||
|
|
||||||
// only for unit test
|
// only for unit test
|
||||||
extern rcsplit_state_e cameraState;
|
extern rcsplitState_e cameraState;
|
||||||
extern serialPort_t *rcSplitSerialPort;
|
extern serialPort_t *rcSplitSerialPort;
|
||||||
extern rcsplit_switch_state_t switchStates[BOXCAMERA3 - BOXCAMERA1 + 1];
|
extern rcsplitSwitchState_t switchStates[BOXCAMERA3 - BOXCAMERA1 + 1];
|
||||||
|
|
|
@ -47,7 +47,7 @@ extern "C" {
|
||||||
|
|
||||||
int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000]
|
int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000]
|
||||||
|
|
||||||
rcsplit_state_e unitTestRCsplitState()
|
rcsplitState_e unitTestRCsplitState()
|
||||||
{
|
{
|
||||||
return cameraState;
|
return cameraState;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ extern "C" {
|
||||||
bool unitTestIsSwitchActivited(boxId_e boxId)
|
bool unitTestIsSwitchActivited(boxId_e boxId)
|
||||||
{
|
{
|
||||||
uint8_t adjustBoxID = boxId - BOXCAMERA1;
|
uint8_t adjustBoxID = boxId - BOXCAMERA1;
|
||||||
rcsplit_switch_state_t switchState = switchStates[adjustBoxID];
|
rcsplitSwitchState_t switchState = switchStates[adjustBoxID];
|
||||||
return switchState.isActivated;
|
return switchState.isActivated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,4 +428,4 @@ extern "C" {
|
||||||
|
|
||||||
bool feature(uint32_t) { return false;}
|
bool feature(uint32_t) { return false;}
|
||||||
void serialWriteBuf(serialPort_t *instance, const uint8_t *data, int count) { UNUSED(instance); UNUSED(data); UNUSED(count); }
|
void serialWriteBuf(serialPort_t *instance, const uint8_t *data, int count) { UNUSED(instance); UNUSED(data); UNUSED(count); }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue