Skip to content

Commit

Permalink
removed depdency of main.cpp on the specific board
Browse files Browse the repository at this point in the history
  • Loading branch information
avtoku committed Jun 26, 2024
1 parent 258f003 commit e1597f8
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@
#include <mavlink.h>
#include <rosflight.h>

// Select which board implementation to include based on cmake variable
#ifdef BUILD_VARMINT_BOARD
#include <Varmint.h>
extern Varmint varmint;
#endif
#ifndef BUILD_TEST_BOARD // Skip main function for gtest

extern rosflight_firmware::Board &board;

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -59,19 +56,14 @@ int main(void);
*/
int main(void)
{
// Select which board implementation to instantiate based on cmake variable
#ifdef BUILD_VARMINT_BOARD
rosflight_firmware::Board * board = &varmint;
#endif

// Rosflight base code
board->init_board();
rosflight_firmware::Mavlink mavlink(*board);
rosflight_firmware::ROSflight firmware(*board, mavlink);
// Rosflight base code
board.init_board();
rosflight_firmware::Mavlink mavlink(board);
rosflight_firmware::ROSflight firmware(board, mavlink);

firmware.init();
firmware.init();

while (true) { firmware.run(); }
while (true) { firmware.run(); }
}

#endif // BUILD_TEST_BOARD

0 comments on commit e1597f8

Please sign in to comment.