Move sonar init function to main

This commit is contained in:
Rihards Skuja 2018-01-04 14:20:41 +02:00
parent 98e9ccf3dd
commit 60aedbc945
No known key found for this signature in database
GPG Key ID: 53FA13A3F7F8571B
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@
#endif /* DEBUG */ #endif /* DEBUG */
#ifndef F_CPU #ifndef F_CPU
#define F_CPU 1000000UL #define F_CPU 1000000UL // Stock atmega328p
#endif #endif
@ -37,6 +37,7 @@ int main(void)
{ {
init_leds(); init_leds();
init_servos(); init_servos();
init_sonar();
run_servos(); run_servos();
read_temp(); read_temp();

View File

@ -31,7 +31,6 @@ ISR(TIMER1_OVF_vect)
int32_t read_sonar(void) int32_t read_sonar(void)
{ {
int dist_in_cm = 0; int dist_in_cm = 0;
init_sonar();
trigger_sonar(); trigger_sonar();
// While echo pin is low // While echo pin is low