ADD: analog input for vehicle during hackerhotel

This commit is contained in:
Niklas Fauth 2018-02-18 14:02:05 +01:00
parent ff224a2509
commit 8d31eaf8af
3 changed files with 1155 additions and 936 deletions

View File

@ -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;

View File

@ -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);

File diff suppressed because it is too large Load Diff