- removed default / fallback variant; you are forced to define the variant of your choice now or build will stop with an error

- added condition in config.h to either take setting from platform.ini or config.h
- homogenized default_envs naming; all variants now have VARIANT_ as prefix
- added nunchuck variant in platform.ini and config.h
- added PPM variant in platform.ini and config.h
- README: added jan's nunchuck breakout board repo
This commit is contained in:
kai 2020-01-04 00:09:57 +01:00
parent 641fd0bd76
commit ec2f6a1eb6
6 changed files with 132 additions and 60 deletions

View File

@ -44,7 +44,7 @@ matrix:
before_script: arm-none-eabi-gcc --version before_script: arm-none-eabi-gcc --version
- name: platformio - name: platformio
script: platformio run -e VARIANT_ADC -e VARIANT_USART3 -e HOVERCAR -e TRANSPOTTER script: platformio run -e VARIANT_ADC -e VARIANT_USART3 -e VARIANT_HOVERCAR -e VARIANT_TRANSPOTTER -e VARIANT_NUNCHUCK -e VARIANT_PPM
language: python language: python
python: python:
- "2.7" - "2.7"

View File

@ -3,18 +3,24 @@
// ############################### DEFINE FIRMWARE VARIANT ############################### // ############################### DEFINE FIRMWARE VARIANT ###############################
// For variant selection, check platformio.ini // For variant selection, check platformio.ini
// For any particular needs, feel free to change this file according to your needs. // or define the desired build variant here if you want to use make
// Select the VARIANT_ADC as default variant, in case NO variant is defined #if !defined(PLATFORMIO)
#if !defined(VARIANT_ADC) && !defined(VARIANT_USART3) && !defined(HOVERCAR) && !defined(TRANSPOTTER) //#define VARIANT_ADC // Variant for control via ADC input
#define VARIANT_ADC //#define VARIANT_USART3 // Variant for Serial control via USART3 input
//#define VARIANT_HOVERCAR // Variant for HOVERCAR build
//#define VARIANT_TRANSPOTTER // Variant for TRANSPOTTER build https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter https://hackaday.io/project/161891-transpotter-ng
//#define VARIANT_NUNCHUCK // Variant for Nunchuck controlled vehicle build
//#define VARIANT_PPM // Variant for RC-Remote with PPM-Sum Signal
#endif #endif
// For any particular needs, feel free to change this file according to your needs.
// ############################### DO-NOT-TOUCH SETTINGS ############################### // ############################### DO-NOT-TOUCH SETTINGS ###############################
#define PWM_FREQ 16000 // PWM frequency in Hz #define PWM_FREQ 16000 // PWM frequency in Hz
#define DEAD_TIME 48 // PWM deadtime #define DEAD_TIME 48 // PWM deadtime
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
#define DELAY_IN_MAIN_LOOP 2 #define DELAY_IN_MAIN_LOOP 2
#else #else
#define DELAY_IN_MAIN_LOOP 5 // in ms. default 5. it is independent of all the timing critical stuff. do not touch if you do not know what you are doing. #define DELAY_IN_MAIN_LOOP 5 // in ms. default 5. it is independent of all the timing critical stuff. do not touch if you do not know what you are doing.
@ -92,9 +98,9 @@
// ############################### SERIAL DEBUG ############################### // ############################### SERIAL DEBUG ###############################
#ifndef TRANSPOTTER #ifndef VARIANT_TRANSPOTTER
//#define DEBUG_SERIAL_SERVOTERM //#define DEBUG_SERIAL_SERVOTERM
#define DEBUG_SERIAL_ASCII // "1:345 2:1337 3:0 4:0 5:0 6:0 7:0 8:0\r\n" //#define DEBUG_SERIAL_ASCII // "1:345 2:1337 3:0 4:0 5:0 6:0 7:0 8:0\r\n"
#endif #endif
@ -109,7 +115,7 @@
#define USART3_BAUD 38400 // UART3 baud rate (short wired cable) #define USART3_BAUD 38400 // UART3 baud rate (short wired cable)
#define USART3_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B #define USART3_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
#if defined(VARIANT_ADC) || defined(HOVERCAR) #if defined(VARIANT_ADC) || defined(VARIANT_HOVERCAR)
// #define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino // #define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino
// #define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! // #define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
// #define DEBUG_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! // #define DEBUG_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
@ -135,10 +141,12 @@
#define UART_DMA_CHANNEL DMA1_Channel2 #define UART_DMA_CHANNEL DMA1_Channel2
#endif #endif
#ifdef VARIANT_PPM
// ###### CONTROL VIA RC REMOTE ###### // ###### CONTROL VIA RC REMOTE ######
// left sensor board cable. Channel 1: steering, Channel 2: speed. // left sensor board cable. Channel 1: steering, Channel 2: speed.
//#define CONTROL_PPM // use PPM-Sum as input. disable CONTROL_SERIAL_USART2! #define CONTROL_PPM // use PPM-Sum as input. disable CONTROL_SERIAL_USART2!
//#define PPM_NUM_CHANNELS 6 // total number of PPM channels to receive, even if they are not used. //#define PPM_NUM_CHANNELS 6 // total number of PPM channels to receive, even if they are not used.
#endif
// ###### CONTROL VIA TWO POTENTIOMETERS ###### // ###### CONTROL VIA TWO POTENTIOMETERS ######
/* ADC-calibration to cover the full poti-range: /* ADC-calibration to cover the full poti-range:
@ -162,7 +170,7 @@
#define ADC2_MID 2048 // mid ADC2-value while poti at minimum-position (ADC2_MIN - ADC2_MAX) #define ADC2_MID 2048 // mid ADC2-value while poti at minimum-position (ADC2_MIN - ADC2_MAX)
#define ADC2_MAX 4095 // max ADC2-value while poti at maximum-position (0 - 4095) #define ADC2_MAX 4095 // max ADC2-value while poti at maximum-position (0 - 4095)
#endif #endif
#ifdef HOVERCAR #ifdef VARIANT_HOVERCAR
#define CONTROL_ADC // use ADC as input. disable CONTROL_SERIAL_USART2, FEEDBACK_SERIAL_USART2, DEBUG_SERIAL_USART2! #define CONTROL_ADC // use ADC as input. disable CONTROL_SERIAL_USART2, FEEDBACK_SERIAL_USART2, DEBUG_SERIAL_USART2!
#define ADC_PROTECT_ENA // ADC Protection Enable flag. Use this flag to make sure the ADC is protected when GND or Vcc wire is disconnected #define ADC_PROTECT_ENA // ADC Protection Enable flag. Use this flag to make sure the ADC is protected when GND or Vcc wire is disconnected
#define ADC_PROTECT_TIMEOUT 30 // ADC Protection: number of wrong / missing input commands before safety state is taken #define ADC_PROTECT_TIMEOUT 30 // ADC Protection: number of wrong / missing input commands before safety state is taken
@ -173,14 +181,16 @@
#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_NUNCHUCK
// ###### CONTROL VIA NINTENDO NUNCHUCK ###### // ###### CONTROL VIA NINTENDO NUNCHUCK ######
/* left sensor board cable. /* left sensor board cable.
* keep cable short, use shielded cable, use ferrits, stabalize voltage in nunchuck, * keep cable short, use shielded cable, use ferrits, stabalize voltage in nunchuck,
* use the right one of the 2 types of nunchucks, add i2c pullups. * use the right one of the 2 types of nunchucks, add i2c pullups.
* use original nunchuck. most clones does not work very well. * use original nunchuck. most clones does not work very well.
* Recommendation: Nunchuck Breakout Board https://github.com/Jan--Henrik/hoverboard-breakout
*/ */
// #define CONTROL_NUNCHUCK // use nunchuck as input. disable FEEDBACK_SERIAL_USART3, DEBUG_SERIAL_USART3! #define CONTROL_NUNCHUCK // use nunchuck as input. disable FEEDBACK_SERIAL_USART3, DEBUG_SERIAL_USART3!
#endif
// ############################### MOTOR CONTROL ######################### // ############################### MOTOR CONTROL #########################
// Control selections // Control selections
@ -246,10 +256,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_NUNCHUCK
#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
// ################################# DEFAULT SETTINGS ############################ // ################################# DEFAULT SETTINGS ############################
#if !defined(HOVERCAR) && !defined(TRANSPOTTER) #if !defined(VARIANT_HOVERCAR) && !defined(VARIANT_TRANSPOTTER) && !defined(VARIANT_NUNCHUCK)
// 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).
@ -260,8 +272,8 @@
#define INVERT_L_DIRECTION #define INVERT_L_DIRECTION
#endif #endif
// ################################# HOVERCAR SETTINGS ############################ // ################################# VARIANT_HOVERCAR SETTINGS ############################
#ifdef HOVERCAR #ifdef VARIANT_HOVERCAR
#define SPEED_COEFFICIENT 16384 // 1.0f #define SPEED_COEFFICIENT 16384 // 1.0f
#define STEER_COEFFICIENT 0 // 0.0f #define STEER_COEFFICIENT 0 // 0.0f
@ -269,8 +281,8 @@
// #define INVERT_L_DIRECTION // #define INVERT_L_DIRECTION
#endif #endif
// ################################# TRANSPOTTER SETTINGS ############################ // ################################# VARIANT_TRANSPOTTER SETTINGS ############################
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
#define CONTROL_GAMETRAK #define CONTROL_GAMETRAK
#define SUPPORT_LCD #define SUPPORT_LCD
#define SUPPORT_NUNCHUCK #define SUPPORT_NUNCHUCK
@ -288,19 +300,27 @@
#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_NUNCHUCK SETTINGS ############################
#ifdef VARIANT_NUNCHUCK
// # ARMCHAIR #
#define FILTER 3276 // 0.05f
#define SPEED_COEFFICIENT 8192 // 0.5f
#define STEER_COEFFICIENT 62259 // -0.2f
#endif
// ################################# SIMPLE BOBBYCAR ################################# // ################################# SIMPLE BOBBYCAR #################################
// for better bobbycar code see: https://github.com/larsmm/hoverboard-firmware-hack-bbcar // for better bobbycar code see: https://github.com/larsmm/hoverboard-firmware-hack-bbcar
// #define FILTER 6553 // 0.1f // #define FILTER 6553 // 0.1f
// #define SPEED_COEFFICIENT 49152 // -1.0f // #define SPEED_COEFFICIENT 49152 // -1.0f
// #define STEER_COEFFICIENT 0 // 0.0f // #define STEER_COEFFICIENT 0 // 0.0f
// ################################# ARMCHAIR #################################
// #define FILTER 3276 // 0.05f
// #define SPEED_COEFFICIENT 8192 // 0.5f
// #define STEER_COEFFICIENT 62259 // -0.2f
// ############################### VALIDATE SETTINGS ############################### // ############################### VALIDATE SETTINGS ###############################
#if !defined(VARIANT_ADC) && !defined(VARIANT_USART3) && !defined(VARIANT_HOVERCAR) && !defined(VARIANT_TRANSPOTTER) && !defined(VARIANT_NUNCHUCK) && !defined(VARIANT_PPM)
#error Variant not defined! Please check platformio.ini or inc/config.h for available variants.
#endif
#if defined(CONTROL_SERIAL_USART2) && defined(CONTROL_SERIAL_USART3) #if defined(CONTROL_SERIAL_USART2) && defined(CONTROL_SERIAL_USART3)
#error CONTROL_SERIAL_USART2 and CONTROL_SERIAL_USART3 not allowed, choose one. #error CONTROL_SERIAL_USART2 and CONTROL_SERIAL_USART3 not allowed, choose one.
#endif #endif
@ -350,3 +370,7 @@
#warning ADC2 Protection NOT possible! Adjust the ADC thresholds. #warning ADC2 Protection NOT possible! Adjust the ADC thresholds.
#undef ADC_PROTECT_ENA #undef ADC_PROTECT_ENA
#endif #endif
#if defined(CONTROL_PPM) && !defined(PPM_NUM_CHANNELS)
#error Total number of PPM channels needs to be set
#endif

View File

@ -55,7 +55,8 @@ startup_stm32f103xe.s
####################################### #######################################
# binaries # binaries
####################################### #######################################
PREFIX = arm-none-eabi- #PREFIX = arm-none-eabi-
PREFIX = gcc-arm-none-eabi-7/bin/arm-none-eabi-
CC = $(PREFIX)gcc CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy CP = $(PREFIX)objcopy

View File

@ -146,6 +146,8 @@ Nunchuck not working: Use the right one of the 2 types of nunchucks. Use i2c pul
Nunchuck or PPM working bad: The i2c bus and PPM signal are very sensitive to emv distortions of the motor controller. They get stronger the faster you are. Keep cables short, use shielded cable, use ferrits, stabilize voltage in nunchuck or reviever, add i2c pullups. To many errors leads to very high accelerations which triggers the protection board within the battery to shut everything down. Nunchuck or PPM working bad: The i2c bus and PPM signal are very sensitive to emv distortions of the motor controller. They get stronger the faster you are. Keep cables short, use shielded cable, use ferrits, stabilize voltage in nunchuck or reviever, add i2c pullups. To many errors leads to very high accelerations which triggers the protection board within the battery to shut everything down.
Recommendation: Nunchuck Breakout Board https://github.com/Jan--Henrik/hoverboard-breakout
Most robust way for input is to use the ADC and potis. It works well even on 1m unshielded cable. Solder ~100k Ohm resistors between ADC-inputs and gnd directly on the mainboard. Use potis as pullups to 3.3V. Most robust way for input is to use the ADC and potis. It works well even on 1m unshielded cable. Solder ~100k Ohm resistors between ADC-inputs and gnd directly on the mainboard. Use potis as pullups to 3.3V.
--- ---

View File

@ -31,7 +31,7 @@
#include "hd44780.h" #include "hd44780.h"
#endif #endif
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
#include "eeprom.h" #include "eeprom.h"
#endif #endif
@ -71,7 +71,7 @@ extern volatile adc_buf_t adc_buffer;
LCD_PCF8574_HandleTypeDef lcd; LCD_PCF8574_HandleTypeDef lcd;
#endif #endif
extern I2C_HandleTypeDef hi2c2; extern I2C_HandleTypeDef hi2c2;
#ifndef TRANSPOTTER #ifndef VARIANT_TRANSPOTTER
extern UART_HandleTypeDef huart2; extern UART_HandleTypeDef huart2;
extern UART_HandleTypeDef huart3; extern UART_HandleTypeDef huart3;
static UART_HandleTypeDef huart; static UART_HandleTypeDef huart;
@ -81,7 +81,7 @@ extern I2C_HandleTypeDef hi2c2;
extern uint8_t LCDerrorFlag; extern uint8_t LCDerrorFlag;
#endif #endif
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
uint8_t nunchuck_connected = 0; uint8_t nunchuck_connected = 0;
float steering; float steering;
int feedforward; int feedforward;
@ -142,14 +142,14 @@ uint8_t ctrlModReq = CTRL_MOD_REQ; // Final control mode request
static int cmd1; // normalized input value. -1000 to 1000 static int cmd1; // normalized input value. -1000 to 1000
static int cmd2; // normalized input value. -1000 to 1000 static int cmd2; // normalized input value. -1000 to 1000
static int16_t speed; // local variable for speed. -1000 to 1000 static int16_t speed; // local variable for speed. -1000 to 1000
#ifndef TRANSPOTTER #ifndef VARIANT_TRANSPOTTER
static int16_t steer; // local variable for steering. -1000 to 1000 static int16_t steer; // local variable for steering. -1000 to 1000
static int16_t steerRateFixdt; // local fixed-point variable for steering rate limiter static int16_t steerRateFixdt; // local fixed-point variable for steering rate limiter
static int16_t speedRateFixdt; // local fixed-point variable for speed rate limiter static int16_t speedRateFixdt; // local fixed-point variable for speed rate limiter
static int32_t steerFixdt; // local fixed-point variable for steering low-pass filter static int32_t steerFixdt; // local fixed-point variable for steering low-pass filter
static int32_t speedFixdt; // local fixed-point variable for speed low-pass filter static int32_t speedFixdt; // local fixed-point variable for speed low-pass filter
#endif #endif
#ifdef HOVERCAR #ifdef VARIANT_HOVERCAR
static MultipleTap MultipleTapBreak; // define multiple tap functionality for the Break pedal static MultipleTap MultipleTapBreak; // define multiple tap functionality for the Break pedal
#endif #endif
static int16_t speedAvg; // average measured speed static int16_t speedAvg; // average measured speed
@ -267,7 +267,7 @@ int main(void) {
HAL_GPIO_WritePin(LED_PORT, LED_PIN, 1); HAL_GPIO_WritePin(LED_PORT, LED_PIN, 1);
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
int lastDistance = 0; int lastDistance = 0;
enable = 1; enable = 1;
uint8_t checkRemote = 0; uint8_t checkRemote = 0;
@ -324,7 +324,7 @@ int main(void) {
LCD_ClearDisplay(&lcd); LCD_ClearDisplay(&lcd);
HAL_Delay(5); HAL_Delay(5);
LCD_SetLocation(&lcd, 0, 0); LCD_SetLocation(&lcd, 0, 0);
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
LCD_WriteString(&lcd, "TranspOtter V2.1"); LCD_WriteString(&lcd, "TranspOtter V2.1");
#else #else
LCD_WriteString(&lcd, "Hover V2.0"); LCD_WriteString(&lcd, "Hover V2.0");
@ -333,7 +333,7 @@ int main(void) {
LCD_WriteString(&lcd, "Initializing..."); LCD_WriteString(&lcd, "Initializing...");
#endif #endif
#if defined(TRANSPOTTER) && defined(SUPPORT_LCD) #if defined(VARIANT_TRANSPOTTER) && defined(SUPPORT_LCD)
LCD_ClearDisplay(&lcd); LCD_ClearDisplay(&lcd);
HAL_Delay(5); HAL_Delay(5);
LCD_SetLocation(&lcd, 0, 1); LCD_SetLocation(&lcd, 0, 1);
@ -363,7 +363,7 @@ int main(void) {
while(1) { while(1) {
HAL_Delay(DELAY_IN_MAIN_LOOP); //delay in ms HAL_Delay(DELAY_IN_MAIN_LOOP); //delay in ms
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
if(HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) { if(HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) {
enable = 0; enable = 0;
while(HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) { while(HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) {
@ -559,7 +559,7 @@ int main(void) {
} }
speedAvgAbs = abs(speedAvg); speedAvgAbs = abs(speedAvg);
#ifndef TRANSPOTTER #ifndef VARIANT_TRANSPOTTER
// ####### MOTOR ENABLING: Only if the initial input is very small (for SAFETY) ####### // ####### MOTOR ENABLING: Only if the initial input is very small (for SAFETY) #######
if (enable == 0 && (!errCode_Left && !errCode_Right) && (cmd1 > -50 && cmd1 < 50) && (cmd2 > -50 && cmd2 < 50)){ if (enable == 0 && (!errCode_Left && !errCode_Right) && (cmd1 > -50 && cmd1 < 50) && (cmd2 > -50 && cmd2 < 50)){
shortBeep(6); // make 2 beeps indicating the motor enable shortBeep(6); // make 2 beeps indicating the motor enable
@ -567,8 +567,8 @@ int main(void) {
enable = 1; // enable motors enable = 1; // enable motors
} }
// ####### HOVERCAR ####### // ####### VARIANT_HOVERCAR #######
#ifdef HOVERCAR #ifdef VARIANT_HOVERCAR
// Calculate speed Blend, a number between [0, 1] in fixdt(0,16,15) // Calculate speed Blend, a number between [0, 1] in fixdt(0,16,15)
uint16_t speedBlend; uint16_t speedBlend;
speedBlend = (uint16_t)(((CLAMP(speedAvgAbs,30,90) - 30) << 15) / 60); // speedBlend [0,1] is within [30 rpm, 90rpm] speedBlend = (uint16_t)(((CLAMP(speedAvgAbs,30,90) - 30) << 15) / 60); // speedBlend [0,1] is within [30 rpm, 90rpm]
@ -599,8 +599,8 @@ int main(void) {
steer = (int16_t)(steerFixdt >> 20); // convert fixed-point to integer steer = (int16_t)(steerFixdt >> 20); // convert fixed-point to integer
speed = (int16_t)(speedFixdt >> 20); // convert fixed-point to integer speed = (int16_t)(speedFixdt >> 20); // convert fixed-point to integer
// ####### HOVERCAR ####### // ####### VARIANT_HOVERCAR #######
#ifdef HOVERCAR #ifdef VARIANT_HOVERCAR
if (!MultipleTapBreak.b_multipleTap) { // Check driving direction if (!MultipleTapBreak.b_multipleTap) { // Check driving direction
speed = steer + speed; // Forward driving speed = steer + speed; // Forward driving
} else { } else {
@ -636,7 +636,7 @@ int main(void) {
lastSpeedL = speedL; lastSpeedL = speedL;
lastSpeedR = speedR; lastSpeedR = speedR;
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
if (timeout > TIMEOUT) { if (timeout > TIMEOUT) {
pwml = 0; pwml = 0;
pwmr = 0; pwmr = 0;
@ -809,7 +809,7 @@ int main(void) {
} }
} }
#ifdef TRANSPOTTER #ifdef VARIANT_TRANSPOTTER
void saveConfig() { void saveConfig() {
HAL_FLASH_Unlock(); HAL_FLASH_Unlock();
EE_WriteVariable(VirtAddVarTab[0], saveValue); EE_WriteVariable(VirtAddVarTab[0], saveValue);

View File

@ -6,10 +6,13 @@ include_dir = Inc
src_dir = Src src_dir = Src
;=================== VARIANT SELECTION ========================== ;=================== VARIANT SELECTION ==========================
default_envs = VARIANT_ADC ; Variant for control via ADC input default_envs = UNDEFINED ;
;default_envs = VARIANT_ADC ; Variant for control via ADC input
;default_envs = VARIANT_USART3 ; Variant for Serial control via USART3 input ;default_envs = VARIANT_USART3 ; Variant for Serial control via USART3 input
;default_envs = HOVERCAR ; Variant for HOVERCAR build ;default_envs = VARIANT_HOVERCAR ; Variant for HOVERCAR build
;default_envs = TRANSPOTTER ; Variant for TRANSPOTTER build https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter https://hackaday.io/project/161891-transpotter-ng ;default_envs = VARIANT_TRANSPOTTER ; Variant for TRANSPOTTER build https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter https://hackaday.io/project/161891-transpotter-ng
;default_envs = VARIANT_NUNCHUCK ; Variant for Nunchuck controlled vehicle build
;default_envs = VARIANT_PPM ; Variant for RC-Remotes with PPM-Sum signal
;================================================================ ;================================================================
[env:VARIANT_ADC] [env:VARIANT_ADC]
@ -33,6 +36,7 @@ build_flags =
-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_ADC -D VARIANT_ADC
-D PALTFORMIO
[env:VARIANT_USART3] [env:VARIANT_USART3]
platform = ststm32 platform = ststm32
@ -55,8 +59,9 @@ build_flags =
-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_USART3 -D VARIANT_USART3
-D PALTFORMIO
[env:HOVERCAR] [env:VARIANT_HOVERCAR]
platform = ststm32 platform = ststm32
framework = stm32cube framework = stm32cube
board = genericSTM32F103RC board = genericSTM32F103RC
@ -76,9 +81,10 @@ 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 HOVERCAR -D VARIANT_HOVERCAR
-D PALTFORMIO
[env:TRANSPOTTER] [env:VARIANT_TRANSPOTTER]
platform = ststm32 platform = ststm32
framework = stm32cube framework = stm32cube
board = genericSTM32F103RC board = genericSTM32F103RC
@ -94,4 +100,43 @@ 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 TRANSPOTTER -D VARIANT_TRANSPOTTER
-D PALTFORMIO
[env:VARIANT_NUNCHUCK]
platform = ststm32
framework = stm32cube
board = genericSTM32F103RC
debug_tool = stlink
upload_protocol = stlink
build_flags =
-I${PROJECT_DIR}/inc/
-DUSE_HAL_DRIVER
-DSTM32F103xE
-Wl,-T./STM32F103RCTx_FLASH.ld
-Wl,-lc
-Wl,-lm
-g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization
# -Wl,-lnosys
-D VARIANT_NUNCHUCK
-D PALTFORMIO
[env:VARIANT_PPM]
platform = ststm32
framework = stm32cube
board = genericSTM32F103RC
debug_tool = stlink
upload_protocol = stlink
build_flags =
-I${PROJECT_DIR}/inc/
-DUSE_HAL_DRIVER
-DSTM32F103xE
-Wl,-T./STM32F103RCTx_FLASH.ld
-Wl,-lc
-Wl,-lm
-g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization
# -Wl,-lnosys
-D VARIANT_PPM
-D PALTFORMIO