77e21b26d2
Stub in hooks for Propeller feathering controls and the turbo prop "condition" lever. I added a line in FGFDM.cpp to force control properties to exist if they don't already. This way you can specify anything you want and find them in the property browser, otherwise no one else may create them and you are stuck. In PropEngine::solve() the code original sets _running = true at the beginning and then sets running = false at the end. I changed this to save the current value at the start, set to true, solve(), and then restore the original value at the end. That way if we start off with _running = true, we don't have to hack up the calc() routine which wasn't using the value anyway. Finally I added some very initial support to shut down a turbine engine (_running = false) when the condition lever goes to zero.
72 lines
1.1 KiB
C++
72 lines
1.1 KiB
C++
#include "Math.hpp"
|
|
#include "Thruster.hpp"
|
|
namespace yasim {
|
|
|
|
Thruster::Thruster()
|
|
{
|
|
_dir[0] = 1; _dir[1] = 0; _dir[2] = 0;
|
|
int i;
|
|
for(i=0; i<3; i++) _pos[i] = _wind[i] = 0;
|
|
_throttle = 0;
|
|
_mixture = 0;
|
|
_starter = false;
|
|
_pressure = _temp = _rho = 0;
|
|
}
|
|
|
|
Thruster::~Thruster()
|
|
{
|
|
}
|
|
|
|
void Thruster::getPosition(float* out)
|
|
{
|
|
int i;
|
|
for(i=0; i<3; i++) out[i] = _pos[i];
|
|
}
|
|
|
|
void Thruster::setPosition(float* pos)
|
|
{
|
|
int i;
|
|
for(i=0; i<3; i++) _pos[i] = pos[i];
|
|
}
|
|
|
|
void Thruster::getDirection(float* out)
|
|
{
|
|
int i;
|
|
for(i=0; i<3; i++) out[i] = _dir[i];
|
|
}
|
|
|
|
void Thruster::setDirection(float* dir)
|
|
{
|
|
Math::unit3(dir, _dir);
|
|
}
|
|
|
|
void Thruster::setThrottle(float throttle)
|
|
{
|
|
_throttle = Math::clamp(throttle, 0, 1);
|
|
}
|
|
|
|
void Thruster::setMixture(float mixture)
|
|
{
|
|
_mixture = Math::clamp(mixture, 0, 1);
|
|
}
|
|
|
|
|
|
void Thruster::setStarter(bool starter)
|
|
{
|
|
_starter = starter;
|
|
}
|
|
|
|
void Thruster::setWind(float* wind)
|
|
{
|
|
int i;
|
|
for(i=0; i<3; i++) _wind[i] = wind[i];
|
|
}
|
|
|
|
void Thruster::setAir(float pressure, float temp, float density)
|
|
{
|
|
_pressure = pressure;
|
|
_temp = temp;
|
|
_rho = density;
|
|
}
|
|
|
|
}; // namespace yasim
|