is a change on FS_ADF1RELATIVEBEARING?
Printable View
is a change on FS_ADF1RELATIVEBEARING?
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).
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
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.
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
For the ADF compass rose, I have this code:
Then for the ADF relative Bearing needle: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;
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):Code: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;
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
That is my Code Idea for case FS_ADF1RELATIVEBEARING.
Non tested!!!!!Code: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;
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
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
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