1
1
/* AM32- multi-purpose brushless controller firmware for the stm32f051 */
2
2
3
- /*
3
+ //===========================================================================
4
+ //=============================== Changelog =================================
5
+ //===========================================================================
6
+
4
7
* 1.54 Changelog ;
5
8
* -- Added firmware name to targets and firmware version to main
6
9
* -- added two more dshot to beacons 1 - 3 currently working
120
123
#include "functions.h"
121
124
#include "peripherals.h"
122
125
126
+ //===========================================================================
127
+ //============================= EEPROM Defaults =============================
128
+ //===========================================================================
123
129
124
130
#define VERSION_MAJOR 1
125
131
#define VERSION_MINOR 74
132
+ char dir_reversed = 0 ;
133
+ char comp_pwm = 1 ;
134
+ char VARIABLE_PWM = 1 ;
135
+ char bi_direction = 0 ;
136
+ char stuck_rotor_protection = 1 ; // Turn off for Crawlers
137
+ char brake_on_stop = 0 ;
138
+ char stall_protection = 0 ;
139
+ char use_sin_start = 0 ;
140
+ char THIRTY_TWO_MS_TLM = 0 ;
141
+
142
+ char advance_level = 2 ; // 7.5 degree increments 0 , 7.5, 15, 22.5)
143
+ uint16_t motor_kv = 2000 ;
144
+ char motor_poles = 14 ;
145
+ //add Startup Power
146
+ //Add PWM Frequency
147
+ //Add Beep Volume
148
+ char drag_brake_strength = 10 ; // Drag Brake Power
149
+ char sine_mode_changeover_thottle_level = 5 ; // Sine Startup Range
150
+
151
+ char USE_HALL_SENSOR = 0 ;
152
+
153
+ //============================= Servo Settings ==============================
154
+ uint16_t servo_low_threshold = 1100 ; // anything below this point considered 0
155
+ uint16_t servo_high_threshold = 1900 ; // anything above this point considered 2000 (max)
156
+ uint16_t servo_neutral = 1500 ;
157
+ uint8_t servo_dead_band = 100 ;
158
+
159
+ //========================= Battery Cuttoff Settings ========================
160
+ char LOW_VOLTAGE_CUTOFF = 0 ; // Turn Low Voltage CUTOFF on or off
161
+ uint16_t low_cell_volt_cutoff = 330 ; // 3.3volts per cell
162
+
163
+ //Add Car/basher mode
164
+
165
+ //=========================== END EEPROM Defaults ===========================
126
166
127
167
typedef struct __attribute__((packed )) {
128
168
uint8_t version_major ;
@@ -142,7 +182,6 @@ uint8_t EEPROM_VERSION;
142
182
char BRUSHED_MODE = 0 ; // overrides everything else
143
183
char RC_CAR_REVERSE = 0 ; // have to set bidirectional, comp_pwm off and stall protection off, no sinusoidal startup
144
184
char GIMBAL_MODE = 0 ; // also sinusoidal_startup needs to be on.
145
- char USE_HALL_SENSOR = 0 ;
146
185
//move these to targets folder or peripherals for each mcu
147
186
148
187
@@ -158,33 +197,23 @@ uint16_t armed_timeout_count;
158
197
159
198
uint8_t desync_happened = 0 ;
160
199
char maximum_throttle_change_ramp = 1 ;
161
- char sine_mode_changeover_thottle_level = 5 ;
162
- char drag_brake_strength = 10 ;
200
+
163
201
164
202
char crawler_mode = 0 ; // no longer used //
165
203
uint16_t velocity_count = 0 ;
166
204
uint16_t velocity_count_threshold = 50 ;
167
205
168
- uint16_t servo_low_threshold = 1100 ; // anything below this point considered 0
169
- uint16_t servo_high_threshold = 1900 ; // anything above this point considered 2000 (max)
170
- uint16_t servo_neutral = 1500 ;
171
- uint8_t servo_dead_band = 100 ;
172
-
173
- char brake_on_stop = 0 ;
174
- char dir_reversed = 0 ;
175
- char bi_direction = 0 ;
176
- char use_sin_start = 0 ;
177
206
char low_rpm_throttle_limit = 1 ;
178
207
179
208
uint16_t low_voltage_count = 0 ;
180
209
181
- char THIRTY_TWO_MS_TLM = 0 ;
210
+
182
211
uint16_t thirty_two_ms_count ;
183
- char LOW_VOLTAGE_CUTOFF = 0 ;
212
+
184
213
char VOLTAGE_DIVIDER = TARGET_VOLTAGE_DIVIDER ; // 100k upper and 10k lower resistor in divider
185
214
186
215
uint16_t battery_voltage ; // scale in volts * 10. 1260 is a battery voltage of 12.60
187
- uint16_t low_cell_volt_cutoff = 330 ; // 3.3volts per cell
216
+
188
217
char cell_count = 0 ;
189
218
190
219
char brushed_direction_set = 0 ;
@@ -195,18 +224,13 @@ float consumed_current = 0;
195
224
uint16_t smoothed_raw_current = 0 ;
196
225
uint16_t actual_current = 0 ;
197
226
198
- uint16_t motor_kv = 2000 ;
199
- char motor_poles = 14 ;
200
- char VARIABLE_PWM = 1 ;
201
227
char lowkv = 0 ;
202
- char comp_pwm = 1 ;
228
+
203
229
int min_startup_duty = 120 ;
204
230
int sin_mode_min_s_d = 120 ;
205
231
char bemf_timeout = 10 ;
206
- char advance_level = 2 ; // 7.5 degree increments 0 , 7.5, 15, 22.5)
207
- char stuck_rotor_protection = 1 ;
232
+
208
233
char startup_boost = 35 ;
209
- char stall_protection = 0 ;
210
234
char reversing_dead_band = 1 ;
211
235
212
236
uint16_t oneKhz_timer = 0 ;
@@ -1712,4 +1736,4 @@ void assert_failed(uint8_t *file, uint32_t line)
1712
1736
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
1713
1737
/* USER CODE END 6 */
1714
1738
}
1715
- #endif /* USE_FULL_ASSERT */
1739
+ #endif /* USE_FULL_ASSERT */
0 commit comments