Skip to content

Commit

Permalink
Merge pull request #337 from runger1101001/dev
Browse files Browse the repository at this point in the history
Add check to sensor
  • Loading branch information
runger1101001 authored Nov 7, 2023
2 parents 72e7458 + 9fd6621 commit 639ccab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/common/base_classes/Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

void Sensor::update() {
float val = getSensorAngle();
if (val<0) // sensor angles are strictly non-negative. Negative values are used to signal errors.
return; // TODO signal error, e.g. via a flag and counter
angle_prev_ts = _micros();
float d_angle = val - angle_prev;
// if overflow happened track it as full rotation
Expand Down
4 changes: 2 additions & 2 deletions src/communication/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Commander::Commander(char eol, bool echo){
}


void Commander::add(char id, CommandCallback onCommand, char* label ){
void Commander::add(char id, CommandCallback onCommand, const char* label ){
call_list[call_count] = onCommand;
call_ids[call_count] = id;
call_label[call_count] = label;
call_label[call_count] = (char*)label;
call_count++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/communication/Commander.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Commander
* @param onCommand - function pointer void function(char*)
* @param label - string label to be displayed when scan command sent
*/
void add(char id , CommandCallback onCommand, char* label = nullptr);
void add(char id , CommandCallback onCommand, const char* label = nullptr);

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

0 comments on commit 639ccab

Please sign in to comment.