View Full Version : Progamming help with FSBus dll
RobiD
10-16-2010, 09:12 PM
So you have two fsbus programs you have to start, one running 2.0.0 and the other running 1.2.0? (I might seriously consider doing this)
Oh, also am I right in thinking that I can't program version 1.2.0 the way I've been programming version 2.0.0? (different programming language?)
How do you get around needing 2 serial ports? Do you have a card to provide that additional port?
David
sgaert
10-17-2010, 04:26 AM
So you have two fsbus programs you have to start, one running 2.0.0 and the other running 1.2.0?
At the moment that is the only way, but i hoppe this year we get a working V2.
Oh, also am I right in thinking that I can't program version 1.2.0 the way I've been programming version 2.0.0? (different programming language?)
No different language, only other funktion names.
How do you get around needing 2 serial ports? Do you have a card to provide that additional port?
On my Notebook i use a UBS to Serial converter. http://www.amazon.com/USB-RS232-Serial-Convert-Adapter/dp/B002WPR8JC/ref=sr_1_13?ie=UTF8&qid=1287303898&sr=8-13
RobiD
10-17-2010, 04:47 AM
Ok. Thanks
Hopefully Dirk will email me back with a response regarding 2.0.0 not working.
USB to serial converter work without any trouble?
Can you give me an example of different function names compared to version 2.
David
sgaert
10-17-2010, 04:52 AM
USB to serial converter work without any trouble?
Absolutly no problems.
Can you give me an example of different function names compared to version 2.
The object build is different, also some changes in the .h file. You need to compare both manuals.
RobiD
10-17-2010, 05:07 AM
Just had a quick read through the version 1 manual.
Very similar, but I can see some of the differences. At least I will only need to program for the steppers and not the rest.
Thanks again for your input Stefan.
David
RobiD
10-28-2010, 09:38 PM
Hi Stefan,
FSWeekend is next weekend isn't it?
When you are discussing with Dirk the dll v2 issue with the steppers, please also let Dirk know that I too am waiting on his response about V2 and that we have been working together quite a bit on this issue when you are talking to him (as well as many others are waiting on a resolution).
I am not going ahead with building a second com board and running as you have until I have an idea of whether Dirk feels this issue with V2 can be resolved quickly and easily.
If after you have spoken to him, you feel that this will not be resolved, then I will go with your solution with the second com card. I really look forward to clarity on whichever way to go with the steppers.
Hope you have a great time at FSWeekend. Wish Australia was a little closer. Sometimes it feels like Australia is so far away from the rest of the world that it may as well be on another planet.
David
sgaert
10-29-2010, 02:53 AM
Hi David,
yes FSweekend is from 06 - 07 November.
I try to talk with Dirk, at the moment iīm surprise Fsbus is in the Exhibitors list but not on the Floorplan.
The frustrating on that all is, last year on Fsweekend i talked with Dirk and we had the same topics. One year without any change.
Stefan
RobiD
10-29-2010, 05:12 AM
I appreciate your efforts Stefan.
David
RobiD
11-11-2010, 08:53 PM
Hi Stefan,
How did you go at FSWeekend?
Did you get to talk to Dirk?
Does he have a plan for correcting the stepper issue?
Thanks
David
RobiD
11-18-2010, 06:27 AM
Hi Stefan,
How did you go at FSWeekend?
Did you get to talk to Dirk?
Does he have a plan for correcting the stepper issue?
Thanks
David
You there Stefan?
sgaert
11-18-2010, 06:41 AM
sorry i forgot to answer.
I talked to Dirk, but only on the street not with my hardware, two dayīs ago i wrote him a Mail.
But no answer, i wait. I heard that DLL V3 will be released soon.
Fsweekend was ok, but not realy new hardware, i buyed a Prototyp FMC frame(panel) from Simparts. Frame, Keys with PCB and backlight only, tonight i will publish a Picture. But i used a OC KeyCard to connect them, it is easier then a IO Card.
Stefan
RobiD
11-18-2010, 06:46 AM
Thanks Stefan.
Hmmm V3. That sounds exciting. I remember when I heard the rumour about v2. Fingers crossed it won't be too long.
It would have been great to come to FSWeekend (way too far). We had a Flight Sim expo here on the Gold Coast a few years ago. It was smallish but lots of good stuff to look at and buy.
Cheers,
David
sgaert
11-18-2010, 06:47 AM
That is the FMC.
http://lh4.ggpht.com/_B8czH7apyHE/TOUDxdclGnI/AAAAAAAAHns/-Rl8zro9dnQ/s800/P1030584b.JPG
RobiD
11-18-2010, 06:49 AM
Wow, that looks great.
Do you mind if I ask how much it cost?
sgaert
11-18-2010, 06:55 AM
You got a PM.
RobiD
11-18-2010, 07:01 AM
Sounds like a good deal. (had to convert euro to AUD)
It's quite a complex piece to make yourself.
David
sgaert
11-18-2010, 07:05 AM
Yes, you canīt create that quality by your self.
It is only one piece, no different layers.
Tonight i mail you some detail pictures.
RobiD
11-18-2010, 07:09 AM
Look forward to seeing them.
Thanks
mondo50m
12-15-2010, 03:39 PM
Does anyone out there have any examples of this programming stuff? I have completed buiding an Engine Oil gauge using servos that will be put into a Bell 206 panel. The gauge contains 2 servos, one for the pressure on the left of the gauge and one for the temp on the right of the gauge. It works fine in the fsbus setup. I am having a really hard time 'wrapping my head' around the programming. Stefan has been extremely generous in his help getting the files set up. If someone can come up with an example of making a servo work through all of this, it would be appreciated. I get confused when it comes to when I need to have a .cpp file, a .h file and so on. Is there a set way of doing all of this so it makes sense? What I mean is....if I want to make an engoilpress object, what needs to be put in what file to make it work? Please help, I know I am old, but I have a few brain cells left, and hopefully this stuff can be beaten into me. I do see some examples in in this thread, but I can not get them printed out so that they are useful to me. So, something that I can print out and look at while I am working on mine would be of great help.
Milt
RobiD
12-16-2010, 07:49 AM
Hey Milt,
With the help of Stefan, I got to understand the use of the calibrate function to drive servos. Once you understand how to modify it, you can vary it to suit any servo based gauge. I use the calibrate function to drive ASI, VSI, Glideslope indicator (vertical and horizontal), Tacho, Pitch and Bank for the atitude indicator, Turn and slip indicator.
I have to get the sample code from my other computer so I'll try and post some info over the weekend.
David
sgaert
12-16-2010, 08:16 AM
On friday we will program that gauge together, via Skype and maybe Teamviewer.
Stefan
mondo50m
12-16-2010, 02:02 PM
Thanks for the help guys, I am sure that once I get one running, it will be much easier to get the others. I now have the idea that for every object made you need to have a .cpp and a .h file to get it to work. Am I supposed to have windows.h somewhere? I do not seem to have it. Probably have to download the windows sdk for Vista? Little by little I will get this going. But not on my own.
Milt
sgaert
12-16-2010, 02:52 PM
I now have the idea that for every object made you need to have a .cpp and a .h file to get it to work.
That isnīt necessary, but it is a good way to cut the project in different parts. Sample: A Pedastel part contains a pedastal.cpp and .h file and so on.
In your actual case i would prefer a gauge.cpp and .h file, that would contains all the different analog gauges, that you like to build.
Am I supposed to have windows.h somewhere?
That is a part of VisualStudio, you have that installed.
Stefan
mondo50m
12-26-2010, 07:00 PM
I am moving along slowly. I am now working on my attitude qauge. I am wondering what does 'FLT64' mean in the FSUIPC var. type? I have the gauge responding, but only to the point that on the pitch, it moves all the way up when it passes the center line going up and all of the way down when it passes the centerline going down. I see nothing in the FSBUSDLL manual about FLT64. So, yes, I am one again confused. Any help please.
Milt
sgaert
12-26-2010, 07:03 PM
It is called TP_I64 in FsBus.
mondo50m
12-26-2010, 08:01 PM
I put TP_I64 in the proper place and it is still doing the same thing, full travel up, or full travel down, depending an whether I am ascending or descending. Obviously, this servo gauge can not be programmed the same way as my oil pressure gauge is.
Milt
sgaert
12-27-2010, 05:14 AM
Can you show us, the make of the FSObject and the case?
mondo50m
12-27-2010, 10:00 AM
This is the FSBUS object as I have built it;
MkFsbusObject(BTP_A_OUT, S_ATTITUDEPITCH, "",EventHandler, 27, 86);
MkFsObject(FS_ATTITUDEPITCH, "", EventHandler, 0x2f70, 8, TP_I64, FS_normal);
This is the case;
switch(oid)
{
case FS_ATTITUDEPITCH:
static CALTAB ATTITUDEPITCH[] = {{0,106},{16384,164}};
FsbusWrite (S_ATTITUDEPITCH, Calibrate (val, ATTITUDEPITCH,2));
I know that I am doing something wrong, but am unable to figure it out.
sgaert
12-27-2010, 05:01 PM
Do you look to the offset with FSInterrogate2std for the min, max, and Zero position value?
Also do one more data to the calltap for the Zero(middel) Position.
Stefan
mondo50m
12-28-2010, 10:54 AM
Got the offset from FSInterrogate and the min-max. Still did not work. I then used TP_DBL in place of the TP_I64 and it is now working. Took a few hours to figure out.
Milt
RobiD
01-02-2011, 05:58 PM
Does anyone out there have any examples of this programming stuff? I have completed buiding an Engine Oil gauge using servos that will be put into a Bell 206 panel. The gauge contains 2 servos, one for the pressure on the left of the gauge and one for the temp on the right of the gauge. It works fine in the fsbus setup. I am having a really hard time 'wrapping my head' around the programming. Stefan has been extremely generous in his help getting the files set up. If someone can come up with an example of making a servo work through all of this, it would be appreciated. I get confused when it comes to when I need to have a .cpp file, a .h file and so on. Is there a set way of doing all of this so it makes sense? What I mean is....if I want to make an engoilpress object, what needs to be put in what file to make it work? Please help, I know I am old, but I have a few brain cells left, and hopefully this stuff can be beaten into me. I do see some examples in in this thread, but I can not get them printed out so that they are useful to me. So, something that I can print out and look at while I am working on mine would be of great help.
Milt
Hi Milt,
Here is a zip file of my complete project. In it you will find examples of servo, switches, rotaries, aircore movement gauges, all except steppers.
Download it from here : http://www.safeweighloss4kids.com/dontlookhere/Davids_Flight_sim.zip
Regards
David
mondo50m
01-02-2011, 08:48 PM
Thank you, Thank you. This will get me the knowledge that I am looking for. I have gotten the eng oil temp and pressure, transmission temp and pressure, and torque percentage gauges complete. I am almost done with the attitude gauge. I have the first three programmed and running, but get stuck on some of the programming, so this is going to be what I need.
Milt
Jan737
01-03-2011, 01:33 PM
Hi,
The link seems not to work.
Best regards
Jan Geurtsen
Hi Milt,
Here is a zip file of my complete project. In it you will find examples of servo, switches, rotaries, aircore movement gauges, all except steppers.
Download it from here : http://www.safeweighloss4kids.com/dontlookhere/Davids_Flight_sim.zip
Regards
David
mondo50m
01-03-2011, 03:41 PM
Use http://www.safeweighloss4kids.com/ (I believe this is what I did). Then when you get to the website, just type in the donotlookhere in the url area and then choose the file from the list.
Milt
RobiD
01-03-2011, 05:42 PM
Opps, forgot the 't' in weight.
Link is: http://www.safeweightloss4kids.com/dontlookhere/Davids_Flight_sim.zip
Sorry guys.
mondo50m
01-03-2011, 06:54 PM
HA! HA! HA! Dd not matter, I got to it anyway.
Milt
shearder
01-05-2011, 02:26 AM
Hey David
You know i have spent hours and i cannot figure what i did to get the APP to work for the glide slope! It disables heading and intercepts and turns into the glide-path but when it intercepts the glide-slope it does not disable the ALT and follow the slope down!!
I am lost! Damn hard drive - i should have backed it up but when i say it crashed i mean it is no longer "seen" by the system on ANY PC. so all changes i made to the project are lost!
RobiD
01-05-2011, 02:37 AM
Sean, perhaps Stefan can take a look at the code. Chances are that if your code is not disabiling the ALT and following the glideslope down, neither is mine.
Can you post the code for the APP. My understanding is that everything that is meant to happen when you push APP should be in this section of code (I hope).
Stefan, can you take a look and let us know?
Thanks
David
shearder
01-05-2011, 03:10 AM
David, I am not home right now and the code i will have to post was the default code i was building on from you. I got it working like a charm and after the crash forgot what i fixed. I remember comparing why the HDG was working and not the ALT and then "did something" but i never did much after getting it all to work and now it has been a whle that i can;t remember what it was LMAO - a pain really!
RobiD
01-05-2011, 03:15 AM
Bugger, I wish I could remember for you.
Perhaps just sitting with it for a while without pressure, it may just occur to you again.
Please let me know, or at least write it up here to benefit others (perhaps even yourself again... No, I bet it won't happen again)
David
shearder
01-05-2011, 03:22 AM
Now i have another cockpit example project that i was initially building on BUT i remember when i hit the SPD hold button it killed engine 1. Perhaps i must go over that one and find where THAT issue is. It's just a pain to have to reprogram which buttons do what LOL
Wish there was a newer FSBUS version like the older graphical interface!
RobiD
01-05-2011, 05:10 AM
I do know that V3 is on it's way some time later this month.
It's just being tested and docs written for it.
It is still C++ but more in line with standard C programming, so it still will take some knowledge and learning.
I do remember the simple old interface. It was a lot simpler to implement, but nowhere near as powerful for programming complex functions.
shearder
01-05-2011, 06:02 AM
I am like someone with a learning disability LOL i read things and then i get VERY bored or frustrated and then i jump ahead and then i don't know why things don't work and what i left out etc etc etc
Also seems all the software for logics has gone up in price then one considers the unthinkable!! All the stuff i use for FS is paid for. I even have IYP which i got registered, i have FSUIPC fully registered, i have Ideal Flight fully registered and I really wanted to buy Logics but in my currency some are like between R12,999 and R40,000. To put that into perspective a bottle of Johnny Walker Blue is around R1800!!! A can of Coke is R5.50 - my daughters school fees for a PRIVATE school is R2710!! How do i justify R12,999 or even R40,000? *sigh* I have already spent R50,000 on hardware etc, electronics etc etc i really cannot afford R12,999 even at the minimum!
RobiD
01-05-2011, 06:23 AM
Excuse my ignorance, but what is the software for logics?
David
shearder
01-05-2011, 06:25 AM
Excuse my ignorance, but what is the software for logics?
David
That is so one can have a FULL working overhead that surpasses FS(x) default possibilities.
RobiD
01-05-2011, 06:34 AM
Wow, still not sure what you mean.
Do you have a link to what you mean so I can have a read?
shearder
01-05-2011, 06:40 AM
Wow, still not sure what you mean.
Do you have a link to what you mean so I can have a read?
Kinda like PM Systems (WAY WAY too expensive) or Sim-Avionics. These also include panel guages etc have a look Here (http://www.sim-avionics.com/index.asp?page=editions)
RobiD
01-05-2011, 06:46 AM
Ok, gotcha. It's like a sim addon for FSX with a much higher degree of functionality that can be used in homemade cockpits to increase realism.
Sound like a good summary?
shearder
01-05-2011, 06:47 AM
Hit the nail on the head! Yes.
sgaert
01-05-2011, 07:43 AM
Ok, gotcha. It's like a sim addon for FSX with a much higher degree of functionality that can be used in homemade cockpits to increase realism.
Sound like a good summary?
But Attention. The normal FS Addon you canīt controll with FSUIPC, you have to use Keyevents. But with that you canīt readout any LED Status.
For me personal, it is not useable for a homecockpit.
@shearder if you like to build a boeing, than look to Prosim737 (300€), if Airbus than is a freeware in the board (http://www.mycockpit.org/forums/forumdisplay.php/263-JeeHell).
shearder
01-05-2011, 07:51 AM
Hey Stefan
Martin says they haven't done FSBUS compatibility yet with Prosim? Not sure if that has changed - i will have a look. Yeah i am building Boeing 737-800. Well as close as i can. Thinking of getting Symulatory Aft O/H kit! I have all the CADs which i have been building my MIP/MCP etc from using laser CNC. But problem is buttons, switches and knobs i can get don't look like the "real" thing.
sgaert
01-05-2011, 08:02 AM
Use FSUIPC, not the inside FSBUS compatibility. That work without a problem.
Symulatory, i have there first Overhaed, a friend have a lot of stuff from them and a actual thread in a German FS Board.
Donīt buy from them, it takes a long time to delivery, nearly no support after buy. If a part missing in the Delivery than you never get an answer or part.
Buy OC it has much more quality and a realy better support.
shearder
01-05-2011, 08:04 AM
Thanks Stefan. I will rather look at OC then. If i use FSUIPC with ProSim737 the hardware I have with FSBUS won't work? I need new hardware?
mondo50m
01-05-2011, 09:38 AM
Hey Stefan
Martin says they haven't done FSBUS compatibility yet with Prosim? Not sure if that has changed - i will have a look. Yeah i am building Boeing 737-800. Well as close as i can. Thinking of getting Symulatory Aft O/H kit! I have all the CADs which i have been building my MIP/MCP etc from using laser CNC. But problem is buttons, switches and knobs i can get don't look like the "real" thing.
HI. We have a nice downloads section where you can post those DXF files for those who have their own CNC machine. They may even be the one push needed for the person who is thinking about building a CNC to get it done.
Milt
shearder
01-05-2011, 10:56 AM
Hey Milt
In fact i think I may have got these CAD files from this site's downloads.
mondo50m
01-05-2011, 05:38 PM
That's good. I am not trying to push, just want to get our DXF file built up. The more files we have here, the less we have to 'farm out' to get what we are looking for.
Milt
RobiD
01-05-2011, 05:42 PM
Hey Stefan,
What software do you use?
David
sgaert
01-05-2011, 06:26 PM
I use Sim Avionics, in the single seater version.
shearder
01-06-2011, 04:50 AM
I use Sim Avionics, in the single seater version.
That will cost me R12,999 :( or round abouts and it is WAY too much - i am going to try that ProSim737
sgaert
01-06-2011, 05:01 AM
I buyed the Software 2 weeks after Publication. I paid 250€.
shearder
01-06-2011, 05:04 AM
I buyed the Software 2 weeks after Publication. I paid 250€.
Yes i remember when it was so cheap and then i was still planning my cockpit and was buying screens and then i missed the "bus" and the price went up TOO much for me.
capetonian
01-07-2011, 07:32 PM
But problem is buttons, switches and knobs i can get don't look like the "real" thing.
..... oh bugger, . guilt trip vcoming on here, .... drop me your address again via PM , ....
RobiD
01-18-2011, 08:27 AM
Stefan,
Shearder and myself are having some issues (one anyway) with the MCP code and hope that you can take a look at it. Here is the problem, when intercepting the ILS vectors, we press the APP button which turns off the AP HDG and stays horizonatally aligned with the runway, but it does not follow the glide slope down to the runway, the ALT remains on and the aircraft maintains it's altitude. We have both gone over the code and cannot identify why this is happening. Without FSBus running, the software (FSX) does exactly as it should.
Here is the .cpp file for the MCP (I will only post the case and not the declarations and Mk code)
Thanks
David
void cbModecontrolpanel (int oid, int val, double dval)
{
int x;
switch (oid)
{
case C_RCOURSELR:
//EventHandler(S_RHEADING, 0, 0); // sound rotary
Course -= val; // val can be >1 or <-1
while (Course > 360) // wrapped forward
Course -= 360; // full circle back
while (Course <= 0) // wrapped backward
Course += 360; // full circle forward
FsWriteInt(FS_NAV1OBS, Course); // to FS
FsbusWrite(C_DCOURSEL, Course); // to cockpit display
FsbusWrite(C_DCOURSER, Course);
FsbusWrite(C_OBS_DISPLAY, Course);
break;
case C_RIAS:
//EventHandler(S_RHEADING, 0, 0); // sound rotary
if (MachSpeed == 0)
{
Airspeed -= val;
if (Airspeed < 100) // minimum 100 knts
Airspeed = 100;
if (Airspeed > 340) // maximum 340 knts
Airspeed = 340;
FsWriteInt(FS_AP_AIRSPEED, Airspeed); // to FS
FsbusWrite(C_DIAS, Airspeed);
}
else
{
Mach -= val;
if (Mach > 70)
Mach = 70;
if (Mach < 10)
Mach = 10;
FsWriteInt(FS_AP_MACH, Mach * 65536 / 100);
FsbusWrite(C_DIAS, Mach);
}
break;
case C_RHEADING: // APHeading range: 1..360
//EventHandler(S_RHEADING, 0, 0); // sound rotary
APHeading -= val; // val can be >1 or <-1
while (APHeading > 360) // wrapped forward
APHeading -= 360; // full circle back
while (APHeading <= 0) // wrapped backward
APHeading += 360; // full circle forward
x = (APHeading % 360) * 65536 / 360 + 1; // (+1 is for rounding)
FsWriteInt(FS_AP_HEADING, x); // to FS
FsbusWrite(C_DHEADING, APHeading); // to cockpit display
break;
case C_RALTITUDE:
apalt += val*100;
if (apalt < 0)
apalt = 0;
if (apalt > 39000)
apalt = 39000;
FsbusWrite (C_DALTITUDE, apalt);
FsWriteInt(FS_AP_ALTITUDE, apalt*19975);
break;
//EventHandler(S_RHEADING, 0, 0); // sound rotary
/*Altitude += val * 10000 / 100;// // val can be >1 or <-1
// printf("Altitude %d\n", Altitude);
FsbusWrite(C_DALTITUDE, Altitude);
FsWriteInt(FS_AP_ALTITUDE, Altitude); // to Fs
break;*/
case C_RVSPEED:
//EventHandler(S_RHEADING, 0, 0); // sound rotary
Vertspeed += val * 10000 / 100; // update
if (Vertspeed < -7600)
Vertspeed = -7600; // Max decend
if (Vertspeed > 6000)
Vertspeed = 6000; // Max climb
FsbusWrite(C_DVSPEED, Vertspeed);
FsWriteInt(FS_AP_VS, Vertspeed); // to FS
break;
case C_SFLIGHTDIRL:
if (val == 0) //here you write if 1 active or 0
{
printf("DIRL0, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 1);
FsbusWrite(C_LMASTFLIGHTL, 1);
FsWriteInt(FS_FLIGHTDIRECTOR,1);
}
else
{
// printf("DIRL1, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 0);
FsbusWrite(C_LMASTFLIGHTL, 0);
FsWriteInt(FS_FLIGHTDIRECTOR, 0);
}
break;
case C_SAUTOTHROTTLEARM:
CockpitATArmed = (val == 0) ? 1 : 0;
if (bSynchronised) // pass only when in sync
FsWriteInt(FS_AUTOTHROTTLEARM, (val == 0) ? 1 : 0);
FsbusWrite(C_LATARMED, CockpitATArmed);
printf("C_SAUTOTHROTTLEARM event, CockpitATarmed %d\n", CockpitATArmed);
if (CockpitATArmed == 0)
{
AirspeedHold = 0;
MachHold = 0;
}
break;
case C_SN1:
if ((val == 0) & (CockpitATArmed == 1)) // button push only
{ // AT on
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
EngN1 = (EngN1 == 0) ? 1 : 0; // toggle
if (MachSpeed == 0)
FsWriteInt(FS_AP_AIRSPEEDHOLD, EngN1); // to FS
else
FsWriteInt(FS_AP_MACHHOLD, EngN1);
if (EngN1 == 1)
AirspeedHold = 0;
FsbusWrite(C_LN1, EngN1);
FsbusWrite(C_LAIRSPEEDHOLD, AirspeedHold);
FsWriteInt(FS_ENGINE1N1, EngN1);
FsWriteInt(FS_ENGINE1N2, EngN1);
}
break;
case C_SSPDHLD:
if ( (val == 0) && (CockpitATArmed == 1) ) // button push only
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
AirspeedHold = (AirspeedHold == 0) ? 1 : 0; // toggle
FsbusWrite(C_LAIRSPEEDHOLD, AirspeedHold);
if (AirspeedHold == 1)
{
EngN1 = 0;
FsbusWrite(C_LN1, EngN1);
if (MachSpeed == 0)
FsWriteInt(FS_AP_AIRSPEEDHOLD, 1);
else
FsWriteInt(FS_AP_MACHHOLD, 1);
}
else
{
FsWriteInt(FS_AP_AIRSPEEDHOLD, 0);
FsWriteInt(FS_AP_MACHHOLD, 0);
}
//FsWriteInt(FS_ENGINE1N1, EngN1);
//FsWriteInt(FS_ENGINE1N2, EngN1);
}
break;
case C_SSPDINTV:
break;
case C_SCHANGEOVER:
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
if (val == 0) // button push only
{
MachSpeed = (MachSpeed == 0) ? 1 : 0; // toggle
if (MachSpeed == 1) // Mach indication
{
DisplayOptions(C_DIAS, 3, 0, TRUE, 3);
FsbusWrite(C_DIAS, Mach);
FsWriteInt(FS_AP_MACHHOLD, 1);
}
else // IAS indication
{
DisplayOptions(C_DIAS, 4, 0, FALSE, 0); // Fsbus bug (p5=0)
FsbusWrite(C_DIAS, Airspeed);
FsWriteInt (FS_AP_AIRSPEEDHOLD, 1);
}
}
break;
case C_SVNAV:
break;
case C_SLNAV:
break;
case C_SLVLCHG:
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
if ((val == 0) && // button push
(abs(ActAlt - Altitude) > 200) && // delta in ft
((AirspeedHold == 1) || (EngN1 == 1)))
{
LvlChg = (LvlChg == 0) ? 1 : 0; // toggle
if (LvlChg == 1) // level change
{
AltitudeLock = 0; // off
FsWriteInt(FS_AP_ALTITUDELOCK, LvlChg); // activate
x = Altitude * 65536 / 100 * 3048; // in meters * 65536
AltitudeSave = Altitude; // save for AltInt
FsWriteInt(FS_AP_ALTITUDE, x * 19975);
FsWriteInt(FS_AP_VSHOLD, 0);
FsbusWrite(C_LLVLCHG, LvlChg); // sync lvl change
if (ActAlt < Altitude) // climbing
{
EngN1 = 0; // force N1 off
//EventHandler(C_SN1, 0, 0); // toggle -> on
FsWriteInt(FS_AP_VS, 800); // default climb speed
}
else // descending
{
AirspeedHold = 0; // force IAS off
//EventHandler(C_SSPDHLD, 0, 0); // toggle -> on
FsWriteInt(FS_AP_VS, -800); // default desc. speed
}
}
else // no level change
{
AltitudeLock = 1; // on
FsbusWrite(C_LLVLCHG, LvlChg); // lvl-swtch
}
FsbusWrite(C_LALTITUDELOCK, AltitudeLock); // update altitude lock
}
break;
case C_SHEADINGLOCK:
if (val == 0) // button push only
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
HeadingLock = (HeadingLock == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_HEADINGLOCK, HeadingLock);
}
break;
case C_SVORLOC:
break;
case C_SAPP:
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
if (val == 0) // button push only
{
ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
}
break;
case C_SALTHLD:
if (val == 0)
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
AltitudeLock = (AltitudeLock == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_ALTITUDELOCK, AltitudeLock);
printf("C_SALTHLD AltitudeLock=%d\n", AltitudeLock);
FsbusWrite(C_LALTITUDELOCK, AltitudeLock);
}
break;
case C_SALTINTV:
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
if (val == 0) // button push only
{
if (AltitudeSave != Altitude) // changed by pilot
{
AltitudeSave = Altitude; // save for AltInt
x = Altitude * 65536 / 10000 * 3048; // in meters * 65536
}
else // unchanged
{
AltitudeSave = ActAlt; // save for AltInt
x = (ActAlt + 50) / 100 * 100; // round to 100
x = x * 65536 / 10000 * 3048; // in meters * 65536
AltitudeLock = 1;
FsbusWrite(C_LALTITUDELOCK, AltitudeLock);
LvlChg = 0;
FsbusWrite(C_LLVLCHG, LvlChg);
}
FsWriteInt(FS_AP_ALTITUDE, x); // new AP altitude
}
break;
case C_SVSPEEDHLD:
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
if (val == 0) // button push only
{
VertspeedHold = (VertspeedHold == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_VSHOLD, VertspeedHold);
}
break;
case C_SCMDA:
if ((val==0) && (Disengage == 0)) // button push only
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
Cmda = (Cmda == 0) ? 1 : 0; // toggle
if (Cmda == 0)
FsbusWrite(C_LCMDA, 0);
else
{
FsbusWrite(C_LCMDA, 1);
FsbusWrite(C_LCMDB, 0);
FsbusWrite(C_LCWSA, 0);
FsbusWrite(C_LCWSB, 0);
FsWriteInt(FS_AP_MASTER, 1);
}
}
break;
case C_SCMDB:
if ((val==0) && (Disengage == 0)) // button push only
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
Cmdb = (Cmdb == 0) ? 1 : 0; // toggle
if (Cmdb == 0)
FsbusWrite(C_LCMDB, 0);
else
{
FsbusWrite(C_LCMDB, 1);
FsbusWrite(C_LCWSA, 0);
FsbusWrite(C_LCWSB, 0);
FsWriteInt(FS_AP_MASTER, 1);
}
}
break;
case C_SCWSA:
if ((val==0) && (Disengage == 0)) // button push only
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
Cwsa = (Cwsa == 0) ? 1 : 0; // toggle
if (Cwsa == 0)
FsbusWrite(C_LCWSA, 0);
else
{
FsbusWrite(C_LCMDA, 0);
FsbusWrite(C_LCMDB, 0);
FsbusWrite(C_LCWSA, 1);
FsbusWrite(C_LCWSB, 0);
FsWriteInt(FS_AP_MASTER, 1);
}
}
break;
case C_SCWSB:
if ((val==0) && (Disengage == 0)) // button push only
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
Cwsb = (Cwsb == 0) ? 1 : 0; // toggle
if (Cwsb == 0)
FsbusWrite(C_LCWSB, 0);
else
{
FsbusWrite(C_LCMDA, 0);
FsbusWrite(C_LCMDB, 0);
FsbusWrite(C_LCWSA, 0);
FsbusWrite(C_LCWSB, 1);
FsWriteInt(FS_AP_MASTER, 1);
}
}
break;
case C_SAPDISENGAGE:
if (val==0) // button push only
{
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
Disengage = (Disengage == 0) ? 1 : 0; // toggle
if (Disengage == 0)
{
FsbusWrite(C_LAPDISENGAGEL, 0);
FsbusWrite(C_LAPDISENGAGER, 0);
}
else
{
FsbusWrite(C_LAPDISENGAGEL, 1);
FsbusWrite(C_LAPDISENGAGER, 1);
FsbusWrite(C_LCMDA, 0);
FsbusWrite(C_LCMDB, 0);
FsbusWrite(C_LCWSA, 0);
FsbusWrite(C_LCWSB, 0);
FsWriteInt(FS_AP_MASTER, 0);
}
}
break;
case FS_AP_MASTER:
break;
case FS_AP_WINGLEVELER:
break;
case FS_AP_NAV1LOCK:
break;
case FS_AP_HEADINGLOCK:
HeadingLock = val;
FsbusWrite(C_LHEADINGLOCK, val);
break;
case FS_AP_HEADING:
APHeading = (val + 1) * 360 / 65536; // (+1 for rounding)
if (APHeading == 0)
APHeading = 360;
FsbusWrite(C_DHEADING, APHeading);
break;
case FS_NAV1OBS:
Course = val;
if (Course == 0)
Course = 360;
FsbusWrite(C_DCOURSEL, Course);
FsbusWrite(C_DCOURSER, Course);
break;
case FS_AP_ALTITUDELOCK:
AltitudeLock = val;
FsbusWrite(C_LALTITUDELOCK, val);
break;
case FS_AP_ALTITUDE:
Altitude = (val / 3048 * 2500 + 8192) / 16384; // to feet
FsbusWrite(C_DALTITUDE, Altitude);
break;
case FS_ALTITUDE:
ActAlt = val * 10000 / 3048; // to feet
if ((ActAlt > 25500) && (ActAlt < 26500))
{
if ((MachSpeed == 0) && (ActAlt > 26000))
cbModecontrolpanel(C_SCHANGEOVER,0,0);
else if ((MachSpeed == 1) && (ActAlt < 26000))
cbModecontrolpanel(C_SCHANGEOVER,0,0);
}
if (abs(Altitude - ActAlt) < 10)
{
LvlChg = 0;
FsbusWrite (C_LLVLCHG , LvlChg);
FsbusWrite (C_LALTITUDELOCK , 1);
}
break;
case FS_AP_VS:
Vertspeed = val;
FsbusWrite(C_DVSPEED, Vertspeed);
break;
case FS_AP_RPMHOLD:
break;
case FS_AP_RPM:
break;
case FS_AP_GLIDESLOPEHOLD:
break;
case FS_AP_APPROACHHOLD:
ApproachHold = val;
FsbusWrite(C_LAPP, ApproachHold);
break;
case FS_FLIGHTDIRECTOR:
if (bSynchronised == false)
{
if (val == 1)
{ printf("C_SFLIGHTDIRL event, ValFlightDir=%d\n", ValFlightDir);
FsbusWrite(C_LFLIGHTDIRL, 1);
FsbusWrite(C_LMASTFLIGHTL, 1);
FsbusWrite(C_LFLIGHTDIRR, 0);
FsbusWrite(C_LMASTFLIGHTR, 0);
// FsWrite(FS_FLIGHTDIRECTOR,1);
ValFlightDir = 1;
}
else
{
FsbusWrite(C_LFLIGHTDIRL, 0);
FsbusWrite(C_LMASTFLIGHTL, 0);
FsbusWrite(C_LFLIGHTDIRR, 0);
FsbusWrite(C_LMASTFLIGHTR, 0);
// FsWrite(FS_FLIGHTDIRECTOR,0);
ValFlightDir = 0;
}
}
break;
case FS_ENGINE1N1:
Engine1N1 = val * 100 / 16384;
break;
case FS_ENGINE1N2:
Engine1N2 = val * 100 / 16384;
break;
}
}
sgaert
01-18-2011, 09:54 AM
Here is the problem, when intercepting the ILS vectors, we press the APP button which turns off the AP HDG and stays horizonatally aligned with the runway, but it does not follow the glide slope down to the runway, the ALT remains on and the aircraft maintains it's altitude.
Ok, what Aircraft do you use?
Do you press the VorLoc befor you press the App?
Can you compare alle the MCP Offsets with FSinterogate, test one Software panel only, second test with hardware.
I donīt know your code. It looks like FS default but without knowing the offset i canīt say anything.
But as first, i also told that Shearder via skype there is no VORLOC funktion.
case C_SAPP:
//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
if (val == 0) // button push only
{
ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
}
break;
That is the App, it only writes 0 or 1 to an offset, the fsbus code donīt makes more. The rest do only the aircraft by it self.
I would start writing the a new MCP code.
Stefan
RobiD
01-20-2011, 08:27 AM
Stefan,
I am testing this in a 737.
When I just use FSX, it works fine and I don't push VOR LOC it intercepts the GS and holds runway heading (basically lands itself).
With FSInterrogate, here are my findings:
When just using FSX (this can be with FSBus running, but pressing the buttons in the VC with the mouse)
When you select APP, 07C8 (APHeadingHold) turns off (goes from a 1 to a 0) as it intercepts the ILS (horizontal) and then 07D0 (APAltitude Hold) turns off as it intersects the glideslope. Also at the same time as pressing APP, the following two offsets turn on: 07FC (AP GSHold), and 0800 (AP Approach Hold).
Same situation, this time just using the buttons on my MCP through FSBUS:
When you select APP, 07C8 (APHeadingHold) turns off (goes from a 1 to a 0) as it intercepts the ILS (horizontal) but 07D0 (APAltitude Hold) does not turn off as it intersects the glideslope. Also at the same time as pressing APP, the following offset turn on: 0800 (AP Approach Hold).
07FC (AP GSHold) does not turn on, which I think is why APAltitude Hold does not turn off as it intersects the glideslope.
Does this give any clarity?
Here is the code I have relating to the last two offsets:
case FS_AP_GLIDESLOPEHOLD:
break;
case FS_AP_APPROACHHOLD:
ApproachHold = val;
FsbusWrite(C_LAPP, ApproachHold);
break;
Thanks
David
PS I hope this makes sense.
sgaert
01-20-2011, 08:56 AM
I would write the MCP new, if you use the default 737 use that MCP as sample.
RobiD
01-20-2011, 09:08 AM
Ok, after much testing, here is the solution!!!
Add this at the top with the rest of the static int:
static int GlideslopeHold = 0;
Then uncomment out:
MkFsObject(FS_AP_GLIDESLOPEHOLD, "",cbModecontrolpanel, 0x07FC, 4, TP_UI32, FS_NORMAL, 0);
Then change this:
case C_SAPP:
if (val == 0) // button push only
{
ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
}
break;
to this:
case C_SAPP:
if (val == 0) // button push only
{
ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
GlideslopeHold = (GlideslopeHold == 0) ? 1 : 0;
FsWriteInt(FS_AP_GLIDESLOPEHOLD, GlideslopeHold);
}
break;
Have tested and works for me.
Let me know if it works for you too.
David
RobiD
01-22-2011, 01:22 AM
Need your help again Stefan.
I am programming a stepper driven ADF/RMI.
I just need help with the details in the code. I have pasted the basic template below and would be very gratefull for your help to complete.
It is driven by 2 stepper motors, one for the ADF Dial Heading(compass card) and the other motor drives the ADF Relative Bearing indicator needle.
I also have a rotary to adjust the compass card.
I have also layed it out using Dirk's example of using only one file which is the .cpp if I understand correctly and do not need the .h file.
Thanks as always.
David
#include "stdafx.h"
#include "fsbus.h"
void cbSteppergauges(int oid, int val, double dval);
#define FS_ADF1RELATIVEBEARING 1
#define FS_ADF1DIALBEARING 2
#define C_ADFCOMPASSCARD 3
#define C_ADFBEARINGNEEDLE 4
#define C_ADFROSEADJUST 5
void cbSteppergaugesBuildObjects()
{
MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle", cbSteppergauges, 0x0C6A, 2, TP_I16, FS_NORMAL,0);
MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card", cbSteppergauges, 0x0C6C, 2, TP_I16, FS_NORMAL,0);
MkFsbusObject(BTP_V_OUT, C_ADFCOMPASSCARD,"",NULL,30,80,0);
MkFsbusObject(BTP_V_OUT, C_ADFBEARINGNEEDLE,"",NULL,29,80,0);
MkFsbusObject(BTP_ROTARY, C_ADFROSEADJUST, "",cbModecontrolpanel, 27, 14, 0);
}
{
switch(oid)
{
case FS_ADF1RELATIVEBEARING:
FsbusWrite(C_ADFBEARINGNEEDLE, ????);//should this be FsbusWriteFmtVar()
break;
case FS_ADF1DIALBEARING:
FsbusWrite(C_ADFCOMPASSCARD, ????);//should this be FsbusWriteFmtVar()
break;
case C_ADFROSEADJUST:
// this rotary will move the compass rose left or right (FS_ADF1DIALBEARING)
FsWriteInt(FS_ADF1DIALBEARING, val??);
break;
}
}
sgaert
01-22-2011, 04:28 AM
Hi David,
The stepper outputs use the FsbusWriteFmtVar(cid,rid,value) function.
You donīt need to define a stepper.
Stefan
RobiD
01-22-2011, 07:43 AM
Ok, is this getting closer?
Also is my rotary code correct?
Also, is this written correctly (do I need to have more than just 'val' there:
case FS_ADF1RELATIVEBEARING:
FsbusWriteFmtVar(29,80,val);
break;
Thanks
David
#include "stdafx.h"
#include "fsbus.h"
void cbSteppergauges(int oid, int val, double dval);
#define FS_ADF1RELATIVEBEARING 1
#define FS_ADF1DIALBEARING 2
//#define C_ADFCOMPASSCARD 3 / not needed
//#define C_ADFBEARINGNEEDLE 4 / not needed
#define C_RADFROSEADJUST 5
static int ADFroseadjust = 0;
void cbSteppergaugesBuildObjects()
{
MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle", cbSteppergauges, 0x0C6A, 2, TP_I16, FS_NORMAL,0);
MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card", cbSteppergauges, 0x0C6C, 2, TP_I16, FS_NORMAL,0);
//MkFsbusObject(BTP_V_OUT, C_ADFCOMPASSCARD,"",NULL,30,80,0);Not needed
//MkFsbusObject(BTP_V_OUT, C_ADFBEARINGNEEDLE,"",NULL,29,80,0);Not needed
MkFsbusObject(BTP_ROTARY, C_RADFROSEADJUST, "",cbModecontrolpanel, 27, 26, 0);
}
{
switch(oid)
{
case FS_ADF1RELATIVEBEARING:
FsbusWriteFmtVar(29,80,val);
break;
case FS_ADF1DIALBEARING:
FsbusWriteFmtVar(30,80,val);
break;
case C_RADFROSEADJUST:
ADFroseadjust -= val;
while (ADFroseadjust > 360)
ADFroseadjust -= 360;
while (ADFroseadjust <=0)
ADFroseadjust += 360;
x = (ADFroseadjust % 360)
FsWriteInt(FS_ADF1DIALBEARING,x);
break;
}
}
sgaert
01-22-2011, 08:08 AM
Did you write a small programm to test your steppers wih the stepper board?
Here my programm:
#include "stdafx.h"
#include "fsbus.h"
int _tmain(int argc, _TCHAR* argv[])
{
CheckIn();
BOOL b = FsbusOpen("COM3");
FsbusWriteFmtVar(29, 80, 0);
FsbusMux(2000);
FsbusWriteFmtVar(29, 80, 2000);
FsbusMux(2000);
FsbusWriteFmtVar(29, 80, 0);
FsbusMux(2000);
CheckOut();
return 0;
}
RobiD
01-22-2011, 08:17 AM
I tested the stepper boards when Dirk sent through some sample code some time ago (He used v1 of the dll to test it though, I think you pointed that out).
So, I know the boards work.
This was what I used (pretty well just minor changes to your code)
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
CheckIn();
BOOL b = FsbusOpen("COM1");
FsbusWriteFmtVar(29, 80, 0);
FsbusMux(2000);
FsbusWriteFmtVar(29, 80, 100);
FsbusMux(2000);
FsbusWriteFmtVar(29, 80, 0);
FsbusMux(2000);
CheckOut();
return 0;
}
So, how am I doing with the code I've written so far for the ADF.
I am getting 1 compiling error though: steppergauges.cpp(22) : error C2447: '{' : missing function header (old-style formal list?)
This is the code exactly to this minute that is producing the error:
#include "stdafx.h"
#include "fsbus.h"
void cbSteppergauges(int oid, int val, double dval);
#define FS_ADF1RELATIVEBEARING 1
#define FS_ADF1DIALBEARING 2
//#define C_ADFCOMPASSCARD 3
//#define C_ADFBEARINGNEEDLE 4
#define C_RADFROSEADJUST 5
static int ADFroseadjust = 0;
void cbSteppergaugesBuildObjects()
{
MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle", cbSteppergauges, 0x0C6A, 2, TP_I16, FS_NORMAL,0);
MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card", cbSteppergauges, 0x0C6C, 2, TP_I16, FS_NORMAL,0);
//MkFsbusObject(BTP_V_OUT, C_ADFCOMPASSCARD,"",NULL,30,80,0);
//MkFsbusObject(BTP_V_OUT, C_ADFBEARINGNEEDLE,"",NULL,29,80,0);
MkFsbusObject(BTP_ROTARY, C_RADFROSEADJUST, "",cbModecontrolpanel, 27, 26, 0);
}
void cbSteppergauges(int oid, int val, double dval);
{
int x;
switch(oid)
{
case FS_ADF1RELATIVEBEARING:
FsbusWriteFmtVar(29,80,val);
break;
case FS_ADF1DIALBEARING:
FsbusWriteFmtVar(30,80,val);
break;
case C_RADFROSEADJUST:
ADFroseadjust -= val;
while (ADFroseadjust > 360)
ADFroseadjust -= 360;
while (ADFroseadjust <=0)
ADFroseadjust += 360;
x = (ADFroseadjust % 360);
FsWriteInt(FS_ADF1DIALBEARING,x);
break;
}
}
Once I get it to compile, should I just test it with the gauge and see what happens?
David
sgaert
01-22-2011, 08:19 AM
try that test with the V3 dll. that works in my sample.
Edit: donīt!!!
void cbSteppergauges(int oid, int val, double dval);
has to be
void cbSteppergauges(int oid, int val, double dval)
RobiD
01-22-2011, 08:53 AM
Great, compiles now.
So looking back at some code you worked with me on for my Altitude gauge, I can see how 'val' is worked out.
case FS_ALTIMETERFEET:
val=val/5; // 1000feet for 360° are 200 steps (1000/200)
//printf("Altimeter Feet %d\n", val);
FsbusWriteFmtVar(8, 80,val);
break;
So for the 'val' in the ADF code, I need to work out the number of steps to 360 deg, and divide the value by that as in the sample above. Am I correct?
Thanks
sgaert
01-22-2011, 09:04 AM
sounds perfect. if you have a gear dont forget it.
A 200step neadle on a 360° scale donīt perfect.
RobiD
01-22-2011, 09:09 AM
I do have gears so I will work it out.
I am trying to print the value of the ADF needle and the ADF rose face, and I don't seem to be getting anything.
Here's what I have (I have the same for the altitude and it prints it fine):
case FS_ADF1RELATIVEBEARING:
val=val/1; // 360° are ? steps
printf("ADF relative bearing %d\n", val);
FsbusWriteFmtVar(29,80,val);
break;
sgaert
01-22-2011, 09:13 AM
I am trying to print the value of the ADF needle and the ADF rose face, and I don't seem to be getting anything.
if i understand that right, you whant to have a output like:
Input value: 12345 Needle Position: 67890
right??
RobiD
01-22-2011, 09:19 AM
Well, it's not really important to have as I can get these figures from FSInterrogate. I was just wondering why it isn't printing any value at all when I move the needle or the dial face.
Also, the ADF Dial heading works on a simple 0 - 360, but the Needle works on -179.9 to 0 to 179.9 0 being at the top, -179 being to the left and +179 to the right. Will I need to write the needle differently?
sgaert
01-22-2011, 09:28 AM
Yes, but i woudl try somethink like
case that with the -179 to 179:
val = val + 179;
than you have your 0 in the -179 positon.
but!!
if (val >=0)
{
val = ( val+1);
}
RobiD
01-22-2011, 09:39 AM
Ah ha, then I can use the 360degress divided by how many steps the motor has in 360deg. I would never have thought of that.
Thank you.
So now I have:
case FS_ADF1RELATIVEBEARING:
val = val + 179;
if (val >=0)
{
val = (val+1);
}
printf("ADF relative bearing %d\n", val);
FsbusWriteFmtVar(29,80,val);
break;
Any idea why it's still not showing anything is the DOS box for the print function?
sgaert
01-22-2011, 09:43 AM
is a change on FS_ADF1RELATIVEBEARING?
RobiD
01-22-2011, 09:52 AM
Yes, when I input the NDB frequency, the needle swings around. In FSInterrogate, this produces changes. My understanding is that there should be a value to print somewhere between -179.9 to 179.9 that should be displayed. (it should be between 0 and 360 with the changes you suggested).
sgaert
01-22-2011, 10:10 AM
Yes it has to show something between 0 and 360.
Why it donīt do it, i donīt know. The code looks ok. but i donīt test it with a compiler.
Stefan
RobiD
01-22-2011, 10:15 AM
Can't get my head around why it won't show anything either. Perhaps it's because it's after midnight here and I think my brain is fried for the night. I will look at again in the morning and see if I can make any sense of it.
Thanks again.
RobiD
01-23-2011, 01:13 AM
Stefan,
The steppers I have are 7.5 deg (48 steps) with the gearing I have, it takes 12 revolutions of the stepper for 360 degrees on both the needle and the rose face, so by my understanding, there are 576 steps for 360 deg.
So how would I reflect this in the code?
Thanks
RobiD
01-23-2011, 07:21 AM
For the ADF compass rose, I have this code:
case FS_ADF1DIALBEARING:
val=val/0.625; // 360° are 576 steps (48 steps for 1 revolution on the stepper, and 12 revolution for 360 deg) (360/576) **this is line (38) in the warning message below
printf("ADF dial bearing, val=%d\n", val);
FsbusWriteFmtVar(30,80,val);
break;
Then for the ADF relative Bearing needle:
case FS_ADF1RELATIVEBEARING:
x = val + 179;
if (x >=0)
{
x = (x+1);
}
printf("%d\n", val);
FsbusWriteFmtVar(29,80,x/0.625);// This is line (33) in the warning below
break;
Is this correct? Also, I am getting two warnings (still compling)(obviously it's not right or I guess I wouldn't be getting these messages):
steppergauges.cpp(33) : warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data
steppergauges.cpp(38) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
Linking...
Thanks
David
sgaert
01-24-2011, 07:21 AM
That is my Code Idea for case FS_ADF1RELATIVEBEARING.
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleMulti;
static int ADF1RelNeedleDeg = 360;
static int ADF1RelNeedleStep = 576;
case FS_ADF1RELATIVEBEARING:
ADF1RelNeedleMulti = ADF1RelNeedleDeg / ADF1RelNeedleStep;
ADF1RelDataIn = val + 179;
if (ADF1RelDataIn >=0)
{
ADF1RelDataIn = (ADF1RelDataIn+1);
}
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
break;
Non tested!!!!!
RobiD
01-24-2011, 07:46 AM
Wow, that's a lot more complex.
I'm looking forward to trying it out.
I'll let you know as soon as I can test it.
One question: Why is there the two lines of code after the FsbusWriteFmtVar line ie:
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
break;
I can understand (I think) the rest of the code (very clever!).
Thanks Stefan.
David
sgaert
01-24-2011, 08:23 AM
i calculate the difference to the last event, so i dont have problems with back turning on a change from 355° to 010° and other situations.
With the last two lines i save the current status.
Stefan
RobiD
01-24-2011, 07:32 PM
Hi Stefan,
I've put the code into my project, compiles fine.
I still cannot get a value using printf. My concern is that there is no value being read (FSInterrogate shows the value changing as the needle moves, but the FsBus Dos box does not show any value.
Does this indicate that there is 'no' value coming into the code for it to be used?
So I am getting no value for either of the two offsets I'm using:
MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle", cbSteppergauges, 0x0C6A, 2, TP_I16, FS_NORMAL,0);
MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card", cbSteppergauges, 0x0C6C, 2, TP_I16, FS_NORMAL,0);
So I feel something is wrong in the code that it is showing no value.
Thanks
David
RobiD
01-24-2011, 08:54 PM
Just another point, in the DOS box when FsBus is running, it now displays the following:
FSBUS.DLL (take out the version number)
www.fsbus.de
FS objects ......... 62
enabled .................... 62
disabled ................... 0
polling .................... lazy:0, normal:55, quick:4
FSBUS objects ...... 128
enabled .................... 128
disabled ................... 0
button,switch .............. 47
rotary ..................... 13
analog in .................. 0
led, digital out ........... 35
7 segment display .......... 18
servo, analog out .......... 15
stepper .................... 0
Timer objects ...... 0
Sound objects ...... 0
running ...Altimeter Feet 5
press any key to exit ...
It now shows what is connected. Is this information gathered from the code? If so, it doesn't seem to recognise that I have 3 steppers attached.
Also, just to be sure the steppers were working, I redid the little motor test code, and it all worked fine.
David
RobiD
01-24-2011, 09:11 PM
Here's just another bit of info that may help.
I did some experimenting with printf.
If I put a basic line like: printf("whiskeycompass"); in any other .cpp file, it displays it in the dos box, when I put it into the Stepper gauges .cpp file, it does not show it in the dos box. (hope that makes sense). It is almost like the steppergauges.cpp file is not being included in the project.
Does that help any?
sgaert
01-25-2011, 02:30 AM
Wrong!
void cbSteppergauges(int oid, int val, double dval);
Right!!!
void cbSteppergauges(int oid, int val, double dval)
With the ";" you close the function.
RobiD
01-25-2011, 06:17 AM
Hmmm, I've had some success.
I've taken the code out of the steppergauges.cpp files and put it into gauges.cpp (which I know works, and the printf works)
So this is the code I have so far in this file:
case FS_ALTIMETERFEET:
val=val/5; // 1000feet for 360° are 200 steps (1000/200)
printf("Altimeter Feet %d\n", val);
FsbusWriteFmtVar(8, 80,val);
break;
case FS_ADF1DIALBEARING:
x=0.625;(I have 576 steps to 360 degrees, which means for each degree it's 0.6 of a step)
val=val/x; (When I do it like this, I have a compiling warning, so obviously this is wrong)
FsbusWriteFmtVar(30,80,val);
printf("ADF Dial Bearing %d/n",val);
break;
So now I'm getting data with the printf.
The stepper for the Altitude does not correlate with the altimeter on the screen, and it's randomly moving forwards and backwards. When it zeros itself on start up, the stepper is smooth and accurate to the zero. Any thoughts?
sgaert
01-25-2011, 06:46 AM
yes analyse the data and build a calibration.
Edit:
case FS_ADF1DIALBEARING:
Work like the same code that i send if my code workes.
RobiD
01-25-2011, 07:01 AM
Some feedback from the code you put together for me:
case FS_ADF1RELATIVEBEARING:
ADF1RelNeedleMulti = ADF1RelNeedleDeg / ADF1RelNeedleStep;
ADF1RelDataIn = val + 179;
if (ADF1RelDataIn >=0)
{
ADF1RelDataIn = (ADF1RelDataIn+1);
}
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("Relative Bearing %d/n",ADF1RelNeedlegoto);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
break;
I am getting an error: > Davids Flight sim.exe!cbGauges(int oid=510, int val=6140, double dval=0.00000000000000000) Line 209 + 0x6 bytes C++
Line 209 is: ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
I am getting data in, here is the datum:
ADF1RelDataDif 6320 int
ADF1RelDataIn 6320 int
ADF1RelDataSave 0 int
ADF1RelNeedleDif 0 int
ADF1RelNeedleMulti 0 int
Unhandled exception at 0x0041282d in Davids Flight sim.exe: 0xC0000094: Integer division by zero.
Next question is how do I use the calibrate function in this situation using steppers?
sgaert
01-25-2011, 07:16 AM
Integer division by zero.
Yes, that is stupid.
you said that the data range is -179 to 179 but the read value is 6140 or 6320.
Please find the right data range in fsuipc.
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d/n",val);
break;
Than we can start to fix the code.
Next question is how do I use the calibrate function in this situation using steppers?
like servos, Analog In or Out.
But not at looping situations, like Compas, RMI,.....
Stefan
RobiD
01-25-2011, 07:55 AM
It's giving a different range using the printf than in FSInterrogate.
at 12 o'clock = 0
at 3 o'clock = 16400
at 6 o'clock =-32780 or 32780
at 9 o'clock = -16400
As for the calibrate function, all these gauges are looping types.
The ADF compass rose face is producing this data with the printf:
North 360/0
E 90
S 180
W 270
So 360 degrees and I have 576 steps for this one too.
sgaert
01-25-2011, 08:20 AM
Try code like that to stop the division by Zero.
case FS_ADF1RELATIVEBEARING:
ADF1RelNeedleMulti = (1000 * ADF1RelNeedleDeg) / ADF1RelNeedleStep;
ADF1RelDataIn = val + 32780;
// if (ADF1RelDataIn >=0)
// {
// ADF1RelDataIn = (ADF1RelDataIn+1);
// }
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
ADF1RelNeedleDif = (ADF1RelDataDif * 1000) / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto/1000);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
break;
RobiD
01-25-2011, 08:41 AM
Implemented the changed code and the printf produces '26' regardless of the needle position.
Odd!
sgaert
01-25-2011, 08:49 AM
that is the point i canīt help. Nomaly i start the debuger than you se what happends.
I is only math, you need to find the right calculation.
Stefan
RobiD
01-30-2011, 07:39 AM
Thanks Stefan. I'll battle on. I have one more question.
Using your little motor testing code, it takes 2355 to make the rose go around 360deg. Does this mean that there is 2355 steps in 360degs? If so, it changes the code I'm working on drastically.
Here's my code to turn the rose 360 just so you're clear on what I mean.
FsbusWriteFmtVar(30,80,0);
FsbusMux(2000);
FsbusWriteFmtVar(30,80,2355);
FsbusMux(8000);
FsbusWriteFmtVar(30,80,0);
FsbusMux(8000);
sgaert
01-30-2011, 04:56 PM
Thatīs right
RobiD
01-31-2011, 06:31 AM
Stefan,
I am getting this error now:
Run-Time Check Failure #2 - Stack around the variable 'buf' was corrupted.
From reading, and if I understand correctly, is this a problem with the dll, or my code.
It seems to be around the ADF needle code. When I tune the ADF, it is ok for a while, then produces this error.
Any idea what it's telling me?
Thanks
David
sgaert
01-31-2011, 06:34 AM
do you named a variable 'buf' ?
RobiD
01-31-2011, 06:37 AM
No. I have no variable "buf".
Doing a little research, this type of error seems to indicate that something is being written to the wrong address, or something is not being cleared from that address before more data is being written to the same address.
I'm probably completely off track with my understanding.
David
sgaert
01-31-2011, 06:40 AM
Ok Thanks.
On Feb. 19 i have a meeting with Dirk and Rob is will that error message to my todo list.
Please count the errors and try to find the situation to generate the error.
Stefan
RobiD
01-31-2011, 06:43 AM
Will do. I'll try to give you as much info as possible.
RobiD
01-31-2011, 07:03 AM
So it's around this piece of code
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = (1000 * ADF1RelNeedleDeg) / ADF1RelNeedleStep;
ADF1RelDataIn = val + 32780;
if (ADF1RelDataIn >=0)
{
ADF1RelDataIn = (ADF1RelDataIn+1);
}
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
ADF1RelNeedleDif = ADF1RelNeedleMulti / ADF1RelDataDif;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto/1000);
printf("Relative Bearing %d\n",ADF1RelNeedlegoto/1000);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
//printf("ADF1RelNeedleMulti: %d\n",ADF1RelNeedleMulti);
//printf("ADF1RelNeedleDeg: %d\n",ADF1RelNeedleDeg);
//printf("ADF1RelNeedleStep: %d\n",ADF1RelNeedleStep);
//printf("ADF1RelDataIn: %d\n",ADF1RelDataIn);
//printf("ADF1RelDataDif: %d\n",ADF1RelDataDif);
//printf("ADF1RelNeedledif: %d\n",ADF1RelNeedlegoto);
break;
This bit in particular:
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto/1000);
printf("Relative Bearing %d\n",ADF1RelNeedlegoto/1000);
With the /1000, the printf data stays at 0 to 4.
If I delete the /1000 I now get some useful figures, but it triggers the error. The error is produced even if I try /10, /100
Hope that give some useful info.
Let me know what the follow up is of the meeting.
Thanks
David
sgaert
01-31-2011, 07:08 AM
This bit in particular:
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto/1000);
printf("Relative Bearing %d\n",ADF1RelNeedlegoto/1000);
With the /1000, the printf data stays at 0 to 4.
If I delete the /1000 I now get some useful figures, but it triggers the error. The error is produced even if I try /10, /100
The problem is i canīt see what is inside of all the other variables that we use in the case.
Solution one, make a printf with all variables.
Solution two, we look together to the code/debuger with Teamviewer.
Stefan
RobiD
01-31-2011, 07:14 AM
Which is the easiest to do?
sgaert
01-31-2011, 07:18 AM
Nomaly Solution two with Teamviewer and Skype.
But if you have time iīm at work, we can try it on a weekend.
Teamviewer i can all the time but no Skype Voice.
RobiD
01-31-2011, 07:20 AM
I have just installed Teamviewer, and I can set up Skype.
Give me a time and day that would suit you.
David
sgaert
01-31-2011, 07:29 AM
As you like but not tomorow.
RobiD
01-31-2011, 07:38 AM
Could we look at Thursday evening around 8.30pm (GMT+10.00 Brisbane Australia)?
This would be about Thursday 11.30am your time. Would you prefer to leave it until the weekend?
sgaert
01-31-2011, 08:13 AM
ok, lets try that.
RobiD
01-31-2011, 08:18 AM
I'll PM you my log in code for Teamview on Thursday.
RobiD
02-03-2011, 05:09 AM
Stefan,
Change in plans. (Not my choice). Can we make it sometime over the weekend?
Thanks
David
sgaert
02-03-2011, 06:05 AM
Ok no problem!
RobiD
02-06-2011, 06:14 AM
Stefan,
Can we lock in 8.30pm Brisbane time on Tuesday night? (That would be about 11.30am Tuesday your time).
Thanks
David
sgaert
02-06-2011, 04:58 PM
ok, i will be there.
sgaert
02-08-2011, 08:35 AM
David,
if you finished the code please post them.
The version here has the 2 bugs.
Stefan
RobiD
02-08-2011, 08:59 AM
Hi Stefan,
Thank you again for your time.
I'll post the code as it stands now.
I checked the number of steps in 360 deg and now have 1150. I have adjusted the code accordingly. The needle is still moving much further than the needle in FSX, so I may need to divide the final output to get the right number of steps.
Also, how does this gauges sync with FSX?
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
float ADF1RelNeedleMulti;
//static int ADF1RelNeedleMulti;
static int ADF1RelNeedleDeg = 360;
//static int ADF1RelNeedleStep = 2355;
static int ADF1RelNeedleStep = 1150;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleStep/ADF1RelNeedleDeg;
//ADF1RelNeedleMulti = ADF1RelNeedleDeg / ADF1RelNeedleStep;
//ADF1RelNeedleMulti = ADF1RelNeedleDeg) / ADF1RelNeedleStep;
ADF1RelDataIn = val + 32780;
if (ADF1RelDataIn >=0)
{
ADF1RelDataIn = (ADF1RelDataIn+1);
}
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("Relative Bearing: %d NeedleDif: %d NeedleSave: %d\n",ADF1RelNeedlegoto, ADF1RelNeedleDif, ADF1RelNeedleSave);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
//printf("ADF1RelNeedleMulti: %d\n",ADF1RelNeedleMulti);
//printf("ADF1RelNeedleDeg: %d\n",ADF1RelNeedleDeg);
//printf("ADF1RelNeedleStep: %d\n",ADF1RelNeedleStep);
//printf("ADF1RelDataIn: %d\n",ADF1RelDataIn);
//printf("ADF1RelDataDif: %d\n",ADF1RelDataDif);
//printf("ADF1RelNeedledif: %d\n",ADF1RelNeedlegoto);
break;
sgaert
02-08-2011, 09:29 AM
The needle is still moving much further than the needle in FSX, so I may need to divide the final output to get the right number of steps.
Not devide only subtract. Is the differenc always the same?
You can also change float ADF1RelNeedleMulti; to static int ADF1RelNeedleMulti;.
RobiD
02-08-2011, 09:37 AM
I am getting an error message on compiling.
I'm not in front of my FSX computer, but it is something about converting int to double (or the other way around) and some data may be lost.
The difference does seem to be consistent.
What changes will occur changing the float bact to a static int?
Thanks
RobiD
02-08-2011, 09:40 AM
I would be substracting from the FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto); line.
So could I write something like this just as an example:
FsbusWriteFmtVar(29,80,(ADF1RelNeedlegoto - 100));
sgaert
02-08-2011, 11:10 AM
I am getting an error message on compiling.
I'm not in front of my FSX computer, but it is something about converting int to double (or the other way around) and some data may be lost.
The difference does seem to be consistent.
What changes will occur changing the float bact to a static int?
Thanks
In the devision you have a resoult with ,xxx that is not possible with int.
Let is as flot, it is ok.
So could I write something like this just as an example:
FsbusWriteFmtVar(29,80,(ADF1RelNeedlegoto - 100));
Right! But only in case that the differenz is always the same.
Stefan
shearder
02-09-2011, 02:17 AM
Ok i have a problem - the same that has always plagued me. I had modified 12way rotary switches for "encoders" and they worked well. BUT - what i found was that from time to time i would turn them and then suddenly they "lost" their settings and just increased the value either way it was turned so i had to go into FSBUS and digital IN settings and reset it to be a 4 tep or whatever.
I got a prompt from Stefan to change the BO bits which i did to 4v. Then i also bought some proper encoders which work GREAT! and they are smooth and are absolutely fantastic. BUT - here is the problem again!!
I will be using my MCP and it works like a charm but then at some stage i will start to change the CRS once i know which runway i will be using and i start turning the encoder then what happens - while i turn it it seems the digits "stick" and then eventually stop changing and then i have to go into FSBUS again Digital IN and set it again to an encoder!!
This happens almost all the time. SO i thought my problem was sorted and spent more money (not a problem as it is better) but my problem remains and i have to keep resetting the rotaries so they act properly.
I don't want to even think about having to constantly reset my switches etc so they work each time i want to fly.
I have even re flashed the 8535 and set the bits etc a couple of times and doesn't seem to fix this. I am lost!
Sean
sgaert
02-09-2011, 02:26 AM
Can you try a new 8535?
shearder
02-09-2011, 02:34 AM
Can you try a new 8535?
Hi Stefan
Yes i have a spare in my box. Guess just the mission to pull the other one our hahaha without damaging it.
Thanks for yuor fast response :)
RobiD
02-09-2011, 06:23 AM
In the devision you have a resoult with ,xxx that is not possible with int.
Let is as flot, it is ok.
Right! But only in case that the differenz is always the same.
Stefan
Hi Stefan,
I have left it as float but is producing the warning. (I will check which line the error is coming from)
Well the difference won't always be the same, for example when the difference is low numbers, it moves in very small increments as it should, but when the difference starts to get higher, say 70 plus, it moves more and more distance. If I minus, when I have small differences, the needle would probably move the wrong way.
So I think I need to change the scale, so that the go to numbers are smaller, but 0 = 0 and not a minus figure. Does that make sense.
So if I used division say divide by 2, it should halve the output, and 0 should still be 0.
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto / 2);
Would that work?
Thanks
David
Sean, I agree with Stefan, change the 8535 and see. I had a dud one that caused me grief too.
sgaert
02-09-2011, 06:29 AM
So if I used division say divide by 2, it should halve the output, and 0 should still be 0.
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto / 2);
Would that work?
No, because you only make the half of steps but the software think it is in the right position. You donīt have a continius readback of the needle Position.
What do the needle if you fly more than one 360, is there a strange moving?
RobiD
02-09-2011, 06:37 AM
If the needle in the software moves 360 degrees, the needle on the gauges will go around 3 or 4 times.
It does consistently move in the correct direction through.
sgaert
02-09-2011, 08:04 AM
If the needle in the software moves 360 degrees, the needle on the gauges will go around 3 or 4 times.
I would try a direct way for testing with the Stepp and angle problem.
FsbusWriteFmtVar(29,80,val/(Stepp/360)); //for Stepp your nummber of stepps for a 360 turn.
Maybe it shows to the opposite direction but it is importent to know the right Stepp/degree ratio.
Stefan
EDIT:
STOP, we both do a big fault. We all the time use the 360 as a Data but that is not true.
We have to use the max input value that is signed +32768 or unsigned 65536.
my try of the code:
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
float ADF1RelNeedleMulti;
//static int ADF1RelNeedleMulti;
static int ADF1RelNeedleDeg = 65536;
//static int ADF1RelNeedleDeg = 360;
//static int ADF1RelNeedleStep = 2355;
static int ADF1RelNeedleStep = 1150;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelDataIn = val + 32780;
if (ADF1RelDataIn >=0)
{
ADF1RelDataIn = (ADF1RelDataIn+1);
}
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("Relative Bearing: %d NeedleDif: %d NeedleSave: %d\n",ADF1RelNeedlegoto, ADF1RelNeedleDif, ADF1RelNeedleSave);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
//printf("ADF1RelNeedleMulti: %d\n",ADF1RelNeedleMulti);
//printf("ADF1RelNeedleDeg: %d\n",ADF1RelNeedleDeg);
//printf("ADF1RelNeedleStep: %d\n",ADF1RelNeedleStep);
//printf("ADF1RelDataIn: %d\n",ADF1RelDataIn);
//printf("ADF1RelDataDif: %d\n",ADF1RelDataDif);
//printf("ADF1RelNeedledif: %d\n",ADF1RelNeedlegoto);
break;
RobiD
02-09-2011, 08:10 AM
I'll give it a try now and let you know.
sgaert
02-09-2011, 08:18 AM
Sorry i Edit my Post befor you.
RobiD
02-09-2011, 08:34 AM
Getting this error message again: Run-Time Check Failure #2 - Stack around the variable 'buf' was corrupted.
I have commented out all other lines but the write line just to make sure something else was not causing it.
I've got the stepp up to 20000 and it is moving more accurately. I know I definately don't have 20,000 steps per 360 degrees
Oh, it seems the 'buf' error happens when the val is passing through 0 at the 360 position.
sgaert
02-09-2011, 08:36 AM
With that?
FsbusWriteFmtVar(29,80,val/(Stepp/360));
or my Edit?
RobiD
02-09-2011, 08:46 AM
With that?
FsbusWriteFmtVar(29,80,val/(Stepp/360));
or my Edit?
With this. I have the Stepp at 20,000 and the needle is moving in the right direction, and also fairly accurately with the screen gauge. The buf error message occurs when the value is passing through 0 at the top of the gauge (goes straight to error message once the needle moves to the left side as they are all negative numbers) and passing the maximum at the bottom (which is then moving into the maximum negative number)
Does that make sense?
sgaert
02-09-2011, 08:49 AM
Donīt use the 360 degrees anymore that is wrong, look to my edit ther is a new code.
RobiD
02-09-2011, 09:07 AM
Ok, that's much much better. Gauge is now a little behind ie: in 180 degrees on the screen, gauge will move 150 deg.
Also, when the needle gets to the bottom (relative bearing data goes from 1222 to 0, or the val goes from +32765 to -32765, the needle does a full 360 deg turn plus another 30degress.
Seems like it's getting close.
sgaert
02-09-2011, 09:13 AM
Ok edit that line to that.
ADF1RelDataIn = val + 32765;
Also, when the needle gets to the bottom (relative bearing data goes from 1222 to 0, or the val goes from +32765 to -32765, the needle does a full 360 deg turn plus another 30degress.
That was the reason why i ask you to fly a lot of 360th. I expected that error.
We need something like a counter that count how many full cirrcles the Data input turn. With that we can add full circle steps to the output.
That is a good homework for us.
Stefan
RobiD
02-09-2011, 09:21 AM
Ok edit that line to that.
ADF1RelDataIn = val + 32765;
Is this the number to edit and play around with until the ratio is correct?
sgaert
02-09-2011, 09:23 AM
no that is to change the signed Value in an unsigned value.
RobiD
02-09-2011, 09:27 AM
Ok, so this is what I need to change: static int ADF1RelNeedleStep = 1150;?
sgaert
02-09-2011, 09:28 AM
That is the nummber of Steps for a full 360.
RobiD
02-09-2011, 09:31 AM
I will do some calculations tomorrow to work out a little more accurately the number of steps.
RobiD
02-09-2011, 09:34 AM
Just another thing, in the FSUIPC SDK the offset I'm using states this:
relative bearing to NDB ( *360/65536 for degrees, ve
left, +ve right)
so if I divide 65536 by 2 would be 32768. Should this be the number in this line: ADF1RelDataIn = val + 32765;
sgaert
02-09-2011, 10:40 AM
maybe, you write that the values are -32765 to 32765.
shearder
02-09-2011, 02:16 PM
Hey guys
Ok i put a new 8535 in and flashed fine, set bits and BO no problems. BUT - during a flight same issue but this time it was VS and CRS that stopped working.
Do you know if the new DLL would fix these problems? When will it be released?
sgaert
02-09-2011, 03:07 PM
I have 11 IO Boards working, there is no error.
David and i have the new DLL for testing.
Official it will release after the 20.Feb.2011.
Stefan
shearder
02-09-2011, 03:14 PM
This is very strange. I can't think of something that is doing this. Could it be the setup of my serial port? or W7? or something affecting it?
I am lost.
RobiD
02-09-2011, 05:48 PM
Hi Sean,
I only have two IO boards working faultlessly. I did have the issue of resets on the board, but changed the fuse bits as you have done, and I have not had a problem since. I use many rotary encoders without problems.
If it has only just started doing this, the board may have developed a cracked track if it has been moved a lot, or bent or twisted a bit.
Looks like some detective work, but there will definately be a fault somewhere, perhaps even a dry solder joint. My next step would be to pull the board out, grab your multimeter and start testing. Maybe even put the board under a little pressure so if there is a crack it would be easier to pick up with the meter.
Just my thoughts.
David
RobiD
02-10-2011, 05:50 AM
maybe, you write that the values are -32765 to 32765.
How would I write it that way in the code?
When ever the relative bearing data goes into a -ve number, the 'buf' error appears.
RobiD
02-10-2011, 05:55 AM
Ok edit that line to that.
ADF1RelDataIn = val + 32765;
That was the reason why i ask you to fly a lot of 360th. I expected that error.
We need something like a counter that count how many full cirrcles the Data input turn. With that we can add full circle steps to the output.
That is a good homework for us.
Stefan
Had any thoughts on this one?
I wouldn't know where to begin to add a counter, let alone what to do with the data after that. Thank god you're here.
sgaert
02-10-2011, 07:23 AM
i have some ideas, but not the time to code that.
Also i donīt know the effect if you enter a new frequenz.
RobiD
02-10-2011, 07:41 AM
Happy to wait until you have time Stefan. I just appreciate the time you are giving.
sgaert
02-10-2011, 08:17 AM
Hehe, new Idea, try it self. :lol:
Here is my Idea.
https://lh6.googleusercontent.com/_B8czH7apyHE/TVPWyGO2Q3I/AAAAAAAAHwQ/UHOIQDQoTAI/s800/2011-02-10_13-13-39_517.jpg
have fun,
Stefan
sgaert
02-14-2011, 02:03 PM
As info Version 3 is released.
download (http://www.fsbus.de/3.html)
Have fun and read the manual for the changes!!
shearder
02-14-2011, 02:40 PM
As info Version 3 is released.
download (http://www.fsbus.de/3.html)
Have fun and read the manual for the changes!!
Thanks Stefan. Anythig new that would be good to take special note of?
sgaert
02-14-2011, 02:42 PM
Yes that ios marked in the Manual and you compiler also give you a message.
RobiD
02-14-2011, 05:46 PM
Hi Stefan,
Has Dirk made any changes to the version I have as a final release?
Thanks
David
sgaert
02-14-2011, 05:48 PM
Yes but only Bug fixes.
RobiD
02-15-2011, 04:17 AM
So I should I download the version from the website and replace the test V3.
Thanks
sgaert
02-15-2011, 04:18 AM
thatīs right.
RobiD
02-15-2011, 06:50 AM
Hehe, new Idea, try it self. :lol:
Here is my Idea.
https://lh6.googleusercontent.com/_B8czH7apyHE/TVPWyGO2Q3I/AAAAAAAAHwQ/UHOIQDQoTAI/s800/2011-02-10_13-13-39_517.jpg
have fun,
Stefan
Hi Stefan,
Had any more thoughts about how to do this?
How would I define dist1, dist2 and dist3?
Thanks
David
sgaert
02-15-2011, 07:17 AM
that is so easy.
The Problem isnīt the Programming, it is normal mathamatics.
You need to find the right formula, use pen and paper and calculate situations/movings. The very last stepp is to translate that in C++.
dist1-3 are normal int.
//dist3
if (ADF1RelDataSave > 32768 )
{
dist3 = 65536 - ADF1RelDataSave;
}
else
{
dist3 == ADF1RelDataSave;
}
//dist2
if (ADF1RelDataIn > 32768 )
{
dist2 = 65536 - ADF1RelDataIn;
}
else
{
dist2 == ADF1RelDataIn;
}
//dist1
if (ADF1RelDataDif > 0)
{
dist1 == ADF1RelDataDif;
}
else
{
dist1 = ADF1RelDataSave - ADF1RelDataIn;
}
RobiD
02-15-2011, 07:24 AM
So for example if dist2 and dist3 are say 30 degrees either side of zero, work out how many steps are in that 30 degrees, or what the val data would be at that 30 degree point.
sgaert
02-15-2011, 07:35 AM
First degreeīs are not relevant only the fsuipc input data!! 0-65536
The Problem is that the Stepper can turn to right and left without a limit.
But the data has only one turn.
Now you need a calculation the how mayīs turn that is.
If you donīt do that the needle goes from 60000 to 10000 in the left way but the rightway is the shortest and the real one.
Now find the formula to check the shortest way and if nesessary add or subtrackt a full circle from the stepper output.
Sample: 1500 data in in the 4 turn, go to 55000 in the 3 turn, what is the stepper output.
try to find the formular.
RobiD
02-15-2011, 08:18 AM
I've just been sitting here reading what you just wrote, then looking at the piece of code you have written, then re-reading what you have just written. I think my head is hurting:)
So I understand that we are working with the val output of the offset.
I have no idea where to begin to work a formula out like that. I understand the principle of what needs to be achieved, but really no idea.
You mentioned before about a counter to count the number of 360 deg revolutions. From what you have just said, this still needs to be in the code in order to go from 1500 data in in the 4 turn, go to 55000 in the 3 turn.
sgaert
02-15-2011, 09:36 AM
try that!!! Completly new Idea from a friend and me.
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleDeg = 65536;
float ADF1RelNeedleMulti;
static int ADF1RelNeedleStep = 1150;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
if (ADF1RelDataSave < ADF1RelDataIn)
{
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelDataDif - ADF1RelNeedleDeg;
}
else
{
ADF1RelDataDif = (ADF1RelDataSave - ADF1RelDataIn) * -1;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelNeedleDeg - ADF1RelDataDif;
}
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
break;
RobiD
02-15-2011, 05:44 PM
Fantastic Stefan, I will give it a try this evening when I get home from work.
Thanks
David
RobiD
02-18-2011, 12:05 AM
Hi Stefan,
I have had a chance to try the new code, I am getting no needle movement at all.
Using the printf function, the Data In is reading exactly the same the the ADF1RelNeedlegoto.
So the data is going from -32 odd thousand to + 32 od thousand.
Here's a copy and paste:
running ...Data in: -32366
ADF1RelNeedlegoto: -32366
ADF1RelNeedleDif: -32366
press any key to exit ...
Any thoughts?
Thanks
David
Oh, I'm also getting this error message:
warning C4244: '=' : conversion from 'int' to 'float',
for these lines:
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
sgaert
02-18-2011, 02:36 AM
Oh, I'm also getting this error message:
warning C4244: '=' : conversion from 'int' to 'float',
for these lines:
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
That is not an error only warning, for me at the moment it isnīt interessting.
But look to a tutorial about Type Casting / Explicit conversion.
running ...Data in: -32366
ADF1RelNeedlegoto: -32366
ADF1RelNeedleDif: -32366
press any key to exit ...
That is not possible, show your print funktions.
Did you fly the aircraft and how run the needle?
Stefan
RobiD
02-18-2011, 03:04 AM
Sorry, I did mean warning.
Here is the code copied and pasted :
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleDeg = 65536;
float ADF1RelNeedleMulti;
//static int ADF1RelNeedleStep = 1150;
static int ADF1RelNeedleStep = 1400;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
if (ADF1RelDataSave < ADF1RelDataIn)
{
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelDataDif - ADF1RelNeedleDeg;
}
else
{
ADF1RelDataDif = (ADF1RelDataSave - ADF1RelDataIn) * -1;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelNeedleDeg - ADF1RelDataDif;
}
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("ADF1RelNeedlegoto: %d\n",val);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
printf("ADF1RelNeedleDif: %d\n",val);
break;
sgaert
02-18-2011, 03:10 AM
OMG!!!!
First how turn the needle if you fly?
Second learn the printf function thet is wrong what you do.
RobiD
02-18-2011, 03:15 AM
Needle does not move at all.
Opps, I see the error of my ways:)
Have corrected printf function and I'll try it again and report back.
David
RobiD
02-18-2011, 03:21 AM
Ok, these are the outputs:
Data in: -10972
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10903
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10844
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10906
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10868
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10834
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10950
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10956
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Just so I'm accurate, this is how I have the printf:
printf("ADF1RelNeedlegoto: %d\n",ADF1RelNeedlegoto);
sgaert
02-18-2011, 03:27 AM
Ok.
Fly for a positive Data in val.
and gereate a printf for ADF1RelDataDif.
sgaert
02-18-2011, 03:54 AM
Next try.
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleDeg = 65536;
float ADF1RelNeedleMulti;
//static int ADF1RelNeedleStep = 1150;
static int ADF1RelNeedleStep = 1400;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
if ( ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelNeedleDeg-ADF1RelDataDif;
else if (ADF1RelDataDif < (ADF1RelNeedleDeg/2 * -1))
ADF1RelDataDif = ADF1RelNeedleDeg+ADF1RelDataDif;
printf("ADF1RelDataDif: %d\n",ADF1RelDataDif);
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("ADF1RelNeedlegoto: %d\n",ADF1RelNeedlegoto);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
printf("ADF1RelNeedleDif: %d\n",ADF1RelNeedleDif);
break;
please fly 1x 360 left and 1x 360 right and report the datalog.
RobiD
02-18-2011, 07:01 AM
Next try.
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleDeg = 65536;
float ADF1RelNeedleMulti;
//static int ADF1RelNeedleStep = 1150;
static int ADF1RelNeedleStep = 1400;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
if ( ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelNeedleDeg-ADF1RelDataDif;
else if (ADF1RelDataDif < (ADF1RelNeedleDeg/2 * -1))
ADF1RelDataDif = ADF1RelNeedleDeg+ADF1RelDataDif;
printf("ADF1RelDataDif: %d\n",ADF1RelDataDif);
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("ADF1RelNeedlegoto: %d\n",ADF1RelNeedlegoto);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
printf("ADF1RelNeedleDif: %d\n",ADF1RelNeedleDif);
break;
please fly 1x 360 left and 1x 360 right and report the datalog.
Hi Stefan,
Sorry had to go out for a while.
I'll do this now and report back. Should take about 15 mins to boot everything up, change the code etc.
David
RobiD
02-18-2011, 07:15 AM
Ok, this is with the new code you have just given me:
(Oh, there was no needle movement on my stepper gauges)
Data in: -26469
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -26686
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -26907
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -27437
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -27654
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -27907
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -28124
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -28589
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -28806
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -29023
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -29466
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -29683
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -29900
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -30293
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -30473
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -30726
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -31033
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -31255
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -31508
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -31689
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -32001
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -32217
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -32434
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -32709
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 32602
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 32384
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 32178
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 31953
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 31736
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 31522
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 31296
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 31072
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 30916
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 30724
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 30459
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 30329
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 30106
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 29853
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 29636
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 29481
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 29255
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 29037
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 28941
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 28722
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 28512
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 28408
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 28196
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 28005
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27960
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27776
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27598
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27568
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27415
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27259
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27277
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27145
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 27024
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26910
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26968
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26848
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26770
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26841
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26756
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26691
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26801
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26747
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26725
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26816
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26785
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26765
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26900
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26887
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26882
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: 26965
ADF1RelDataDif: 0
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
sgaert
02-18-2011, 07:19 AM
Strange, can you start teamviewer and skype?
sgaert
02-18-2011, 07:22 AM
haha :p
big fault add that line as first line in the case
ADF1RelDataIn = val;
Jan737
07-09-2011, 03:00 PM
Hi Guys,
I just want to know if you have made some progress with version 3 of the dll=
I.e. the flap gauge with a steppenmotor.
Best regards
Jan Geurtsen
sgaert
07-09-2011, 03:52 PM
Hi Jan,
i used a Servo.
Stefan
RobiD
08-05-2011, 06:52 AM
Hi everyone,
Well it's been a while since I've been here or posted.
After completing my sim (well about 99%) which took over 6 years, I spent a couple of months flying it.
I have now spent the last few weeks dismantling it all. I now have a garage again (it makes my wife happy as it's now also her office).
I intend to build a fixed platform generic cockpit in the near future, but far less elaborate than the 2 DOF fully enclosed monster I built, that could only be moved on a very large tandem axle trailer, and only fitted one person inside. (bit boring not being able to share the experience).
I absolutely enjoy and respect this community and will keep you updated on my progress over time.
I would also like to thank Stefan for his patience and unwavering support and assistance.
Speak to you all soon.
David
John_B
04-28-2012, 08:05 AM
Ok, after much testing, here is the solution!!!
Add this at the top with the rest of the static int:
static int GlideslopeHold = 0;
Then uncomment out:
MkFsObject(FS_AP_GLIDESLOPEHOLD, "",cbModecontrolpanel, 0x07FC, 4, TP_UI32, FS_NORMAL, 0);
Then change this:
case C_SAPP:
if (val == 0) // button push only
{
ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
}
break;
to this:
case C_SAPP:
if (val == 0) // button push only
{
ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
GlideslopeHold = (GlideslopeHold == 0) ? 1 : 0;
FsWriteInt(FS_AP_GLIDESLOPEHOLD, GlideslopeHold);
}
break;
Have tested and works for me.
Let me know if it works for you too.
David
Hi David
Do you still frequent this forum?
Would greatly appreciate your help re the code here..I too have the exact same problem in FSBUS but am using the CDK not dll.
John
John_B
05-01-2012, 02:04 PM
An Update
I have bitten the bullet and hope to go the FSBUS DLL route although I have no programmer DNA whatsoever..
I have looked at a few examples of .h and .cpp and they seem to contradict the stuff in the fsbus dll "manual" or at least Icannot see the relationship.
Just an update
John
ciccio85
01-22-2013, 06:37 AM
Hello,
I need to set 7 segments display value to show dash lines "---".
How to set it in Fsbus?
sgaert
01-22-2013, 06:55 AM
Hello,
I need to set 7 segments display value to show dash lines "---".
How to set it in Fsbus?
Hi,
you have to use DISPLAY_BAR as value in the FsbusWrite call.
Sample:
FsbusWrite (IASDisplay, DISPLAY_BAR);
Stefan
ciccio85
01-22-2013, 09:47 AM
Hi,
you have to use DISPLAY_BAR as value in the FsbusWrite call.
Sample:
FsbusWrite (IASDisplay, DISPLAY_BAR);
Stefan
Well it works! How to set the other special characters like S, t, d, E? And how to set a single dash, like "-1000".
Thanks for your help!
Francesco
sgaert
01-22-2013, 09:58 AM
Well it works! How to set the other special characters like S, t, d, E? And how to set a single dash, like "-1000".
Thanks for your help!
Francesco
Single Characters are very compilcated.
You have DISPLAY_STD or DISPLAY_Std that writes all 3 characters.
For -1000 send the value -1000.
Stefan
michalm89
04-19-2013, 05:41 AM
Hi Everyone
I need some help with programming fsbus dll. I'm trying to programming master caution button, master fire warn button and sixpack in fsbus dll, but I can't find fsuipc offsets for this. Did anyone can help me find it? Or maybe someone write program for sixpack and could share it with me?
wozniakair
05-08-2013, 02:58 PM
Hello, How to read RID for LED's ? On I/O Board? 0-63 are buttons that i can check button RIDs in FSBUS Admin... How about Output and LEDs?
michaelra
05-11-2013, 05:25 AM
Hi all,<o:p></o:p>
I'm new to this. I have made a FSBUS COM board and the Display board (six pack) and they work fine with FSBUS Admin. But I dont know where to go from here. I was wondering if someone can give me the C++ code and instructions on how to make the Six Pack Display show what I see in Flight Sim MCP displays. Such as the set air speed, course, vertical speed, altitude. Any info will greatly appreciated.<o:p></o:p>
John_B
05-14-2013, 02:39 PM
hi Michaelra
I use the FSBUS CDK
I have to say I am useless at it but got my MCP working with the default 737's
I still am struggling getting the button anunciators working with my Ifly 737
You are welcome to the CDK files I have
Most came from Job Van Dijk and I simply altered the values to suit the CID's ect
Its a MASSIVE learning curve if you don't have programming skill ( I dont!!)
John
John_B
05-14-2013, 03:09 PM
Hi wozinakair
I am struggling with that too. (at least in the ifly 737) for the default aircraft. the offsets (addresses) can be monitored in FS Interrogate. ...
The theory being....see which address changes when the led on screen lights and use that address in your ini file for the airplane (in my case its b737ng_glareshield.ini assuming you are using the CDK)
here's a bit of the file I mean. (again this is not my work Rob Van Djik gets all the credit ....check his site out)
you are intersted in the entries "DOUT" (digital out)
'FSBUS Basic (DA 2006/2007)
'B737NG - Glareshield
'R.F. van Dijk (intro (http://www.rvdijk.nl))
'
'COCKPIT COMPONENTS - MCP
'-------------------------------------------------------------------------------
'C NAME TYPE CID RID FLAGS P1 P2 P3
'-------------------------------------------------------------------------------
C, CDCourseL, DISPLAY, 13, 0, LEADZERO, 3, 3, 0
C, CDCourseR, DISPLAY, 16, 0, LEADZERO, 3, 3, 0
C, CDIas, DISPLAY, 14, 0, , 4, 2, 0
C, CDHeading, DISPLAY, 15, 0, LEADZERO, 3, 3, 0
C, CDAltitude, DISPLAY, 17, 0, LEADZERO, 5, 1, 0
C, CDVertSpeed, DISPLAY, 18, 0, , 0, 0, 0
C, CRCourseLR, ROTARY, 3, 44, , 0, 0
C, CRIas, ROTARY, 3, 60, , 0, 0
C, CRHeading, ROTARY, 3, 62, , 0, 0
C, CRAltitude, ROTARY, 3, 56, , 0, 0
C, CRVertSpeed, ROTARY, 3, 58, , 0, 0
C, CSFlightDirL, SWITCH, 3, 43, TOGGLE, 0, 0
C, CSFlightDirR, SWITCH, 10, 58, TOGGLE, 0, 0
C, CSATArmed, SWITCH, 3 , 42, NEGEDGE|TOGGLE, 0, 0
C, CSN1, SWITCH, 3, 16, NEGEDGE|TOGGLE, 0, 0
C, CSSpdHld, SWITCH, 3, 49, NEGEDGE|TOGGLE, 0, 0
C, CSSpdIntv, SWITCH, 3, 46, NEGEDGE|TOGGLE, 0, 0
C, CSChangeOver, SWITCH, 3, 47, NEGEDGE|TOGGLE, 0, 0
C, CSVNav, SWITCH, 3, 32, NEGEDGE|TOGGLE, 0, 0
C, CSLNav, SWITCH, 3, 34, NEGEDGE|TOGGLE, 0, 0
C, CSLvlChg, SWITCH, 3, 18, NEGEDGE|TOGGLE, 0, 0
C, CSHdgLock, SWITCH, 3, 19, NEGEDGE|TOGGLE, 0, 0
C, CSVorLoc, SWITCH, 3, 33, NEGEDGE|TOGGLE, 0, 0
C, CSApp, SWITCH, 3, 20, NEGEDGE|TOGGLE, 0, 0
C, CSAltHld, SWITCH, 3, 21, NEGEDGE|TOGGLE, 0, 0
C, CSAltIntv, SWITCH, 3, 39, NEGEDGE|TOGGLE, 0, 0
C, CSVertSpdHld, SWITCH, 3, 48, NEGEDGE|TOGGLE, 0, 0
C, CSCMDA, SWITCH, 3, 36, POSEDGE, 0, 0
C, CSCMDB, SWITCH, 3, 38, POSEDGE, 0, 0
C, CSCWSA, SWITCH, 3, 35, POSEDGE, 0, 0
C, CSCWSB, SWITCH, 3, 37, POSEDGE, 0, 0
C, CSAPDiseng, SWITCH, 3, 50, NEGEDGE, 0, 0
C, CLFlightDirL, DOUT, 3, 00, , 0, 0
C, CLFlightDirR, DOUT, 3, 00, , 0, 0
C, CLMastFlightL, DOUT, 10, 33, , 0, 0
C, CLMastFlightR, DOUT, 10, 44, , 0, 0
C, CLATArmed, DOUT, 3, 8, , 0, 0
C, CLN1, DOUT, 3, 07, , 0, 0
C, CLSpdHld, DOUT, 3, 06, , 0, 0
C, CLVNav, DOUT, 3, 5, , 0, 0
C, CLLNav, DOUT, 3, 1, , 0, 0
C, CLLvlChg, DOUT, 3, 4, , 0, 0
C, CLHdgLock, DOUT, 3, 3, , 0, 0
C, CLVorLoc, DOUT, 3, 2, , 0, 0
C, CLApp, DOUT, 3, 15, , 0, 0
C, CLAltHld, DOUT, 3, 14, , 0, 0
C, CLVertSpdHld, DOUT, 3, 13, , 0, 0
C, CLCMDA, DOUT, 3, 9, , 0, 0
C, CLCMDB, DOUT, 3, 10, , 0, 0
C, CLCWSA, DOUT, 3, 12, , 0, 0
C, CLCWSB, DOUT, 3, 11, , 0, 0
C, CLAPDisengL, DOUT, 10, 53, , 0, 0
C, CLAPDisengR, DOUT, 10, 54, , 0, 0
'ACCUMULATOR - MCP
'-------------------------------------------------------------------------------
'A NAME MIN MAX FLAGS
'-------------------------------------------------------------------------------
A, ACourse, 1, 360, WRAPAROUND
A, AIas, 0, 500,
A, AMach, 0, 99,
A, AHeading, 1, 360, WRAPAROUND
A, AAltitude, -100, 50000,
A, AVertSpeed, -5000, 5000,
but the offsets dont match the format with the ifly planes....I think its probably the different programming languages involved.......probably wrong on that .
or have I miss understood your question?
John
michaelra
05-14-2013, 09:31 PM
hi Michaelra
I use the FSBUS CDK
I have to say I am useless at it but got my MCP working with the default 737's
I still am struggling getting the button anunciators working with my Ifly 737
You are welcome to the CDK files I have
Most came from Job Van Dijk and I simply altered the values to suit the CID's ect
Its a MASSIVE learning curve if you don't have programming skill ( I dont!!)
John
Hi John,
It would be great to have your CDK. Can you send it or how can I get it?
Some instruction on what I'm supposed to do with them would be much appriciated.
Michael
John_B
05-15-2013, 04:55 AM
Hi Michael
Not sure if my answer posted correctly so here's another go
I might add here:- I only work with the 737 whether its the same for all aircraft I have no idea.
If you let me have you email Addy via a private message we can sort out getting the cdk and stuff to you.
As for telling you how to do it I can only give you the VERY basics as I am at a loss..I have the manual but they might as well be written in latin I have no programmer DNA in me..
Although the displays seemed quite straightforward (well they were for me cos they are working LOL)
I am sure we will get there especially if we can get a few more FSBUS users/newbies on board!!!
I have just finished building myself a 737 TQ not had a chance to start connecting it as my PC died the same day ...awaiting parts for the new machine as I type.
I thought this hobby was supposed to be fun
John
John_B
05-17-2013, 03:01 AM
Hi MIchael
How ya getting on with it?
John
michaelra
05-17-2013, 07:14 AM
Hi John,
I'm thrilled to announce to yo that, with your genrous help, the display is working!
There is a about a second lag in displaying but apart from that all's very good.
Michael
John_B
05-17-2013, 07:29 AM
Hi Michael
Wahoo
That is SO cool
I think that when the dab and all the ini files are included with nothing unused the lag gets much shorter!
The nice thing about the displays (so I have found so far)
That the offsets are the same in the default aircraft are the same as the add on ones I only use the ifly now though!
So whats the next project?
Heres a pic of what I have just finished (but so far have not hooked up to FSBUS as my pc died)
http://www.junkroom.co.uk/throttle-quad.jpg
michaelra
05-17-2013, 08:01 AM
Hi John,<o:p></o:p>
Your throttle quadrant if just fantastic. I have made one too. Its made of wood and its very crude by your standard. But it was just to check thing out. I'll try to do the final one a bit better. How did you turn out such a masterpiece?<o:p></o:p>
I started my cockpit project on the MJOY16 as this was easy. But soon found out, it also was limited. Therefore Im trying to get into FSBUS.
Michael
John_B
05-17-2013, 11:24 AM
Heya Michael
oops we are getting off topic.......so I will email you
John
ciccio85
06-06-2013, 06:34 PM
Hello, i'm programming A320 Master Warning leds, and these leds are intermittent. How to do the intermittent light in c++?
John_B
06-07-2013, 02:44 AM
Hi Ciccio85
Unfortunately I do not know any programming (have tried to learn and failed).
By intermittent do you mean flashing?
If so (and you know how to make a normal led light up) you could use a "flashing led "
Just an idea.....not having any programmer DNA I have to use these kind of work arounds.
I hope a few C+ programmers will get involved in this thread.
John
ciccio85
06-07-2013, 04:45 AM
Hi Ciccio85
Unfortunately I do not know any programming (have tried to learn and failed).
By intermittent do you mean flashing?
If so (and you know how to make a normal led light up) you could use a "flashing led "
Just an idea.....not having any programmer DNA I have to use these kind of work arounds.
I hope a few C+ programmers will get involved in this thread.
John
Yes, i need flashing led in C++.
John_B
07-09-2013, 12:56 PM
Hi all
Just wondered how you guys are getting on with FSBUS (CDK)?
I got most things, I have, working in the default 737 but the offsets are a bit different for my iFly 737 ( BTW Fabulous aircraft if you are interested )
I thought I was doing great until I discovered I cannot find a way to address a specific bit in an offset.
For example for the light switches on the overhead use offset 0x0D0C and the bits 0,1,2,3,4,etc are the individual lights (8 per offset)
I was kindly sent an "ini" file which I got real exited about cos I thought it showed how to do it BUT (there's always a BUT!!!!) I am sure it is not for FSBUS :( as I cannot see any way to define a data type "BIT" .
Maybe I am overlooking something.
Any input anyone???
Please also it would be great if any FSBUS FSBUS (CDK) users chip in here..I am sure there are still some of us out there and I am also sure between us we "can crack this nut"
John
ciccio85
07-09-2013, 07:33 PM
Hi all
Just wondered how you guys are getting on with FSBUS (CDK)?
I got most things, I have, working in the default 737 but the offsets are a bit different for my iFly 737 ( BTW Fabulous aircraft if you are interested )
I thought I was doing great until I discovered I cannot find a way to address a specific bit in an offset.
For example for the light switches on the overhead use offset 0x0D0C and the bits 0,1,2,3,4,etc are the individual lights (8 per offset)
I was kindly sent an "ini" file which I got real exited about cos I thought it showed how to do it BUT (there's always a BUT!!!!) I am sure it is not for FSBUS :( as I cannot see any way to define a data type "BIT" .
Maybe I am overlooking something.
Any input anyone???
Please also it would be great if any FSBUS FSBUS (CDK) users chip in here..I am sure there are still some of us out there and I am also sure between us we "can crack this nut"
John
Hello,
use the FSBUS dll instend of the CDK. It's more and more powerful. I know how to write single bits on an offset, but only with dll and C++. If you like i can help you but only with dll's.
Ciccio
John_B
07-10-2013, 08:05 AM
Hi Ciccio
Thank you for the very kind offer.. although you might live to regret it ;).
I have struggled enough to learn the little I know about CDK so I will be starting as a complete beginner with DLL even after reading or trying to read the documentation that comes with it.
I have also, over the years, tried to learn C from books but I have come to the conclusion I have no programming DNA in me.Its very frustrating as I am not an idiot (I have even got a degree in mechatronics...but have forgotten all of it !!!)...but is= all just seems foreign to me.
I have tried with "samples" but they make no sense especially how they always are an example of something obscure..I know its to just give an idea but unless I can relate it to a real thing I have less than no hope........
John
ciccio85
07-10-2013, 08:21 AM
what kind of aircraft are you building? what kind of FSBUS interfaces have you built?
John_B
07-10-2013, 09:16 AM
Hi
A 737 800 ish (iFly) captains side only (no space!)
I have
1x COM (ng)
2x I/O
1x Display 6 pack
2x Display 2 pack
Plus below not used so far but tested in fs admin
1x DO64
2x servo
Panels made so far
MCP
Nav Radio
VHF Radio
The above are used and for the most part working (CDK)
Below are built but not tested with a cockpit
Throttle quadrant.
EFIS
Landing gear lever
Flaps gauge still in prototype.
John
ps
I bought a laser cutter and engraver to make my parts so if you want any bits made let me know!
John_B
07-10-2013, 11:20 AM
WAHOO:-)
You are not going to believe this BUT I have found a way !!!!!!!!!!!!!!!!!!! Hours of trial and error !:cool:
I have set two switches to turn two lights (on the same offset) on and off.They do not interact (so it seems) with anything else that should not be turning on and off.
For those interested here's and excerpt from my trial ini file
'Flight sim component
' Name ID Offset Type Mul Div Interval Param Flags
'----------------------------------------------------------------------
F, FLLIGHT, 0, 0x0D0C, I16, 1, 1, 1, 1, RW|BIT
F, FTAXION, 0, 0x0D0C, I16, 1, 1, 1, 3, RW|BIT
The Param number being the BIT you want to access 0,1,2,3, etc
I could not be happier right now!!...I am sure it won't last.
Next stop is grab a handful of switches and see if all 8 work as they should.
John
ciccio85
07-10-2013, 01:44 PM
Oh very good!! Happy for you. Anyway if you like you can download this c++ code for your 737 from download (http://www.rvdijk.nl/download.html). It's a good base to start with, and I can help you to adapt it for your hardware and software. :)
So you can engrave. Yes I need some panels for my A320. I have .cad files. What kind of software are you using for your CNC? Price for engraving?
Thanks
Ciccio
John_B
07-11-2013, 02:30 AM
Hi Ciccio
Thanks for the link
Its Robs CDK files I started with and altered t get as far as I did unfortunately as its fairly old it doesn't cover the iFly 737 very much as I don't think many of the systems were modeled then (might be wrong)
But as you say a good basis to start with DLL !!!
For panels what formats of cad can you save to?
Have you drawn them? If so what software did you use?
I use Corel draw...only because its really easy LOL.
I have vers 6 and 4 but the laser is directly linked to vers 4
I can import most file types but have found out that some just don't keep accurate dimensions.
As for cost .. how does material costs plus a bit for the laser maintenance sound?...
What colour do you need the base RAL7011 or something similar? (for RAL 7011 I think I'll need to buy a spray as I use a very acceptable locally obtainable grey)
Also, you might be interested, I have a friend that makes very good Boeing knobs etc at really reasonable cost.
I'll send a PM with my email
John
John_B
07-11-2013, 03:27 PM
Just to keep up to date!
Really cooking with gas now.
Got the "BIT addressed Leds" working in FSBUS (CDK) ....Long task of writing the files ahead.
Plus a downer..dug out my 64 digital out card only to find at some stage I had spilled etching fluid on it ARGH....all my chips are eroded away too double argh!!!!!!
John
Kosmo_001
11-11-2013, 07:42 AM
Hi,
i am new in this thread. i have a question about FSBus DLL 3.01. In my Project i created 108 FS-Obj. But only 104 are polled (checked with FsInvalidate). Is there a limit of FS-Obj. FsReadDirect works fine but slows things down. I am using MS C++ 2008 EE. Any idea ?
Dirk
John_B
11-11-2013, 12:47 PM
Hi,
i am new in this thread. i have a question about FSBus DLL 3.01. In my Project i created 108 FS-Obj. But only 104 are polled (checked with FsInvalidate). Is there a limit of FS-Obj. FsReadDirect works fine but slows things down. I am using MS C++ 2008 EE. Any idea ?
Dirk
I might be terribly wrong on this :???: as I am struggling to learn this stuff myself.
BUT I do, kinda, recall reading somewhere that you define the number of objects?
Where I don't remember though (am struggling at the moment with an "undefined identifier" so I dare not distract myself by wading through all the bumf I have.)
John
388TH_A
08-27-2014, 07:10 AM
How is everyone? Me, im staring to pick this back up and I cant seem to find all of my files so I have to start over lol - o well
John_B
08-27-2014, 07:49 AM
Hi 388TH_A
Sorry to hear about having to start over...oh the tedium of it all....
But welcome "back"
John
388TH_A
08-27-2014, 10:11 AM
LOL I found a working copy on my computer that I was given back in 2010 from RVDB737NG Copyright(c)2009, Rob van Dijk - www.rvdijk.nl Now im just trying to change it up and make it my own.
John_B
08-27-2014, 10:52 AM
Phew!
I also have just about all of Robs original files..let me know if you cant find anything ...What cockpit are you working on?
John
388TH_A
08-27-2014, 11:21 AM
for now im doing my radios and autopilot then might try and make it around a 737-800
John_B
08-27-2014, 12:02 PM
Ah same here (737-800) although as I am building mine Its going in bubble wrap as we aim to move house in a few months.
John
388TH_A
08-31-2014, 11:00 AM
So a couple of things
1( Working on the Pedestal the freqs will only count up when ever I turn the Rotary Knobs
/*---------------------- COM1 Events ----------------------*/
case FS_COM1FREQUENCY:
Com1Fr = ((10000 + BCD2Int(val)) * 10 + 5) / 25 * 25; // rounded, units: 0.001
FsbusWrite(C_DCOM1, Com1Fr / 10); // to cockpit
break;
case FS_COM1STANDBY:
Com1FrStb = ((10000 + BCD2Int(val)) * 10 + 5) / 25 * 25;
FsbusWrite(C_DCOM1STB, Com1FrStb / 10); // to cockpit
break;
case C_RCOM1DEC:
x = Com1FrStb %1000;
x = x + 25 * val; // in steps of 0.025
if (x > 975) // upper limit: 0.975
x = 0;
else if (x < 0)
x = 975;
Com1FrStb = Com1FrStb / 1000 * 1000 + x; // units: 0.001
FsbusWrite(C_DCOM1STB, Com1FrStb / 10); // truncated to 0.01
x = Int2BCD((Com1FrStb % 100000) / 10); // stripped and truncated to 0.01
FsWrite(FS_COM1STANDBY, x); // to FS
break;
case C_RCOM1FRA:
x = Com1FrStb / 1000; // ahead of dec point
x = x + val; // in steps of 1.000
if (x > 136)
x = 118;
else if (x < 118)
x = 136;
Com1FrStb = x * 1000 + (Com1FrStb % 1000);
FsbusWrite(C_DCOM1STB, Com1FrStb / 10);
x = Int2BCD((Com1FrStb % 100000) / 10);
FsWrite(FS_COM1STANDBY, x);
break;
case C_SCOM1SWAP:
if(val==0)
FsWrite (FS_RADIOUSESTBYTOGGLE,0x08); // toggle bit 3 (COM1)
break;
case C_SCOM1TEST:
break;
2) for the 737NGX Transponder there are Five positions for the Knob but cant seem to find the offset for them
case C_SXPNDRIDENT: break;
case C_SXPNDRCTRL1:
break;
case C_SXPNDRCTRL2:
break;
case C_SXPNDRCTRL3:
break;
case C_SXPNDRCTRL4:
break;
case C_SXPNDRCTRL5:
break;
3) The ADF1STBY Freq doesnt seem to show the correct Freq. And the Value I do get is 0x0000
MkFsObject(FS_EXTENDEDADF1, "OID", EventHandler, 0x0356, 2, TP_UI16, FS_NORMAL);
case FS_ADF1FREQUENCY:
ADF1 = (ADF1 / 10000) * 10000 + BCD2Int(val) * 10 + ADF1 % 10;
FsbusWrite(C_DADF1, ADF1);
if (bSynchronised == false)
{
ADF1Stb = ADF1;
FsbusWrite(C_DADF1STB, ADF1Stb);
}
break;
case FS_EXTENDEDADF1:
ADF1 = BCD2Int(val >> 8) * 10000 + ((ADF1/10)%1000)*10 + BCD2Int(val & 0x00FF);
FsbusWrite(C_DADF1, ADF1);
if (bSynchronised == false)
{
ADF1Stb = ADF1;
FsbusWrite(C_DADF1STB, ADF1Stb);
}
break;
case C_RADF_100:
x = ADF1Stb / 1000; // hundreds
x = x + val; // update 100s
if (x > 17)
x = 1; // wrap
else if (x < 1)
x = 17; // wrap
ADF1Stb = x * 1000 + ADF1Stb % 1000; // new 100s
FsbusWrite(C_DADF1STB, ADF1Stb);
break;
case C_RADF_10:
x = (ADF1Stb % 1000) / 10; // tens + units
x = x + val; // update 10s
if (x > 99)
x = 0; // wrap
else if (x < 0)
x = 99; // wrap
ADF1Stb = (ADF1Stb / 1000) * 1000 + x * 10 + ADF1Stb % 10; // new 10s
FsbusWrite(C_DADF1STB, ADF1Stb);
break;
case C_RADF_1:
x = ADF1Stb % 10; // .1 units
x = x + val; // update 10s
if (x > 9)
x = 0; // wrap
else if (x < 0)
x = 9; // wrap
ADF1Stb = (ADF1Stb / 10) * 10 + x;
FsbusWrite(C_DADF1STB, ADF1Stb);
break;
case C_SADFSWAP:
if (val == 0)
{
x = ADF1Stb; // save
ADF1Stb = ADF1; // swap
ADF1 = x; // swap
x = Int2BCD(ADF1); // convert to bcd
FsWrite(FS_EXTENDEDADF1, ((x & 0x0F0000) >> 8) | (x & 0x00000F));
FsWrite(FS_ADF1FREQUENCY, (x & 0x00FFF0) >> 4);
FsbusWrite(C_DADF1STB, ADF1Stb);
}
break;
case FS_ADF1MORSE:
break;
388TH_A
09-13-2014, 04:16 PM
bump bump__
388TH_A
09-26-2014, 06:40 AM
Just come to the realisation that there are no offsets for the OFF, STBY, ON, ALT or test, so it was a pointless exercise.
I've gone back to basics, I've pulled two of the switches out and converted the holes to fit the rotary encoders, so now I have the same layout as Rob uses ie: 2 rotary encoders, 4 digits and a dummy 5 position switch.
The code compiles so that's a good sign. I just need to wire it all up to test.
When I'm done with the coding, I will be giving the uncompiled project to anyone who wants to build a cessna cockpit using FSBus dll. Hope no one minds (I'm sure no one does).
David
Hi Stefan,
Thanks for your comments.
I think I will have to redesign my transponder. I built this a long time ago from someone elses idea.
I will have to get the old cnc machine out again.
Am I correct:
Rob's code is based on 1 rotary encoder
A 5 position rotary switch (for OFF, STBY, ON, ALT, TEST)
It is a 5 7-segment display (not 4 like mine is)
Regards
David
Hi Stefan,
Back again. Everything is going great.
I have started on the xponder.
My set us uses 4 on-off-on self centering switches for the four digits, one for each digit (push up for up one number and press down for down one number), (hope that makes sense).
I have a 12 position rotary switch which I use for: Off, SBY, ON, ALT, TEST.
What do I need to change in Rob's (it's probably your code) code to achieve this.
Oh, another thing, I have a single LED as an on indicator.
Appreciate your help once again.
David
Here's Rob's code
case FS_TRANSPONDERSETTING:
Expdr = BCD2Int(val);
FsbusWrite (C_DXPNDR, Expdr);
break;
case C_RXPNDRL:
if (val > 0)
{
Expdr += 1000;
if ((Expdr % 10000) > 7777)
Expdr -= 8000;
}
else
{
Expdr += 100;
if ((Expdr % 1000) > 777)
Expdr -= 800;
}
FsbusWrite(C_DXPNDR, Expdr);
x = Int2BCD(Expdr);
FsWrite(FS_TRANSPONDERSETTING, x);
break;
case C_RXPNDRR:
if (val > 0)
{
Expdr += 10;
if ((Expdr % 100) > 77)
Expdr -= 80;
}
else
{
Expdr += 1;
if ((Expdr % 10) > 7)
Expdr -= 8;
}
FsbusWrite(C_DXPNDR, Expdr);
x = Int2BCD(Expdr);
FsWrite(FS_TRANSPONDERSETTING, x);
break;
case C_SXPNDRIDENT://this would be off?
break;
case C_SXPNDRCTRL1://this would be sby?
break;
case C_SXPNDRCTRL2://this would be on?
break;
case C_SXPNDRCTRL3://this would be alt?
break;
case C_SXPNDRCTRL4://this would be test?
break;
case C_SXPNDRCTRL5:
break;
I did find this
65CB 1 BYTE XPDR_XpndrSelector_2; false: 1 true: 265CC 1 BYTE XPDR_AltSourceSel_2 false: 1 true: 2
65CD 1 BYTE XPDR_ModeSel 0: STBY
1: ALT RPTG OFF
...
4: TA/RA
65CE 1 BYTE XPDR_annunFAIL Boolean
http://fsuipc.simflight.com/beta/Offset_Mapping_PMDG737NGX.pdf
RobiD
11-27-2014, 10:45 PM
Been away from building for a long... long time. Great to see this thread still going and helping people out. Don't forget to share your work (if you wish to) so that it helps others.
Cheers,
David
388TH_A
11-29-2014, 07:58 AM
im still stuck
John_B
11-30-2014, 06:53 AM
388TH_A
Is your issue the rotary encoders only counting up regardless of direction of rotation?
(I have had this)
If so there's a better than average change that they are either wired/connected incorrectly or the wrong type of switch is selected in the setup admin. If memory serves I also had to make sure also that one of the pairs the encoder uses has not already been assigned a rotary switch type (ie clear them back to basic toggles then assign em!)
John
ThomasCaL
03-16-2015, 01:52 PM
Appreciate you sharing, great forum.Much thanks again. Whipkey (http://odifhgn4346jkfjp3e.tumblr.com/)
388TH_A
05-08-2015, 01:05 PM
ok so Back to where I was my knobs for my com1, com2 etc doesnt matter if you turn them to the left or right it makes the freq count up. And it does this for the FRA and DEC place.
MkFsbusObject(BTP_ROTARY, C_RCOM1DEC, "OID", EventHandler, 29, 5);
MkFsbusObject(BTP_ROTARY, C_RCOM1FRA, "OID", EventHandler, 29, 3);
/*---------------------- COM1 Events ----------------------*/
case FS_COM1FREQUENCY:
Com1Fr = ((10000 + BCD2Int(val)) * 10 + 5) / 25 * 25; // rounded, units: 0.001
FsbusWrite(C_DCOM1, Com1Fr / 10); // to cockpit
break;
case FS_COM1STANDBY:
Com1FrStb = ((10000 + BCD2Int(val)) * 10 + 5) / 25 * 25;
FsbusWrite(C_DCOM1STB, Com1FrStb / 10); // to cockpit
break;
case C_RCOM1DEC:
x = Com1FrStb %1000;
x = x + 25 * val; // in steps of 0.025
if (x > 975) // upper limit: 0.975
x = 0;
else if (x < 0)
x = 975;
Com1FrStb = Com1FrStb / 1000 * 1000 + x; // units: 0.001
FsbusWrite(C_DCOM1STB, Com1FrStb / 10); // truncated to 0.01
x = Int2BCD((Com1FrStb % 100000) / 10); // stripped and truncated to 0.01
FsWrite(FS_COM1STANDBY, x); // to FS
break;
case C_RCOM1FRA:
x = Com1FrStb / 1000; // ahead of dec point
x = x + val; // in steps of 1.000
if (x > 136)
x = 118;
else if (x < 118)
x = 136;
Com1FrStb = x * 1000 + (Com1FrStb % 1000);
FsbusWrite(C_DCOM1STB, Com1FrStb / 10);
x = Int2BCD((Com1FrStb % 100000) / 10);
FsWrite(FS_COM1STANDBY, x);
break;
case C_SCOM1SWAP:
if(val==0)
FsWrite (FS_RADIOUSESTBYTOGGLE,0x08); // toggle bit 3 (COM1)
break;
case C_SCOM1TEST:
break;
388TH_A
05-08-2015, 01:35 PM
Ill look into that but I know im missing something because at one point in time I had everything working back when before I had to start over
388TH_A
05-09-2015, 07:51 PM
So went threw all of the code and looks like theres isnt any doubles of anything for the IDs
388TH_A
06-16-2015, 03:57 PM
So I worked on my stuff for a bit and then stopped for yrs and now im working on them again from time to time. So looks like on my IO board some of the connections might be touching for example you can have a switch on 00 but when you flip the switch 00 and 16 will be effected. This is also the same for 32,48 08,24 and 40,56. The other issue I found was I have to go to ever switch and rotary and Define it in the FSBUS Admin screen in the CDK in order for them to work like they should. If I dont then for example the Rotary will only count up. After fixing it, it will then count up and down so there for it was never the C++ like I thought.
Do you guys know of other ways to fix the rotarys with out going to each one and defining them in that Admin screen?
cotheseest
06-12-2017, 12:31 PM
Why would an air conditioning company ask hvac techs what problems they are having with their heaters? Strange.