Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
esp8266-oled-ssd1306
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
c3pb
esp8266-oled-ssd1306
Commits
52701fd9
Commit
52701fd9
authored
8 years ago
by
Fabrice Weinberg
Browse files
Options
Downloads
Patches
Plain Diff
Reset state values when calling setFrames Fixing #34
parent
bf5cb507
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
OLEDDisplayUi.cpp
+11
-5
11 additions, 5 deletions
OLEDDisplayUi.cpp
OLEDDisplayUi.h
+5
-2
5 additions, 2 deletions
OLEDDisplayUi.h
with
16 additions
and
7 deletions
OLEDDisplayUi.cpp
+
11
−
5
View file @
52701fd9
...
...
@@ -95,22 +95,20 @@ void OLEDDisplayUi::setFrameAnimation(AnimationDirection dir) {
this
->
frameAnimationDirection
=
dir
;
}
void
OLEDDisplayUi
::
setFrames
(
FrameCallback
*
frameFunctions
,
uint8_t
frameCount
)
{
this
->
frameCount
=
frameCount
;
this
->
frameFunctions
=
frameFunctions
;
this
->
frameCount
=
frameCount
;
this
->
resetState
();
}
// -/----- Overlays ------\-
void
OLEDDisplayUi
::
setOverlays
(
OverlayCallback
*
overlayFunctions
,
uint8_t
overlayCount
){
this
->
overlayCount
=
overlayCount
;
this
->
overlayFunctions
=
overlayFunctions
;
this
->
overlayCount
=
overlayCount
;
}
// -/----- Loading Process -----\-
void
OLEDDisplayUi
::
runLoadingProcess
(
LoadingStage
*
stages
,
uint8_t
stagesCount
)
{
display
->
setTextAlignment
(
TEXT_ALIGN_CENTER
);
display
->
setFont
(
ArialMT_Plain_10
);
uint8_t
progress
=
0
;
uint8_t
increment
=
100
/
stagesCount
;
...
...
@@ -206,6 +204,14 @@ void OLEDDisplayUi::tick() {
this
->
display
->
display
();
}
void
OLEDDisplayUi
::
resetState
()
{
this
->
state
.
lastUpdate
=
0
;
this
->
state
.
ticksSinceLastStateSwitch
=
0
;
this
->
state
.
frameState
=
FIXED
;
this
->
state
.
currentFrame
=
0
;
this
->
state
.
isIndicatorDrawen
=
true
;
}
void
OLEDDisplayUi
::
drawFrame
(){
switch
(
this
->
state
.
frameState
){
case
IN_TRANSITION
:
{
...
...
This diff is collapsed.
Click to expand it.
OLEDDisplayUi.h
+
5
−
2
View file @
52701fd9
...
...
@@ -135,7 +135,9 @@ class OLEDDisplayUi {
// Loading screen
LoadingDrawFunction
loadingDrawFunction
=
[](
OLEDDisplay
*
display
,
LoadingStage
*
stage
,
uint8_t
progress
)
{
display
->
drawString
(
64
,
20
,
stage
->
process
);
display
->
setTextAlignment
(
TEXT_ALIGN_CENTER
);
display
->
setFont
(
ArialMT_Plain_10
);
display
->
drawString
(
64
,
18
,
stage
->
process
);
display
->
drawProgressBar
(
4
,
32
,
120
,
8
,
progress
);
};
...
...
@@ -150,6 +152,7 @@ class OLEDDisplayUi {
void
drawFrame
();
void
drawOverlays
();
void
tick
();
void
resetState
();
public
:
...
...
@@ -255,7 +258,7 @@ class OLEDDisplayUi {
* Set the function that will draw each step
* in the loading animation
*/
void
setLoadingDrawFunction
(
LoadingDrawFunction
stage
);
void
setLoadingDrawFunction
(
LoadingDrawFunction
loadingFunction
);
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment