From 8263d86582acf43e9dc7d3035a5c92f59f871a54 Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 14:32:32 +0200 Subject: [PATCH 1/9] fix typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 08c7d22..626946c 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ void setFont(const uint8_t* fontData); ## Ui Library (OLEDDisplayUi) The Ui Library is used to provide a basic set of Ui elements called, `Frames` and `Overlays`. A `Frame` is used to provide -information the default behaviour is to display a `Frame` for a defined time and than move to the next. The library also provides an `Indicator` that will be updated accordingly. An `Overlay` on the other hand is a pieces of information (e.g. a clock) that is displayed always at the same position. +information the default behaviour is to display a `Frame` for a defined time and than move to the next. The library also provides an `Indicator` that will be updated accordingly. An `Overlay` on the other hand is a piece of information (e.g. a clock) that is displayed always at the same position. ```C++ @@ -371,7 +371,7 @@ void setLoadingDrawFunction(LoadingDrawFunction loadingDrawFunction); */ void runLoadingProcess(LoadingStage* stages, uint8_t stagesCount); -// Manuell Controll +// Manual control void nextFrame(); void previousFrame(); @@ -401,7 +401,7 @@ int8_t update(); ![DemoFrame1](https://github.com/squix78/esp8266-oled-ssd1306/raw/master/resources/DemoFrame1.jpg) This frame shows three things: - * How to draw an xbm image + * How to draw a xbm image * How to draw a static text which is not moved by the frame transition * The active/inactive frame indicators From 4ca225e1c806e7a4e74368a6c931a2d18237e6de Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 14:41:16 +0200 Subject: [PATCH 2/9] manuelControll -> manualControl --- src/OLEDDisplayUi.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/OLEDDisplayUi.cpp b/src/OLEDDisplayUi.cpp index 778a2e7..202044e 100644 --- a/src/OLEDDisplayUi.cpp +++ b/src/OLEDDisplayUi.cpp @@ -60,7 +60,7 @@ OLEDDisplayUi::OLEDDisplayUi(OLEDDisplay *display) { state.currentFrame = 0; state.frameTransitionDirection = 1; state.isIndicatorDrawen = true; - state.manuelControll = false; + state.manualControl = false; state.userData = NULL; shouldDrawIndicators = true; autoTransition = true; @@ -179,10 +179,10 @@ void OLEDDisplayUi::runLoadingProcess(LoadingStage* stages, uint8_t stagesCount) delay(150); } -// -/----- Manuel control -----\- +// -/----- Manual control -----\- void OLEDDisplayUi::nextFrame() { if (this->state.frameState != IN_TRANSITION) { - this->state.manuelControll = true; + this->state.manualControl = true; this->state.frameState = IN_TRANSITION; this->state.ticksSinceLastStateSwitch = 0; this->lastTransitionDirection = this->state.frameTransitionDirection; @@ -191,7 +191,7 @@ void OLEDDisplayUi::nextFrame() { } void OLEDDisplayUi::previousFrame() { if (this->state.frameState != IN_TRANSITION) { - this->state.manuelControll = true; + this->state.manualControl = true; this->state.frameState = IN_TRANSITION; this->state.ticksSinceLastStateSwitch = 0; this->lastTransitionDirection = this->state.frameTransitionDirection; @@ -214,7 +214,7 @@ void OLEDDisplayUi::transitionToFrame(uint8_t frame) { if (frame == this->state.currentFrame) return; this->nextFrameNumber = frame; this->lastTransitionDirection = this->state.frameTransitionDirection; - this->state.manuelControll = true; + this->state.manualControl = true; this->state.frameState = IN_TRANSITION; this->state.frameTransitionDirection = frame < this->state.currentFrame ? -1 : 1; } @@ -266,10 +266,10 @@ void OLEDDisplayUi::tick() { } break; case FIXED: - // Revert manuelControll - if (this->state.manuelControll) { + // Revert manualControl + if (this->state.manualControl) { this->state.frameTransitionDirection = this->lastTransitionDirection; - this->state.manuelControll = false; + this->state.manualControl = false; } if (this->state.ticksSinceLastStateSwitch >= this->ticksPerFrame){ if (this->autoTransition){ From 87a7750794fb0e586964d9e4516ad35913b96932 Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 14:42:40 +0200 Subject: [PATCH 3/9] use manualControl --- src/OLEDDisplayUi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OLEDDisplayUi.h b/src/OLEDDisplayUi.h index 9aa3f32..b93d2a4 100644 --- a/src/OLEDDisplayUi.h +++ b/src/OLEDDisplayUi.h @@ -95,7 +95,7 @@ struct OLEDDisplayUiState { // Normal = 1, Inverse = -1; int8_t frameTransitionDirection; - bool manuelControll; + bool manualControl; // Custom data that can be used by the user void* userData; @@ -183,7 +183,7 @@ class OLEDDisplayUi { */ void setTargetFPS(uint8_t fps); - // Automatic Controll + // Automatic Control /** * Enable automatic transition to next frame after the some time can be configured with `setTimePerFrame` and `setTimePerTransition`. */ @@ -201,12 +201,12 @@ class OLEDDisplayUi { void setAutoTransitionBackwards(); /** - * Set the approx. time a frame is displayed + * Set the approximate time a frame is displayed */ void setTimePerFrame(uint16_t time); /** - * Set the approx. time a transition will take + * Set the approximate time a transition will take */ void setTimePerTransition(uint16_t time); From a87ae8b5ec81cda60984cc1284fab931b627550e Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 14:47:36 +0200 Subject: [PATCH 4/9] drawen -> drawn --- src/OLEDDisplayUi.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/OLEDDisplayUi.cpp b/src/OLEDDisplayUi.cpp index 202044e..8dfad76 100644 --- a/src/OLEDDisplayUi.cpp +++ b/src/OLEDDisplayUi.cpp @@ -59,7 +59,7 @@ OLEDDisplayUi::OLEDDisplayUi(OLEDDisplay *display) { state.frameState = FIXED; state.currentFrame = 0; state.frameTransitionDirection = 1; - state.isIndicatorDrawen = true; + state.isIndicatorDrawn = true; state.manualControl = false; state.userData = NULL; shouldDrawIndicators = true; @@ -106,11 +106,11 @@ void OLEDDisplayUi::setTimePerTransition(uint16_t time){ // -/------ Customize indicator position and style -------\- void OLEDDisplayUi::enableIndicator(){ - this->state.isIndicatorDrawen = true; + this->state.isIndicatorDrawn = true; } void OLEDDisplayUi::disableIndicator(){ - this->state.isIndicatorDrawen = false; + this->state.isIndicatorDrawn = false; } void OLEDDisplayUi::enableAllIndicators(){ @@ -205,7 +205,7 @@ void OLEDDisplayUi::switchToFrame(uint8_t frame) { if (frame == this->state.currentFrame) return; this->state.frameState = FIXED; this->state.currentFrame = frame; - this->state.isIndicatorDrawen = true; + this->state.isIndicatorDrawn = true; } void OLEDDisplayUi::transitionToFrame(uint8_t frame) { @@ -294,7 +294,7 @@ void OLEDDisplayUi::resetState() { this->state.ticksSinceLastStateSwitch = 0; this->state.frameState = FIXED; this->state.currentFrame = 0; - this->state.isIndicatorDrawen = true; + this->state.isIndicatorDrawn = true; } void OLEDDisplayUi::drawFrame(){ @@ -337,32 +337,32 @@ void OLEDDisplayUi::drawFrame(){ int8_t dir = this->state.frameTransitionDirection >= 0 ? 1 : -1; x *= dir; y *= dir; x1 *= dir; y1 *= dir; - bool drawenCurrentFrame; + bool drawnCurrentFrame; - // Prope each frameFunction for the indicator Drawen state + // Probe each frameFunction for the indicator drawn state this->enableIndicator(); (this->frameFunctions[this->state.currentFrame])(this->display, &this->state, x, y); - drawenCurrentFrame = this->state.isIndicatorDrawen; + drawnCurrentFrame = this->state.isIndicatorDrawn; this->enableIndicator(); (this->frameFunctions[this->getNextFrameNumber()])(this->display, &this->state, x1, y1); // Build up the indicatorDrawState - if (drawenCurrentFrame && !this->state.isIndicatorDrawen) { - // Drawen now but not next + if (drawnCurrentFrame && !this->state.isIndicatorDrawn) { + // Drawn now but not next this->indicatorDrawState = 2; - } else if (!drawenCurrentFrame && this->state.isIndicatorDrawen) { - // Not drawen now but next + } else if (!drawnCurrentFrame && this->state.isIndicatorDrawn) { + // Not drawn now but next this->indicatorDrawState = 1; - } else if (!drawenCurrentFrame && !this->state.isIndicatorDrawen) { - // Not drawen in both frames + } else if (!drawnCurrentFrame && !this->state.isIndicatorDrawn) { + // Not drawn in both frames this->indicatorDrawState = 3; } // If the indicator isn't draw in the current frame - // reflect it in state.isIndicatorDrawen - if (!drawenCurrentFrame) this->state.isIndicatorDrawen = false; + // reflect it in state.isIndicatorDrawn + if (!drawnCurrentFrame) this->state.isIndicatorDrawn = false; break; } @@ -381,7 +381,7 @@ void OLEDDisplayUi::drawIndicator() { // Only draw if the indicator is invisible // for both frames or // the indiactor is shown and we are IN_TRANSITION - if (this->indicatorDrawState == 3 || (!this->state.isIndicatorDrawen && this->state.frameState != IN_TRANSITION)) { + if (this->indicatorDrawState == 3 || (!this->state.isIndicatorDrawn && this->state.frameState != IN_TRANSITION)) { return; } From 37ef19bf8c792a822400486482c32d4b89f1af1c Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 14:48:25 +0200 Subject: [PATCH 5/9] drawen -> drawn --- src/OLEDDisplayUi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OLEDDisplayUi.h b/src/OLEDDisplayUi.h index b93d2a4..27a83e8 100644 --- a/src/OLEDDisplayUi.h +++ b/src/OLEDDisplayUi.h @@ -90,7 +90,7 @@ struct OLEDDisplayUiState { FrameState frameState; uint8_t currentFrame; - bool isIndicatorDrawen; + bool isIndicatorDrawn; // Normal = 1, Inverse = -1; int8_t frameTransitionDirection; @@ -143,10 +143,10 @@ class OLEDDisplayUi { OverlayCallback* overlayFunctions; uint8_t overlayCount; - // Will the Indicator be drawen + // Will the Indicator be drawn // 3 Not drawn in both frames // 2 Drawn this frame but not next - // 1 Not drown this frame but next + // 1 Not drawn this frame but next // 0 Not known yet uint8_t indicatorDrawState; From ff06472ef37d96b6edd8da6dda41fbe882502781 Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 14:53:18 +0200 Subject: [PATCH 6/9] fix typo --- src/OLEDDisplayUi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OLEDDisplayUi.cpp b/src/OLEDDisplayUi.cpp index 8dfad76..3ade99f 100644 --- a/src/OLEDDisplayUi.cpp +++ b/src/OLEDDisplayUi.cpp @@ -237,7 +237,7 @@ int16_t OLEDDisplayUi::update(){ #endif int32_t timeBudget = this->updateInterval - (frameStart - this->state.lastUpdate); if ( timeBudget <= 0) { - // Implement frame skipping to ensure time budget is keept + // Implement frame skipping to ensure time budget is kept if (this->autoTransition && this->state.lastUpdate != 0) this->state.ticksSinceLastStateSwitch += ceil((double)-timeBudget / (double)this->updateInterval); this->state.lastUpdate = frameStart; From fc7229260664d47625b205a352ef1cfe7e51ebb3 Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 16:05:14 +0200 Subject: [PATCH 7/9] fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcel Stör --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 626946c..79fd98a 100644 --- a/README.md +++ b/README.md @@ -401,7 +401,7 @@ int8_t update(); ![DemoFrame1](https://github.com/squix78/esp8266-oled-ssd1306/raw/master/resources/DemoFrame1.jpg) This frame shows three things: - * How to draw a xbm image + * How to draw an XMB image * How to draw a static text which is not moved by the frame transition * The active/inactive frame indicators From ec284eaddb47f29a3afd36df517c7525630173b8 Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 18:59:41 +0200 Subject: [PATCH 8/9] expand doc --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 79fd98a..2d47e77 100644 --- a/README.md +++ b/README.md @@ -258,9 +258,10 @@ void setFont(const uint8_t* fontData); ## Ui Library (OLEDDisplayUi) -The Ui Library is used to provide a basic set of Ui elements called, `Frames` and `Overlays`. A `Frame` is used to provide -information the default behaviour is to display a `Frame` for a defined time and than move to the next. The library also provides an `Indicator` that will be updated accordingly. An `Overlay` on the other hand is a piece of information (e.g. a clock) that is displayed always at the same position. - +The Ui Library is used to provide a basic set of user interface elements called, `Frames` and `Overlays`. A `Frame` is used to provide +information to the user. The default behaviour is to display a `Frame` for a defined time and than move to the next `Frame`. The library also +provides an `Indicator` element that will be updated accordingly. An `Overlay` on the other hand is a piece of information (e.g. a clock) that +is always displayed at the same position. ```C++ /** From 4f04bcb97ad52324b8c5e9aba55f3552fc3e1054 Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sat, 24 Jul 2021 19:01:11 +0200 Subject: [PATCH 9/9] doc update --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2d47e77..a2db816 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ void setFont(const uint8_t* fontData); ## Ui Library (OLEDDisplayUi) -The Ui Library is used to provide a basic set of user interface elements called, `Frames` and `Overlays`. A `Frame` is used to provide +The Ui Library is used to provide a basic set of user interface elements called `Frames` and `Overlays`. A `Frame` is used to provide information to the user. The default behaviour is to display a `Frame` for a defined time and than move to the next `Frame`. The library also provides an `Indicator` element that will be updated accordingly. An `Overlay` on the other hand is a piece of information (e.g. a clock) that is always displayed at the same position. @@ -382,7 +382,7 @@ void previousFrame(); void switchToFrame(uint8_t frame); /** - * Transition to frame `frame`, when the `frame` number is bigger than the current + * Transition to frame `frame`. When the `frame` number is bigger than the current * frame the forward animation will be used, otherwise the backwards animation is used. */ void transitionToFrame(uint8_t frame); @@ -403,7 +403,7 @@ int8_t update(); This frame shows three things: * How to draw an XMB image - * How to draw a static text which is not moved by the frame transition + * How to draw static text which is not moved by the frame transition * The active/inactive frame indicators ### Frame 2