Ejemplo n.º 1
0
  private void reloadConfig() {
    _configuredBrightness = _config.getInt("Brightness.Value", 100);
    _configuredAutoBrightnessNotificationThreshold =
        _config.getInt("Brightness.AutoBrightness.NotificationThresholdPercent", 0);
    _configuredAutoBrightnessMsBetweenUpdates =
        _config.getInt("Brightness.AutoBrightness.MillisecondsBetweenUpdates", 0);
    _configuredAutoBrightnessMinimalValue =
        _config.getInt("Brightness.AutoBrightness.MinimalValue", 0);
    _configuredAutoBrightnessNumValuesForAverage =
        _config.getInt("Brightness.AutoBrightness.NumValuesForAverage", 0);

    String newPin = _config.getString("Brightness.AutoBrightness.LdrPinName");
    if (_configuredAutoBrightnessPin != null && !_configuredAutoBrightnessPin.equals(newPin))
      System.out.println(
          "Warning: You changed LDR Pin. You have to restart the application that changes take effect.");
    _configuredAutoBrightnessPin = _config.getString("Brightness.AutoBrightness.LdrGpioPinNumber");

    int newCapacitorUnloadNs =
        _config.getInt("Brightness.AutoBrightness.MaxCapacitorUnloadNanoseconds");
    if (_configuredAutoBrightnessCapacitorUnloadNs != 0
        && _configuredAutoBrightnessCapacitorUnloadNs != newCapacitorUnloadNs)
      System.out.println(
          "Warning: You changed LDR Capacitor Unload milliseconds. You have to restart the application that changes take effect.");
    _configuredAutoBrightnessCapacitorUnloadNs = newCapacitorUnloadNs;

    updateBrightnessReaderSettings();

    if (_configuredBrightness != 0) _newBrightness = _configuredBrightness;
    if (_currentBrightness != _newBrightness)
      System.out.println("New brightness: " + _newBrightness);
  }
Ejemplo n.º 2
0
 private BrightnessCorrection() {
   _config = new DisplayConfiguration("brightness.properties", true);
   _config.addObserver(this);
   reloadConfig();
   _currentBrightness = _configuredBrightness;
   _newBrightness = _configuredBrightness;
   System.out.println("Initial brightness: " + _currentBrightness);
   initBrightnessSensorReader();
 }