Skip to content

Commit

Permalink
Merge pull request #62 from DEIS-Tools/60-fw-set-tube-level-in-tube-2…
Browse files Browse the repository at this point in the history
…-results-in-error

#60 Set tube level in tube 2 results in error
  • Loading branch information
magoorden authored Aug 28, 2024
2 parents acbc4b8 + 07e39cf commit 7e03275
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Claire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ bool Claire::setLevel(Output &in, Output &out, int level) {

Sensor sensor = default_sensor_defs::TUBE1_HEIGHT;

if (in.tube == 0) {
if (in.tube == 1) {
sensor = default_sensor_defs::TUBE1_HEIGHT;
} else if (in.tube == 1) {
} else if (in.tube == 2) {
sensor = default_sensor_defs::TUBE2_HEIGHT;
} else {
Serial.println("ERROR: Unknown tube referenced, aborting setLevel");
Expand Down
6 changes: 3 additions & 3 deletions src/Claire.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define SET_LEVEL_INTEGRAL_GAIN 5
#define SET_LEVEL_ADD_MIN_ACTUATE_TIME 500
#define SET_LEVEL_ADD_MAX_ACTUATE_TIME 5000
#define SET_LEVEL_SUB_MIN_ACTUATE_TIME 1000
#define SET_LEVEL_SUB_MIN_ACTUATE_TIME 700
#define SET_LEVEL_SUB_MAX_ACTUATE_TIME 5000
// allowed inaccuracy of ranging when setting level
#define SET_LEVEL_HYSTERESIS 5
Expand Down Expand Up @@ -91,8 +91,8 @@ static Output** default_pumps = new Output*[PUMP_COUNT + 1] {


namespace default_sensor_defs {
static const auto TUBE1_HEIGHT = Sensor{ 10, "Tube1_sonar_dist_mm", 0 };
static const auto TUBE2_HEIGHT = Sensor{ 11, "Tube2_sonar_dist_mm", 1 };
static const auto TUBE1_HEIGHT = Sensor{ 11, "Tube1_sonar_dist_mm", 1 };
static const auto TUBE2_HEIGHT = Sensor{ 10, "Tube2_sonar_dist_mm", 2 };
}

const int SENSOR_COUNT = 2;
Expand Down

0 comments on commit 7e03275

Please sign in to comment.