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
|
||||
serialPort_t *rcSplitSerialPort = NULL;
|
||||
rcsplit_switch_state_t switchStates[BOXCAMERA3 - BOXCAMERA1 + 1];
|
||||
rcsplit_state_e cameraState = RCSPLIT_STATE_UNKNOWN;
|
||||
rcsplitSwitchState_t switchStates[BOXCAMERA3 - BOXCAMERA1 + 1];
|
||||
rcsplitState_e cameraState = RCSPLIT_STATE_UNKNOWN;
|
||||
|
||||
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.
|
||||
for (boxId_e i = BOXCAMERA1; i <= BOXCAMERA3; i++) {
|
||||
uint8_t switchIndex = i - BOXCAMERA1;
|
||||
switchStates[switchIndex].boxId = 1 << i;
|
||||
switchStates[switchIndex].isActivated = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,15 +22,14 @@
|
|||
#include "fc/fc_msp.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t boxId;
|
||||
bool isActivated;
|
||||
} rcsplit_switch_state_t;
|
||||
} rcsplitSwitchState_t;
|
||||
|
||||
typedef enum {
|
||||
RCSPLIT_STATE_UNKNOWN = 0,
|
||||
RCSPLIT_STATE_INITIALIZING,
|
||||
RCSPLIT_STATE_IS_READY,
|
||||
} rcsplit_state_e;
|
||||
} rcsplitState_e;
|
||||
|
||||
// packet header and tail
|
||||
#define RCSPLIT_PACKET_HEADER 0x55
|
||||
|
@ -51,6 +50,6 @@ bool rcSplitInit(void);
|
|||
void rcSplitProcess(timeUs_t currentTimeUs);
|
||||
|
||||
// only for unit test
|
||||
extern rcsplit_state_e cameraState;
|
||||
extern rcsplitState_e cameraState;
|
||||
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]
|
||||
|
||||
rcsplit_state_e unitTestRCsplitState()
|
||||
rcsplitState_e unitTestRCsplitState()
|
||||
{
|
||||
return cameraState;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ extern "C" {
|
|||
bool unitTestIsSwitchActivited(boxId_e boxId)
|
||||
{
|
||||
uint8_t adjustBoxID = boxId - BOXCAMERA1;
|
||||
rcsplit_switch_state_t switchState = switchStates[adjustBoxID];
|
||||
rcsplitSwitchState_t switchState = switchStates[adjustBoxID];
|
||||
return switchState.isActivated;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue