| 447 | } |
| 448 | |
| 449 | bool Smoothing::SelectConfig(unsigned cfg, bool force) |
| 450 | { |
| 451 | //WATCH |
| 452 | if (_currentConfigId == cfg && !force) |
| 453 | { |
| 454 | return true; |
| 455 | } |
| 456 | |
| 457 | if (cfg < (unsigned)_configurations.size()) |
| 458 | { |
| 459 | _settlingTime = _configurations[cfg]->settlingTime; |
| 460 | _pause = _configurations[cfg]->pause; |
| 461 | _antiFlickeringTreshold = _configurations[cfg]->antiFlickeringTreshold; |
| 462 | _antiFlickeringStep = _configurations[cfg]->antiFlickeringStep; |
| 463 | _antiFlickeringTimeout = _configurations[cfg]->antiFlickeringTimeout; |
| 464 | |
| 465 | int64_t newUpdateInterval = std::max(_configurations[cfg]->updateInterval, (int64_t)5); |
| 466 | |
| 467 | if (newUpdateInterval != _updateInterval || _configurations[cfg]->type != _smoothingType) |
| 468 | { |
| 469 | _updateInterval = newUpdateInterval; |
| 470 | _smoothingType = _configurations[cfg]->type; |
| 471 | |
| 472 | clearQueuedColors(!_pause && _enabled, true); |
| 473 | } |
| 474 | |
| 475 | _currentConfigId = cfg; |
| 476 | |
| 477 | Info(_log, "Selecting config (%d) => type: %s, pause: %s, settlingTime: %ims, interval: %ims (%iHz), antiFlickTres: %i, antiFlickStep: %i, antiFlickTime: %i", |
| 478 | _currentConfigId, QSTRING_CSTR(SmoothingConfig::EnumToString(_smoothingType)), (_pause) ? "true" : "false", int(_settlingTime), |
| 479 | int(_updateInterval), int(1000.0 / _updateInterval), _antiFlickeringTreshold, _antiFlickeringStep, int(_antiFlickeringTimeout)); |
| 480 | |
| 481 | return true; |
| 482 | } |
| 483 | |
| 484 | // reset to default |
| 485 | _currentConfigId = SMOOTHING_USER_CONFIG; |
| 486 | return false; |
| 487 | } |
| 488 | |
| 489 | bool Smoothing::isPaused() const |
| 490 | { |