Sub: Change division to multiplication

This commit is contained in:
muramura 2024-04-20 19:13:51 +09:00 committed by Peter Barker
parent 20dce34988
commit dcafda890b
4 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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(),

View File

@ -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
}

View File

@ -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
}