Skip to content

Commit 66960fa

Browse files
authored
Merge pull request #201 from am32-firmware/feature/new_settings
Add features from experimental branch
2 parents 8b20c52 + bbd6e8b commit 66960fa

15 files changed

+489
-452
lines changed

Inc/eeprom.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ typedef union EEprom_u {
1111
uint8_t major; //3
1212
uint8_t minor; //4
1313
} version;
14-
char firmware_name[12]; //5-16
14+
uint8_t max_ramp; //5 0.1% per ms to 25% per ms
15+
uint8_t minimum_duty_cycle; //6 0.2% to 51 percent
16+
uint8_t disable_stick_calibration; //7
17+
uint8_t absolute_voltage_cutoff; //8 voltage level 1 to 100 in 0.5v increments
18+
uint8_t current_P; //9 0-255
19+
uint8_t current_I; //10 0-255
20+
uint8_t current_D; //11 0-255
21+
uint8_t active_brake_power; //12 1-5 percent duty cycle
22+
char reserved_eeprom_3[4]; //13-16
1523
uint8_t dir_reversed; // 17
1624
uint8_t bi_direction; // 18
1725
uint8_t use_sine_start; // 19
@@ -23,7 +31,7 @@ typedef union EEprom_u {
2331
uint8_t startup_power; // 25
2432
uint8_t motor_kv; // 26
2533
uint8_t motor_poles; // 27
26-
uint8_t brake_on_stop; // 28
34+
uint8_t brake_on_stop; // 28
2735
uint8_t stall_protection; // 29
2836
uint8_t beep_volume; // 30
2937
uint8_t telemetry_on_interval; // 31

Inc/targets.h

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,6 +2406,24 @@
24062406
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_7
24072407
#endif
24082408

2409+
#ifdef FVT_LITTLEBEE_50_F031
2410+
#define FILE_NAME "FVT_LITTLEBEE_50_F031"
2411+
#define FIRMWARE_NAME "FVT LB50"
2412+
#define DEAD_TIME 60
2413+
#define HARDWARE_GROUP_F031_C
2414+
#define TARGET_STALL_PROTECTION_INTERVAL 8000
2415+
#define MILLIVOLT_PER_AMP 30
2416+
#define CURRENT_OFFSET 266
2417+
#define USE_SERIAL_TELEMETRY
2418+
#define CURRENT_SENSE_ADC_PIN LL_GPIO_PIN_2
2419+
#define VOLTAGE_SENSE_ADC_PIN LL_GPIO_PIN_0
2420+
#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_2
2421+
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_0
2422+
#define INVERTED_EXTI
2423+
#define TARGET_VOLTAGE_DIVIDER 152
2424+
//#define NO_POLLING_START
2425+
#endif
2426+
24092427
/******************** G031 TARGETS ******************************************/
24102428

24112429
#ifdef GEN_G031
@@ -3444,6 +3462,7 @@
34443462

34453463
#ifdef HARDWARE_GROUP_F031_B
34463464

3465+
#define MCU_F031
34473466
#define USE_TIMER_2_CHANNEL_3
34483467
#define INPUT_PIN LL_GPIO_PIN_2
34493468
#define IC_TIMER_CHANNEL LL_TIM_CHANNEL_CH3
@@ -3504,6 +3523,65 @@
35043523

35053524
#endif
35063525

3526+
#ifdef HARDWARE_GROUP_F031_C
3527+
3528+
#define MCU_F031
3529+
#define USE_TIMER_16
3530+
#define INPUT_PIN LL_GPIO_PIN_6
3531+
#define INPUT_PIN_PORT GPIOA
3532+
#define IC_TIMER_CHANNEL LL_TIM_CHANNEL_CH1
3533+
#define IC_TIMER_REGISTER TIM16
3534+
#define IC_TIMER_POINTER htim16
3535+
3536+
#define INPUT_DMA_CHANNEL LL_DMA_CHANNEL_3
3537+
#define DMA_HANDLE_TYPE_DEF hdma_tim16_ch1
3538+
#define IC_DMA_IRQ_NAME DMA1_Channel2_3_IRQn
3539+
3540+
#define PHASE_A_EXTI_PORT GPIOF
3541+
#define PHASE_B_EXTI_PORT GPIOB
3542+
#define PHASE_C_EXTI_PORT GPIOB
3543+
3544+
#define PHASE_A_EXTI_PIN LL_GPIO_PIN_0
3545+
#define PHASE_B_EXTI_PIN LL_GPIO_PIN_1
3546+
#define PHASE_C_EXTI_PIN LL_GPIO_PIN_7
3547+
3548+
#define PHASE_A_EXTI_LINE 0
3549+
#define PHASE_B_EXTI_LINE 1
3550+
#define PHASE_C_EXTI_LINE 7
3551+
3552+
#define SYSCFG_EXTI_PORTA LL_SYSCFG_EXTI_PORTF
3553+
#define SYSCFG_EXTI_PORTB LL_SYSCFG_EXTI_PORTB
3554+
#define SYSCFG_EXTI_PORTC LL_SYSCFG_EXTI_PORTB
3555+
3556+
#define SYSCFG_EXTI_LINEA LL_SYSCFG_EXTI_LINE0
3557+
#define SYSCFG_EXTI_LINEB LL_SYSCFG_EXTI_LINE1
3558+
#define SYSCFG_EXTI_LINEC LL_SYSCFG_EXTI_LINE7
3559+
3560+
#define PHASE_A_LL_EXTI_LINE LL_EXTI_LINE_0
3561+
#define PHASE_B_LL_EXTI_LINE LL_EXTI_LINE_1
3562+
#define PHASE_C_LL_EXTI_LINE LL_EXTI_LINE_7
3563+
3564+
#define EXTI_IRQ1_NAME EXTI0_1_IRQn
3565+
#define EXTI_IRQ2_NAME EXTI4_15_IRQn
3566+
3567+
3568+
#define PHASE_A_GPIO_LOW LL_GPIO_PIN_14
3569+
#define PHASE_A_GPIO_PORT_LOW GPIOB
3570+
#define PHASE_A_GPIO_HIGH LL_GPIO_PIN_9
3571+
#define PHASE_A_GPIO_PORT_HIGH GPIOA
3572+
3573+
#define PHASE_B_GPIO_LOW LL_GPIO_PIN_13
3574+
#define PHASE_B_GPIO_PORT_LOW GPIOB
3575+
#define PHASE_B_GPIO_HIGH LL_GPIO_PIN_8
3576+
#define PHASE_B_GPIO_PORT_HIGH GPIOA
3577+
3578+
#define PHASE_C_GPIO_LOW LL_GPIO_PIN_15
3579+
#define PHASE_C_GPIO_PORT_LOW GPIOB
3580+
#define PHASE_C_GPIO_HIGH LL_GPIO_PIN_10
3581+
#define PHASE_C_GPIO_PORT_HIGH GPIOA
3582+
3583+
#endif
3584+
35073585
/***********************************************************************************************************/
35083586

35093587
#ifdef HARDWARE_GROUP_GD_A
@@ -4200,20 +4278,25 @@
42004278
#define COMP_PA5 0b1010001
42014279
#endif
42024280

4203-
#ifdef MCU_F031
4281+
#ifdef MCU_F031
42044282
#define NEED_INPUT_READY
42054283
#define STMICRO
42064284
#define CPU_FREQUENCY_MHZ 48
42074285
#define EEPROM_START_ADD (uint32_t)0x08007C00
42084286
#define INTERVAL_TIMER TIM3
4287+
#ifdef USE_TIMER_16
4288+
#define TEN_KHZ_TIMER TIM2
4289+
#else
42094290
#define TEN_KHZ_TIMER TIM16
4291+
#endif
42104292
#define UTILITY_TIMER TIM17
42114293
#define COM_TIMER TIM14
42124294
#define APPLICATION_ADDRESS 0x08001000
4213-
#define TARGET_MIN_BEMF_COUNTS 3
4295+
#define TARGET_MIN_BEMF_COUNTS 2
42144296
// #define USE_SERIAL_TELEMETRY // moved to individual ESCs
42154297
#define USE_ADC
42164298
#define LOOP_FREQUENCY_HZ 20000
4299+
#define POLLING_MODE_THRESHOLD 500
42174300
#endif
42184301

42194302
#ifdef MCU_G071
@@ -4477,4 +4560,6 @@
44774560
#define TIM1_AUTORELOAD ((uint16_t)(CPU_FREQUENCY_MHZ * 1000U * 1000U / NOMINAL_PWM)-1)
44784561
#endif
44794562

4480-
4563+
#ifndef POLLING_MODE_THRESHOLD
4564+
#define POLLING_MODE_THRESHOLD 2000
4565+
#endif

Inc/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
update this file for new releases
33
*/
44
#define VERSION_MAJOR 2
5-
#define VERSION_MINOR 18
5+
#define VERSION_MINOR 19
66

7-
#define EEPROM_VERSION 2
7+
#define EEPROM_VERSION 3

0 commit comments

Comments
 (0)