From b83ad153131483a9d25553e796c5a037a73fb109 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 27 Oct 2000 22:00:43 +0000 Subject: [PATCH] Added CHT (cylinder head temp) to BFI and property manager. --- src/FDM/LaRCsim.cxx | 1 + src/FDM/flight.hxx | 3 +++ src/Main/bfi.cxx | 14 ++++++++++++++ src/Main/bfi.hxx | 1 + src/Main/fg_init.cxx | 6 ++++++ src/Main/keyboard.cxx | 5 ++++- src/Main/main.cxx | 29 ++++++++++++++++++++++++++++- src/Main/viewmgr.hxx | 3 +++ 8 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index e3134d337..8423e5283 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -134,6 +134,7 @@ bool FGLaRCsim::update( int multiloop ) { e->set_MaxHP( eng.get_MaxHP() ); e->set_Percentage_Power( eng.get_Percentage_Power() ); e->set_EGT( eng.get_EGT() ); + e->set_CHT( eng.get_CHT() ); e->set_prop_thrust( eng.get_prop_thrust_SI() ); #if 0 diff --git a/src/FDM/flight.hxx b/src/FDM/flight.hxx index 0e333d2af..e49008f48 100644 --- a/src/FDM/flight.hxx +++ b/src/FDM/flight.hxx @@ -112,6 +112,7 @@ private: double MaxHP; double Percentage_Power; double EGT; + double CHT; double prop_thrust; /* others... @@ -137,6 +138,7 @@ public: inline double get_MaxHP() const { return MaxHP; } inline double get_Percentage_Power() const { return Percentage_Power; } inline double get_EGT() const { return EGT; } + inline double get_CHT() const { return CHT; } inline double get_prop_thrust() const { return prop_thrust; } inline void set_Throttle( double t ) { Throttle = t; } @@ -147,6 +149,7 @@ public: inline void set_MaxHP( double hp ) { MaxHP = hp; } inline void set_Percentage_Power( double p ) { Percentage_Power = p; } inline void set_EGT( double e ) { EGT = e; } + inline void set_CHT( double c ) { CHT = c; } inline void set_prop_thrust( double t ) { prop_thrust = t; } }; diff --git a/src/Main/bfi.cxx b/src/Main/bfi.cxx index e4fb0fb5e..59a5e68e8 100644 --- a/src/Main/bfi.cxx +++ b/src/Main/bfi.cxx @@ -130,6 +130,8 @@ FGBFI::init () getRPM, 0); current_properties.tieDouble("/engines/engine0/egt", getEGT, 0); + current_properties.tieDouble("/engines/engine0/cht", + getCHT, 0); // Velocities current_properties.tieDouble("/velocities/airspeed", @@ -713,6 +715,18 @@ FGBFI::getEGT () } +/** + * Return the current engine0 CHT. + */ +double +FGBFI::getCHT () +{ + if ( current_aircraft.fdm_state->get_engine(0) != NULL ) { + return current_aircraft.fdm_state->get_engine(0)->get_CHT(); + } +} + + //////////////////////////////////////////////////////////////////////// // Velocities diff --git a/src/Main/bfi.hxx b/src/Main/bfi.hxx index 6c086f676..877af44d9 100644 --- a/src/Main/bfi.hxx +++ b/src/Main/bfi.hxx @@ -94,6 +94,7 @@ public: static double getRPM (); static void setRPM ( double rpm ); static double getEGT (); + static double getCHT (); // Velocities static double getAirspeed (); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 408baf805..23e82f52d 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -583,6 +583,9 @@ bool fgInitSubsystems( void ) { cur_fdm_state->get_Theta(), cur_fdm_state->get_Psi() ); + // set current view to 0 (first) which is our main pilot view + globals->set_current_view( pilot_view ); + FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << globals->get_current_view()->get_abs_view_pos()); @@ -815,6 +818,9 @@ void fgReInitSubsystems( void ) cur_fdm_state->get_Theta(), cur_fdm_state->get_Psi() ); + // set current view to 0 (first) which is our main pilot view + globals->set_current_view( pilot_view ); + FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << globals->get_current_view()->get_abs_view_pos()); diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index e28854cc8..d5bbf920a 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -418,7 +418,9 @@ void GLUTkey(unsigned char k, int x, int y) { fgUpdateSkyAndLightingParams(); return; case 118: // v key -// globals->get_options()->cycle_view_mode(); + globals->set_current_view( globals->get_viewmgr()->next_view() ); +#if 0 + // globals->get_options()->cycle_view_mode(); if ( globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_FOLLOW ) { @@ -433,6 +435,7 @@ void GLUTkey(unsigned char k, int x, int y) { v->set_view_offset( FG_PI * 1.75 ); globals->get_current_view()->set_pilot_offset(25.0, -25.0, 1.0); } +#endif fgReshape( globals->get_options()->get_xsize(), globals->get_options()->get_ysize() ); return; diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 658ee8f74..945e75fb6 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -336,6 +336,28 @@ void fgRenderFrame( void ) { cur_fdm_state->get_Theta(), cur_fdm_state->get_Psi() ); + FGViewerLookAt *chase_view = + (FGViewerLookAt *)globals->get_viewmgr()->get_view( 1 ); + + sgVec3 po; // chase view pilot_offset + sgVec3 wup; // chase view world up + sgCopyVec3( po, chase_view->get_pilot_offset() ); + sgCopyVec3( wup, chase_view->get_world_up() ); + sgMat4 CXFM; // chase view + pilot offset xform + sgMakeRotMat4( CXFM, cur_fdm_state->get_Psi() * RAD_TO_DEG, wup ); + sgVec3 npo; // new pilot offset after rotation + sgXformVec3( npo, po, CXFM ); + + chase_view->set_geod_view_pos( cur_fdm_state->get_Longitude(), + cur_fdm_state->get_Lat_geocentric(), + cur_fdm_state->get_Altitude() * + FEET_TO_METER ); + chase_view->set_pilot_offset( npo[0], npo[1], npo[2] ); + sgVec3 negpo; + sgNegateVec3( negpo, npo ); + chase_view->set_view_forward( negpo ); + chase_view->set_view_up( wup ); + #if 0 // this is a test, we are trying to match RPH and LookAt // matrices @@ -1347,7 +1369,12 @@ int main( int argc, char **argv ) { FGViewerRPH *pv = new FGViewerRPH; globals->get_viewmgr()->add_view( pv ); - globals->set_current_view( pv ); + + FGViewerLookAt *chase = new FGViewerLookAt; + globals->get_viewmgr()->add_view( chase ); + + // set current view to 0 (first) which is our main pilot view + globals->set_current_view( globals->get_viewmgr()->get_view( 0 ) ); // Scan the config file(s) and command line options to see if // fg_root was specified (ignore all other options for now) diff --git a/src/Main/viewmgr.hxx b/src/Main/viewmgr.hxx index 08be5aebf..80928abf0 100644 --- a/src/Main/viewmgr.hxx +++ b/src/Main/viewmgr.hxx @@ -64,6 +64,9 @@ public: // getters inline int size() const { return views.size(); } + inline FGViewer *get_view() { + return views[current]; + } inline FGViewer *get_view( int i ) { if ( i < 0 ) { i = 0; } if ( i >= (int)views.size() ) { i = views.size() - 1; } -- 2.39.5