ADD: analog input for vehicle during hackerhotel
This commit is contained in:
parent
ff224a2509
commit
8d31eaf8af
10
Src/bldc.c
10
Src/bldc.c
|
@ -163,7 +163,7 @@ void DMA1_Channel1_IRQHandler() {
|
||||||
|
|
||||||
//0-4096
|
//0-4096
|
||||||
//+-2000
|
//+-2000
|
||||||
|
|
||||||
pwmrl = 0;
|
pwmrl = 0;
|
||||||
if(adccmd1 - 700 > 0){
|
if(adccmd1 - 700 > 0){
|
||||||
pwmrl += adccmd1 - 700;
|
pwmrl += adccmd1 - 700;
|
||||||
|
@ -171,8 +171,12 @@ void DMA1_Channel1_IRQHandler() {
|
||||||
if(adccmd2 - 700 > 0){
|
if(adccmd2 - 700 > 0){
|
||||||
pwmrl -= adccmd2 - 700;
|
pwmrl -= adccmd2 - 700;
|
||||||
}
|
}
|
||||||
pwml = -pwmrl/4;
|
|
||||||
pwmr = pwmrl/4;
|
pwmrl = powf((pwmrl/4), 3) / 614125;
|
||||||
|
pwml = -pwmrl;
|
||||||
|
pwmr = pwmrl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(ABS((adc_buffer.dcl - offsetdcl) * MOTOR_AMP_CONV_DC_AMP) > DC_CUR_LIMIT || timeout > 50 || enable == 0) {
|
if(ABS((adc_buffer.dcl - offsetdcl) * MOTOR_AMP_CONV_DC_AMP) > DC_CUR_LIMIT || timeout > 50 || enable == 0) {
|
||||||
LEFT_TIM->BDTR &= ~TIM_BDTR_MOE;
|
LEFT_TIM->BDTR &= ~TIM_BDTR_MOE;
|
||||||
|
|
|
@ -132,6 +132,7 @@ int main(void) {
|
||||||
|
|
||||||
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)) {}
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
buzzerFreq = i;
|
buzzerFreq = i;
|
||||||
HAL_Delay(100);
|
HAL_Delay(100);
|
||||||
|
|
2080
build/hover.hex
2080
build/hover.hex
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue