Skip to content

Commit

Permalink
Merge pull request #424 from rosflight/varmint_updates
Browse files Browse the repository at this point in the history
Varmint updates
  • Loading branch information
bsutherland333 authored Jun 28, 2024
2 parents 258f003 + 6145e73 commit 8abba6f
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 55 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/lint.yml

This file was deleted.

8 changes: 6 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
- name: check toolchain
run: arm-none-eabi-gcc --version
- name: build varmint
run: mkdir build && cd build && cmake .. -DBUILD_VARMINT=true && make
run: mkdir varmint_build && cd varmint_build && cmake .. -DBOARD_TO_BUILD=varmint && make
- name: build pixracer pro
run: mkdir pixracer_pro_build && cd pixracer_pro_build && cmake .. -DBOARD_TO_BUILD=pixracer_pro && make

- uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand All @@ -29,4 +31,6 @@ jobs:
prerelease: true
title: "Development Build"
files: |
build/varmint.hex
varmint_build/varmint_10X.hex
pixracer_pro_build/pixracer_pro.hex
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ jobs:
- name: check toolchain
run: arm-none-eabi-gcc --version
- name: build varmint
run: mkdir build && cd build && cmake .. -DBUILD_VARMINT=true && make
run: mkdir varmint_build && cd varmint_build && cmake .. -DBOARD_TO_BUILD=varmint && make
- name: build pixracer pro
run: mkdir pixracer_pro_build && cd pixracer_pro_build && cmake .. -DBOARD_TO_BUILD=pixracer_pro && make

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
build/varmint.hex
varmint_build/varmint_10X.hex
pixracer_pro_build/pixracer_pro.hex
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DBUILD_TEST=true -DCMAKE_BUILD_TYPE=Release
cmake .. -DBOARD_TO_BUILD=test -DCMAKE_BUILD_TYPE=Release
- name: make
run: |
cd build
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/varmint_firmware.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Varmint Firmware
name: Varmint Boards Build

on: [push]

Expand All @@ -15,5 +15,7 @@ jobs:
run: sudo apt -y install gcc-arm-none-eabi
- name: check toolchain
run: arm-none-eabi-gcc --version
- name: build
run: mkdir build && cd build && cmake .. -DBUILD_VARMINT=true && make
- name: build varmint
run: mkdir varmint_build && cd varmint_build && cmake .. -DBOARD_TO_BUILD=varmint && make
- name: build pixracer pro
run: mkdir pixracer_pro_build && cd pixracer_pro_build && cmake .. -DBOARD_TO_BUILD=pixracer_pro && make
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "comms/mavlink/v1.0"]
path = comms/mavlink/v1.0
url = https://github.com/rosflight/mavlink_c_library.git
[submodule "boards/varmint"]
path = boards/varmint
url = https://github.com/rosflight/varmint.git
[submodule "boards/varmint_h7"]
path = boards/varmint_h7
url = https://github.com/rosflight/varmint_h7.git
19 changes: 11 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ file(GLOB_RECURSE ROSFLIGHT_SOURCES

### select boards to compile ###

option(BUILD_VARMINT "Build the varmint board target" OFF)
option(BUILD_TEST "Build the test board target" OFF)

if(BUILD_VARMINT)
set(BOARD_TO_BUILD "" CACHE STRING "Select the board to build")
if("${BOARD_TO_BUILD}" STREQUAL "varmint")
message("===== Selecting varmint board target. =====")
add_subdirectory(boards/varmint)
elseif(BUILD_TEST)
set(TARGET_NAME "varmint_10X")
add_subdirectory(boards/varmint_h7/varmint_10X)
elseif("${BOARD_TO_BUILD}" STREQUAL "pixracer_pro")
message("===== Selecting pixracer pro board target. =====")
set(TARGET_NAME "pixracer_pro")
add_subdirectory(boards/varmint_h7/pixracer_pro)
elseif("${BOARD_TO_BUILD}" STREQUAL "test")
message("===== Selecting test board target. ======")
add_subdirectory(test)
else()
message(FATAL_ERROR "No board selected! Please select the varmint or test board with -DBUILD_VARMINT=TRUE or -DBUILD_TEST=TRUE.")
endif ()
message(FATAL_ERROR "No valid board selected! Please select the varmint, pixracer pro, or test board with -DBOARD_TO_BUILD=varmint, -DBOARD_TO_BUILD=pixracer_pro, OR -DBOARD_TO_BUILD=test.")
endif()
1 change: 0 additions & 1 deletion boards/varmint
Submodule varmint deleted from 423a2a
1 change: 1 addition & 0 deletions boards/varmint_h7
Submodule varmint_h7 added at f7a806
10 changes: 6 additions & 4 deletions include/sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ typedef struct

enum GNSSFixType
{
GNSS_FIX_TYPE_NO_FIX,
GNSS_FIX_TYPE_FIX,
GNSS_FIX_RTK_FLOAT, // The two RTK fix types are for possible future use.
GNSS_FIX_RTK_FIXED
GNSS_FIX_TYPE_NO_FIX = 0,
GNSS_FIX_TYPE_DEAD_RECKONING_ONLY = 1,
GNSS_FIX_TYPE_2D_FIX = 2,
GNSS_FIX_TYPE_3D_FIX = 3,
GNSS_FIX_TYPE_GNSS_PLUS_DEAD_RECKONING = 4,
GNSS_FIX_TYPE_TIME_FIX_ONLY = 5,
};

struct GNSSData
Expand Down
12 changes: 10 additions & 2 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,23 @@ echo_blue "Test 1: Build varmint firmware"
rm -rf build
mkdir build
cd build
cmake .. -DBUILD_VARMINT=TRUE -DCMAKE_BUILD_TYPE=RELEASE && make -j4 -l4
cmake .. -DBOARD_TO_BUILD=varmint -DCMAKE_BUILD_TYPE=RELEASE && make -j8 -l8
print_result $?
cd ..

echo_blue "Test 1: Build pixracer pro firmware"
rm -rf build
mkdir build
cd build
cmake .. -DBOARD_TO_BUILD=pixracer_pro -DCMAKE_BUILD_TYPE=RELEASE && make -j8 -l8
print_result $?
cd ..

echo_blue "Test 2: Build test suite"
rm -rf build
mkdir build
cd build
cmake .. -DBUILD_TEST=TRUE -DCMAKE_BUILD_TYPE=RELEASE && make -j4 -l4
cmake .. -DBOARD_TO_BUILD=test -DCMAKE_BUILD_TYPE=RELEASE && make -j8 -l8
print_result $?

echo_blue "Test 3: Run test suite"
Expand Down
18 changes: 5 additions & 13 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,15 +56,10 @@ 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);
board.init_board();
rosflight_firmware::Mavlink mavlink(board);
rosflight_firmware::ROSflight firmware(board, mavlink);

firmware.init();

Expand Down

0 comments on commit 8abba6f

Please sign in to comment.