Jump to content

Recommended Posts

Posted

Gents, the A10-C engine Fan gauges are not a linear scale. with zero to 50% fan speed taking up less than 75 degrees of travel, the next 25% rpm taking up about 25 degrees, and the remaining 25% needing about 190 degrees rotation.

 

Other than reprinting the fan gauge faces as a linear scale, is there any way to modify the DCS BIOS sketch to match the correct movement to the scale?

 

Cheers

 

Les

Posted

I am not an expert DCS BIOS user, but you're still uploading Arduino sketches to boards, right? If so, you could write a simple function/method to scale. Example below (pseudo-code, haven't tried to compile it, but it should work, more or less).

 

These assume that DCS BIOS treats RPM input and output to the gauge as a floating-point percent (0 = 0%, 1.0 = 100%). If it treats it as an integer (0 = 0%, 100 = 100%) you might have to do slightly different casts but the idea holds.

 

 

 

/// Convert from one range to another.
/// value is the input value (e.g.: from the DCS output)

/// in_min = minimum input value we care about for this part of the range.
/// in_max = maximum input value we care about for this part of the range.
/// out_min = minimum output value. If value were in_min, we'd return out_min.
/// out_max = maximum output value. If value were in_max, we'd return out_max.

float scale_value(float value, float in_min, float in_max, float out_min, float out_max)
{
 // First, calculate the percent of the input range.
 // This doesn't do any bounds-checking, so do that first.

 float pct = (value - in_min) / (in_max - in_min);
 // Then multiply the output range by the percent, and offset it by the min value.

 return out_min + (pct * (out_max - out_min)

}


/// Now we can use scale_value to scale the range.
/// This function assumes that everything is a floating point percent. If it's an integer you

float scale_gauge(float value)
{


 if (value < 0.25)  // if the RPM is between 0 to 25%
 {
   // scale the range to between 0 and 75 degrees (which is 20.8% of a circle).

   return scale_value(value, 0, 0.25f, 0, 0.208);

 }
 else if (value < 0.5)
 {
   // scale to between 75 and 100 degrees (which is 27.7% of a circle).

   return scale_value(value, 0.25f, 0.5f, 0.208f, .277f);

 }
 else
 {
    // If value is greater than 50% rpm, scale between 27.7% and the ful circle.

    return scale_value (value, 0.5f, 1.0f, .277f, 1.0f);

 }

}

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...