Yep your right it does work i got it to work with my COM1 display
Printable View
Yep your right it does work i got it to work with my COM1 display
Now broadcast the comand (CID 0) and all Displays will react.
Stefan
thats what im doing and it works great. Now every thing will turn off when the power to them turns off.
Can you show me how you did this.
When I turn my master avionics switch off, in the software, all the radio stack go out, by my actual radio stack stays lit.
I'd like to also do this with my battery switch, when I turn the battery switch off in the cockpit, all the gauges ie: fuel, oil pump, fuel pump etc all turn off on the screen, but in my cockpit, the air core gauges do not turn off as they should.
Appreciate the help from all as always.
David
Here you have my function.
The Servos you have to drive by your self.Code:MkFsObject(FS_BUSVOLT,"", EventHandler, 0x2834, 8, TP_DBL, FS_NORMAL)
case FS_BUSVOLT:
// send the voltage information as a percent value
// to all controllers with command 131.
int spannung = (val * 100 / 24);
if (spannung != SpannungSave)
{
FsbusWriteFmt3 (0, 131,spannung);
SpannungSave=spannung;
}
break;
Stefan
in my .CPP i put this but this is the Offset for the Avionics but you can change it to the main Battery one if you want
Code:#include "stdafx.h"
void BuildRadiostackObjects ()
{
MkFsObject(FS_BUSVOLT, "BUSVOLTS", cbBusvolt, 0x2850, 8, TP_I64, FS_QUICK);
}
void cbBusvolt (int oid, int val, double dval)
{
switch (oid)
{
case FS_BUSVOLT:
FsbusWriteFmt3 (0, 131, val * 100 / 24 );
}
}
Thanks guys, I'll put it in the code and see how it goes.
I'll let you know.
David
Finally got the time to test out the code.
Here what is happening.
When I start FSX, the displays (in my cockpit) are lit even though the cockpit is cold and dark in the software (there must be a syncronize command somewhere to add in).
As I go through the start up sequence, I turn the avionics on and the displays start flashing on and off.
When I start the engine, the displays go out.
When I stop the engine, displays start flashing again.
When I turn the avionics switch off, displays go off (this part is working well)
Any ideas on what I need to tweak?
Do you want me to post the code from the .cpp file this code is in?
Ah, I'd do it anyway:
ThanksCode:#include "stdafx.h"
void cbVoltmetersBuildObjects()
{
MkFsbusObject (BTP_A_OUT,C_FUELLEFT,"Left Fuel Gauge",cbVoltmeters,27,86);
MkFsbusObject (BTP_A_OUT,C_FUELRIGHT,"Right Fuel Gauge",cbVoltmeters,27,84);
MkFsbusObject (BTP_A_OUT,C_OILPRESSURE,"Oil Pressure Gauges",cbVoltmeters,27,87);
MkFsbusObject (BTP_A_OUT,C_OILTEMP,"Oil Temp Gauges",cbVoltmeters,27,85);
MkFsbusObject (BTP_A_OUT,C_MAINBUSAMPS,"Main Bus Amp Gauge",cbVoltmeters,27,83);
MkFsbusObject (BTP_A_OUT,C_FUELPRESSURE,"Fuel Pressure Gauge",cbVoltmeters,27,82);
MkFsObject(FS_FUELLEFTMAINLEVEL,"Left Fuel Gauge",cbVoltmeters, 0x0B7C,4,TP_I32, FS_NORMAL);
MkFsObject(FS_FUELRIGHTMAINLEVEL,"Right Fuel Gauge",cbVoltmeters, 0x0B94,4,TP_I32, FS_NORMAL);
MkFsObject(FS_GENERALENGINE1OILPRESSURE,"Oil Pressure Gauge",cbVoltmeters,0x3B60,8,TP_DBL,FS_NORMAL);
MkFsObject(FS_ENGINE1OILTEMP,"Engine Oil Temp Gauge",cbVoltmeters,0x08B8,2,TP_I16,FS_NORMAL);
MkFsObject(FS_MAINBUSAMPS,"Main Bus amp Gauge",cbVoltmeters,0x282C,8,TP_DBL,FS_NORMAL);
MkFsObject(FS_FUELPRESSURE,"Fuel Pressure Gauge",cbVoltmeters,0x3868,8,TP_DBL,FS_NORMAL);
MkFsObject(FS_BUSVOLT, "BUSVOLTS", cbVoltmeters, 0x2850, 8, TP_I64, FS_QUICK);
}
void cbVoltmeters (int oid, int val, double dval)
{
switch (oid)
{
case FS_GENERALENGINE1OILPRESSURE:
{
val=(val / 41);
static CALTAB OILPRESSUREGauge[] = {
{0,255},{127,200},{255,0}
};
val = Calibrate (val, OILPRESSUREGauge,3);
FsbusWrite (C_OILPRESSURE, val);
}
break;
case FS_FUELLEFTMAINLEVEL:
{
static CALTAB FUELLEFTMAINGauge[] = {
{0,255},{4194304,155},{8388608,0}
};
val = Calibrate (val, FUELLEFTMAINGauge,3);
FsbusWrite (C_FUELLEFT, val);
}
break;
case FS_FUELRIGHTMAINLEVEL:
{
static CALTAB FUELRIGHTMAINGauge[] = {
{0,255},{4194304,155},{8388608,0}
};
val = Calibrate (val, FUELRIGHTMAINGauge,3);
FsbusWrite (C_FUELRIGHT, val);
}
break;
case FS_ENGINE1OILTEMP:
{
static CALTAB OILTEMPGauge[] = {
{0,255},{25000,0}
};
val = Calibrate (val, OILTEMPGauge,2);
FsbusWrite (C_OILTEMP, val);
}
break;
case FS_MAINBUSAMPS:
{
static CALTAB MAINBUSAMPSGauge[] = {
{-60,255},{0,177},{60,0}
};
val = Calibrate (val, MAINBUSAMPSGauge,3);
FsbusWrite (C_MAINBUSAMPS, val);
}
break;
case FS_FUELPRESSURE:
{
static CALTAB FUELPRESSUREGauge[] = {
{0,255},{10,230},{16,200},{40,0}
};
val = Calibrate (val, FUELPRESSUREGauge,4);
FsbusWrite (C_FUELPRESSURE, val);
}
break;
case FS_BUSVOLT:
{
FsbusWriteFmt3 (0, 131, val * 100 / 24 );
}
}
}
David
I dont see any Displays in your code what Displays are you talking about?
Trevor
Hi Trevor,
I've only copied the code for the voltmeters.cpp
The code for the displays are in various other relevant .cpp files
The displays I have programmed are:
Nav1 & Nav1 stby
ADF
XPNDR
MCP
all 7 seg led displays.
The code for most of it is in this thread as Stefan has helped me with just about all of it.
Another thing, if I turn the master battery switch off, the 7seg displays also go out as they should.
So I just can't get them to stay lit (stop flashing) when everything is turned on and engine not running and to stay lit (not turn off) when engine is started.
Hope I'm explaining myself clearly.
Thanks
David
PS. I'm going to try Stefan's code for this later today and see how that goes.
Code:MkFsObject(FS_BUSVOLT,"", cbVoltmeters, 0x2834, 8, TP_DBL, FS_NORMAL)
case FS_BUSVOLT:
// send the voltage information as a percent value
// to all controllers with command 131.
int voltage = (val * 100 / 24);
if (voltage != VoltageSave)
{
FsbusWriteFmt3 (0, 131,voltage);
VoltageSave=voltage;
}
break;