Skip to content

Commit e36e76b

Browse files
Fix typos (#350)
1 parent 87dbeee commit e36e76b

File tree

3 files changed

+41
-40
lines changed

3 files changed

+41
-40
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,10 @@ void setFont(const uint8_t* fontData);
258258
259259
## Ui Library (OLEDDisplayUi)
260260
261-
The Ui Library is used to provide a basic set of Ui elements called, `Frames` and `Overlays`. A `Frame` is used to provide
262-
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.
263-
261+
The Ui Library is used to provide a basic set of user interface elements called `Frames` and `Overlays`. A `Frame` is used to provide
262+
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
263+
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
264+
is always displayed at the same position.
264265
265266
```C++
266267
/**
@@ -371,7 +372,7 @@ void setLoadingDrawFunction(LoadingDrawFunction loadingDrawFunction);
371372
*/
372373
void runLoadingProcess(LoadingStage* stages, uint8_t stagesCount);
373374
374-
// Manuell Controll
375+
// Manual control
375376
void nextFrame();
376377
void previousFrame();
377378
@@ -381,7 +382,7 @@ void previousFrame();
381382
void switchToFrame(uint8_t frame);
382383
383384
/**
384-
* Transition to frame `frame`, when the `frame` number is bigger than the current
385+
* Transition to frame `frame`. When the `frame` number is bigger than the current
385386
* frame the forward animation will be used, otherwise the backwards animation is used.
386387
*/
387388
void transitionToFrame(uint8_t frame);
@@ -401,8 +402,8 @@ int8_t update();
401402
![DemoFrame1](https://github.com/squix78/esp8266-oled-ssd1306/raw/master/resources/DemoFrame1.jpg)
402403

403404
This frame shows three things:
404-
* How to draw an xbm image
405-
* How to draw a static text which is not moved by the frame transition
405+
* How to draw an XMB image
406+
* How to draw static text which is not moved by the frame transition
406407
* The active/inactive frame indicators
407408

408409
### Frame 2

src/OLEDDisplayUi.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ OLEDDisplayUi::OLEDDisplayUi(OLEDDisplay *display) {
5959
state.frameState = FIXED;
6060
state.currentFrame = 0;
6161
state.frameTransitionDirection = 1;
62-
state.isIndicatorDrawen = true;
63-
state.manuelControll = false;
62+
state.isIndicatorDrawn = true;
63+
state.manualControl = false;
6464
state.userData = NULL;
6565
shouldDrawIndicators = true;
6666
autoTransition = true;
@@ -106,11 +106,11 @@ void OLEDDisplayUi::setTimePerTransition(uint16_t time){
106106

107107
// -/------ Customize indicator position and style -------\-
108108
void OLEDDisplayUi::enableIndicator(){
109-
this->state.isIndicatorDrawen = true;
109+
this->state.isIndicatorDrawn = true;
110110
}
111111

112112
void OLEDDisplayUi::disableIndicator(){
113-
this->state.isIndicatorDrawen = false;
113+
this->state.isIndicatorDrawn = false;
114114
}
115115

116116
void OLEDDisplayUi::enableAllIndicators(){
@@ -179,10 +179,10 @@ void OLEDDisplayUi::runLoadingProcess(LoadingStage* stages, uint8_t stagesCount)
179179
delay(150);
180180
}
181181

182-
// -/----- Manuel control -----\-
182+
// -/----- Manual control -----\-
183183
void OLEDDisplayUi::nextFrame() {
184184
if (this->state.frameState != IN_TRANSITION) {
185-
this->state.manuelControll = true;
185+
this->state.manualControl = true;
186186
this->state.frameState = IN_TRANSITION;
187187
this->state.ticksSinceLastStateSwitch = 0;
188188
this->lastTransitionDirection = this->state.frameTransitionDirection;
@@ -191,7 +191,7 @@ void OLEDDisplayUi::nextFrame() {
191191
}
192192
void OLEDDisplayUi::previousFrame() {
193193
if (this->state.frameState != IN_TRANSITION) {
194-
this->state.manuelControll = true;
194+
this->state.manualControl = true;
195195
this->state.frameState = IN_TRANSITION;
196196
this->state.ticksSinceLastStateSwitch = 0;
197197
this->lastTransitionDirection = this->state.frameTransitionDirection;
@@ -205,7 +205,7 @@ void OLEDDisplayUi::switchToFrame(uint8_t frame) {
205205
if (frame == this->state.currentFrame) return;
206206
this->state.frameState = FIXED;
207207
this->state.currentFrame = frame;
208-
this->state.isIndicatorDrawen = true;
208+
this->state.isIndicatorDrawn = true;
209209
}
210210

211211
void OLEDDisplayUi::transitionToFrame(uint8_t frame) {
@@ -214,7 +214,7 @@ void OLEDDisplayUi::transitionToFrame(uint8_t frame) {
214214
if (frame == this->state.currentFrame) return;
215215
this->nextFrameNumber = frame;
216216
this->lastTransitionDirection = this->state.frameTransitionDirection;
217-
this->state.manuelControll = true;
217+
this->state.manualControl = true;
218218
this->state.frameState = IN_TRANSITION;
219219
this->state.frameTransitionDirection = frame < this->state.currentFrame ? -1 : 1;
220220
}
@@ -237,7 +237,7 @@ int16_t OLEDDisplayUi::update(){
237237
#endif
238238
int32_t timeBudget = this->updateInterval - (frameStart - this->state.lastUpdate);
239239
if ( timeBudget <= 0) {
240-
// Implement frame skipping to ensure time budget is keept
240+
// Implement frame skipping to ensure time budget is kept
241241
if (this->autoTransition && this->state.lastUpdate != 0) this->state.ticksSinceLastStateSwitch += ceil((double)-timeBudget / (double)this->updateInterval);
242242

243243
this->state.lastUpdate = frameStart;
@@ -266,10 +266,10 @@ void OLEDDisplayUi::tick() {
266266
}
267267
break;
268268
case FIXED:
269-
// Revert manuelControll
270-
if (this->state.manuelControll) {
269+
// Revert manualControl
270+
if (this->state.manualControl) {
271271
this->state.frameTransitionDirection = this->lastTransitionDirection;
272-
this->state.manuelControll = false;
272+
this->state.manualControl = false;
273273
}
274274
if (this->state.ticksSinceLastStateSwitch >= this->ticksPerFrame){
275275
if (this->autoTransition){
@@ -294,7 +294,7 @@ void OLEDDisplayUi::resetState() {
294294
this->state.ticksSinceLastStateSwitch = 0;
295295
this->state.frameState = FIXED;
296296
this->state.currentFrame = 0;
297-
this->state.isIndicatorDrawen = true;
297+
this->state.isIndicatorDrawn = true;
298298
}
299299

300300
void OLEDDisplayUi::drawFrame(){
@@ -337,32 +337,32 @@ void OLEDDisplayUi::drawFrame(){
337337
int8_t dir = this->state.frameTransitionDirection >= 0 ? 1 : -1;
338338
x *= dir; y *= dir; x1 *= dir; y1 *= dir;
339339

340-
bool drawenCurrentFrame;
340+
bool drawnCurrentFrame;
341341

342342

343-
// Prope each frameFunction for the indicator Drawen state
343+
// Probe each frameFunction for the indicator drawn state
344344
this->enableIndicator();
345345
(this->frameFunctions[this->state.currentFrame])(this->display, &this->state, x, y);
346-
drawenCurrentFrame = this->state.isIndicatorDrawen;
346+
drawnCurrentFrame = this->state.isIndicatorDrawn;
347347

348348
this->enableIndicator();
349349
(this->frameFunctions[this->getNextFrameNumber()])(this->display, &this->state, x1, y1);
350350

351351
// Build up the indicatorDrawState
352-
if (drawenCurrentFrame && !this->state.isIndicatorDrawen) {
353-
// Drawen now but not next
352+
if (drawnCurrentFrame && !this->state.isIndicatorDrawn) {
353+
// Drawn now but not next
354354
this->indicatorDrawState = 2;
355-
} else if (!drawenCurrentFrame && this->state.isIndicatorDrawen) {
356-
// Not drawen now but next
355+
} else if (!drawnCurrentFrame && this->state.isIndicatorDrawn) {
356+
// Not drawn now but next
357357
this->indicatorDrawState = 1;
358-
} else if (!drawenCurrentFrame && !this->state.isIndicatorDrawen) {
359-
// Not drawen in both frames
358+
} else if (!drawnCurrentFrame && !this->state.isIndicatorDrawn) {
359+
// Not drawn in both frames
360360
this->indicatorDrawState = 3;
361361
}
362362

363363
// If the indicator isn't draw in the current frame
364-
// reflect it in state.isIndicatorDrawen
365-
if (!drawenCurrentFrame) this->state.isIndicatorDrawen = false;
364+
// reflect it in state.isIndicatorDrawn
365+
if (!drawnCurrentFrame) this->state.isIndicatorDrawn = false;
366366

367367
break;
368368
}
@@ -381,7 +381,7 @@ void OLEDDisplayUi::drawIndicator() {
381381
// Only draw if the indicator is invisible
382382
// for both frames or
383383
// the indiactor is shown and we are IN_TRANSITION
384-
if (this->indicatorDrawState == 3 || (!this->state.isIndicatorDrawen && this->state.frameState != IN_TRANSITION)) {
384+
if (this->indicatorDrawState == 3 || (!this->state.isIndicatorDrawn && this->state.frameState != IN_TRANSITION)) {
385385
return;
386386
}
387387

src/OLEDDisplayUi.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ struct OLEDDisplayUiState {
9090
FrameState frameState;
9191
uint8_t currentFrame;
9292

93-
bool isIndicatorDrawen;
93+
bool isIndicatorDrawn;
9494

9595
// Normal = 1, Inverse = -1;
9696
int8_t frameTransitionDirection;
9797

98-
bool manuelControll;
98+
bool manualControl;
9999

100100
// Custom data that can be used by the user
101101
void* userData;
@@ -143,10 +143,10 @@ class OLEDDisplayUi {
143143
OverlayCallback* overlayFunctions;
144144
uint8_t overlayCount;
145145

146-
// Will the Indicator be drawen
146+
// Will the Indicator be drawn
147147
// 3 Not drawn in both frames
148148
// 2 Drawn this frame but not next
149-
// 1 Not drown this frame but next
149+
// 1 Not drawn this frame but next
150150
// 0 Not known yet
151151
uint8_t indicatorDrawState;
152152

@@ -183,7 +183,7 @@ class OLEDDisplayUi {
183183
*/
184184
void setTargetFPS(uint8_t fps);
185185

186-
// Automatic Controll
186+
// Automatic Control
187187
/**
188188
* Enable automatic transition to next frame after the some time can be configured with `setTimePerFrame` and `setTimePerTransition`.
189189
*/
@@ -201,12 +201,12 @@ class OLEDDisplayUi {
201201
void setAutoTransitionBackwards();
202202

203203
/**
204-
* Set the approx. time a frame is displayed
204+
* Set the approximate time a frame is displayed
205205
*/
206206
void setTimePerFrame(uint16_t time);
207207

208208
/**
209-
* Set the approx. time a transition will take
209+
* Set the approximate time a transition will take
210210
*/
211211
void setTimePerTransition(uint16_t time);
212212

0 commit comments

Comments
 (0)