Removed 'boxId' from 'rcsplitSwitchState_t', cleaned up naming.

This commit is contained in:
mikeller 2017-06-25 16:49:49 +12:00
parent facac4c3e6
commit 7396e2665d
3 changed files with 9 additions and 11 deletions

View File

@ -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;
}

View File

@ -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];

View File

@ -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;
}
@ -428,4 +428,4 @@ extern "C" {
bool feature(uint32_t) { return false;}
void serialWriteBuf(serialPort_t *instance, const uint8_t *data, int count) { UNUSED(instance); UNUSED(data); UNUSED(count); }
}
}