Skip to content

Commit b80ed6f

Browse files
Sub: rename has_manual_throttle to requires_altitude()
1 parent 522429f commit b80ed6f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

ArduSub/Sub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void Sub::ten_hz_logging_loop()
246246
if (should_log(MASK_LOG_RCOUT)) {
247247
logger.Write_RCOUT();
248248
}
249-
if (should_log(MASK_LOG_NTUN) && (sub.flightmode->requires_GPS() || !sub.flightmode->has_manual_throttle())) {
249+
if (should_log(MASK_LOG_NTUN) && (sub.flightmode->requires_GPS() || sub.flightmode->requires_altitude())) {
250250
pos_control.write_log();
251251
}
252252
if (should_log(MASK_LOG_IMU) || should_log(MASK_LOG_IMU_FAST) || should_log(MASK_LOG_IMU_RAW)) {

ArduSub/mode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ bool Sub::set_mode(Mode::Number mode, ModeReason reason)
9595

9696
// check for valid altitude if old mode did not require it but new one does
9797
// we only want to stop changing modes if it could make things worse
98-
if (flightmode->has_manual_throttle() &&
99-
!new_flightmode->has_manual_throttle() &&
98+
if (flightmode->requires_altitude() &&
99+
!new_flightmode->requires_altitude() &&
100100
!sub.control_check_barometer()) { // maybe use ekf_alt_ok() instead?
101101
gcs().send_text(MAV_SEVERITY_WARNING, "Mode change failed: %s need alt estimate", new_flightmode->name());
102102
LOGGER_WRITE_ERROR(LogErrorSubsystem::FLIGHT_MODE, LogErrorCode(mode));

ArduSub/mode.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Mode
6464
virtual bool init(bool ignore_checks) { return true; }
6565
virtual void run() = 0;
6666
virtual bool requires_GPS() const = 0;
67-
virtual bool has_manual_throttle() const = 0;
67+
virtual bool requires_altitude() const = 0;
6868
virtual bool allows_arming(bool from_gcs) const = 0;
6969
virtual bool is_autopilot() const { return false; }
7070
virtual bool in_guided_mode() const { return false; }
@@ -198,7 +198,7 @@ class ModeManual : public Mode
198198
virtual void run() override;
199199
bool init(bool ignore_checks) override;
200200
bool requires_GPS() const override { return false; }
201-
bool has_manual_throttle() const override { return true; }
201+
bool requires_altitude() const override { return false; }
202202
bool allows_arming(bool from_gcs) const override { return true; }
203203
bool is_autopilot() const override { return false; }
204204

@@ -221,7 +221,7 @@ class ModeAcro : public Mode
221221

222222
bool init(bool ignore_checks) override;
223223
bool requires_GPS() const override { return false; }
224-
bool has_manual_throttle() const override { return true; }
224+
bool requires_altitude() const override { return false; }
225225
bool allows_arming(bool from_gcs) const override { return true; }
226226
bool is_autopilot() const override { return false; }
227227

@@ -244,7 +244,7 @@ class ModeStabilize : public Mode
244244

245245
bool init(bool ignore_checks) override;
246246
bool requires_GPS() const override { return false; }
247-
bool has_manual_throttle() const override { return true; }
247+
bool requires_altitude() const override { return false; }
248248
bool allows_arming(bool from_gcs) const override { return true; }
249249
bool is_autopilot() const override { return false; }
250250

@@ -267,7 +267,7 @@ class ModeAlthold : public Mode
267267

268268
bool init(bool ignore_checks) override;
269269
bool requires_GPS() const override { return false; }
270-
bool has_manual_throttle() const override { return false; }
270+
bool requires_altitude() const override { return true; }
271271
bool allows_arming(bool from_gcs) const override { return true; }
272272
bool is_autopilot() const override { return false; }
273273
void control_depth();
@@ -326,7 +326,7 @@ class ModeGuided : public Mode
326326

327327
bool init(bool ignore_checks) override;
328328
bool requires_GPS() const override { return true; }
329-
bool has_manual_throttle() const override { return false; }
329+
bool requires_altitude() const override { return true; }
330330
bool allows_arming(bool from_gcs) const override { return true; }
331331
bool is_autopilot() const override { return true; }
332332
bool in_guided_mode() const override { return true; }
@@ -380,7 +380,7 @@ class ModeAuto : public ModeGuided
380380

381381
bool init(bool ignore_checks) override;
382382
bool requires_GPS() const override { return true; }
383-
bool has_manual_throttle() const override { return false; }
383+
bool requires_altitude() const override { return true; }
384384
bool allows_arming(bool from_gcs) const override { return true; }
385385
bool is_autopilot() const override { return true; }
386386
bool auto_loiter_start();
@@ -421,7 +421,7 @@ class ModePoshold : public ModeAlthold
421421
bool init(bool ignore_checks) override;
422422

423423
bool requires_GPS() const override { return true; }
424-
bool has_manual_throttle() const override { return false; }
424+
bool requires_altitude() const override { return true; }
425425
bool allows_arming(bool from_gcs) const override { return true; }
426426
bool is_autopilot() const override { return true; }
427427

@@ -448,7 +448,7 @@ class ModeCircle : public Mode
448448

449449
bool init(bool ignore_checks) override;
450450
bool requires_GPS() const override { return true; }
451-
bool has_manual_throttle() const override { return false; }
451+
bool requires_altitude() const override { return true; }
452452
bool allows_arming(bool from_gcs) const override { return true; }
453453
bool is_autopilot() const override { return true; }
454454

@@ -470,7 +470,7 @@ class ModeSurface : public Mode
470470

471471
bool init(bool ignore_checks) override;
472472
bool requires_GPS() const override { return false; }
473-
bool has_manual_throttle() const override { return false; }
473+
bool requires_altitude() const override { return false; }
474474
bool allows_arming(bool from_gcs) const override { return true; }
475475
bool is_autopilot() const override { return true; }
476476

@@ -493,7 +493,7 @@ class ModeMotordetect : public Mode
493493

494494
bool init(bool ignore_checks) override;
495495
bool requires_GPS() const override { return false; }
496-
bool has_manual_throttle() const override { return false; }
496+
bool requires_altitude() const override { return false; }
497497
bool allows_arming(bool from_gcs) const override { return true; }
498498
bool is_autopilot() const override { return true; }
499499

0 commit comments

Comments
 (0)