Caravan Autopilot - won't disarm?
-
OK, I have cleared my Community folder of everything except the Caravan, the Real Sim Gear MSFS module, and the FSUIPC lvar module. All other planes, liveries, scenery, nav data, all moved out and the sim loaded with just those three. Did not fix the problem.
I then switched both the 530 and the 430 to the radio stacks while still in the air. The AP panel also flickered like it was changing, and it lost my set altitude. I did not have it engaged at the time. I played with the AP and the radios for a minute or three, the AP with just the radios did not have the issue.
Of note: the AP with the radio stack did not revert to Roll and Pitch mode when disengaged, it turned off and stayed off entirely.
Went back to the GNS units, issue came back.
-
Thank you for helping rule some things out and give me an idea of where to look. After many hours of testing, I was able to reproduce your issue, and I think I have a solution. For me, I was able to disable the autopilot for good by just pressing the disconnect button a second time, though.
Something very tiny changed in the behavior of the WT GNS's autopilot manager recently. I think I know what, and I am lucky that it is not affecting my other aircraft. I have a one-line patch for you that should hopefully eliminate the symptoms of this change.
In ...\Community\bksq-aircraft-analogcaravan\html_ui\Pages\VCockpit\Instruments\Generic\Radios\bksq-aircraft-analogcaravan\KAP140\KAP140.js...
Please add the following line after the line containing "AP_FLIGHT_LEVEL_CHANGE_OFF". You can search for it, or it should be line 313.
setTimeout(() => {if(SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool")){SimVar.SetSimVarValue("K:AP_MASTER", "number", 0);}}, 500);
If that works for you to disconnect the autopilot, I have a couple other fixes I can apply to correct the behavior of the display while working with the GNS 530, which I can then distribute in a new file.
Good luck, and let me know how it goes!
-
//Start Normal Operation if(this.autoPilotDisconnectTimer == 0 && !SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool")){ this.autoPilotDisconnectTimer = 5000; SimVar.SetSimVarValue("K:AP_HDG_HOLD_OFF", "number", 0); SimVar.SetSimVarValue("K:AP_NAV1_HOLD_OFF", "number", 0); SimVar.SetSimVarValue("K:AP_APR_HOLD_OFF", "number", 0); SimVar.SetSimVarValue("K:AP_ALT_HOLD_OFF", "number", 0); SimVar.SetSimVarValue("K:AP_LOC_HOLD_OFF", "number", 0); SimVar.SetSimVarValue("K:AP_BC_HOLD_OFF", "number", 0); SimVar.SetSimVarValue("K:AP_FLIGHT_LEVEL_CHANGE_OFF", "number", 0); setTimeout(() => {if(SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool")){SimVar.SetSimVarValue("K:AP_MASTER", "number", 0);}}, 500); }
If this is the correct place for it, then no, that fix did not mitigate the problem. Is this something that the sim compiles? Do I need to clear all the Caravan files out of my AppData folder to force the sim to recompile it?
-
Yes, that's the right spot... So long as you restarted the simulator after making those changes, they should take effect. I'm pretty surprised that didn't fix it. Reading your description of the problem again after my troubleshooting yesterday, does the autopilot really reengage when arriving at altitude, and not just when you're disconnecting it? All I could reproduce in my testing was it reengaging roil mode immediately after being disengaged. When you have the chance, please try one more time with a clean community folder and also removing the Real Sim Gear module, and the FSUIPC lvar module. I just want to make sure that there isn't anything else at play here. I'll do some more testing on my end too. I'll revert WT's last changes to the GNS 530 in an attempt to pinpoint what changed, and see if that leads to any hints. Thanks again for working on this with me. It's unreasonably frustrating to me when my users cannot enjoy my products as intended, whatever the reason.
-
Yes, it engages by itself at the armed altitude. In my test with that new line of code, for instance, I set 4000ft and the AP came on and took over as I climbed after takeoff and reached 4000ft.
I made the changes to the file without the sim running, so hopefully it should have taken effect. I'll try with a completely clean folder.
-
Alright, I tried with a completely empty folder and then realized I had also taken out the Caravan 😂
After putting the Caravan, and only the Caravan into the folder (no FSUIPC, no RSG, nothing else), it still does it.
The best way I have to recreate is to be cruising at altitude with the AP engaged in some LNAV mode and in ALT hold. Disengage the autopilot and then hand fly for a little bit. As you gain/lose altitude a little bit and go slightly above/below your set ALT, the AP will eventually capture it again and turn back on. It also happens if I hand fly up to my set cruise altitude, but hand flying you can repeat it every time you disengage the AP until finally ALT stays lit in the annunciator panel, then it will stay off.
I do believe you have fixed the "issue" of reverting to roll and pitch mode when disconnecting the AP, though. I will have to test more next round, as this was a quick test with a blank Community folder and no peripherals setup; just spawn on the runway up and running and then pray I can takeoff with the trim wheel.
Most of my testing has been from cold and dark with my full setup, for what it's worth.
Is this something you could put some extra debugging or logging stuff into a test build and send me?
-
Thank you for providing all this information. I'm going to be looking into this again tonight, and that was exactly the kind of steps I was looking for to reproduce the problem. Hopefully I can make it happen. Unfortunately, the autopilot system is pretty invisible to outside interrogation, so I have to work off hunches and stepping through program execution with the debugger. I have a couple other tricks up my sleeve too. Thank you for the update. I'll do my best later tonight, and let you know how it goes!
-
I think I have a solution for you! You're never going to believe it. I think this is the culprit, because it's definitely not in my KAP140 code, and it's the one thing in the Caravan's autopilot configuration that differs from my other aircraft.
Try changing "flight_director_available" from 0 to 1 in ...\bksq-aircraft-analogcaravan\SimObjects\Airplanes\bksq-aircraft-analogcaravan\systems.cfg
I don't know why this behavior would have changed in the last update, but it also seems to have solved the immediate reactivation of the autopilot after being disconnected, so you likely don't need the first code fix for KAP140.js anymore.
I really hope that solves the problem for you! This has been a tricky one.
Unfortunately, the autopilot will still display the inactive modes when deactivated while using the GNS 530, but that's a solved problem on my end, and has no effect on autopilot functionality. I'll include it in the next update, but if you want to fix it now, you can add the following line directly after these four lines in KAP140.js.
if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; }
getLateralModeActive(){ getLateralModeArmed(){ getVerticalModeActive(){ getVerticalModeArmed(){
-
@Black-Square Seems like this did the trick! No more abnormalities noticed with the AP at all this last flight. Thanks for putting this together!
-
One down, one to go! Thank you for taking the time to test this. Sorry it took a while to find a solution. It would have taken me much longer to find the problem without your excellent descriptions of the problem.
-
@Black-Square said in Caravan Autopilot - won't disarm?:
I think I have a solution for you! You're never going to believe it. I think this is the culprit, because it's definitely not in my KAP140 code, and it's the one thing in the Caravan's autopilot configuration that differs from my other aircraft.
Try changing "flight_director_available" from 0 to 1 in ...\bksq-aircraft-analogcaravan\SimObjects\Airplanes\bksq-aircraft-analogcaravan\systems.cfg
I don't know why this behavior would have changed in the last update, but it also seems to have solved the immediate reactivation of the autopilot after being disconnected, so you likely don't need the first code fix for KAP140.js anymore.
I really hope that solves the problem for you! This has been a tricky one.
Unfortunately, the autopilot will still display the inactive modes when deactivated while using the GNS 530, but that's a solved problem on my end, and has no effect on autopilot functionality. I'll include it in the next update, but if you want to fix it now, you can add the following line directly after these four lines in KAP140.js.
if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; }
getLateralModeActive(){ getLateralModeArmed(){ getVerticalModeActive(){ getVerticalModeArmed(){
I'll give the .CFG fix a try momentarily. Question regarding the other fix(es), what do I do with the line I've already added into my KAP140.js file? Should I revert to my backup of the original and put this new line in? Do I need both?
EDIT: immediately after posting this I see it's in the sentence immediately below the fix, I've been really blind these past few days. I revert to my original KAP140.js file and try it with the flight director fix and see what that does, then try this new KAP140 line.
-
I think that did it! It certainly didn't happen in the normal places it would have, and I spent a fair few minutes turning the AP on and off and deviating from my altitude, as well as hand flying up to a set one and waiting for it to take over on me. It didn't. This was with the flight director change and the stock KAP140.js file. How the hell could such a small thing make such a big difference??? Amazing. Good find!
I am not able to successfully add in your new line to the KAP140.js file, though. Those 4 lines you listed are all methods (unless I'm in the completely wrong place), and I tried putting it after the final method's last }, the line after return;, but that completely bricked my avionics when I started the sim back up. No GNS, no AP, hell, no weather radar, either.
Some more guidance on placement would be appreciated. I don't have any proper coding tools; I can get line numbers through WordPad I think, but nothing fancy to highlight bracket pairing or anything.
-
So glad it worked for you! I'll let technical support know about this to make sure that anyone else with the same problem is made aware of the solution. Thank you again for helping me find it. This is the problem with software that's constantly changing... I'm just glad we found a solution for you.
Ah, good thinking on your code edits, but that line should go directly after the four method declarations that I quoted, not after. For instance, the first one should read as follows:
getLateralModeActive(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; }
-
@Black-Square said in Caravan Autopilot - won't disarm?:
So glad it worked for you! I'll let technical support know about this to make sure that anyone else with the same problem is made aware of the solution. Thank you again for helping me find it. This is the problem with software that's constantly changing... I'm just glad we found a solution for you.
Ah, good thinking on your code edits, but that line should go directly after the four method declarations that I quoted, not after. For instance, the first one should read as follows:
getLateralModeActive(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; }
That makes sense based on your wording. I made that change and copied the line from your original post in all four locations.
I did a very, very quick test just by loading into mid-air from the world map, and the avionics were loaded and I could interact with them. None of the buttons seemed to work aside from the AP button, though. ROL and PIT mode were stuck as the only active modes.
getLateralModeActive(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool")) { return "ROL"; } else if (SimVar.GetSimVarValue("AUTOPILOT HEADING LOCK", "Bool")) { return "HDG"; } else if (SimVar.GetSimVarValue("AUTOPILOT NAV1 LOCK", "Bool")) { if(SimVar.GetSimVarValue('GPS DRIVES NAV1', 'Bool')) return 'GPS'; else return 'NAV'; } else if (SimVar.GetSimVarValue("AUTOPILOT BACKCOURSE HOLD", "Bool")) { return "REV"; } else if (SimVar.GetSimVarValue("AUTOPILOT APPROACH HOLD", "Bool")) { return "APR"; } else if (SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) { return "ROL"; } return ""; } getLateralModeArmed(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if (!SimVar.GetSimVarValue("AUTOPILOT HEADING LOCK", "Bool") && !SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool")) { return ""; } else if (SimVar.GetSimVarValue("AUTOPILOT NAV1 LOCK", "Bool")) { return "NAV"; } else if (SimVar.GetSimVarValue("AUTOPILOT BACKCOURSE HOLD", "Bool")) { return "REV"; } else if (SimVar.GetSimVarValue("AUTOPILOT APPROACH HOLD", "Bool")) { return "APR"; } return ""; } getVerticalModeActive(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if(SimVar.GetSimVarValue("AUTOPILOT PITCH HOLD", "Bool")) { return 'PIT'; } else if (SimVar.GetSimVarValue("AUTOPILOT FLIGHT LEVEL CHANGE", "Bool")) { return 'FLC'; } else if (SimVar.GetSimVarValue("AUTOPILOT VERTICAL HOLD", "Bool")) { return "VS"; } else if (SimVar.GetSimVarValue("AUTOPILOT ALTITUDE LOCK", "Bool")) { return "ALT"; } if (SimVar.GetSimVarValue("AUTOPILOT GLIDESLOPE ACTIVE", "Boolean")) { return "GS"; } return ""; } getVerticalModeArmed(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if (SimVar.GetSimVarValue("AUTOPILOT GLIDESLOPE ARM", "Boolean")) { return "GS"; } // if (SimVar.GetSimVarValue("AUTOPILOT ALTITUDE ARM", "Bool")) { // return "ALT"; // } if(SimVar.GetSimVarValue("AUTOPILOT VERTICAL HOLD", "Bool") || SimVar.GetSimVarValue("AUTOPILOT PITCH HOLD", "Bool") || SimVar.GetSimVarValue("AUTOPILOT FLIGHT LEVEL CHANGE", "Bool")){ let altitudeSet = SimVar.GetSimVarValue("AUTOPILOT ALTITUDE LOCK VAR", "FEET"); let verticalSpeedSet = SimVar.GetSimVarValue("AUTOPILOT VERTICAL HOLD VAR", "FT/MIN"); let currentAltitude = SimVar.GetSimVarValue("INDICATED ALTITUDE:"+this.altimeterIndex, "FEET"); let currentVerticalSpeed = SimVar.GetSimVarValue("VERTICAL SPEED", "feet per second") * 60.0; if( (SimVar.GetSimVarValue("SIM ON GROUND", "bool") && altitudeSet > currentAltitude + 100) || (currentVerticalSpeed > 50 && altitudeSet > currentAltitude + 100) || (currentVerticalSpeed < -50 && altitudeSet < currentAltitude - 100) ){ return 'ALT'; } } return ""; }
-
Hm. I diffed our two files, and they were identical. Here are all four functions copied directly from my file. If that doesn't work, then I don't know what to say. I can try sending you my file directly (unfortunately, this forum doesn't support the sharing of arbitrary file types).
getLateralModeActive(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if(SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool")) { return "ROL"; } else if (SimVar.GetSimVarValue("AUTOPILOT HEADING LOCK", "Bool")) { return "HDG"; } else if (SimVar.GetSimVarValue("AUTOPILOT NAV1 LOCK", "Bool")) { if(SimVar.GetSimVarValue('GPS DRIVES NAV1', 'Bool')) return 'GPS'; else return 'NAV'; } else if (SimVar.GetSimVarValue("AUTOPILOT BACKCOURSE HOLD", "Bool")) { return "REV"; } else if (SimVar.GetSimVarValue("AUTOPILOT APPROACH HOLD", "Bool")) { return "APR"; } else if (SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) { return "ROL"; } return ""; } getLateralModeArmed(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if(!SimVar.GetSimVarValue("AUTOPILOT HEADING LOCK", "Bool") && !SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool")) { return ""; } else if (SimVar.GetSimVarValue("AUTOPILOT NAV1 LOCK", "Bool")) { return "NAV"; } else if (SimVar.GetSimVarValue("AUTOPILOT BACKCOURSE HOLD", "Bool")) { return "REV"; } else if (SimVar.GetSimVarValue("AUTOPILOT APPROACH HOLD", "Bool")) { return "APR"; } return ""; } getVerticalModeActive(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if(SimVar.GetSimVarValue("AUTOPILOT PITCH HOLD", "Bool")) { return 'PIT'; } else if (SimVar.GetSimVarValue("AUTOPILOT FLIGHT LEVEL CHANGE", "Bool")) { return 'FLC'; } else if (SimVar.GetSimVarValue("AUTOPILOT VERTICAL HOLD", "Bool")) { return "VS"; } else if (SimVar.GetSimVarValue("AUTOPILOT ALTITUDE LOCK", "Bool")) { return "ALT"; } if (SimVar.GetSimVarValue("AUTOPILOT GLIDESLOPE ACTIVE", "Boolean")) { return "GS"; } return ""; } getVerticalModeArmed(){ if(!SimVar.GetSimVarValue("AUTOPILOT MASTER", "Bool") && (SimVar.GetSimVarValue("AUTOPILOT WING LEVELER", "Bool") || SimVar.GetSimVarValue("AUTOPILOT BANK HOLD", "Bool")) && !SimVar.GetSimVarValue("L:XMLVAR_GPS_DISABLED_AS530_1", "bool")){ return ""; } if(SimVar.GetSimVarValue("AUTOPILOT GLIDESLOPE ARM", "Boolean")) { return "GS"; } // if (SimVar.GetSimVarValue("AUTOPILOT ALTITUDE ARM", "Bool")) { // return "ALT"; // } if(SimVar.GetSimVarValue("AUTOPILOT VERTICAL HOLD", "Bool") || SimVar.GetSimVarValue("AUTOPILOT PITCH HOLD", "Bool") || SimVar.GetSimVarValue("AUTOPILOT FLIGHT LEVEL CHANGE", "Bool")){ let altitudeSet = SimVar.GetSimVarValue("AUTOPILOT ALTITUDE LOCK VAR", "FEET"); let verticalSpeedSet = SimVar.GetSimVarValue("AUTOPILOT VERTICAL HOLD VAR", "FT/MIN"); let currentAltitude = SimVar.GetSimVarValue("INDICATED ALTITUDE:"+this.altimeterIndex, "FEET"); let currentVerticalSpeed = SimVar.GetSimVarValue("VERTICAL SPEED", "feet per second") * 60.0; if( (SimVar.GetSimVarValue("SIM ON GROUND", "bool") && altitudeSet > currentAltitude + 100) || (currentVerticalSpeed > 50 && altitudeSet > currentAltitude + 100) || (currentVerticalSpeed < -50 && altitudeSet < currentAltitude - 100) ){ return 'ALT'; } } return ""; }
-
I changed absolutely nothing, I just started the sim up again and did the exact same thing, and this time it worked. Maybe I broke something by not giving the avionics a bit to spin up (since I loaded in mid air), but without changing a damn thing it's now working great. Panel goes blank when I disengage the AP and it doesn't reengage on me.
I might try reverting the flight director change with the KAP140 changes and see if it ending all AP modes fixes the original problem when I have more time, just for hahas.
Thanks so much for the help, so happy we got it sorted!
I do have something else with the Caravan that could use some looking at with the audio panel, but that's a quality of life thing and doesn't really hamper the experience. I'll write it up as another topic.
-
@Black-Square Just for kicks, I changed the flight_director variable in the systems.cfg back to 0 to see if your KAP140 changes canceling all modes when disengaged also fixed the AP auto-engagement. It does not; it will revert to ROL and PIT anyway and come back on.
Maybe worth discussing with the WT folks to see why that silly-sounding change makes such a difference, but good catch and thanks for coming up with it to try.
-
Thanks for trying that out. I thought about telling you that I fully expected it to go back to misbehaving without that change, but I thought I didn't want to seem like a know-it-all. Thanks again for helping me find that issue. I will certainly be looking through their code more and mention it to them soon. Unfortunately, I think things are still a little backed up over there after the holidays. I'm just glad you have a fully functioning Caravan now! I hope you have some time to enjoy flying it. It's still one of my favorites, though it seems the curse of an aircraft developer is that I only get to enjoy my aircraft when they're broken or unfinished!
-
I will! I haven't flown an airliner for my VA in a few months now; as I said elsewhere I've been flying our winter tour in the TBM, but I might switch a few legs to the Caravan now!
Any idea when you'll push these changes (along with anything else you have up your sleeve) live? Or are the Dukes coming first and then a polish pass on everything else?