mirror of
https://github.com/EFeru/hoverboard-sideboard-hack-STM.git
synced 2025-08-17 00:56:10 +00:00
Improved UART Timeout
Major: - Improved UART Timeout: Apparently, the UART data Rx/Tx is quite unreliable (especially under motor load) leading to very often out-of-sync issues. This change allows to reset the DMA more often, leading to a faster re-sync of the UART transmission and thus avoiding UART timeout. Issue #1 Minor: - added #define MPU_SENSOR_ENABLE to allow to enable/disable the MPU6050 sensor and save code size if the sensors is not needed - fixed the orientation in the Processing sketch - updated ReadMe
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
|
||||
|
||||
/* ==================================== SETTINGS MPU-6050 ==================================== */
|
||||
#define MPU_SENSOR_ENABLE // [-] Enable flag for MPU-6050 sensor. Comment-out this flag to Disable the MPU sensor and reduce code size.
|
||||
#define MPU_DMP_ENABLE // [-] Enable flag for MPU-6050 DMP (Digital Motion Processing) functionality.
|
||||
#define MPU_DEFAULT_HZ 20 // [Hz] Default MPU frequecy: must be between 1Hz and 200Hz.
|
||||
#define TEMP_READ_MS 500 // [ms] Temperature read time interval
|
||||
@@ -73,7 +74,7 @@
|
||||
#define USART_MAIN_BAUD 38400 // [bit/s] MAIN Serial Tx/Rx baud rate
|
||||
#endif
|
||||
#define SERIAL_START_FRAME 0xABCD // [-] Start frame definition for reliable serial communication
|
||||
#define SERIAL_TIMEOUT 500 // [-] Numer of wrong received data for Serial timeout detection
|
||||
#define SERIAL_TIMEOUT 800 // [-] Numer of wrong received data for Serial timeout detection
|
||||
|
||||
|
||||
/* ==================================== VALIDATE SETTINGS ==================================== */
|
||||
|
@@ -23,6 +23,7 @@
|
||||
// Define to prevent recursive inclusion
|
||||
#ifndef MPU6050_H
|
||||
#define MPU6050_H
|
||||
#ifdef MPU_SENSOR_ENABLE
|
||||
|
||||
#include <stdint.h>
|
||||
#include "defines.h"
|
||||
@@ -143,4 +144,5 @@ void mpu_handle_input(char c);
|
||||
void mpu_print_to_console(void);
|
||||
|
||||
|
||||
#endif
|
||||
#endif // MPU_SENSOR_ENABLE
|
||||
#endif // MPU6050_H
|
||||
|
@@ -23,6 +23,7 @@
|
||||
// Define to prevent recursive inclusion
|
||||
#ifndef MPU6050_DMP_H
|
||||
#define MPU6050_DMP_H
|
||||
#ifdef MPU_SENSOR_ENABLE
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -103,5 +104,6 @@ int dmp_read_fifo(short *gyro, short *accel, long *quat,
|
||||
unsigned long *timestamp, short *sensors, unsigned char *more);
|
||||
|
||||
|
||||
#endif
|
||||
#endif // MPU_SENSOR_ENABLE
|
||||
#endif // MPU6050_DMP_H
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
#ifndef DMPKEY_H__
|
||||
#define DMPKEY_H__
|
||||
#ifdef MPU_SENSOR_ENABLE
|
||||
|
||||
|
||||
#define KEY_CFG_25 (0)
|
||||
@@ -492,4 +493,5 @@ typedef struct {
|
||||
|
||||
|
||||
|
||||
#endif // MPU_SENSOR_ENABLE
|
||||
#endif // DMPKEY_H__
|
||||
|
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
#ifndef DMPMAP_H
|
||||
#define DMPMAP_H
|
||||
#ifdef MPU_SENSOR_ENABLE
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@@ -261,4 +262,6 @@ extern "C"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MPU_SENSOR_ENABLE
|
||||
#endif // DMPMAP_H
|
||||
|
Reference in New Issue
Block a user