diff --git a/inc/board_config.h b/inc/board_config.h index d6af13d..a3a36cb 100644 --- a/inc/board_config.h +++ b/inc/board_config.h @@ -12,6 +12,8 @@ // #define POWER_SUPPLY_12V #define POWER_SUPPLY_24V +// #define DEBUG_VOFA_TOOL + /******************************************************************************/ #ifdef POWER_SUPPLY_12V diff --git a/src/led.c b/src/led.c index 35f89eb..a89c9b4 100644 --- a/src/led.c +++ b/src/led.c @@ -35,5 +35,5 @@ void led_blink_config(void) timer_enable(LED_BLINK_TIMER); - nvic_irq_enable(LED_BLINK_IRQ, 2); + nvic_irq_enable(LED_BLINK_IRQ, 3U); } \ No newline at end of file diff --git a/src/main.c b/src/main.c index 023f270..08d0193 100644 --- a/src/main.c +++ b/src/main.c @@ -25,26 +25,25 @@ int main(void) /* configure LED */ led_blink_config(); /* configure FWDGT */ - watchdog_init(); + // watchdog_init(); -#ifdef SOFTWARE_IIC - soft_i2c_config(); -#else - i2c_config(); -#endif +// #ifdef SOFTWARE_IIC +// soft_i2c_config(); +// #else +// i2c_config(); +// #endif printf("system start!\r\n"); ultrasonic_config(); while(1){ - gd60914_get_object_tempture(); + // gd60914_get_object_tempture(); delay_ms(50); - ultrasonic_pwm_out_cycles(ULTRASONIC_TX_CYCLES); - watchdog_reload(); + // watchdog_reload(); } } diff --git a/src/rs485_protocol.c b/src/rs485_protocol.c index 787cbc4..923218b 100644 --- a/src/rs485_protocol.c +++ b/src/rs485_protocol.c @@ -110,6 +110,9 @@ void ultrasonic_distance_report(void) { distance_uint16 = ultrasonic_calc_distance(); +#ifdef DEBUG_VOFA_TOOL + printf("%d\n", distance_uint16) +#else package_data[0] = (distance_uint16 >> 8) & 0xFF; package_data[1] = distance_uint16 & 0xFF; @@ -120,4 +123,5 @@ void ultrasonic_distance_report(void) { printf("%c%c%c", package_header[0], package_header[1], package_header[2]); printf("%c%c", package_data[0], package_data[1]); printf("%c", calculate_crc(combined_data, 6)); +#endif } diff --git a/src/ultrasonic_analog.c b/src/ultrasonic_analog.c index 10ef5b5..6ed775d 100644 --- a/src/ultrasonic_analog.c +++ b/src/ultrasonic_analog.c @@ -140,7 +140,7 @@ void ultrasonic_config(void) { } uint16_t ultrasonic_calc_distance(void) { - while (!ultrasonicMeasurementDone); + // while (!ultrasonicMeasurementDone); // uint32_t us_value = timer_channel_capture_value_register_read(US_ECHO_TIMER, US_ECHO_CH); uint16_t distance = (TIME_CORRECTION_US + g_capture_value) * 17; /*