Skip to content

Commit

Permalink
sensor: ping360: add num_steps to sensor settings struct
Browse files Browse the repository at this point in the history
This is a parameter needed for auto transmit strategy
  • Loading branch information
jaxxzer committed Feb 1, 2024
1 parent 508b250 commit 68fa8b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/sensor/ping360.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ void Ping360::asyncProfileRequest()

auto_transmit.set_start_angle(_sensorSettings.start_angle);
auto_transmit.set_stop_angle(_sensorSettings.end_angle);
auto_transmit.set_num_steps(_angular_speed);
auto_transmit.set_num_steps(_sensorSettings.num_steps);
auto_transmit.set_delay(0);
auto_transmit.updateChecksum();

Expand Down Expand Up @@ -452,7 +452,7 @@ void Ping360::handleMessage(const ping_message& msg)
_sensorSettings.checkSector = true;
_sensorSettings.checkValidation({autoDeviceData.transmit_duration(), autoDeviceData.gain_setting(),
autoDeviceData.data_length(), autoDeviceData.sample_period(), autoDeviceData.transmit_frequency(),
autoDeviceData.start_angle(), autoDeviceData.stop_angle()});
autoDeviceData.start_angle(), autoDeviceData.stop_angle(), autoDeviceData.num_steps()});

// Everything should be valid, otherwise the sensor is not in sync
if (!link()->isWritable() && _sensorSettings.valid) {
Expand All @@ -461,6 +461,7 @@ void Ping360::handleMessage(const ping_message& msg)
set_sample_period(autoDeviceData.sample_period());
set_transmit_frequency(autoDeviceData.transmit_frequency());
set_number_of_points(autoDeviceData.data_length());
set_angular_speed(autoDeviceData.num_steps());
}

if (!_sensorSettings.valid) {
Expand Down
5 changes: 4 additions & 1 deletion src/sensor/ping360.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class Ping360 : public PingSensor {
{
if (angular_speed != _angular_speed) {
_angular_speed = angular_speed;
_sensorSettings.num_steps = angular_speed;
emit angularSpeedChanged();
}
}
Expand Down Expand Up @@ -615,6 +616,7 @@ class Ping360 : public PingSensor {

uint16_t start_angle = 0;
uint16_t end_angle = 399;
uint8_t num_steps = 1;
bool checkSector = false;

bool valid = true;
Expand All @@ -632,7 +634,8 @@ class Ping360 : public PingSensor {
&& other.num_points == num_points && other.sample_period == sample_period
&& other.transmit_frequency == transmit_frequency;
if (checkSector && valid) {
valid = other.start_angle == start_angle && other.end_angle == end_angle;
valid
= other.start_angle == start_angle && other.end_angle == end_angle && other.num_steps == num_steps;
}
return valid;
}
Expand Down

0 comments on commit 68fa8b4

Please sign in to comment.