forked from p-h-a-i-l/hoverboard-firmware-hack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
platformio.ini
226 lines (211 loc) · 15.4 KB
/
platformio.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
; PlatformIO Project Configuration File2
; http://docs.platformio.org/page/projectconf.html
[platformio]
include_dir = inc
env_default = genericSTM32F103RC
;env_default = transport_board
;env_default = paddelec
[env:genericSTM32F103RC]
monitor_speed = 19200
platform = ststm32
framework = stm32cube
debug_tool = stlink
board = genericSTM32F103RC
build_flags =
-I${PROJECT_DIR}/inc/
-DUSE_HAL_DRIVER
-DSTM32F103xE
-Wl,-T./STM32F103RCTx_FLASH.ld
-Wl,-lc
-Wl,-lm
# -Wl,-lnosys
[env:transport_board]
monitor_speed = 19200
platform = ststm32
framework = stm32cube
debug_tool = stlink
board = genericSTM32F103RC
build_flags =
-I${PROJECT_DIR}/inc/
-DUSE_HAL_DRIVER
-DSTM32F103xE
-Wl,-T./STM32F103RCTx_FLASH.ld
-Wl,-lc
-Wl,-lm
-Og
# -Wl,-lnosys
-D IGNORE_GLOBAL_CONFIG
; ############################### DO-NOT-TOUCH SETTINGS ###############################
-D PWM_FREQ=16000 ; PWM frequency in Hz
-D DEAD_TIME=32 ; PWM deadtime
-D 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.
-D TIMEOUT=50 ; number of wrong / missing input commands before emergency off
-D SOFTWATCHDOG_TIMEOUT=50 ; Watchdog, Monitors main loop. Stops motors and shuts down when not called after xx ms.
; ############################### GENERAL ###############################
-D BAT_CALIB_REAL_VOLTAGE=43.0 ; input voltage measured by multimeter
-D BAT_CALIB_ADC=1704 ; adc-value measured by mainboard (value nr 5 on UART debug output)
-D BAT_NUMBER_OF_CELLS=10 ; normal Hoverboard battery: 10s
-D BAT_LOW_LVL1_ENABLE=0 ; to beep or not to beep, 1 or 0
-D BAT_LOW_LVL1=3.6 ; gently beeps at this voltage level. [V/cell]
-D BAT_LOW_LVL2_ENABLE=1 ; to beep or not to beep, 1 or 0
-D BAT_LOW_LVL2=3.5 ; your battery is almost empty. Charge now! [V/cell]
-D BAT_LOW_DEAD=3.37 ; undervoltage poweroff. (while not driving) [V/cell]
-D DC_CUR_LIMIT=15 ; DC current limit in amps per motor. so 15 means it will draw 30A out of your battery. it does not disable motors, it is a soft current limit.
; Board overheat detection: the sensor is inside the STM/GD chip. it is very inaccurate without calibration (up to 45°C). so only enable this funcion after calibration! let your board cool down. see <How to calibrate>. get the real temp of the chip by thermo cam or another temp-sensor taped on top of the chip and write it to TEMP_CAL_LOW_DEG_C. write debug value 8 to TEMP_CAL_LOW_ADC. drive around to warm up the board. it should be at least 20°C warmer. repeat it for the HIGH-values. enable warning and/or poweroff and make and flash firmware.
-D TEMP_CAL_LOW_ADC=1655 ; temperature 1: ADC value
-D TEMP_CAL_LOW_DEG_C=35.8 ; temperature 1: measured temperature [°C]
-D TEMP_CAL_HIGH_ADC=1588 ; temperature 2: ADC value
-D TEMP_CAL_HIGH_DEG_C=48.9 ; temperature 2: measured temperature [°C]
-D TEMP_WARNING_ENABLE=0 ; to beep or not to beep, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!
-D TEMP_WARNING=60 ; annoying fast beeps [°C]
-D TEMP_POWEROFF_ENABLE=0 ; to poweroff or not to poweroff, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!
-D TEMP_POWEROFF=65 ; overheat poweroff. (while not driving) [°C]
-D INACTIVITY_TIMEOUT=8 ; minutes of not driving until poweroff. it is not very precise.
; ############################### LCD DEBUG ###############################
; -D DEBUG_I2C_LCD ; standard 16x2 or larger text-lcd via i2c-converter on right sensor board cable
; ############################### SERIAL DEBUG ###############################
; -D DEBUG_SERIAL_USART2 ; left sensor board cable, disable if ADC or PPM is used!
; -D DEBUG_SERIAL_USART3 ; right sensor board cable, disable if I2C (nunchuck or lcd) is used!
; -D DEBUG_SERIAL_SERVOTERM
-D DEBUG_SERIAL_ASCII ; "1:345 2:1337 3:0 4:0 5:0 6:0 7:0 8:0\r\n"
; ############################### INPUT ###############################
; ###### CONTROL VIA UART (serial) ######
; -D CONTROL_SERIAL_NAIVE_USART2 ; left sensor board cable, disable if ADC or PPM is used!
; -D CONTROL_SERIAL_NAIVE_USART3 ; right sensor board cable, disable if I2C (nunchuck or lcd) is used!
; -D CONTROL_SERIAL_NAIVE_CRC ; Add CRC32 check to control serial
-D CONTROL_SERIAL_PROTOCOL ; enables processing of input characters through 'protocol.c'
; -D SERIAL_USART2_IT ; Interface for CONTROL_SERIAL_PROTOCOL
-D USART2_BAUD=19200 ; UART baud rate
-D USART2_WORDLENGTH=UART_WORDLENGTH_8B ; UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
-D SERIAL_USART3_IT ; Interface for CONTROL_SERIAL_PROTOCOL
-D USART3_BAUD=115200 ; UART baud rate
-D USART3_WORDLENGTH=UART_WORDLENGTH_8B ; UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
-D SERIAL_USART_IT_BUFFERTYPE='unsigned char' ; char or short
-D HALL_INTERRUPTS ; ENABLE INTERRUPT READING OF HALL SENSORS FOR POSITION
; -D WHEEL_SIZE_INCHES=8.5 ; set to your wheelsize to override the default 6.5
; ###### CONTROL VIA RC REMOTE ######
; -D CONTROL_PPM ; use PPM-Sum as input. disable DEBUG_SERIAL_USART2!
; -D PPM_NUM_CHANNELS=6 ; total number of PPM channels to receive, even if they are not used.
; ###### CONTROL VIA TWO POTENTIOMETERS ######
-D CONTROL_ADC ; use ADC as input. disable DEBUG_SERIAL_USART2!
-D ADC1_MIN=0 ; min ADC1-value while poti at minimum-position (0 - 4095)
-D ADC1_ZERO=1200 ; ADC1-value while poti at zero-position (0 - 4095)
-D ADC1_MAX=4095 ; max ADC1-value while poti at maximum-position (0 - 4095)
-D ADC1_MULT_NEG=1300.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC1_MULT_POS=3000.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC2_MIN=0 ; min ADC2-value while poti at minimum-position (0 - 4095)
-D ADC2_ZERO=2000 ; ADC2-value while poti at zero-position (0 - 4095)
-D ADC2_MAX=4095 ; max ADC2-value while poti at maximum-position (0 - 4095)
-D ADC2_MULT_NEG=330.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC2_MULT_POS=330.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC_OFF_START=0 ; Start Value of Area at which other inputs can be active (0 - 4095) Applies to Speed ADC
-D ADC_OFF_END=700 ; End Value of Area at which other inputs can be active (0 - 4095) Applies to Speed ADC
-D ADC_SWITCH_CHANNELS ; define if ADC1 is used for Steer and ADC2 for Speed
-D ADC_REVERSE_STEER ; define if ADC1 is used for Steer and ADC2 for Speed
; ###### CONTROL VIA NINTENDO NUNCHUCK ######
; -D CONTROL_NUNCHUCK ; use nunchuck as input. disable DEBUG_SERIAL_USART3!
; ############################### DRIVING BEHAVIOR ###############################
-D FILTER=0.1 ; lower value == softer filter. do not use values <0.01, you will get float precision issues.
-D SPEED_COEFFICIENT=0.5 ; higher value == stronger. 0.0 to ~2.0?
-D STEER_COEFFICIENT=0.5 ; higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0
; -D SWITCH_WHEELS ; switch right and left wheel. Watch out, you probably also need to invert directions.
-D INVERT_R_DIRECTION
-D INVERT_L_DIRECTION
-D BEEPS_BACKWARD=0 ; 0 or 1
;Turbo boost at high speeds while button1 is pressed:
; -D ADDITIONAL_CODE='if (button1 && speedR > 700) { /* field weakening at high speeds */ weakl = cmd1 - 700; /* weak should never exceed 400 or 450 MAX!! */ weakr = cmd1 - 700; } else { weakl = 0; weakr = 0; }'
[env:paddelec]
monitor_speed = 19200
platform = ststm32
framework = stm32cube
debug_tool = stlink
board = genericSTM32F103RC
build_flags =
-I${PROJECT_DIR}/inc/
-DUSE_HAL_DRIVER
-DSTM32F103xE
-Wl,-T./STM32F103RCTx_FLASH.ld
-Wl,-lc
-Wl,-lm
-Og
# -Wl,-lnosys
-D IGNORE_GLOBAL_CONFIG
; ############################### DO-NOT-TOUCH SETTINGS ###############################
-D PWM_FREQ=16000 ; PWM frequency in Hz
-D DEAD_TIME=32 ; PWM deadtime
-D 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.
-D TIMEOUT=50 ; number of wrong / missing input commands before emergency off
-D SOFTWATCHDOG_TIMEOUT=50 ; Watchdog, Monitors main loop. Stops motors and shuts down when not called after xx ms.
; ############################### GENERAL ###############################
-D BAT_CALIB_REAL_VOLTAGE=43.0 ; input voltage measured by multimeter
-D BAT_CALIB_ADC=1704 ; adc-value measured by mainboard (value nr 5 on UART debug output)
-D BAT_NUMBER_OF_CELLS=10 ; normal Hoverboard battery: 10s
-D BAT_LOW_LVL1_ENABLE=0 ; to beep or not to beep, 1 or 0
-D BAT_LOW_LVL1=3.6 ; gently beeps at this voltage level. [V/cell]
-D BAT_LOW_LVL2_ENABLE=1 ; to beep or not to beep, 1 or 0
-D BAT_LOW_LVL2=3.5 ; your battery is almost empty. Charge now! [V/cell]
-D BAT_LOW_DEAD=3.37 ; undervoltage poweroff. (while not driving) [V/cell]
-D DC_CUR_LIMIT=15 ; DC current limit in amps per motor. so 15 means it will draw 30A out of your battery. it does not disable motors, it is a soft current limit.
; Board overheat detection: the sensor is inside the STM/GD chip. it is very inaccurate without calibration (up to 45°C). so only enable this funcion after calibration! let your board cool down. see <How to calibrate>. get the real temp of the chip by thermo cam or another temp-sensor taped on top of the chip and write it to TEMP_CAL_LOW_DEG_C. write debug value 8 to TEMP_CAL_LOW_ADC. drive around to warm up the board. it should be at least 20°C warmer. repeat it for the HIGH-values. enable warning and/or poweroff and make and flash firmware.
-D TEMP_CAL_LOW_ADC=1655 ; temperature 1: ADC value
-D TEMP_CAL_LOW_DEG_C=35.8 ; temperature 1: measured temperature [°C]
-D TEMP_CAL_HIGH_ADC=1588 ; temperature 2: ADC value
-D TEMP_CAL_HIGH_DEG_C=48.9 ; temperature 2: measured temperature [°C]
-D TEMP_WARNING_ENABLE=0 ; to beep or not to beep, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!
-D TEMP_WARNING=60 ; annoying fast beeps [°C]
-D TEMP_POWEROFF_ENABLE=0 ; to poweroff or not to poweroff, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!
-D TEMP_POWEROFF=65 ; overheat poweroff. (while not driving) [°C]
-D INACTIVITY_TIMEOUT=8 ; minutes of not driving until poweroff. it is not very precise.
; ############################### LCD DEBUG ###############################
; -D DEBUG_I2C_LCD ; standard 16x2 or larger text-lcd via i2c-converter on right sensor board cable
; ############################### SERIAL DEBUG ###############################
; -D DEBUG_SERIAL_USART2 ; left sensor board cable, disable if ADC or PPM is used!
; -D DEBUG_SERIAL_USART3 ; right sensor board cable, disable if I2C (nunchuck or lcd) is used!
; -D DEBUG_SERIAL_SERVOTERM
-D DEBUG_SERIAL_ASCII ; "1:345 2:1337 3:0 4:0 5:0 6:0 7:0 8:0\r\n"
; ############################### INPUT ###############################
; ###### CONTROL VIA UART (serial) ######
; -D CONTROL_SERIAL_NAIVE_USART2 ; left sensor board cable, disable if ADC or PPM is used!
; -D CONTROL_SERIAL_NAIVE_USART3 ; right sensor board cable, disable if I2C (nunchuck or lcd) is used!
; -D CONTROL_SERIAL_NAIVE_CRC ; Add CRC32 check to control serial
-D CONTROL_SERIAL_PROTOCOL ; enables processing of input characters through 'protocol.c'
-D SERIAL_USART2_IT ; Interface for CONTROL_SERIAL_PROTOCOL
-D USART2_BAUD=115200 ; UART baud rate
-D USART2_WORDLENGTH=UART_WORDLENGTH_8B ; UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
; -D SERIAL_USART3_IT ; Interface for CONTROL_SERIAL_PROTOCOL
-D USART3_BAUD=19200 ; UART baud rate
-D USART3_WORDLENGTH=UART_WORDLENGTH_8B ; UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
-D SERIAL_USART_IT_BUFFERTYPE='unsigned char' ; char or short
-D HALL_INTERRUPTS ; ENABLE INTERRUPT READING OF HALL SENSORS FOR POSITION
; -D WHEEL_SIZE_INCHES=8.5 ; set to your wheelsize to override the default 6.5
; ###### CONTROL VIA RC REMOTE ######
; -D CONTROL_PPM ; use PPM-Sum as input. disable DEBUG_SERIAL_USART2!
; -D PPM_NUM_CHANNELS=6 ; total number of PPM channels to receive, even if they are not used.
; ###### CONTROL VIA TWO POTENTIOMETERS ######
; -D CONTROL_ADC ; use ADC as input. disable DEBUG_SERIAL_USART2!
-D ADC1_MIN=0 ; min ADC1-value while poti at minimum-position (0 - 4095)
-D ADC1_ZERO=1500 ; ADC1-value while poti at zero-position (0 - 4095)
-D ADC1_MAX=4095 ; max ADC1-value while poti at maximum-position (0 - 4095)
-D ADC1_MULT_NEG=500.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC1_MULT_POS=1500.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC2_MIN=0 ; min ADC2-value while poti at minimum-position (0 - 4095)
-D ADC2_ZERO=2000 ; ADC2-value while poti at zero-position (0 - 4095)
-D ADC2_MAX=4095 ; max ADC2-value while poti at maximum-position (0 - 4095)
-D ADC2_MULT_NEG=300.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC2_MULT_POS=300.0f ; Use 1000.0f to calibrate form MIN to MAX
-D ADC_OFF_START=0 ; Start Value of Area at which other inputs can be active (0 - 4095) Applies to Speed ADC
-D ADC_OFF_END=1000 ; End Value of Area at which other inputs can be active (0 - 4095) Applies to Speed ADC
-D ADC_SWITCH_CHANNELS ; define if ADC1 is used for Steer and ADC2 for Speed
-D ADC_REVERSE_STEER ; define if ADC1 is used for Steer and ADC2 for Speed
; ###### CONTROL VIA NINTENDO NUNCHUCK ######
; -D CONTROL_NUNCHUCK ; use nunchuck as input. disable DEBUG_SERIAL_USART3!
; ############################### DRIVING BEHAVIOR ###############################
-D FILTER=0.1 ; lower value == softer filter. do not use values <0.01, you will get float precision issues.
-D SPEED_COEFFICIENT=0.5 ; higher value == stronger. 0.0 to ~2.0?
-D STEER_COEFFICIENT=0.5 ; higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0
; -D INVERT_R_DIRECTION
; -D INVERT_L_DIRECTION
-D SWITCH_WHEELS ; switch right and left wheel. Watch out, you probably also need to invert directions.
-D BEEPS_BACKWARD=0 ; 0 or 1
;Turbo boost at high speeds while button1 is pressed:
; -D ADDITIONAL_CODE='if (button1 && speedR > 700) { /* field weakening at high speeds */ weakl = cmd1 - 700; /* weak should never exceed 400 or 450 MAX!! */ weakr = cmd1 - 700; } else { weakl = 0; weakr = 0; }'