Skip to content

Commit

Permalink
ping360: Only use heading when running in full scam mode
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Feb 7, 2020
1 parent ea03b8b commit 04d7bd5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sensor/ping360.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ class Ping360 : public PingSensor {
*
* @return uint16_t
*/
uint16_t angle() { return (_angle + angle_offset() + static_cast<int>(_heading)) % _angularResolutionGrad; }
uint16_t angle()
{
// Only use heading correction if running in full scam mode (sector size == resolution)
const int angle
= _angle + angle_offset() + (_sectorSize == _angularResolutionGrad ? static_cast<int>(_heading) : 0);
return angle % _angularResolutionGrad;
}
Q_PROPERTY(int angle READ angle NOTIFY angleChanged)

/**
Expand Down

0 comments on commit 04d7bd5

Please sign in to comment.