space removal

This commit is contained in:
kai 2020-01-18 01:15:45 +01:00
parent 04fc584f0a
commit e1aa42bad0
5 changed files with 22 additions and 22 deletions

View File

@ -8,7 +8,7 @@
#if !defined(PLATFORMIO) #if !defined(PLATFORMIO)
//#define VARIANT_ADC // Variant for control via ADC input //#define VARIANT_ADC // Variant for control via ADC input
//#define VARIANT_USART // Variant for Serial control via USART3 input //#define VARIANT_USART // Variant for Serial control via USART3 input
//#define VARIANT_ NUNCHUK // Variant for Nunchuk controlled vehicle build //#define VARIANT_NUNCHUK // Variant for Nunchuk controlled vehicle build
//#define VARIANT_PPM // Variant for RC-Remote with PPM-Sum Signal //#define VARIANT_PPM // Variant for RC-Remote with PPM-Sum Signal
//#define VARIANT_IBUS // Variant for RC-Remotes with FLYSKY IBUS //#define VARIANT_IBUS // Variant for RC-Remotes with FLYSKY IBUS
//#define VARIANT_HOVERCAR // Variant for HOVERCAR build //#define VARIANT_HOVERCAR // Variant for HOVERCAR build
@ -197,7 +197,7 @@
#define ADC2_MAX 2200 // max ADC2-value while poti at maximum-position (0 - 4095) #define ADC2_MAX 2200 // max ADC2-value while poti at maximum-position (0 - 4095)
#endif #endif
#ifdef VARIANT_ NUNCHUK #ifdef VARIANT_NUNCHUK
// ###### CONTROL VIA NINTENDO NUNCHUK ###### // ###### CONTROL VIA NINTENDO NUNCHUK ######
/* left sensor board cable. /* left sensor board cable.
* keep cable short, use shielded cable, use ferrits, stabalize voltage in nunchuk, * keep cable short, use shielded cable, use ferrits, stabalize voltage in nunchuk,
@ -205,7 +205,7 @@
* use original nunchuk. most clones does not work very well. * use original nunchuk. most clones does not work very well.
* Recommendation: Nunchuk Breakout Board https://github.com/Jan--Henrik/hoverboard-breakout * Recommendation: Nunchuk Breakout Board https://github.com/Jan--Henrik/hoverboard-breakout
*/ */
#define CONTROL_ NUNCHUK // use nunchuk as input. disable FEEDBACK_SERIAL_USART3, DEBUG_SERIAL_USART3! #define CONTROL_NUNCHUK // use nunchuk as input. disable FEEDBACK_SERIAL_USART3, DEBUG_SERIAL_USART3!
#endif #endif
// ############################### MOTOR CONTROL ######################### // ############################### MOTOR CONTROL #########################
@ -272,12 +272,12 @@
#define RATE 480 // 30.0f [-] lower value == slower rate [0, 32767] = [0.0, 2047.9375]. Do NOT make rate negative (>32767) #define RATE 480 // 30.0f [-] lower value == slower rate [0, 32767] = [0.0, 2047.9375]. Do NOT make rate negative (>32767)
// Value of FILTER is in fixdt(0,16,16): VAL_fixedPoint = VAL_floatingPoint * 2^16. In this case 6553 = 0.1 * 2^16 // Value of FILTER is in fixdt(0,16,16): VAL_fixedPoint = VAL_floatingPoint * 2^16. In this case 6553 = 0.1 * 2^16
#ifndef VARIANT_ NUNCHUK #ifndef VARIANT_NUNCHUK
#define FILTER 6553 // 0.1f [-] lower value == softer filter [0, 65535] = [0.0 - 1.0]. #define FILTER 6553 // 0.1f [-] lower value == softer filter [0, 65535] = [0.0 - 1.0].
#endif #endif
// ################################# DEFAULT SETTINGS ############################ // ################################# DEFAULT SETTINGS ############################
#if !defined(VARIANT_HOVERCAR) && !defined(VARIANT_TRANSPOTTER) && !defined(VARIANT_ NUNCHUK) #if !defined(VARIANT_HOVERCAR) && !defined(VARIANT_TRANSPOTTER) && !defined(VARIANT_NUNCHUK)
// Value of COEFFICIENT is in fixdt(1,16,14) // Value of COEFFICIENT is in fixdt(1,16,14)
// If VAL_floatingPoint >= 0, VAL_fixedPoint = VAL_floatingPoint * 2^14 // If VAL_floatingPoint >= 0, VAL_fixedPoint = VAL_floatingPoint * 2^14
// If VAL_floatingPoint < 0, VAL_fixedPoint = 2^16 + floor(VAL_floatingPoint * 2^14). // If VAL_floatingPoint < 0, VAL_fixedPoint = 2^16 + floor(VAL_floatingPoint * 2^14).
@ -301,7 +301,7 @@
#ifdef VARIANT_TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
#define CONTROL_GAMETRAK #define CONTROL_GAMETRAK
#define SUPPORT_LCD #define SUPPORT_LCD
#define SUPPORT_ NUNCHUK #define SUPPORT_NUNCHUK
#define GAMETRAK_CONNECTION_NORMAL // for normal wiring according to the wiki instructions #define GAMETRAK_CONNECTION_NORMAL // for normal wiring according to the wiki instructions
//#define GAMETRAK_CONNECTION_ALTERNATE // use this define instead if you messed up the gametrak ADC wiring (steering is speed, and length of the wire is steering) //#define GAMETRAK_CONNECTION_ALTERNATE // use this define instead if you messed up the gametrak ADC wiring (steering is speed, and length of the wire is steering)
@ -316,8 +316,8 @@
#define STEER_COEFFICIENT 8192 // 0.5f - higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0 #define STEER_COEFFICIENT 8192 // 0.5f - higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0
#endif #endif
// ################################# VARIANT_ NUNCHUK SETTINGS ############################ // ################################# VARIANT_NUNCHUK SETTINGS ############################
#ifdef VARIANT_ NUNCHUK #ifdef VARIANT_NUNCHUK
// # ARMCHAIR # // # ARMCHAIR #
#define FILTER 3276 // 0.05f #define FILTER 3276 // 0.05f
#define SPEED_COEFFICIENT 8192 // 0.5f #define SPEED_COEFFICIENT 8192 // 0.5f
@ -333,7 +333,7 @@
// ############################### VALIDATE SETTINGS ############################### // ############################### VALIDATE SETTINGS ###############################
#if !defined(VARIANT_ADC) && !defined(VARIANT_USART) && !defined(VARIANT_HOVERCAR) && !defined(VARIANT_TRANSPOTTER) && !defined(VARIANT_ NUNCHUK) && !defined(VARIANT_PPM)&& !defined(VARIANT_IBUS) #if !defined(VARIANT_ADC) && !defined(VARIANT_USART) && !defined(VARIANT_HOVERCAR) && !defined(VARIANT_TRANSPOTTER) && !defined(VARIANT_NUNCHUK) && !defined(VARIANT_PPM)&& !defined(VARIANT_IBUS)
#error Variant not defined! Please check platformio.ini or Inc/config.h for available variants. #error Variant not defined! Please check platformio.ini or Inc/config.h for available variants.
#endif #endif
@ -365,16 +365,16 @@
#error CONTROL_PPM and SERIAL_USART2 not allowed. It is on the same cable. #error CONTROL_PPM and SERIAL_USART2 not allowed. It is on the same cable.
#endif #endif
#if (defined(DEBUG_SERIAL_USART3) || defined(CONTROL_SERIAL_USART3)) && defined(CONTROL_ NUNCHUK) #if (defined(DEBUG_SERIAL_USART3) || defined(CONTROL_SERIAL_USART3)) && defined(CONTROL_NUNCHUK)
#error CONTROL_ NUNCHUK and SERIAL_USART3 not allowed. It is on the same cable. #error CONTROL_NUNCHUK and SERIAL_USART3 not allowed. It is on the same cable.
#endif #endif
#if (defined(DEBUG_SERIAL_USART3) || defined(CONTROL_SERIAL_USART3)) && defined(DEBUG_I2C_LCD) #if (defined(DEBUG_SERIAL_USART3) || defined(CONTROL_SERIAL_USART3)) && defined(DEBUG_I2C_LCD)
#error DEBUG_I2C_LCD and SERIAL_USART3 not allowed. It is on the same cable. #error DEBUG_I2C_LCD and SERIAL_USART3 not allowed. It is on the same cable.
#endif #endif
#if defined(CONTROL_PPM) && defined(CONTROL_ADC) && defined(CONTROL_ NUNCHUK) || defined(CONTROL_PPM) && defined(CONTROL_ADC) || defined(CONTROL_ADC) && defined(CONTROL_ NUNCHUK) || defined(CONTROL_PPM) && defined(CONTROL_ NUNCHUK) #if defined(CONTROL_PPM) && defined(CONTROL_ADC) && defined(CONTROL_NUNCHUK) || defined(CONTROL_PPM) && defined(CONTROL_ADC) || defined(CONTROL_ADC) && defined(CONTROL_NUNCHUK) || defined(CONTROL_PPM) && defined(CONTROL_NUNCHUK)
#error only 1 input method allowed. use CONTROL_PPM or CONTROL_ADC or CONTROL_ NUNCHUK. #error only 1 input method allowed. use CONTROL_PPM or CONTROL_ADC or CONTROL_NUNCHUK.
#endif #endif
#if defined(ADC_PROTECT_ENA) && ((ADC1_MIN - ADC_PROTECT_THRESH) <= 0 || (ADC1_MAX + ADC_PROTECT_THRESH) >= 4096) #if defined(ADC_PROTECT_ENA) && ((ADC1_MIN - ADC_PROTECT_THRESH) <= 0 || (ADC1_MAX + ADC_PROTECT_THRESH) >= 4096)

View File

@ -156,7 +156,7 @@ Most robust way for input is to use the ADC and potis. It works well even on 1m
This firmware offers currently these variants (selectable in [platformio.ini](/platformio.ini) and / or [/Inc/config.h](/Inc/config.h)): This firmware offers currently these variants (selectable in [platformio.ini](/platformio.ini) and / or [/Inc/config.h](/Inc/config.h)):
- **VARIANT_ADC**: In this variant the motors are controlled by two potentiometers connected to the Left sensor cable (long wired) - **VARIANT_ADC**: In this variant the motors are controlled by two potentiometers connected to the Left sensor cable (long wired)
- **VARIANT_USART**: In this variant the motors are controlled via serial protocol on USART3 right sensor cable (short wired). The commands can be sent from an Arduino. Check out the [hoverserial.ino](/02_Arduino/hoverserial) as an example sketch. - **VARIANT_USART**: In this variant the motors are controlled via serial protocol on USART3 right sensor cable (short wired). The commands can be sent from an Arduino. Check out the [hoverserial.ino](/02_Arduino/hoverserial) as an example sketch.
- **VARIANT_ NUNCHUK**: Wii Nunchuk offers one hand control for throttle, braking and steering. This was one of the first input device used for electric armchairs or bottle crates. - **VARIANT_NUNCHUK**: Wii Nunchuk offers one hand control for throttle, braking and steering. This was one of the first input device used for electric armchairs or bottle crates.
- **VARIANT_PPM**: This is when you want to use a RC remote control with PPM Sum signal - **VARIANT_PPM**: This is when you want to use a RC remote control with PPM Sum signal
- **VARIANT_IBUS**: This is when you want to use a RC remote control with Flysky IBUS protocol connected to the Left sensor cable. - **VARIANT_IBUS**: This is when you want to use a RC remote control with Flysky IBUS protocol connected to the Left sensor cable.
- **VARIANT_HOVERCAR**: In this variant the motors are controlled by two pedals brake and throttle. Reverse is engaged by double tapping on the brake pedal at standstill. - **VARIANT_HOVERCAR**: In this variant the motors are controlled by two pedals brake and throttle. Reverse is engaged by double tapping on the brake pedal at standstill.

View File

@ -146,7 +146,7 @@ typedef struct{
static SerialFeedback Feedback; static SerialFeedback Feedback;
#endif #endif
#if defined(CONTROL_ NUNCHUK) || defined(SUPPORT_ NUNCHUK) || defined(CONTROL_PPM) || defined(CONTROL_ADC) #if defined(CONTROL_NUNCHUK) || defined(SUPPORT_NUNCHUK) || defined(CONTROL_PPM) || defined(CONTROL_ADC)
static uint8_t button1, button2; static uint8_t button1, button2;
#endif #endif
@ -304,7 +304,7 @@ int main(void) {
PPM_Init(); PPM_Init();
#endif #endif
#ifdef CONTROL_ NUNCHUK #ifdef CONTROL_NUNCHUK
I2C_Init(); I2C_Init();
Nunchuk_Init(); Nunchuk_Init();
#endif #endif
@ -453,7 +453,7 @@ int main(void) {
} }
#endif #endif
#if defined(CONTROL_ NUNCHUK) || defined(SUPPORT_ NUNCHUK) #if defined(CONTROL_NUNCHUK) || defined(SUPPORT_NUNCHUK)
if (nunchuk_connected != 0) { if (nunchuk_connected != 0) {
Nunchuk_Read(); Nunchuk_Read();
cmd1 = CLAMP((nunchuk_data[0] - 127) * 8, INPUT_MIN, INPUT_MAX); // x - axis. Nunchuk joystick readings range 30 - 230 cmd1 = CLAMP((nunchuk_data[0] - 127) * 8, INPUT_MIN, INPUT_MAX); // x - axis. Nunchuk joystick readings range 30 - 230
@ -714,7 +714,7 @@ int main(void) {
poweroff(); poweroff();
} }
#ifdef SUPPORT_ NUNCHUK #ifdef SUPPORT_NUNCHUK
if (counter % 500 == 0) { if (counter % 500 == 0) {
if (nunchuk_connected == 0 && enable == 0) { if (nunchuk_connected == 0 && enable == 0) {
if (Nunchuk_Ping()) { if (Nunchuk_Ping()) {

View File

@ -178,7 +178,7 @@ void SysTick_Handler(void) {
/* USER CODE END SysTick_IRQn 1 */ /* USER CODE END SysTick_IRQn 1 */
} }
#ifdef CONTROL_ NUNCHUK #ifdef CONTROL_NUNCHUK
extern I2C_HandleTypeDef hi2c2; extern I2C_HandleTypeDef hi2c2;
void I2C1_EV_IRQHandler(void) void I2C1_EV_IRQHandler(void)
{ {

View File

@ -11,7 +11,7 @@ src_dir = Src
; ;
;default_envs = VARIANT_ADC ; Variant for control via ADC input ;default_envs = VARIANT_ADC ; Variant for control via ADC input
;default_envs = VARIANT_USART ; Variant for Serial control via USART3 input ;default_envs = VARIANT_USART ; Variant for Serial control via USART3 input
;default_envs = VARIANT_ NUNCHUK ; Variant for Nunchuk controlled vehicle build ;default_envs = VARIANT_NUNCHUK ; Variant for Nunchuk controlled vehicle build
;default_envs = VARIANT_PPM ; Variant for RC-Remotes with PPM-Sum signal ;default_envs = VARIANT_PPM ; Variant for RC-Remotes with PPM-Sum signal
;default_envs = VARIANT_IBUS ; Variant for RC-Remotes with FLYSKY IBUS ;default_envs = VARIANT_IBUS ; Variant for RC-Remotes with FLYSKY IBUS
;default_envs = VARIANT_HOVERCAR ; Variant for HOVERCAR build ;default_envs = VARIANT_HOVERCAR ; Variant for HOVERCAR build
@ -70,7 +70,7 @@ build_flags =
;================================================================ ;================================================================
[env:VARIANT_ NUNCHUK] [env:VARIANT_NUNCHUK]
platform = ststm32 platform = ststm32
framework = stm32cube framework = stm32cube
board = genericSTM32F103RC board = genericSTM32F103RC
@ -86,7 +86,7 @@ build_flags =
-Wl,-lm -Wl,-lm
-g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization -g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization
# -Wl,-lnosys # -Wl,-lnosys
-D VARIANT_ NUNCHUK -D VARIANT_NUNCHUK
-D PLATFORMIO -D PLATFORMIO
;================================================================ ;================================================================