1
0
Fork 0

Send fuel tank capacity, fuel density and level in m3

This commit is contained in:
Chris Speck 2020-07-17 10:13:57 +10:00 committed by James Turner
parent 3300ac543e
commit 932938cbee
3 changed files with 31 additions and 5 deletions

View file

@ -191,6 +191,11 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
for ( i = 0; i < net->num_tanks; ++i ) { for ( i = 0; i < net->num_tanks; ++i ) {
SGPropertyNode *node = fgGetNode("/consumables/fuel/tank", i, true); SGPropertyNode *node = fgGetNode("/consumables/fuel/tank", i, true);
net->fuel_quantity[i] = node->getDoubleValue("level-gal_us"); net->fuel_quantity[i] = node->getDoubleValue("level-gal_us");
net->tank_selected[i] = node->getBoolValue("selected");
net->capacity_m3[i] = node->getDoubleValue("capacity-m3");
net->unusable_m3[i] = node->getDoubleValue("unusable-m3");
net->density_kgpm3[i] = node->getDoubleValue("density-kgpm3");
net->level_m3[i] = node->getDoubleValue("level-m3");
} }
// Gear and flaps // Gear and flaps
@ -272,6 +277,11 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
for ( i = 0; i < net->num_tanks; ++i ) { for ( i = 0; i < net->num_tanks; ++i ) {
htonf(net->fuel_quantity[i]); htonf(net->fuel_quantity[i]);
htonl(net->tank_selected[i]);
htond(net->capacity_m3[i]);
htond(net->unusable_m3[i]);
htond(net->density_kgpm3[i]);
htond(net->level_m3[i]);
} }
net->num_tanks = htonl(net->num_tanks); net->num_tanks = htonl(net->num_tanks);
@ -355,6 +365,11 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
net->num_tanks = htonl(net->num_tanks); net->num_tanks = htonl(net->num_tanks);
for ( i = 0; i < net->num_tanks; ++i ) { for ( i = 0; i < net->num_tanks; ++i ) {
htonf(net->fuel_quantity[i]); htonf(net->fuel_quantity[i]);
htonl(net->tank_selected[i]);
htond(net->capacity_m3[i]);
htond(net->unusable_m3[i]);
htond(net->density_kgpm3[i]);
htond(net->level_m3[i]);
} }
net->num_wheels = htonl(net->num_wheels); net->num_wheels = htonl(net->num_wheels);
@ -455,7 +470,12 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
for (i = 0; i < net->num_tanks; ++i ) { for (i = 0; i < net->num_tanks; ++i ) {
SGPropertyNode * node SGPropertyNode * node
= fgGetNode("/consumables/fuel/tank", i, true); = fgGetNode("/consumables/fuel/tank", i, true);
node->setDoubleValue("level-gal_us", net->fuel_quantity[i] ); node->setDoubleValue("level-gal_us", net->fuel_quantity[i]);
node->setBoolValue("selected", net->tank_selected[i] > 0);
node->setDoubleValue("capacity-m3", net->capacity_m3[i]);
node->setDoubleValue("unusable-m3", net->unusable_m3[i]);
node->setDoubleValue("density-kgpm3", net->density_kgpm3[i]);
node->setDoubleValue("level-m3", net->level_m3[i]);
} }
for (i = 0; i < net->num_wheels; ++i ) { for (i = 0; i < net->num_wheels; ++i ) {

View file

@ -91,7 +91,13 @@ public:
// Consumables // Consumables
uint32_t num_tanks; // Max number of fuel tanks uint32_t num_tanks; // Max number of fuel tanks
float fuel_quantity[FG_MAX_TANKS]; float fuel_quantity[FG_MAX_TANKS]; // used by GPSsmooth and possibly others
uint32_t tank_selected[FG_MAX_TANKS]; // selected, capacity, usable, density and level required for multiple-pc setups to work
double capacity_m3[FG_MAX_TANKS];
double unusable_m3[FG_MAX_TANKS];
double density_kgpm3[FG_MAX_TANKS];
double level_m3[FG_MAX_TANKS];
// Gear status // Gear status
uint32_t num_wheels; uint32_t num_wheels;