• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

PT KLN90B Thread

Messages
158
Country
us-northcarolina
Back in March of 2014 Project Tupolev placed the source code for their KLN90B in the public domain, which was a great gift to the community, and I'm sure they were hoping someone would pick up the sword and finish it. It's a bit buggy.

Since I love the KLN90B so much that I once contemplated doing the gauge myself, I guess that would be me! Too bad I only discovered this now, instead of months ago, but it is what it is.

I posted on SOH in response to their announcement of the Tu-154B version 1.3 that I was working on the gauge, and responders asked me to start a thread here so we can discuss it. This is that thread.

Task list in order of priority:

1. Move the text up so the last line doesn't get chopped off.
2. Make the AP heading actually work by fixing the wrong calculation of DTK.
3. Clean up some of the screen artifacts that get stuck on the divider lines.
4. Allow loading of the MSFS flight plan from inside the gauge rather than from the add-on menu.
5. Use the FSX NAV/GPS switch/signal to decide whether to drive the AP heading from the KLN90B.
6. Add the ILS frequencies to the airport page 4 list.
7. Implement the ALT button.
8. Get a clearer, cleaner background image of the KLN90B.

Status:

Numbers 1, 2, and 3 are done!

On number 4, my current idea is to follow what the Islander KLN90B does, when "MSFS" is the only waypoint in the plan and you "use" it, it will copy the currently loaded simulator plan in place of the "MSFS" one. We will default FPL1 to the "MSFS" one to make it easy to copy it in and use it.

On number 5, I don't plan to take the current menu items away, but I don't want the pilot to have to use the FSX menu to do any functions. For me that breaks immersion a bit. The functionality will be that if the pilot has the nav/gps switch to gps, but the AP selected to HDG, the KLN90B will drive the heading. Otherwise it will leave well enough alone.

Number 6 will be difficult since those frequencies are not in the nav database! But some are in FSX...we will see. I want this.

The current working version (BETA!) is downloadable here: http://fscaptain.net/downloads/kln90b.dll

Dutch
 
Last edited:
This topic is actually better off in the showroom because you already have something to show and download and because visitors are more inclined to look there. ;)

Great work nonetheless. I like when people pick up something that would otherwise end up incomplete and abandoned.
 
Hi again Dutch.

Well I made a little test and I suffer an old bug. Because you didn't said nothing about it I thought that it was solved in your compilation.

It is kown as the Half screen bug. In this thread in PT forums (at the end of the1st page).


n_zpsa28b8cad.jpg


As you can read in the thread linked, the annoying bug is solved when we set the windows (the SO) location to Russia. It's not only the screen, also the font as you can see.

Thanks for your work.
 
I have not seen that. Do you know of any steps to reproduce it?

I did look at the thread and the only thing that occurs to me is a font problem. It uses a font named "glass gauge" but that is not it above. That's a serif font. Interestingly, "Lucida Console" (a font every Windows system has) is commented out in the code.

I haven't changed my Windows location. This could be OS dependent. Do you use Windows 7?
 
Nopes. I don't know how reproduce it. I suffer this bug since the first beta was released. And as you can see...It's not the only case. Maybe with US and RUssian locations works well and others (me: Spain) not....We will do some questions in the forums...

About the font, I paste the font Glass Gauge in Windows/Font and in FSX/Fonts and still without changes. I suspected that maybe the screen bug is done by the font issue....But I am not a programmer.

I use W7 64bits. FSXA

P.S...Well maybe... Set the system locale to other country....maybe you can see the bug.
 
Last edited:
I know it's not a real "fix" for the half-sized vertical, but you can compensate for that in the panel.cfg entry:
window_size=00.ww, 00.hh

-or-

size_mm=www, hhh
and
gauge00=some!gauge, x,y,ww,hh
 
#6 on your list, the ILS frequencies, requires the GPS WaypointAirport methods and a bunch of comparing and copying of string values. I've done this before - I'll put something together for you.

Doug
 
There's some kind of font issue. In your screenshot of the gauge, that's not the 'glass gauge' font. Which for me is in FSX/Fonts and it must be distributed with at last some FSX pure installs, because I took a look at my purely virgin Steam install I use for compatibility testing, and it's there. I haven't made a single mod or tweak to the Steam version.

Look in FSX/Fonts and see if you see glassga.ttf. When I browse my Windows fonts I also see 'glass gauge regular'.

Of course the gauge calculates the font height and width based on the size of the screen area it has to work with. Funny/unepected numbers coming from there could definitely wreak havoc. But I can't really see what's happening unless I can reproduce the problem.
 
Last edited:
Thank so much Doug! :D The deep dark secrets of the FS environment never cease to amaze me.
 
I can't resist mentioning the DTK bug because it took a day and an half of hard tracking to find it. The numbers it gave me for DTK were absurd - fly a heading of 2147 to the next waypoint! It truncated that to 214 for the AP and flew that heading. The real heading was 135. (This was also the cause of a lot of the screen artifacts - numbers left over that were pushed outside their boundaries.)

The problem turned out to be this code in get_magdec():

int m=(Lat-(DWORD)(Lat))*10;
int n=(Lon-(DWORD)(Lon))*10;
double K = m*((K3-K2)/10.0f) + K1 + n*((K3-K1)/10.0f);

It was returning insane magnetic variation numbers whenever the lat or long was a negative number. As long as you flew in a part of the world where decimal lat and long were both positive you never saw this. The solution was simple:

int m=(Lat-(int)(Lat))*10;
int n=(Lon-(int)(Lon))*10;

Dutch
 
glassgla.ttf in FSX/fonts exist...but is 'glass gauge normal'. Maybe a confusion in the code between "normal" and "regular"?

Resize the panel didn't work.

I hope that in the following days we can have more feeadback from other users.
 
Last edited:
I was able to reproduce this and I think I have it fixed. It's fixed for me, anyway. In order to do that I had to use Lucida Console. And the font setup specified "RUSSIAN_CHARSET". I replaced that with ANSI_CHARSET, since the KLN90B is purely standard English. (I think that's why the windows locale fixed it for some people.)

Download the new version and see if it works for you. You should not be getting those crazy fonts anymore - the two screenshots you posted look like Courier New in the first one, and Terminal in the second. Which besides Lucida are the only two fixed fonts that come with Windows standard. So, it may be saying: They are insisting on a Russian fixed-font charset. The only ones I can find are Courier New and Terminal. I will substitute one of those. But why is it still readable in English? Not sure. Maybe because the character codes are all for Roman not Cyrillic characters? I don't understand Fonts all that well.

But hopefully the half-page problem is gone. And the font is consistently Lucida Console. (Lucida does not fail. We have many people using FSCaptain around the world and it uses Lucida and we have not had a single font problem ever for five years.)

Later I may make the font configurable in klb90b.cnf.

You will note there's a revision number (this one is 0.71B) and a date on the self-test page now!

Dutch

Oh yes, my personal favorite font and the one I've found that looks closest to the screen font of the real KLN is "Terminus", which is free for non-commercial use: http://terminus-font.sourceforge.net/
 
Last edited:
It works good over here. I was scared I might have gotten the half screen issue as you changed the font to another one and I'm still required to use Russian locale due to number of programs related to my work and well... certain Russian simulators and addons do not work well if you modify a Russian computer to another language or locale. Still I believe it might be better to leave the locale as Russian, because there might be unforseen problems with incompability later seeing how unstable the KLN90B really is with the Tu-154 often causing crashes for little to no reason.

P.S, Is there any plans to remove the SID/STARs feature from the KLN? They do not work well, airplane skips their waypoints, and often they're jut buggy and completely misplaced or broken causing you to get lost easily. I do not believe the real GPS is capable of these terminal procedures and in fact when you mess with the KLN90B SID or STAR such as altering or deleting them, or adding, is where 90% of CTDs come from.
 
It works! Thanks Dutch.
I am moving to test more deeply the KLN.

I hope that this strange font bug is solved forever :D
Terminus looks nice. You saw the font awxkln90b.ttf? It was used in the FS9 version of the KLN.

8War6XW.jpg


Screen added.
 
Last edited:
I'm glad it's working. The problem seems to be 'glass gauge' if I switch back to that font the half-screen problem returns. I would like to use Terminus or the awxkln90.ttf in the future, Lucida just doesn't reproduce that KLN90 "look". I will make the font switchable in the cnf file so users can choose if they want. Make Lucida the default since that's safest.

My next task is to to get the vector issues fixed so I can use the debugger. After that, I'll straighten out the AP nav issues. Right now it doesn't seem to drive the heading very intelligently. It seems fixated on the DTK regardless of your position. It needs to consider how to get back on track and stay there. As it flies from waypoint to waypoint it's drifting further and further from the course and eventually it will miss one altogether. I think that's likely why it's getting lost following a SID/STAR.

On the crash issues. I can't even debug the thing because of constant 'vector iterator not derefenceable' debug assertions. These go away when it's compiled for release but the problem remains -- it just gets ignored. Also, there were many level 1 warnings on the compile...things like 'not all paths return a value' and even 'use of uninitialized variable.' I cleaned all that up and we get no more level 1 warnings. That alone may have solved some crash issues (an uninitialized var will crash you). Once the vector iterator problem is solved (maybe today, I am getting good advice in the thread here) another potential crash area will be resolved.

We will have SIDs and STARs working. Approaches too.

I am determined to make this a 100% accurate, faithful and reliable KLN90B. Okay, maybe 98% but no less than that. Already I have made some small changes for accuracy. Before it's released as 1.00 I will go through the manual page by page and be sure every letter and number is in the right place and every procedure works exactly as documented in the pilot's guide.

It will take time but we'll get there. I have a "day job" with FSCaptain and that has to take priority of my time.

Dutch

Oh, to answer a question about the Russian nav: there is a section titled: "For communication with ABSU". However it uses the same 'calc_ap_navigation()' function so it's probably not optimal yet, as I documented above.
 
Last edited:
KLN90B Progress Report, change log as of tonight:

// 150113 CEO 0.071B Added VERT_ADJ and HORZ_ADJ to adjust position of text window (solved bottom line chop)
// 150115 CEO 0.071B Fixed DWORD bug in get_magdec(), DTK is now right for negative lat/long
// 150115 CEO 0.071B Changed RUSSIAN to ANSI CHARSET creating font, and standardized on Lucida Console
// 150115 CEO 0.072B Cleaned up all level 1 compiler warnings - several uninitialized vars!
// 150115 CEO 0.072B Made VOR display always "FR" (from) in NAV2 page.
// 150116 CEO 0.072B KLN will control heading when AP is active, set on HDG, and NAV/GPS switch is GPS.
// 150116 CEO 0.072B The config file is now named KLN90B.CNF in the KLN90B folder in the FSX root where the navdata is.
// 150116 CEO 0.072B New option FONT=0|1 where 0 is the default Lucida Console and 1 is Terminus. Others may be added.
// 150116 CEO 0.072B Pressing ENT when on FPL 0 and not in CRSR mode will load the MSFS flight plan into FPL 0
// 150116 CEO 0.072B AP nav calculation will track to next WP until that course is within 5 degrees of DTK.

In particular the KLN should be more stable, and now it should do a much better job of staying on course. There's much more work to do in this area, this is just a quick fix because the current calculation is totally broken. It goes to a great deal of trouble to calculate wind drift and applies that to the DTK (desired track) but it always flies this calculated heading regardless of where you are! It will not fly an intercept if you are not already on course. Or it wouldn't. It will now. It's aware of the heading it needs to fly to get to the next waypoint and if the DTK is within five degrees of that course it will fly the DTK. Otherwise, it flies the course to intercept the next WP. Ideally, it should fly an intercept angle to get back on the DTK. But that must come later. Right now it's much better than it was. It should not be losing its way while flying the course from WP to WP.

These AP nav fixes apply only to the default autopilot right now. We will retrofit them to the Russian ones when it works on the default. I can only test the default.

Note than now the KLN90B menu is never required. You can make the KLN drive the heading by flipping the NAV/GPS switch to GPS while the AP is in heading mode and is active. You can trigger the loading of the MSFS flight plan by putting the left side on FPL0, have CRSR mode off, and press ENT. The current simulator FP will load into FPL0. The old add-on menu is still there and will still work.

Much more to be done. But this is an improvement already. Download from the same location.

Dutch

------------------------------------------------------------------------------------
A quick little doc on the config file. It is now named KLN90B.CNF and it's in the KLn90B folder that's in FS root - the one where the navdata lives. (Previously it was named PT_KLN90B and lived in the FS root folder.) If you don't have one all defaults are applied.
This is updated for 0.074B.

[INTERFACE]
KOHLSMAN=1 <- The KLN will read the altimeter setting for you. Init page starts with 'APPROVE?' Use 0 for the baro set method.
[KLN90B]
FONT=0 <- new FONT statement 0=Lucida Console 1=Terminus
EXTINTDB=1 <- use airac 'isect.txt' as the waypoint DB. 0=use MSFS.
TC=nnnnn <- written by KLN to store user setting for text color.
TB=nnnnn <- written by KLN to store user setting for text background.

0 is the font default, if you switch to 1 you need to have Terminus installed.
This is all there is right now, I'll update this as more options appear (they will!)
 
Last edited:
Hello Dutch,
Wonderful to see you tackling the KLN in this way - looking forward to further development.
By the way I notice that there already is a Terminus font in my Windows 7 as well as in my FSX font folders. Is this the same as the one you are referring to above?
 
Last edited:
Yes that's the one Rick. It's an old-style green screen font that's much closer to the original look of the KLN than Lucida Console. The one in use before, "glass gauge" triggered some kind of locale-related bug so I ditched it.
 
The KLN works without bugs, however doesn't couple anymore to the autopilot of the Tu-154B-2 unfortunately. I don't claim to know a lot about coding but it would be wise to leave the lines connecting KLN to the AP of Tu-154 intact so it wouldn't cause any issues later on. Unless there is some other reason... Read there is plans to retrofit, but this autopilot is really a hard to work with as it's only known to couple with the original KLN and reality xp GPS. Reality XP drives the AP really lousy which is why KLN is preferred to most users.
 
Back
Top