// Configuration. Eventually this may be user-achivable in order that settings can be persistent between sessions.
_suaAlertEnabled = false;
_altAlertEnabled = false;
+ _minDisplayBrightness = 4;
// Mega-hack - hardwire airport town and state names for the FG base area since we don't have any data for these at the moment
// TODO - do this better one day!
// Run any positional calc's required first
DCLGPS::update(dt);
+ // Set the display brightness. This should be reduced in response to falling light
+ // (i.e. nighttime), or the user covering the photocell that detects the light level.
+ // At the moment I don't know how to detect nighttime or actual light level, so only
+ // respond to the photocell being obscured.
+ // TODO - reduce the brightness in response to nighttime / lowlight.
+ float rgba[4] = {1.0, 0.0, 0.0, 1.0};
+ if(fgGetBool("/instrumentation/kln89/photocell-obscured")) {
+ rgba[0] -= (9 - _minDisplayBrightness) * 0.05;
+ }
+ _instrument->SetPixelColor(rgba);
+
_cum_dt += dt;
if(_blink) {
if(_cum_dt > 0.2) {
DCLGPS::DtoInitiate(id);
}
+void KLN89::SetMinDisplayBrightness(int n) {
+ _minDisplayBrightness = n;
+ if(_minDisplayBrightness < 1) _minDisplayBrightness = 1;
+ if(_minDisplayBrightness > 9) _minDisplayBrightness = 9;
+}
+
+void KLN89::DecrementMinDisplayBrightness() {
+ _minDisplayBrightness--;
+ if(_minDisplayBrightness < 1) _minDisplayBrightness = 1;
+}
+
+void KLN89::IncrementMinDisplayBrightness() {
+ _minDisplayBrightness++;
+ if(_minDisplayBrightness > 9) _minDisplayBrightness = 9;
+}
+
void KLN89::DrawBar(int page) {
int px = 1 + (page * 15);
int py = 1;
inline void SetAltAlertEnabled(bool b) { _altAlertEnabled = b; }
inline bool GetAltAlertEnabled() { return(_altAlertEnabled); }
+
+ void SetMinDisplayBrightness(int n); // Set minDisplayBrightness (between 1 and 9)
+ void DecrementMinDisplayBrightness(); // Decrease by 1
+ void IncrementMinDisplayBrightness(); // Increase by 1
+ inline int GetMinDisplayBrightness() { return(_minDisplayBrightness); }
inline bool GetMsgAlert() const { return(!_messageStack.empty()); }
// Configuration settings that the user can set via. the KLN89 SET pages.
bool _suaAlertEnabled; // Alert user to potential SUA entry
bool _altAlertEnabled; // Alert user to min safe alt violation
+ int _minDisplayBrightness; // Minimum display brightness in low light.
};
#endif // _KLN89_HXX
case 11:
_kln89->DrawText("MIN DISPLAY", 2, 2, 3);
_kln89->DrawText("BRIGHTNESS ADJ", 2, 1, 2);
+ if(_kln89->_mode == KLN89_MODE_CRSR && _uLinePos == 1) {
+ if(!_kln89->_blink) {
+ _kln89->DrawChar('0' + _kln89->GetMinDisplayBrightness(), 2, 6, 0);
+ }
+ _kln89->Underline(2, 6, 0, 1);
+ } else {
+ _kln89->DrawChar('0' + _kln89->GetMinDisplayBrightness(), 2, 6, 0);
+ }
+ if(_kln89->GetMinDisplayBrightness() == 4) {
+ _kln89->DrawText("Default", 2, 8, 0);
+ }
break;
}
case 10:
break;
case 11:
+ _maxULinePos = 1;
break;
}
}
_kln89->SetDistVelUnitsSI(!_kln89->GetDistVelUnitsSI());
}
break;
+ case 11:
+ if(_uLinePos == 1) {
+ _kln89->DecrementMinDisplayBrightness();
+ }
+ break;
}
}
}
_kln89->SetDistVelUnitsSI(!_kln89->GetDistVelUnitsSI());
}
break;
+ case 11:
+ if(_uLinePos == 1) {
+ _kln89->IncrementMinDisplayBrightness();
+ }
+ break;
}
}
}
_clipy1 = 0;
_clipy2 = _logy - 1;
+ // Default to black background / white text.
_backgroundColor[0] = 0.0;
_backgroundColor[1] = 0.0;
_backgroundColor[2] = 0.0;
_backgroundColor[3] = 1.0;
_pixelColor[0] = 1.0;
- _pixelColor[1] = 0.0;
- _pixelColor[2] = 0.0;
+ _pixelColor[1] = 1.0;
+ _pixelColor[2] = 1.0;
_pixelColor[3] = 1.0;
_ra2d_debug = false;
drawing_list.clear();
}
+void RenderArea2D::SetPixelColor(const float* rgba) {
+ _pixelColor[0] = rgba[0];
+ _pixelColor[1] = rgba[1];
+ _pixelColor[2] = rgba[2];
+ _pixelColor[3] = rgba[3];
+}
+
// Set clipping region in logical units
void RenderArea2D::SetClipRegion(int x1, int y1, int x2, int y2) {
_clipx1 = x1;