implement suggested bugfix for main loop delay (does not work)

This commit is contained in:
interfisch 2019-12-06 22:07:06 +01:00
parent ddeb7fbd18
commit 2e28a807ea
2 changed files with 217 additions and 213 deletions

View File

@ -89,7 +89,7 @@
#define START_FRAME 0xAAAA // [-] Start frame definition for serial commands
#define SERIAL_TIMEOUT 160 // [-] Serial timeout duration for the received data. 160 ~= 0.8 sec. Calculation: 0.8 sec / 0.005 sec
#define USART2_BAUD 38400 // UART2 baud rate (long wired cable)
#define USART2_BAUD 38400 // UART2 baud rate (long wired cable, soldered next to buzzer)
#define USART2_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
#define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino
#define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!

View File

@ -284,9 +284,11 @@ int main(void) {
int16_t board_temp_adcFilt = adc_buffer.temp;
int16_t board_temp_deg_c;
uint32_t timePrev=0; //for loop timing
while(1) {
HAL_Delay(DELAY_IN_MAIN_LOOP); //delay in ms
//HAL_Delay(DELAY_IN_MAIN_LOOP); //delay in ms
if ((HAL_GetTick()-timePrev) > DELAY_IN_MAIN_LOOP) { // try with DELAY_IN_MAIN_LOOP = 5 ms and then with DELAY_IN_MAIN_LOOP = 10 ms
#ifdef CONTROL_NUNCHUCK
Nunchuck_Read();
@ -514,6 +516,8 @@ int main(void) {
poweroff();
}
}
timePrev = HAL_GetTick();
}
}
/** System Clock Configuration