Caravan Autopilot - won't disarm?
-
@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?
-
I'm glad you're enjoying it! That's probably what it's going to be, yes. I have a lot of smaller changes that I've brought from my newer aircraft into the older ones, but I also want to do a major update for the TBM. Sorry I can't give anything more specific than that. I hope you'll let me know if there is anything else I can help you with in the meantime, though!
-
Just the comm panel and vPilot!
For a wishlist I think the only thing I'd really like is native integration of the WT avionics in your line instead of using the Marketplace mod to point to them. Maybe for the Caravan it won't really make a difference since the KAP140 is so simple, but for example we talked in the Go Around thread about how the GA button doesn't work in the TBM with the 530 since WT changed how it handles all that compared to the old Asobo one. Maybe that's part of your upcoming plans, as I think you mentioned it is integrated into the Dukes.
If flying time were no object, I'd run out and buy the whole Steam Gauge collection right now, but I'm definitely going to go take a much closer look at either the Baron or King Air and grab a Duke when it releases.
-
I'm on it! I've already made the GNS 530 change for all my aircraft on my side. It's literally only adding a couple characters to the panel.cfg. What take a little more effort is integrating the "WTT Mode" modification offered by PMS50 for their GTN 750. I've done that for the Dukes too, but that only matters to dedicated users of the PMS50 ecosystem.
The King Air is certainly its own beast, but the Dukes will be so superior to my other products upon release, I think that buying the bundle with piston and turboprop versions would satisfy me for almost endless hours of flying. I hope you enjoy whichever of my products you choose to fly!
-
I stumbled on this in the main MSFS forums. I've talked with Les before about it in other places, which is where most of my limited knowledge of what the optional WT mod does for planes.
Just in case you find it useful:
https://forums.flightsimulator.com/t/the-kap-140-autopilot-will-not-work-more-than-once-per-flight/625924/14 -
Hello - I am now utterly confused about what changes are needed to make the BS Caravan AP work correctly with the GNS avionics. I had given up on flying it altogether after trying suggested changes to the GNS code. @jmarkows pointed me here which I much appreciate. But I'm unclear which of the many suggested above were confirmed as a solution.
I've seen the original changes to the 530 and 430 files, possible changes to the KAP140 js, and also a change in systems.cfg. As well as keeping or not keeping the WT content manager mods.
@Black-Square can you please provide a single, comprehensive set of instructions in one place for the needed changes to fix the issues? My experience seems to be quite similar to that of @jmarkows .
-
@ultradianguy said in Caravan Autopilot - won't disarm?:
Hello - I am now utterly confused about what changes are needed to make the BS Caravan AP work correctly with the GNS avionics. I had given up on flying it altogether after trying suggested changes to the GNS code. @jmarkows pointed me here which I much appreciate. But I'm unclear which of the many suggested above were confirmed as a solution.
I've seen the original changes to the 530 and 430 files, possible changes to the KAP140 js, and also a change in systems.cfg. As well as keeping or not keeping the WT content manager mods.
@Black-Square can you please provide a single, comprehensive set of instructions in one place for the needed changes to fix the issues? My experience seems to be quite similar to that of @jmarkows .
- You DO need the marketplace mod installed. Without it, the plane calls the original Asobo GNS units and autopilot and things like NAV won't capture and follow
- You DO need to set "flight_director_available" to 1 in the systems.cfg in the Analog Caravan folder
- You do NOT need to make the change to the KAP140.js file; the AP shouldn't display any modes when disconnected, and that code change fixes that, but it's not critical to the fix so you can wait if you don't want to make that change yourself.
- You do NOT need to make changes to the WT530.js and WT430.js to fix the hot swapping issue with the latest WT avionics, but an official fix is likely not coming until SU15 and you run the risk of the AP not working if the state saving doesn't load you into something with the 530/430 already set. I DO recommend you make this fix.
They're not complicated fixes and all that's required is some copy and pasting. You should make a copy of the original file before making the changes, that way you can easily go back if you don't do it right.
-
Thanks - not worried about making the edits - no big deal - just wasn't clear on which were determined to be helpful.
The way people are discussing this is a bit confusing - as saying that the WT avionics are now incorporated into the core sim implies (to me) that no addin is needed in Content Manager. (In my mind, anything I see in Content Manager is not Core - but maybe that's just mistaken).
Anyway, regarding bullet 1 above - there are two GNS files listed in CM - a bigger one with no thumbnail and a smaller one with a thumbnail. I'm understanding the most recent replies to mean BOTH should be loaded.
Confirm?
(And thank you) -
@ultradianguy said in Caravan Autopilot - won't disarm?:
Thanks - not worried about making the edits - no big deal - just wasn't clear on which were determined to be helpful.
The way people are discussing this is a bit confusing - as saying that the WT avionics are now incorporated into the core sim implies (to me) that no addin is needed in Content Manager. (In my mind, anything I see in Content Manager is not Core - but maybe that's just mistaken).
Anyway, regarding bullet 1 above - there are two GNS files listed in CM - a bigger one with no thumbnail and a smaller one with a thumbnail. I'm understanding the most recent replies to mean BOTH should be loaded.
Confirm?
(And thank you)Confirmed, yes. The one without the thumbnail is the core avionics and to my knowledge actually can't be uninstalled. The one with the color thumbnail is the pointer, which can be removed, but you want it installed.
Just to give you a warning to something that tripped me up making the KAP140 edits, Black Square gives four lines that the provided code snipped needs to go after: those are functions and that should be the first line in each function. My first attempt, I misread it as putting it after the block of four functions, and that bricked my avionics. The rest are super simple.