Enabled printf float support

- needed to display Self test results
This commit is contained in:
EmanuelFeru 2020-02-08 08:58:02 +01:00
parent 43794ba7c1
commit 4a470e97b6
7 changed files with 21 additions and 1231 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ MDK-ARM/DebugConfig/
MDK-ARM/RTE/
MDK-ARM/sideboard_CobeMX_prj/
MDK-ARM/*.uvguix
MDK-ARM/.lst
!build/VARIANT_DEBUG/firmware.hex
!build/VARIANT_DEBUG/firmware.bin
!build/VARIANT_DEBUG/firmware.elf

View File

@ -28,7 +28,7 @@
#endif
/* ==================================== DO NOT TOUCH SETTINGS ==================================== */
//#define PRINTF_FLOAT_SUPPORT // [-] Uncomment this for printf to support float. It will increase code size!
#define PRINTF_FLOAT_SUPPORT // [-] Uncomment this for printf to support float on Serial Debug. It will increase code size!
#define BYPASS_CUBEMX_DEFINES // [-] Use this flag to bypass the Ports definitions generated by CUBE MX in main.h and use the ones in defines.h
#define MPU6050 // [-] Define IMU sensor type
#define MPU_GYRO_FSR 2000 // [deg/s] Set Gyroscope Full Scale Range: 250 deg/s, 500 deg/s, 1000 deg/s, 2000 deg/s. !! DMP sensor fusion works only with 2000 deg/s !!

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@ make flash
---
## Example Variants
This firmware offers currently these variants (selectable in [config.h](/Inc/config.h)):
This firmware offers currently these variants (selectable in [platformio.ini](/platformio.ini) or [config.h](/Inc/config.h)):
- **VARIANT_DEBUG**: In this variant the user can interact with sideboard via a Serial Monitor to observe and check the capabilities of the sideboard.
- **VARIANT_HOVERBOARD**: In this variant the sideboard is communicating with the mainboard of a hoverboard using the [FOC firmware repository](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC). This Variant is not yet fully tested!
@ -77,7 +77,7 @@ Of course the firmware can be further customized for other needs or projects.
---
## 3D Visualization Demo
By [converting Quaternions to Euler angles](https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles), we can make a [3D visualization example](/docs/sketch_processing/sketch_processing.pde) in [Processing](https://processing.org/) as shown below. For this Demo use the VARIANT_HOVERBOARD.
By [converting Quaternions to Euler angles](https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles), we can make a [3D visualization example](/docs/sketch_processing/sketch_processing.pde) in [Processing](https://processing.org/) as shown below. For this Demo VARIANT_HOVERBOARD was used.
![sketch_pic](/docs/pictures/sketch_processing_pic.png)
@ -85,7 +85,7 @@ By [converting Quaternions to Euler angles](https://en.wikipedia.org/wiki/Conver
---
## Contributions
Every contribution to this repository is highly appriciated! Feel free to create pull requests to improve this firmware as ultimately you are going to help everyone.
Every contribution to this repository is highly appreciated! Feel free to create pull requests to improve this firmware as ultimately you are going to help everyone.
If you want to donate to keep this firmware updated, please use the link below:

View File

@ -3226,18 +3226,18 @@ void mpu_start_self_test(void)
result = mpu_run_self_test(gyro, accel);
#endif
if (result == 0x7) {
#ifdef SERIAL_DEBUG
consoleLog("Passed!\n");
log_i("accel: %7.4f %7.4f %7.4f\n",
accel[0]/65536.f,
accel[1]/65536.f,
accel[2]/65536.f);
log_i("gyro: %7.4f %7.4f %7.4f\n",
gyro[0]/65536.f,
gyro[1]/65536.f,
gyro[2]/65536.f);
/* Test passed. We can trust the gyro data here, so now we need to update calibrated data*/
#endif
#ifdef SERIAL_DEBUG
consoleLog("Passed!\n");
log_i("accel: %7.4f %7.4f %7.4f\n",
accel[0]/65536.f,
accel[1]/65536.f,
accel[2]/65536.f);
log_i("gyro: %7.4f %7.4f %7.4f\n",
gyro[0]/65536.f,
gyro[1]/65536.f,
gyro[2]/65536.f);
/* Test passed. We can trust the gyro data here, so now we need to update calibrated data*/
#endif
#ifdef USE_CAL_HW_REGISTERS
/*
@ -3357,10 +3357,10 @@ int mpu_config(void)
// mpu_get_gyro_fsr(&gyro_fsr);
// mpu_get_accel_fsr(&accel_fsr);
/* Initialize HAL state variables. */
hal.sensors = ACCEL_ON | GYRO_ON;
hal.dmp_on = 0;
hal.report = 0;
/* Initialize HAL state variables. */
hal.sensors = ACCEL_ON | GYRO_ON;
hal.dmp_on = 0;
hal.report = 0;
hal.next_pedo_ms = 0;
hal.next_temp_ms = 0;

Binary file not shown.

Binary file not shown.