• 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.

Anyone having problems looking up MODULE_VARs?

Messages
26
Country
germany
No. Not at all. Everything works just as expected. What exactly is happening (or not happening) in your gauges?
 
Messages
135
Country
us-kentucky
No. Not at all. Everything works just as expected. What exactly is happening (or not happening) in your gauges?

Well, the variables (mine, not FS's) are not getting initialized apparently as there is just garbage in them instead of the com freq's. I use the same code in both FS9, and FS X:

wstring RadioPage::GetCom1Active()
{
lookup_var(&m_com_frequency);
lookup_var(&m_com_radio_25_khz_tunable);

UINT32 bcd = m_com_frequency.var_value.d;

m_Com1Freq[0] = '1';
m_Com1Freq[1] = ((bcd >> 12) & 0xF) + 0x30;
m_Com1Freq[2] = ((bcd >> 8) & 0xF) + 0x30;
m_Com1Freq[3] = '.';
m_Com1Freq[4] = ((bcd >> 4) & 0xF) + 0x30;
m_Com1Freq[5] = ((bcd) & 0xF) + 0x30;
if(m_Com1Freq[5] == '2' || m_Com1Freq[5] == '7')
{
m_Com1Freq[6] = '5';
m_Com1Freq[7] = '\0'; // NULL Terminator
}
else
{
m_Com1Freq[6] = '\0'; // NULL Terminator
}
m_Com1Freq[7] = '\0'; // NULL Terminator

return m_Com1Freq;
}

So, I'm baffled as to why they don't make it into the vars in FSX. In FS9, they show up as planned, in FS X there is just random stuff put on the screen instead of the freq's.
 

ddawson

Resource contributor
Messages
862
Country
canada
UINT32 bcd = m_com_frequency.var_value.d;

Patrick,

Try:
UINT32 bcd = (UINT32)m_com_frequency.var_value.n;

I think you will find that all numeric values are returned as floats, even the ones that would be more appropriate in another format.

Doug
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
UINT32 bcd = m_com_frequency.var_value.d;

Patrick,

Try:
UINT32 bcd = (UINT32)m_com_frequency.var_value.n;

I think you will find that all numeric values are returned as floats, even the ones that would be more appropriate in another format.

Doug

Odd, that... This routine still seems to work fine in FSX, considering that I'm still reading the .d member:

double COM2freq=0;
WCHAR com2freq_wch[8] = L"";

sprintf(charWork, "1%02x.%02x", COM2_bcd.var_value.d/256, COM2_bcd.var_value.d % 256);
COM2freq = atof(charWork);
swprintf(com2freq_wch, L"%3.3f", COM2freq);

Note also the rather neat way to obtain the decimal display of the freq without having to use any BCD2DEC conversion... ;)
 
Messages
135
Country
us-kentucky
Bill,

Would you try a test compile using my .h??? Let me know if it works? I'll email it to you.

Patrick
 
Messages
135
Country
us-kentucky
This is all fixed for me thanks to help from Doug. Turned out it was just my not getting the number of bytes returned in my printf's right, or the length of my WCHAR[]'s.

Thanks Doug.
 
Top