Skip to content

Commit

Permalink
Sub: Change division to multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
muramura authored and peterbarker committed Jan 2, 2025
1 parent 20dce34 commit dcafda8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ArduSub/GCS_MAVLink_Sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ bool GCS_MAVLINK_Sub::send_info()
send_named_float("RollPitch", sub.roll_pitch_flag);

CHECK_PAYLOAD_SIZE(NAMED_VALUE_FLOAT);
send_named_float("RFTarget", sub.mode_surftrak.get_rangefinder_target_cm() / 100.0f);
send_named_float("RFTarget", sub.mode_surftrak.get_rangefinder_target_cm() * 0.01f);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion ArduSub/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void Sub::Log_Write_Control_Tuning()
angle_boost : attitude_control.angle_boost(),
throttle_out : motors.get_throttle(),
throttle_hover : motors.get_throttle_hover(),
desired_alt : pos_control.get_pos_target_z_cm() / 100.0f,
desired_alt : pos_control.get_pos_target_z_cm() * 0.01f,
inav_alt : inertial_nav.get_position_z_up_cm() * 0.01f,
baro_alt : barometer.get_altitude(),
desired_rangefinder_alt : (int16_t)mode_surftrak.get_rangefinder_target_cm(),
Expand Down
2 changes: 1 addition & 1 deletion ArduSub/motors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ bool Sub::handle_do_motor_test(mavlink_command_int_t command) {

if (is_equal(throttle_type, (float)MOTOR_TEST_THROTTLE_PERCENT)) {
throttle = constrain_float(throttle, 0.0f, 100.0f);
throttle = channel_throttle->get_radio_min() + throttle / 100.0f * (channel_throttle->get_radio_max() - channel_throttle->get_radio_min());
throttle = channel_throttle->get_radio_min() + throttle * 0.01f * (channel_throttle->get_radio_max() - channel_throttle->get_radio_min());
return motors.output_test_num(motor_number, throttle); // true if motor output is set
}

Expand Down
4 changes: 2 additions & 2 deletions ArduSub/surface_bottom_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ void Sub::update_surface_and_bottom_detector()


if (ap.at_surface) {
set_surfaced(current_depth > g.surface_depth/100.0 - 0.05); // add a 5cm buffer so it doesn't trigger too often
set_surfaced(current_depth > g.surface_depth*0.01 - 0.05); // add a 5cm buffer so it doesn't trigger too often
} else {
set_surfaced(current_depth > g.surface_depth/100.0); // If we are above surface depth, we are surfaced
set_surfaced(current_depth > g.surface_depth*0.01); // If we are above surface depth, we are surfaced
}


Expand Down

0 comments on commit dcafda8

Please sign in to comment.