Skip to content

Commit 639ccab

Browse files
Merge pull request #337 from runger1101001/dev
Add check to sensor
2 parents 72e7458 + 9fd6621 commit 639ccab

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/common/base_classes/Sensor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
void Sensor::update() {
88
float val = getSensorAngle();
9+
if (val<0) // sensor angles are strictly non-negative. Negative values are used to signal errors.
10+
return; // TODO signal error, e.g. via a flag and counter
911
angle_prev_ts = _micros();
1012
float d_angle = val - angle_prev;
1113
// if overflow happened track it as full rotation

src/communication/Commander.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Commander::Commander(char eol, bool echo){
1111
}
1212

1313

14-
void Commander::add(char id, CommandCallback onCommand, char* label ){
14+
void Commander::add(char id, CommandCallback onCommand, const char* label ){
1515
call_list[call_count] = onCommand;
1616
call_ids[call_count] = id;
17-
call_label[call_count] = label;
17+
call_label[call_count] = (char*)label;
1818
call_count++;
1919
}
2020

src/communication/Commander.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Commander
9191
* @param onCommand - function pointer void function(char*)
9292
* @param label - string label to be displayed when scan command sent
9393
*/
94-
void add(char id , CommandCallback onCommand, char* label = nullptr);
94+
void add(char id , CommandCallback onCommand, const char* label = nullptr);
9595

9696
// printing variables
9797
VerboseMode verbose = VerboseMode::user_friendly; //!< flag signaling that the commands should output user understanable text

0 commit comments

Comments
 (0)