DISARM after rtl in copter 3.5.4

Hi, I would like to ask you a question. Right now I have arducopter 3.5.4, configuration in x I have the parameter: DISARM_DELAY = 0. so if I stay any time armed in any flight mode, the drone does not disarm.

On the other hand, if I practice the following sequence of flight modes: (All this without touching the accelerator, pitch, roll and yaw controls. ONLY TOUCHING THE CHANNELS THAT CONTROL THE MODES)
1st (take off at loiter, initially I manipulate the accelerator channel to raise it to 1500 us, then it stays that way) AUTO (for a while) _> RTL (once landed I wait 1 second and switch quickly from RTL to AUTO)> (I wait 1 seconds in auto mode and switch to STABILIZE for 4 seconds) ___> AUTO.
There is no problem and this runs well BUT:
If I wait more than 1 second once landed after RTL, the drone is disarmed indicating no reason.
[it is disarmed in rtl mode, once landed and with the accelerator in the intermediate position] {this did not happen to me in ac 3.2.1} How could I really make the drone not disarm if it is not with my express permission through radio control or other methods in these situations.

Set DISARM_DELAY to 10 seconds. Try that, it might help.

the intresting thing is that in ac 3.2.1 it works well, if you do RTL (wait for a landing) then you can stay in the ground with the motors off during the time you want, finaly if you changue the mode to STABILIZE the copter will take off (of course because you never touch the sticks including the acelerator and it is alwais in the midlle position 1500 us )

may be if i update to a lower firmware like ac 3.3 “this function” is available

i test with the ac 3.3 and “doenst work”…
the automatic disarm after an rtl only cam be removed by hard programin i thik,
better i look the code…

make a modification in the code, in the ArduCopter/mode_rtl.cpp i comented the line 358. in the : // disarm when the landing detector says we’ve landed i dont want that in my case. that sems to work but: wen i changue mode it gets me an error in mission planer : error changuing mode (more or less like that) maibe is because i landed with the acelerator in the middle possition, and if i changue RTL mode to STABILICE,…dontwork i dont know wy

in my case i9 dont want that,
i want it for a very long time undefined long time

you know the thing is that im trying to make a full autonumus drone, the drone is doing a mission and if the battery levelis low, then RTL chargue and continue the mission
to do this , i use an arduino that i put in the midle of the receiver and the APM/pixhawk.
This is because the arducopter source code is to hard to me, so i modificate the inputs chanels of the apm/pixhawk chanel 5 and chanel 7.
chanel 7 is for RTL, chanel 5 is for AUTO/STABILIZE
with the apm 2.8 (ac 3.2.1) there is one problem, the code works… but the RTL landings of the apm have an error more than 1 meter.
i ned less error, maybe is because im ussing a cheap clone, but i cant buy ofiginal boards now :frowning:slight_smile:
i want to make this sistem with the pixhawk
the true is that if set"a real" DISARM_DELAY= infinite, I would have done it :smile:

over line 350 AdruCopter/mode_rtl.cpp

// rtl_returnhome_run - return home
// called by rtl_run at 100hz or more
void Copter::ModeRTL::land_run(bool disarm_on_land)
// if not auto armed or landing completed or motor interlock not enabled set throttle to zero and exit immediately
if (!motors->armed() || !ap.auto_armed || ap.land_complete || !motors->get_interlock()) {
// set target to current position

    // disarm when the landing detector says we've landed
    if (ap.land_complete && disarm_on_land) {
 /////////i comented this//maybe i have to delete the if////       _copter.init_disarm_motors();

    // check if we've completed this stage of RTL
    _state_complete = ap.land_complete;

what is the diference , if i coment the line, or i coment the entire if,or i delete it

In that particular case commenting out that single line, or the entire if has the same effect.

there has to be a way to disable the automatic disarming function after RTL
this is similar:

maybe if i put in mode_rtl.cpp (or control_rtl.cpp in the link)
in line 85: