From 82744353f86663a3db525bee3505f83a3f324615 Mon Sep 17 00:00:00 2001 From: Fabrice Weinberg <Fabrice@weinberg.me> Date: Sun, 24 Jul 2016 13:45:57 +0200 Subject: [PATCH] Make it possible to enable/disable all indicators --- OLEDDisplayUi.cpp | 12 +++++++++++- OLEDDisplayUi.h | 14 +++++++++++++- README.md | 10 ++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/OLEDDisplayUi.cpp b/OLEDDisplayUi.cpp index 5acc6ee..e787442 100644 --- a/OLEDDisplayUi.cpp +++ b/OLEDDisplayUi.cpp @@ -76,6 +76,14 @@ void OLEDDisplayUi::disableIndicator(){ this->state.isIndicatorDrawen = false; } +void OLEDDisplayUi::enableAllIndicators(){ + this->shouldDrawIndicators = true; +} + +void OLEDDisplayUi::disableAllIndicators(){ + this->shouldDrawIndicators = false; +} + void OLEDDisplayUi::setIndicatorPosition(IndicatorPosition pos) { this->indicatorPosition = pos; } @@ -220,7 +228,9 @@ void OLEDDisplayUi::tick() { this->display->clear(); this->drawFrame(); - this->drawIndicator(); + if (shouldDrawIndicators) { + this->drawIndicator(); + } this->drawOverlays(); this->display->display(); } diff --git a/OLEDDisplayUi.h b/OLEDDisplayUi.h index 77c46c7..55f74bd 100644 --- a/OLEDDisplayUi.h +++ b/OLEDDisplayUi.h @@ -81,7 +81,7 @@ struct OLEDDisplayUiState { bool isIndicatorDrawen = true; // Normal = 1, Inverse = -1; - int8_t frameTransitionDirection = 1; + int8_t frameTransitionDirection = 1; bool manuelControll = false; @@ -109,6 +109,8 @@ class OLEDDisplayUi { const char* activeSymbol = ANIMATION_activeSymbol; const char* inactiveSymbol = ANIMATION_inactiveSymbol; + bool shouldDrawIndicators = true; + // Values for the Frames AnimationDirection frameAnimationDirection = SLIDE_RIGHT; @@ -215,6 +217,16 @@ class OLEDDisplayUi { */ void disableIndicator(); + /** + * Enable drawing of indicators + */ + void enableAllIndicator(); + + /** + * Disable draw of indicators. + */ + void disableAllIndicator(); + /** * Set the position of the indicator bar. */ diff --git a/README.md b/README.md index 6e60fc6..e1e6a1d 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,16 @@ void enableIndicator(); */ void disableIndicator(); +/** + * Enable drawing of indicators + */ +void enableAllIndicator(); + +/** + * Disable drawing of indicators. + */ +void disableAllIndicator(); + /** * Set the position of the indicator bar. */ -- GitLab