Skip to content

Commit

Permalink
Closes #343: Fix IGNORE_OW_DECKS compile flag implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ataffanel committed Jul 2, 2018
1 parent 5d0f8d3 commit 7d646a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/deck/core/deck.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ void deckInit()
deckDriverCount();
deckInfoInit();

#ifndef IGNORE_OW_DECKS
int nDecks;
int i;

Expand All @@ -65,13 +64,11 @@ void deckInit()
deck->driver->init(deck);
}
}
#endif
}

bool deckTest()
{
bool pass = true;
#ifndef IGNORE_OW_DECKS
int nDecks;
int i;

Expand All @@ -89,7 +86,6 @@ bool deckTest()
}
}
}
#endif

return pass;
}
12 changes: 10 additions & 2 deletions src/deck/core/deck_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ DeckInfo * deckInfo(int i)
// Dummy driver for decks that do not have a driver implemented
static const DeckDriver dummyDriver;

#ifndef IGNORE_OW_DECKS
static const DeckDriver * findDriver(DeckInfo *deck)
{
char name[30];
Expand All @@ -110,6 +111,7 @@ static const DeckDriver * findDriver(DeckInfo *deck)

return driver;
}
#endif

void printDeckInfo(DeckInfo *info)
{
Expand All @@ -135,6 +137,7 @@ void printDeckInfo(DeckInfo *info)
}
}

#ifndef IGNORE_OW_DECKS
static bool infoDecode(DeckInfo * info)
{
uint8_t crcHeader;
Expand Down Expand Up @@ -168,11 +171,11 @@ static bool infoDecode(DeckInfo * info)

return true;
}
#endif

static void enumerateDecks(void)
{
uint8_t nDecks = 0;
int i;
bool noError = true;

owInit();
Expand All @@ -186,7 +189,8 @@ static void enumerateDecks(void)
nDecks = 0;
}

for (i = 0; i < nDecks; i++)
#ifndef IGNORE_OW_DECKS
for (int i = 0; i < nDecks; i++)
{
DECK_INFO_DBG_PRINT("Enumerating deck %i\n", i);
if (owRead(i, 0, sizeof(deckInfos[0].raw), (uint8_t *)&deckInfos[i]))
Expand Down Expand Up @@ -214,6 +218,10 @@ static void enumerateDecks(void)
noError = false;
}
}
#else
DEBUG_PRINT("Ignoring all OW decks because of compile flag.\n");
nDecks = 0;
#endif

// Add build-forced driver
if (strlen(deck_force) > 0) {
Expand Down

0 comments on commit 7d646a6

Please sign in to comment.