Jump to content
The simFlight Network Forums

GFDisplay - Display part of a text string


Recommended Posts

Hi Pete,

I have been working with GFDisplay and have started out with some simple tasks, and to that end I have been successful. Now I am working on turning a GF166 into a DME (using 0C29 and 0C2E). I am able to display the speed and distance, however, there is a trailing space in the speed string and the distance string has a trainling space followed by two digits. I have looked through the documentation, but can find nothing that speaks (or hints at) being able to take effectively the first three characters of each offset.

Could you provide some insight as to how I can accomplish this task please?

Thanks

Phil

Link to comment
Share on other sites

... can find nothing that speaks (or hints at) being able to take effectively the first three characters of each offset.

I'm not sure I understand properly, sorry. Could you give some actual examples of the DME strings and what you actually see on the displays?

It may be that these types of value need special coding in GFdisplay, but I need to kow what you are seeing first. I'm afraid I don't have any GoFlight gear now except for 2 off each P8's and RP48's.

Regards,

Pete

Link to comment
Share on other sites

Sure I can give you an example:

0C29 displays as "25.1 67" - the 25.1 is the actual distance and so I only want to display 25.1 or I guess to be more precise I want to format as NN.N only

0C2E displays as "106 " - and here I want to format as NNN only without the trailing space.

I appreciate your help with this.

Thanks,

Phil

Link to comment
Share on other sites

0C29 displays as "25.1 67" - the 25.1 is the actual distance and so I only want to display 25.1 or I guess to be more precise I want to format as NN.N only

Okay. I assume this is due to the intervening character being a space rather than a zero?

There are two possible ways for me to tackle that -- either (in FSUIPC) ensure that the separator is always zero, or (in GFdisplay) have an extra format selector which says "end on space or zero".

I'll make a note to do one or the other, but I'm afraid it won't be till after Christmas now -- but hopefully I'll be able to fit it in before I go on holiday in January.

I will have to depend on you to test it though, as I have no GF displays here now.

0C2E displays as "106 " - and here I want to format as NNN only without the trailing space.

What does the trailing space look like on the display as opposed to nothing? I'm a little confused there.

Regards,

Pete

Link to comment
Share on other sites

Thanks Pete I am more than happy to test this for you. The trailing space shows up as a blank on the GF166 and moves the numbers indicating the speed or the distance over to the left by one LED (the distance actually moves over 3 LEDS since there is a two digit numeric that follows the space).

As we are on the subject, the next step for me in "building" the DME will be to switch between a display showing speed/distance to station and a display showing speed/time to station. As speed and distance are character strings, it would be difficult to calculate time to station using these numbers (unless I could some how convert them to a numeric). Would it be possible for you to add a "time to station" offset as well?

Thanks again

Phil

Link to comment
Share on other sites

... and a display showing speed/time to station. As speed and distance are character strings, it would be difficult to calculate time to station using these numbers (unless I could some how convert them to a numeric). Would it be possible for you to add a "time to station" offset as well?

Providing a "numeric version of string" type would probably be easy enough (in fact it may actually be the best solution to the previous problem -- then you can display them as numerics, not strings, to your own formatting needs).

But I don't understand how, in the GFDisplay context, you intended to compute time to station from the raw data?

Pete

Link to comment
Share on other sites

I am assuming (and maybe incorrectly) that I can calculate time to station as:

Distance (NM) / GS (Kt/Hr) = Time to Station (in hours) * 60 = minutes to station

If that won't work, then I'm back to my original question of would you be able to provide the time to station in an offset (with the format of MM:SS)?

Thanks,

Phil

Link to comment
Share on other sites

I am assuming (and maybe incorrectly) that I can calculate time to station as:

Distance (NM) / GS (Kt/Hr) = Time to Station (in hours) * 60 = minutes to station

Yes, but I don't think I support such computation in GFdisplay, do I? There are multipliers and divisors, but they are , I think, literal numerics only, aren't they? Not other variables. Maybe I'm forgetting stuff. Please tell me what you are thinking here.

Regards,

Pete

Link to comment
Share on other sites

Initially I was thinking something like:

D0= 0C29 / 0C2E * 60 (assuming I could get them converted to a numeric)

But then I realized this wouldn't quite work since this would only give me the minutes and that a DME time to station is displayed as MM:SS. So then I was going to try and see if I could calculate the minutes and seconds and write the output to an offset (ala FSUIPC). To be honest, I haven't worked with GFDisplay ot FSUIPC for any length of time to know if this could even be done. However, I read in the FSUIPC documentation that certain offsets could be written to and so I figured that it was worth a go. I don't see anything within FSUIPC or GFDisplay that would allow me to convert text to numeric and such and so I never got that far in my testing.

Phil

Link to comment
Share on other sites

Initially I was thinking something like:

D0= 0C29 / 0C2E * 60 (assuming I could get them converted to a numeric)

But then I realized this wouldn't quite work since this would only give me the minutes and that a DME time to station is displayed as MM:SS.

It won't work anyway because multipliers and divisors have to be literal numbers. As stated in the doc here:

*n Multiplier, /n Divisor:

These two allow conversions of the value obtained from the offset by simple multiplication and division. The values ‘n’ must be decimal literals.

Really you are trying to do programming with a little simple utility which is only offering to transfer values from FSUIPC to a display. I can see that GFdisplay's role should be enhanced to provide some more useful formats, like strings as numbers, but deriving new values based upon two or more others is really way beyong its scope.

So then I was going to try and see if I could calculate the minutes and seconds and write the output to an offset (ala FSUIPC).

There agai you are talking as if GFdisplay is some sort of programming system, a compiler. There's no facilities to WRITE values back to FS at all. Its job is only to move values from FS to GF displays.

To do what you want to do would, I think, require FSUIPC to be enhanced with a "time to station" variable. That's the only sensible way. If I'm going to have to do that I may as well leave GFdisplay as it is and instead of having a "string to number" formatting option, just provide three new FSUIPC variables for each VOR -- DME distance, speed and time, all in numeric format (probably 16-bit integers as tenths miles/knots/seconds).

I'll make a note, but this is now not trivial. If I don't do it soon after Christmas remind me in February.

Regards,

Pete

Link to comment
Share on other sites

To do what you want to do would, I think, require FSUIPC to be enhanced with a "time to station" variable. That's the only sensible way. If I'm going to have to do that I may as well leave GFdisplay as it is and instead of having a "string to number" formatting option, just provide three new FSUIPC variables for each VOR -- DME distance, speed and time, all in numeric format (probably 16-bit integers as tenths miles/knots/seconds).

I've done this now. It's in FSUIPC 3.522. Please see the interim versions announcement at the top of the Forum.

Regards,

Pete

Link to comment
Share on other sites

Pete,

I have done some testing with the new offsets and overall they work pretty well. Something that I have noticed, however, is that the time to station does not seem to update unless there is a significant change in ground speed - if GS stays fairly constant, the time to station remains the same and does not update as you get closer to the station (I have verified this against the DME display in the radio stack and I have tested both offsets with the same result). If you pause the MSFS, the ground speed goes to zero and the time to station will update. If you unpause, the time to station will continue to update until ground speed becomes "stable" and then it will continue to display the same time and not update as you get closer to the station.

The distance to station does seem to lag behind the DME display in the radio stack but only by a few seconds and overall I think that "it's close enough for government work". Ground speed seems to be just fine.

One question I have is that I determined that there is enough digits on my GF166 to display ground speed and time to station in a single display. Is it possible to display these two offsets at the same time on the same display (i.e. D0)?

Thanks,

Phil

Link to comment
Share on other sites

... the time to station does not seem to update unless there is a significant change in ground speed - if GS stays fairly constant, the time to station remains the same and does not update as you get closer to the station (I have verified this against the DME display in the radio stack and I have tested both offsets with the same result).

I'll re-check here, but I'm pretty sure that my code is simply dividing one of the values into the other at the same time it stores them. Please check all three values in parallel. The time to station should be changing any time either or both of the others do.

You can log them as they change to the FSUIPC.LOG file using the Monitoring facilities in FSUIPC -- see the Logging tab.

One question I have is that I determined that there is enough digits on my GF166 to display ground speed and time to station in a single display. Is it possible to display these two offsets at the same time on the same display (i.e. D0)?

No. Having two separate values to the same display is way outside of the scope of the program. It is out if the question at this time. Sorry.

Regards,

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.