C/CPP Test Fixes
Fixed incorrect DREF for flaps. Fixed error where sendCTRL and sendPOSI were using abs instead of fabs.
This commit is contained in:
@@ -238,7 +238,7 @@ short sendCTRLTest() // sendCTRL test
|
||||
// Initialize
|
||||
int i; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float CTRL[5] = {0.0};
|
||||
float CTRL[6] = {0.0};
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100];
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
@@ -256,14 +256,16 @@ short sendCTRLTest() // sendCTRL test
|
||||
strcpy(DREFArray[2],"sim/cockpit2/controls/yoke_heading_ratio");
|
||||
strcpy(DREFArray[3],"sim/flightmodel/engine/ENGN_thro");
|
||||
strcpy(DREFArray[4],"sim/cockpit/switches/gear_handle_status");
|
||||
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqsts");
|
||||
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqst");
|
||||
for (i = 0; i < 100; i++) {
|
||||
DREFSizes[i] = (int)strlen(DREFArray[i]);
|
||||
}
|
||||
CTRL[3] = 0.8; // Throttle
|
||||
CTRL[4] = 1; // Gear
|
||||
CTRL[5] = 0.5; // Flaps
|
||||
|
||||
// Execute
|
||||
sendCTRL(sendPort, 4, CTRL);
|
||||
sendCTRL(sendPort, 6, CTRL);
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 6, recDATA, DREFSizes); // Test
|
||||
|
||||
// Close
|
||||
@@ -275,9 +277,9 @@ short sendCTRLTest() // sendCTRL test
|
||||
{
|
||||
return -6;
|
||||
}
|
||||
for (i=0;i<6-1;i++)
|
||||
for (i=0;i<6;i++)
|
||||
{
|
||||
if (abs(recDATA[i][0]-CTRL[i])>1e-4)
|
||||
if (fabs(recDATA[i][0]-CTRL[i])>1e-4)
|
||||
{
|
||||
return -i;
|
||||
}
|
||||
@@ -343,7 +345,7 @@ short sendPOSITest() // sendPOSI test
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (abs(recDATA[i][0]-POSI[i])>1e-4)
|
||||
if (fabs(recDATA[i][0]-POSI[i])>1e-4)
|
||||
{
|
||||
return -i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user