Everything posted by jspan_com
-
C++ Airspeed bug mouse function
Hi all,C++ Airspeed Indicator and Airspeed Bug Mouse problem:The Airspeed Bug needle and mouse function is working, the problem is that I have not been able to limit the values controlled by the mouse, which despite all efforts still varies between 0 to 990 knots. Relevant code://-- (main .c file) -->MODULE_VAR airspeed_bug = {AUTOPILOT_AIRSPEED_HOLD_VAR};//-- (asi.c file -->MOUSE_FUNCTION asi_speed_up_set; //airspeed bug setMOUSE_FUNCTION asi_speed_down_set; //airspeed bug setMOUSE_BEGIN( asi_mouse_rect, 0, 0, 0 ) MOUSE_CHILD_FUNCT( 283, 24, 30, 30, CURSOR_UPARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_up ) MOUSE_CHILD_FUNCT( 250, 24, 30, 30, CURSOR_DOWNARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_down ) MOUSE_CHILD_FUNCT( 31, 24, 30, 30, CURSOR_HAND, MOUSE_LEFTSINGLE, asi_bug_set ) MOUSE_CHILD_FUNCT( 283, 260, 30, 40, CURSOR_UPARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_up_set ) MOUSE_CHILD_FUNCT( 247, 260, 30, 40, CURSOR_DOWNARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_down_set ) MOUSE_END// Maximum/minimum airspeed bug to be registered#define GAUGE_MAX_AIRSPEED_BUG 250#define GAUGE_MIN_AIRSPEED_BUG 60UINT32 airspeed = 0; //Reset airspeed bug set---// MOUSE Airspeed Bug UP SetBOOL FSAPI asi_speed_up_set( PPIXPOINT relative_point, FLAGS32 mouse_flags ){ lookup_var(&airspeed_bug); airspeed = (int)((double)airspeed_bug.var_value.n); if (airspeed < 60) airspeed = 60; trigger_key_event (KEY_AP_SPD_VAR_INC,1); return FALSE;}// MOUSE Airspeed Bug DOWN SetBOOL FSAPI asi_speed_down_set( PPIXPOINT relative_point, FLAGS32 mouse_flags ){ lookup_var(&airspeed_bug); airspeed = (int)((double)airspeed_bug.var_value.n); if (airspeed > 250) airspeed = 250; trigger_key_event (KEY_AP_SPD_VAR_DEC,1); return FALSE;}// Airspeed bug needle dayFLOAT64 FSAPI asi_speedbug_src_cb_day (PELEMENT_NEEDLE pelement){ lookup_var(&airspeed_bug); airspeed = (int)((double)airspeed_bug.var_value.n); if ( airspeed > GAUGE_MAX_AIRSPEED_BUG ) airspeed = GAUGE_MAX_AIRSPEED_BUG; if ( airspeed < GAUGE_MIN_AIRSPEED_BUG ) airspeed = GAUGE_MIN_AIRSPEED_BUG; if ( airspeed > 250 ) airspeed = 250; else if ( airspeed < 60 ) airspeed = 60; return airspeed;}//-- end -->The airspeed bug needle works fine, but mouse values is starting from 0 up to 990 knots as monitored by the FSlook program. Help on this one is appreciated!Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
ATT: Kd527Okay, please send me an e-mail, so I can send a mail directly to you. You can use the email link in the Webmaster box (down left) on my homepage.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
Hi, Yes sure, it's not easy to get in there :). Email sent.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
Hi, no problem :). The sd2gau17.zip by Dai Griffiths can be downloaded from www.flightsim.com, file size 3256 KB.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
ATT: Kd527In Dai Griffiths' latest Gauge Tutorial (rev. 17) - sd2gau17.zip you can find complete source code for Panel Switches with sound.Regarding the forum problems, check out "Help for the AVSIM Forums" above, it might be problems related to cookie or security settings in your Internet Browser.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
ATT: ryanloganThe code used here is compiled and built using the FS2002 SDK. The gauge can also be used in FS2004. The code was earlier setup with the MSFSSound routines by Daniel Steiner, refer to the "FS2000 and CFS Gauge Creation" document by Dai Griffiths. I have also tested this code with FS2004 Gauges.h and it seem to work, but not tested extensively.When converting the code to use the "TGaugePlaySound" concept I could remove the links to fssound_msvc.lib and dsound.lib in Visual C ++ 6.0 Object/Library (modules). By doing this you will be able to compile & build gauges with sound(s) which not are dependant of FSSound.h and FSSound.dll (which has to be resident in FS2XXmodules).Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
Hi Bill,Thank you for the tip, I will check that out ASAP. I have BTW reworked the code by using the Token Var {RADIO_HEIGHT}. I will draw a new Flow Diagram and try to figure out all the pointers, there are still quite a few :). It's easy to get a broken link here and there! I will come back to you later with the result of this.Another thing which might make things more complicated: This FS2002 gauge has still subgauges using FSSound.dll. I will therefore rework all sub's to use the TGaugePlaySound concept. Otherwise I am using Visual C ++ 6.0 STD (SP5) and the FS2K2Gauges.h (243 KB) with the timestamp 11JULY 2002 13:02.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
Hi Arne,Certainly I read your post, I even save your postings here. Regarding the latest advices from you, I did follow it up, but got some errors messages. I have now sorted those problems out and have added the lines you suggested and will work further on the code.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
C++ Callout Gauge problem
Hi Arne and Bill.Thanks again for your help! Well, for me it's not so simple! Unfortunately the sound loop is still there. Here's what I have done so far:Global UINT's and Vars (in the main c file)://--->UINT32 Plane = 0;UINT32 Ground = 0;UINT32 Alt = 0;UINT32 AltCheck = 0;UINT32 Down = 0;UINT32 Gearup = 0;UINT32 gearwarn = 0;UINT32 gearflag = 0;MODULE_VAR landed = {AIRCRAFT_ON_GROUND};MODULE_VAR gearpos = {GEAR_POS_LEFT}; //0 = up, 16K = dn MODULE_VAR PHeight = {PLANE_ALTITUDE};MODULE_VAR GHeight = {GROUND_ALTITUDE};/-->The gear warning callback in the Callout.c:FLOAT64 FSAPI gear_cb(PELEMENT_ICON pelement) { FLOAT64 gearwarn=pelement->source_var.var_value.n;lookup_var(&gearpos );lookup_var(&PHeight );lookup_var(&GHeight );lookup_var(&landed );Down = (int)((double)landed.var_value.n);Plane = (int)((double)PHeight.var_value.n);Ground = (int)((double)GHeight.var_value.n);Ground = Ground/256;Gearup = (int)((double)gearpos.var_value.n);Alt = Plane - Ground;Alt = (int)((double)Alt * 3.28083989501312);if (Alt < 500) AltCheck = 1 ; //Check that aircraft is below 500 feetif (Down = 1) AltCheck = 0; //If aircraft has landed then reset the altitude checkgearwarn = (float)Gearup ; if ( gearwarn > 1 ) { Gearup = 0 ; } if ( gearwarn < 0 ) { Gearup = 1 ; } if ( Gearup == 0 ) { gearflag = 1 ; }if ( Gearup == 1 && gearflag == 1 ) { gearflag = 0 ; }if ( Gearup == 0 && Alt < 500 && gearflag)gearflag = 0 ;GaugePlaySound("soundJSATRJSATR_gear.wav","",0);return Gearup; }//--->The TGaugePlaySound is set up with the sound declaration and in the Main Gauge Callback and should work. There are no error or warning messages during compilation or build.Best regardsJan H. Sorensen
-
C++ Callout Gauge problem
Thank you both for the replies, I will test these options. This gauge is setup using the MSFSSound routines by Daniel Steiner, and I have tried to setup the callback functions in PANEL_SERVICE_PRE_UPDATE. Now, the sound is playing when the condition are met, but still looping. But I will investigate this one further.The FLOAT64 FSAPI callback is absolutely interesting! I noticed this line:--->if ( test_rotary == 1 && test1 == 1 ) { test1 = 0 ; (GaugePlaySound)("soundESDGitt_warn.wav","",0) ; }--->The statement (GaugePlaySound) will be tested, but I guess that means that I have to leave the MSFSSound concept?Best regardsJan H. Sorensen
-
C++ Callout Gauge problem
Hi All,I am working on a C++ callout (sound) gauge. This gauge does not use mouse clicks, but is only intended to play sounds at specific events. The code used here is modified from another gauge using mouse clicks and that's perhaps the problem? The sound does come up, but plays in an endless loop!Here are extracts from the code://--->// --------------------------------------------------------------------------// icons set to OFF or zero value// --------------------------------------------------------------------------UINT32 gearup = 0;// --------------------------------------------------------------------------// callbacks for the icons// --------------------------------------------------------------------------FLOAT64 FSAPI gear_cb(PELEMENT_ICON);// --------------------------------------------------------------------------// main gauge callback// --------------------------------------------------------------------------void FSAPI callout_cb(PGAUGEHDR, int, UINT32);// --------------------------------------------------------------------------// local variables// --------------------------------------------------------------------------char callout_gauge_name[] = GAUGE_NAME;extern PELEMENT_HEADER callout_list;extern MOUSERECT callout_mouse_rect[];// --------------------------------------------------------------------------// this variable will hold the actual width of the gauge; //needed in some mouse callbacks// --------------------------------------------------------------------------double width;// --------------------------------------------------------------------------// variables/definitions for the sound buffers:// sound files in FS Sound folder// --------------------------------------------------------------------------MFSSoundFileVars(gear_sound, "SOUNDJSATR_gear.WAV");// --------------------------------------------------------------------------// MODULE IMPORT AND EXPORT DEFINITIONS// --------------------------------------------------------------------------GAUGE_HEADER_FS700(GAUGE_W, callout_gauge_name, &callout_list, callout_mouse_rect, callout_cb, 0, 0, 0 );// --------------------------------------------------------------------------// DRAWING ELEMENTS DEFINITIONS// --------------------------------------------------------------------------MAKE_ICON( gear, CALLOUT, NULL, NULL, IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | IMAGE_HIDDEN, 0, 0, 0, MODULE_VAR_NONE, gear_cb, ICON_SWITCH_TYPE_SET_CUR_ICON, 1, 0, 0)// --------------------------------------------------------------------------// link the drawing elements to the background// --------------------------------------------------------------------------PELEMENT_HEADER callout_plist1[] = { &gear.header, NULL};MAKE_STATIC( callout_background, CALLOUT_BACKGROUND, &callout_plist1, NULL, IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE |IMAGE_HIDDEN, 0, 0,0)PELEMENT_HEADER callout_list = &callout_background.header;// --------------------------------------------------------------------------// RESET VARS TO ZERO - MODULE Vars// --------------------------------------------------------------------------UINT32 Plane = 0;UINT32 Ground = 0;UINT32 Alt = 0; //Radio AltitudeUINT32 AltCheck = 0;UINT32 Down = 0;UINT32 Gearup = 0;MODULE_VAR landed = {AIRCRAFT_ON_GROUND};MODULE_VAR gearpos = {GEAR_POS_LEFT}; MODULE_VAR PHeight = {RADIO_HEIGHT};MODULE_VAR GHeight = {GROUND_ALTITUDE};// --------------------------------------------------------------------------// DRAWING ELEMENT CALLBACKS// --------------------------------------------------------------------------// icon callbacksFLOAT64 FSAPI gear_cb(PELEMENT_ICON pelement) { FLOAT64 val=pelement->source_var.var_value.n; lookup_var(&gearpos ); lookup_var(&PHeight ); lookup_var(&GHeight ); lookup_var(&landed ); Down = (int)((double)landed.var_value.n); Plane = (int)((double)PHeight.var_value.n); Ground = (int)((double)GHeight.var_value.n); Ground = Ground/256; Gearup = (int)((double)gearpos.var_value.n); Alt = Plane - Ground; Alt = (int)((double)Alt * 3.28083989501312);//Check that aircraft is below 400 feet if (Alt < 400) { AltCheck = 1; }//If aircraft has landed then reset the altitude check if (Down == 1) { AltCheck = 0; }// Play altitude callout if (Gearup == 0 ) { Gearup = 1 ; } else { Gearup = 0 ; } MFSSoundFilePlay(gear_sound, FALSE); return FALSE;}// --------------------------------------------------------------------------// MAIN GAUGE CALLBACK// --------------------------------------------------------------------------void FSAPI callout_cb(PGAUGEHDR pgauge, int service_id, UINT32 extra_data) { switch(service_id) { case PANEL_SERVICE_POST_INSTALL: // sounds need to be registered before they can be played MFSSoundFileRegister(gear_sound); break; case PANEL_SERVICE_PRE_INITIALIZE: // save the actual with of the gauge width = ((PELEMENT_STATIC_IMAGE)pgauge->elements_list[0]) ->image_data.final->dim.x; break; case PANEL_SERVICE_PRE_UPDATE: /* "pre_update_routine()"*/ break; case PANEL_SERVICE_PRE_DRAW: /* "draw_routine()"*/ break; case PANEL_SERVICE_PRE_KILL: // never forget to unregister the sounds MFSSoundUnregister(gear_sound); break; }}// --------------------------------------------------------------------------// MOUSE SPECIFIC DEFINITIONS// --------------------------------------------------------------------------MOUSE_BEGIN(callout_mouse_rect, HELP_NONE, 0, 0)MOUSE_END// --------------------------------------------------------------------------// CLEAN UP// --------------------------------------------------------------------------#undef GAUGE_NAME#undef GAUGEHDR_VAR_NAME#undef GAUGE_W//--->I would indeed appreciate help on this one!Best regardsJan H. Sorensen
-
FS2002 Heading/Track Mismatch
On several occasions I have experienced that the aircraft heading and track suddenly goes offset by a large number of degrees. This seem to be happening on the Northern Hemisphere (I haven't checked on the Southern Hemisphere yet). Yesterday at the fix MAMED (N38 34.80 E057 42.00) we where two pilots flying online with the PSS B747 and we both came into the same trouble at this position, which made the FMC's unserviceable. The other pilot got an compass error of about plus 45 degress, and I got an error of about plus 115 degrees.Later I have checked on WSSS Singapore (our destination) offline and also with default aircraft and the same error occurs. We have both installed FSNavigator (latest version), and the navigation data there seem to be correct. We would appreciate help on this problem :-).Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
FS9 Texture Problems
ATT: NicolasHi and thank you very much :-). That was the solution! I did a new installation and this time the colors of the ground textures look fine!Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
FS9 Texture Problems
ATT: BigshotThanks, I have reset FS9 to default and also deleted FS9.cfg, and then tried the KSEA Seattle Tacoma "default" flight, but the red ground textures are still there :-(. Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
FS9 Texture Problems
ATT: W. SieffertThank you for the reply :-). I have tried all options as described in your post, the latest VIA Chipset driver is installed (v4.51) as well as the latest 56.64 Nvidia driver. In the Graphics card advanced option I have tried both with or without Application-controlled settings for AA and AF, but the problem is still there. Also the latest DirectX 9.0b version is installed. One slight problem when running dxdiag: The diagnosis program is not able to access the latest information on the usage of DirectX. I am using WinXP Pro English SP2 v.2082.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
FS9 Texture Problems
I have just reinstalled FS9 and unfortunately the colors on airports in particular displays a red and erroneous color, check out the following images:1. ENHD Haugesund Karmoy Norway (Norway Airports V9)http://www.jspanels.com/images/FS9_REDTEX_ENHD.jpg2. KCGX Chicago Meigs default FS9http://www.jspanels.com/images/FS9_REDTEX_KCGX.jpgOnly the default textures are used in the FS9Textures and FS9SceneryWorldTextures folders. I would indeed appreciate help on this one!System: MB MSI KT3 Ultra2CPU AMD Athlon XP 2200+Graphics Adapter MSI GF4 Ti4200-TDBest regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
XML Ammeter
Jan :-)Thanks again for your help! Unfortunately the variable "(A:Electrical Battery Load,amps)" did not show any noticeable needle movement when testing miscellaneous switches.Howevever, when testing this code with the "(A:ELECTRICAL BATTERY BUS VOLTAGE,volts)" variable, the needle came on the move :-). I guess I just might use this variable as a "fake" solution and adjust the scale as appropriate for the correct deflection (aprx. 40 amps) when switching on the battery.Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
XML Ammeter
>In my Cessna 421B xml voltammeter, I use these:>(A:ELECTRICAL BATTERY BUS VOLTAGE,volts) 4.166667 * for>battery voltage, multitplied to use the other visual scale>correctly.>>(A:ELECTRICAL BATTERY LOAD,amps) for the load on the battery,>i.e. when alternarots are offline, and>>(A:Electrical genalt1 bus amps,amps) to show the load on>alternator1.>>Additionally, you can hook up RPM effects to get a shaky>needle, or even add your own parts of the electrical system>(special equipment etc) that isn't by default supported.Hi Karl,I have read most of the topics related to the MSFS Electrical system, which seemingly is rather buggy :-(. I have really worked hard to solve the ATR42 DC Ampere gauge, which is integrated in the Overhead panel. So far no luck whatsoever. Here's a screenshot of the DCAmp gauge with the stuck needle:http://www.jspanels.com/images/atr423_dcamp.jpgThe XML code for this element (the comments are values stated in the Aircraft.cfg file): (A:GENERAL ENG1 MASTER ALTERNATOR,bool) if{ (A:Electrical genalt1 bus amps,amps) } els{ (A:Electrical genalt1 bus amps,amps) (A:Electrical genalt1 bus amps,amps) } 4*The statement is copied from another post on this tread. Does anyone have a solution to this issue?Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com
-
EPR Formula
@ Ian,Thank you for the JT8D SS EPR data, which will be useful for future Jet Aircraft projects :-). As said before on this tread, the ATR42 engines does not use EPR, but rather NH, NL and NP data.Best regardsJan H. Sorensenwww.jspanels.com
-
EPR Formula
>Looks like Jean-Luc didn't sleep too well last night... >>@Jan: sorry that I didn't answer earlier. I just didn't look>into this forum. Anyway Douglas said everything that has to be>said about the NH/NL indications. Another way to solve this>would be to use the normal N2 variable and correct it by using>a non-linearity table. My knowledge about the XML stuff is>pretty small, but if nl-tables work in XML like they do in C,>it should be easy to do.Hi Hans,No problems :-). Thanks to all who have been very helpful during the development of the ATR42 project, which by the way is far from finished yet! A new article has just been posted on my web site (address below) with some screenshots of the 2D panels, among them the new engine gauges on the center panel. Best regardsJan H. Sorensenwww.jspanels.com
-
EPR Formula
Hi Douglas,Thanks for your help and for the most useful information on the ATR42 engines :-).The TURB ENG (1&2) CORRECTED N1 a:vars work fine both in FS2002 and FS9.Best regardsJan H. Sorensenwww.jspanels.com
-
EPR Formula
Hi Hans,I most probably have got it wrong then, since you are asking :-). The purpose of this gauge is the NH NL indication (pressure ??). If you can inform me what kind of (XML) variable to be used here it would be fine!Best regardsJan H. Sorensenwww.jspanels.com
-
EPR Formula
Hi All,I want to use the XML variable (a:var) TURB ENG1 PRESSURE RATIO and have tried different codes without any success. This code is for a turboprop engine (ATR42), example:(A:TURB ENG1 PRESSURE RATIO,percent) Result is that the indication starts on 100 %. By changing to this code:(A:TURB ENG1 PRESSURE RATIO,percent) 65536 / 100 *the result is almost zero. Help on this one is appreciated!Another interesting "issue" is the way MSFS calculates hPA or millibars versus inches HG. According to the Gauges Tutorial by Dai Griffiths MSFS sets 29.92 in HG equal to 1013.2 mb, while the correct value should be 1013.25. I have set this calculation in an XML Altimeter like this:%((A:Kohlsman setting hg,mbar) 1.0000493485984998026056060007896 *)%!04.0f!and it seem to work fine related to the in HG values.Best regardsJan H. Sorensenwww.jspanels.com
-
Angle of Attack Indicator
Hi Ron and all,Thank you all a lot :-).These parameters will be most useful, and we will try them out ASAP on our FS9/FS8 ATR42 project.
-
Angle of Attack Indicator
>Hi Jan>>As Arne mentioned, the INCIDENCE_ALPHA variable reports the>aircraft BODY angle of attack (which is the angle between the>longitudinal fuselage axis and relative wind, ie TAS vector).>Although it is of course a major factor for lift, we know wing>lift depends on WING angle of attack which is simply: AOAw =>AOAb + wing incidence + 0.5*wing twist (at least in FS8) ; FS9>discards any wing incidence and twist data in the aircraft.cfg>so AOAw always equals AOAb..not true in FS8.>Wing lift is thereafter calculated from AOAw and relevant data>of air file table #404 (CL vs AOAw) or Table #1545 if it>exists>According the way this table is build, positive lift can be>generated even for small negative AOA angles..It solely>depends on the table values>>Hope this will clarify>>Herv