Skip to content

Commit

Permalink
disable ld06 pwm loop
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeferguson committed Nov 12, 2023
1 parent 3029c60 commit 4075a25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/libcpp/inc/ld06.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -188,6 +190,7 @@ class LD06
control_pwm_ -= 1;
}
TIM12->CCR2 = control_pwm_;
*/
return EXPECTED_PACKET_LENGTH;
}

Expand Down
6 changes: 6 additions & 0 deletions projects/etherbotix/user_io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4075a25

Please sign in to comment.