Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed issue where create angle/create distance reading wouldn't be co…

…mpletely reset by the set functions
  • Loading branch information...
commit 32bf72d42eaf95a5e021feb3f1d0f5e507ba0668 1 parent b132ccf
@bmcdorman bmcdorman authored
Showing with 7 additions and 3 deletions.
  1. +1 −1  include/kovan/create.hpp
  2. +6 −2 src/create.cpp
View
2  include/kovan/create.hpp
@@ -455,7 +455,7 @@ class EXPORT_SYM Create
void updateState();
void updateSensorPacket1();
- void updateSensorPacket2();
+ void updateSensorPacket2(bool forceUpdate = false);
void updateSensorPacket3();
void updateSensorPacket4();
void updateSensorPacket5();
View
8 src/create.cpp
@@ -822,11 +822,15 @@ bool Create::setBaudRate(const unsigned char& baudCode)
void Create::setDistance(const int distance)
{
+ // Clear distance on device
+ updateSensorPacket2(true);
m_state.distance = distance;
}
void Create::setAngle(const int angle)
{
+ // Clear angle on device
+ updateSensorPacket2(true);
m_state.angle = angle;
}
@@ -1028,9 +1032,9 @@ void Create::updateSensorPacket1()
endAtomicOperation();
}
-void Create::updateSensorPacket2()
+void Create::updateSensorPacket2(bool forceUpdate)
{
- if(!hasRequiredTimePassed(timestamps[1])) return;
+ if(!forceUpdate && !hasRequiredTimePassed(timestamps[1])) return;
flush();
beginAtomicOperation();
write(OI_SENSORS);
Please sign in to comment.
Something went wrong with that request. Please try again.