diff --git a/libraries/libcpp/inc/ld06.hpp b/libraries/libcpp/inc/ld06.hpp index 34b5c00..54c1189 100644 --- a/libraries/libcpp/inc/ld06.hpp +++ b/libraries/libcpp/inc/ld06.hpp @@ -178,6 +178,8 @@ class LD06 if (crc == packet.crc) { ++packets_; + // Disabled because scan is more stable when PWM is open loop + /* last_speed_ = packet.radar_speed; if (last_speed_ < MINIMUM_LASER_SPEED) { @@ -188,6 +190,7 @@ class LD06 control_pwm_ -= 1; } TIM12->CCR2 = control_pwm_; + */ return EXPECTED_PACKET_LENGTH; } diff --git a/projects/etherbotix/user_io.hpp b/projects/etherbotix/user_io.hpp index 81ae8d1..1dc42d6 100644 --- a/projects/etherbotix/user_io.hpp +++ b/projects/etherbotix/user_io.hpp @@ -238,6 +238,12 @@ inline void user_io_set_direction() inline bool user_io_ld06_init() { + if (user_io_laser_active_) + { + // Don't re-init the laser if already active - this slows the laser + return true; + } + user_io_laser_active_ = 1; // Uses USART3 and TIM12