Skip to content

Commit

Permalink
Add deck parameter for BigQuad, Flow, OA and LED ring deck (bitcraze#237
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fredg02 committed Nov 10, 2017
1 parent 31f7167 commit f7cb6cb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/deck/drivers/src/bigquad.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ static void osdResponseCallback(uint8_t* pBuffer, uint32_t bufferLen)

static void bigquadInit(DeckInfo *info)
{
if(isInit)
if(isInit) {
return;
}

DEBUG_PRINT("Switching to brushless.\n");
motorsInit(motorMapBigQuadDeck);
Expand Down Expand Up @@ -118,4 +119,8 @@ static const DeckDriver bigquad_deck = {
};

DECK_DRIVER(bigquad_deck);

PARAM_GROUP_START(deck)
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, bcBigQuad, &isInit)
PARAM_GROUP_STOP(deck)
#endif // ENABLE_BQ_DECK
10 changes: 8 additions & 2 deletions src/deck/drivers/src/flowdeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static void pamotionTask(void *param)
readMotion(&currentMotion);

// Flip motion information to comply with sensor mounting
// (might need to be changed if mounted diffrently)
// (might need to be changed if mounted differently)
int16_t accpx = -currentMotion.deltaY;
int16_t accpy = -currentMotion.deltaX;

Expand Down Expand Up @@ -312,7 +312,9 @@ static void pamotionTask(void *param)

static void pamotionInit()
{
if (isInit) return;
if (isInit) {
return;
}

// Initialize the VL53 sensor using the zRanger deck driver
const DeckDriver *zRanger = deckFindDriverByName("bcZRanger");
Expand Down Expand Up @@ -399,3 +401,7 @@ LOG_GROUP_STOP(motion)
PARAM_GROUP_START(motion)
PARAM_ADD(PARAM_UINT8, disable, &useFlowDisabled)
PARAM_GROUP_STOP(motion)

PARAM_GROUP_START(deck)
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, bcFlow, &isInit)
PARAM_GROUP_STOP(deck)
11 changes: 11 additions & 0 deletions src/deck/drivers/src/ledring12.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "pm.h"
#include "log.h"

static bool isInit = false;

/*
* To add a new effect just add it as a static function with the prototype
Expand Down Expand Up @@ -619,6 +620,10 @@ static void ledring12Timer(xTimerHandle timer)

static void ledring12Init(DeckInfo *info)
{
if (isInit) {
return;
}

GPIO_InitTypeDef GPIO_InitStructure;

ws2812Init();
Expand All @@ -631,6 +636,8 @@ static void ledring12Init(DeckInfo *info)
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_Init(GPIOB, &GPIO_InitStructure);

isInit = true;

timer = xTimerCreate( "ringTimer", M2T(50),
pdTRUE, NULL, ledring12Timer );
xTimerStart(timer, 100);
Expand Down Expand Up @@ -660,3 +667,7 @@ static const DeckDriver ledring12_deck = {
};

DECK_DRIVER(ledring12_deck);

PARAM_GROUP_START(deck)
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, bcLedRing, &isInit)
PARAM_GROUP_STOP(deck)
8 changes: 7 additions & 1 deletion src/deck/drivers/src/oa.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ static void oaTask(void *param)

static void oaInit()
{
if (isInit) return;
if (isInit) {
return;
}

pca95x4Init();

Expand Down Expand Up @@ -182,3 +184,7 @@ LOG_ADD(LOG_UINT16, up, &rangeUp)
LOG_ADD(LOG_UINT16, left, &rangeLeft)
LOG_ADD(LOG_UINT16, right, &rangeRight)
LOG_GROUP_STOP(oa)

PARAM_GROUP_START(deck)
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, bcOA, &isInit)
PARAM_GROUP_STOP(deck)

0 comments on commit f7cb6cb

Please sign in to comment.