Repository navigation
Conversation
Tracker has no flight mode channel, but flight_mode_channel_number() returned 1, so RC_Channels::flight_mode_channel() returned RC1 and a non-zero RC1_OPTION would be reported as a mode channel conflict. Return 0, which flight_mode_channel() already treats as no channel.
With AP_SUB_RC_ENABLED=0 flight_mode_channel_number() returned 1, making RC1 look like a mode channel. Return 0, which flight_mode_channel() already treats as no channel.
A flight mode channel that also has an RCn_OPTION set is a configuration error. Report it at boot via the config error loop, so the user must fix the parameters and reboot, like other config errors.
Check the conflict is a config error at boot, and that a conflict created after boot is still caught at arming.
389d8f6 to
df1f3ab
Compare
|
Automated review note — AI-generated (Claude), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks, this is a sensible tightening, and the Tracker/Sub change to return 0 is needed so that RC1_OPTION doesn't trip the new check. The new Rover autotest passes at head and fails with the RC_Channel change reverted. Two nonblocking points:
Not verified: an AP_SUB_RC_ENABLED=0 Sub build, real hardware, and CI (pending at review time). |
Global Size Summary (Total Flash delta in bytes)Built from df1f3ab rebased onto e204ca7
|
|
closing this since config errors are only used if the bd will crash if it continues to boot...the pre-arm check is the better approach |
Summary
Alternate to #34592. Instead of making it a periodic pre-arm check, a flight mode channel that also has an
RCn_OPTIONset is reported at boot as a config error (Config Error: Mode channel and RC8_OPTION conflict). Like other config errors, the vehicle stays in the config error loop until the parameter is fixed and the vehicle is rebooted. The existing arm-time check is kept, so a conflict created after boot still blocks arming.Classification & Testing (check all that apply and add your own)
Checked by a human programmer
Non-functional change
No-binary change
Infrastructure change (e.g. unit tests, helper scripts)
Automated test(s) verify changes (e.g. unit test, autotest)
Tested manually, description below (e.g. SITL)
Tested on hardware
Logs attached
Logs available on request
New Rover autotest
RCModeChannelOptionConflict:MODE_CH=8,RC8_OPTION=4and rebootsConfig Error: Mode channel and RC8_OPTION conflictRC8_OPTION=0from inside the config error loop, reboots and waits for ready-to-armRC8_OPTION=4again and checks that arming fails withMode channel and RC8_OPTION conflictIt passes on this branch. With the
RC_Channels.cppchange reverted, it fails because the config error text is never received.test.Rover.RCDuplicateOptionsExistandtest.Rover.ConfigErrorLoopstill pass.SITL builds of copter, plane, rover, sub, blimp and antennatracker succeed.
The
AP_SUB_RC_ENABLED=0branch of the Sub change was not compiled; it only changes a returned constant.Description
The check is done in
RC_Channels::init(), beforeinit_aux_all(), using the existingflight_mode_channel_conflicts_with_rc_option(). The arm-time checks inAP_Arming::rc_arm_checks()are unchanged.Behaviour changes:
ARMING_SKIP_CHK, and the check doesn't depend onARMING_REQUIREor RC input. The vehicle doesn't finish booting until the conflict is fixed. A vehicle without a receiver (GCS or companion control) that has a leftoverRCn_OPTIONon its mode channel could previously arm, and will now stop at boot after upgrading.rc().init()runs beforegcs().setup_uarts(), so during the config error loop only the console port (normally USB) has MAVLink. Existing Plane config errors raised beforesetup_uarts(), such as barometer calibration, behave the same way.The arm check could be removed, since the boot check catches any conflict present at startup. That saves 44 bytes of flash (measured on MatekF405 Copter and Plane). The cost is that a conflict created by changing parameters after boot would go unreported until the next reboot. On the other hand, a user can make the vehicle dangerous after boot through parameter changes in any number of ways, so reviewers may prefer to save the bytes. This PR keeps the arm check.
Tracker has no flight mode channel, but
flight_mode_channel_number()returned1, so a non-zeroRC1_OPTIONwould put Tracker into the config error loop. Sub'sAP_SUB_RC_ENABLED=0fallback had the same placeholder. Both now return0, whichRC_Channels::flight_mode_channel()already treats as "no mode channel". These two commits are the same as in #34592.Related: #34592 (pre-arm approach; only one of the two should be merged), #34427, #32749 (replaces
FLTMODE_CHwith an RC option; whichever PR merges second needs rebasing).AI-assisted: implementation, tests and description were drafted with Claude Code.
🤖 Generated with Claude Code