Skip to content

Commit

Permalink
#382 Refactoring to reduce warnings in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed Nov 28, 2018
1 parent d321158 commit 43b6c25
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/deck/drivers/src/flowdeck_v1v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "estimator.h"
#include "estimator_kalman.h"

#include "arm_math.h"
#include "cf_math.h"

#include <stdlib.h>

Expand Down
2 changes: 1 addition & 1 deletion src/deck/drivers/src/lpsTwrTag.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include "stabilizer_types.h"
#include "estimator_kalman.h"
#include "arm_math.h"
#include "cf_math.h"

#include "physicalConstants.h"
#include "configblock.h"
Expand Down
2 changes: 1 addition & 1 deletion src/deck/drivers/src/zranger.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#include "estimator.h"
#include "estimator_kalman.h"
#include "arm_math.h"
#include "cf_math.h"

// Measurement noise model
static float expPointA = 1.0f;
Expand Down
2 changes: 1 addition & 1 deletion src/deck/drivers/src/zranger2.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

#include "estimator.h"
#include "estimator_kalman.h"
#include "arm_math.h"
#include "cf_math.h"

// Measurement noise model
static float expPointA = 2.5f;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/src/estimator_kalman.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#include "param.h"

#include "math.h"
#include "arm_math.h"
#include "cf_math.h"

//#define KALMAN_USE_BARO_UPDATE
//#define KALMAN_NAN_CHECK
Expand Down
38 changes: 38 additions & 0 deletions src/utils/interface/cf_math.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* || ____ _ __
* +------+ / __ )(_) /_______________ _____ ___
* | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
* +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
* || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
*
* Crazyflie control firmware
*
* Copyright (C) 2018 Bitcraze AB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, in version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Utilities to simplify unit testing
*
*/

#pragma once

// Include "arm_math.h". This header generates some warnings, especially in
// unit tests. We hide them to avoid noise.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "arm_math.h"
#pragma GCC diagnostic pop
4 changes: 2 additions & 2 deletions test/deck/drivers/src/test_lps_twr_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

// #include "mock_arm_math.h"

// The mocking FW can not handle the arm_math.h file, it crashes while parsing it. We have to use manual mocks instead.
// The mocking FW can not handle the cf_math.h/arm_math.h file, it crashes while parsing it. We have to use manual mocks instead.
// Temporarily fix to make tests pass, add test code for the kalman part of rxcallback()
#include "arm_math.h"
#include "cf_math.h"
void arm_std_f32( float32_t * pSrc, uint32_t blockSize, float32_t * pResult) { *pResult = 0.0; }
void arm_mean_f32( float32_t * pSrc, uint32_t blockSize, float32_t * pResult) { *pResult = 0.0; }

Expand Down

0 comments on commit 43b6c25

Please sign in to comment.