Skip to content

Commit 732cad8

Browse files
authored
Merge pull request stylesuxx#51 from Voodoobrew101/Consolidate-EEPROM
Consolidate default EEPROM settings
2 parents 42c9e68 + bf1123b commit 732cad8

File tree

1 file changed

+48
-24
lines changed

1 file changed

+48
-24
lines changed

Src/main.c

+48-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/* AM32- multi-purpose brushless controller firmware for the stm32f051 */
22

3-
/*
3+
//===========================================================================
4+
//=============================== Changelog =================================
5+
//===========================================================================
6+
47
* 1.54 Changelog;
58
* --Added firmware name to targets and firmware version to main
69
* --added two more dshot to beacons 1-3 currently working
@@ -120,9 +123,46 @@
120123
#include "functions.h"
121124
#include "peripherals.h"
122125

126+
//===========================================================================
127+
//============================= EEPROM Defaults =============================
128+
//===========================================================================
123129

124130
#define VERSION_MAJOR 1
125131
#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 ===========================
126166

127167
typedef struct __attribute__((packed)) {
128168
uint8_t version_major;
@@ -142,7 +182,6 @@ uint8_t EEPROM_VERSION;
142182
char BRUSHED_MODE = 0; // overrides everything else
143183
char RC_CAR_REVERSE = 0; // have to set bidirectional, comp_pwm off and stall protection off, no sinusoidal startup
144184
char GIMBAL_MODE = 0; // also sinusoidal_startup needs to be on.
145-
char USE_HALL_SENSOR = 0;
146185
//move these to targets folder or peripherals for each mcu
147186

148187

@@ -158,33 +197,23 @@ uint16_t armed_timeout_count;
158197

159198
uint8_t desync_happened = 0;
160199
char maximum_throttle_change_ramp = 1;
161-
char sine_mode_changeover_thottle_level = 5;
162-
char drag_brake_strength = 10;
200+
163201

164202
char crawler_mode = 0; // no longer used //
165203
uint16_t velocity_count = 0;
166204
uint16_t velocity_count_threshold = 50;
167205

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;
177206
char low_rpm_throttle_limit = 1;
178207

179208
uint16_t low_voltage_count = 0;
180209

181-
char THIRTY_TWO_MS_TLM = 0;
210+
182211
uint16_t thirty_two_ms_count;
183-
char LOW_VOLTAGE_CUTOFF = 0;
212+
184213
char VOLTAGE_DIVIDER = TARGET_VOLTAGE_DIVIDER; // 100k upper and 10k lower resistor in divider
185214

186215
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+
188217
char cell_count = 0;
189218

190219
char brushed_direction_set = 0;
@@ -195,18 +224,13 @@ float consumed_current = 0;
195224
uint16_t smoothed_raw_current = 0;
196225
uint16_t actual_current = 0;
197226

198-
uint16_t motor_kv = 2000;
199-
char motor_poles = 14;
200-
char VARIABLE_PWM = 1;
201227
char lowkv = 0;
202-
char comp_pwm = 1;
228+
203229
int min_startup_duty = 120;
204230
int sin_mode_min_s_d = 120;
205231
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+
208233
char startup_boost = 35;
209-
char stall_protection = 0;
210234
char reversing_dead_band = 1;
211235

212236
uint16_t oneKhz_timer = 0;
@@ -1712,4 +1736,4 @@ void assert_failed(uint8_t *file, uint32_t line)
17121736
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
17131737
/* USER CODE END 6 */
17141738
}
1715-
#endif /* USE_FULL_ASSERT */
1739+
#endif /* USE_FULL_ASSERT */

0 commit comments

Comments
 (0)