Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
egorguslyan
Dashboard
Commits
c22f5e03
Verified
Commit
c22f5e03
authored
3 years ago
by
egorguslyan
Browse files
Options
Downloads
Patches
Plain Diff
Animations fixes
parent
43c65ff0
No related branches found
No related tags found
1 merge request
!5
Animations
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Dashboard/Dashboard.ino
+1
-1
1 addition, 1 deletion
Dashboard/Dashboard.ino
Dashboard/screens.h
+84
-26
84 additions, 26 deletions
Dashboard/screens.h
with
85 additions
and
27 deletions
Dashboard/Dashboard.ino
+
1
−
1
View file @
c22f5e03
...
...
@@ -581,7 +581,7 @@ void loop()
case
1
:
PRINTLN_DEBUG
(
F
(
"Prepared"
));
unhandle
();
clearBuffer
(
globalVars
.
leds
);
clearBuffer
(
&
globalVars
.
leds
[
0
]
);
screens
[
globalVars
.
currentScreen
].
funcPrepare
();
case
2
:
PRINTLN_DEBUG
(
F
(
"Animated"
));
...
...
This diff is collapsed.
Click to expand it.
Dashboard/screens.h
+
84
−
26
View file @
c22f5e03
...
...
@@ -80,18 +80,26 @@ void animate(uint16_t reciprocal_speed)
for
(
uint8_t
x
=
0
;
x
<
WIDTH
;
x
++
)
setPixel
(
&
matrix
.
leds
[
0
],
x
,
y
,
getPixel
(
&
matrix
.
leds
[
0
],
x
,
y
+
1
));
for
(
uint8_t
x
=
0
;
x
<
WIDTH
;
x
++
)
setPixel
(
&
matrix
.
leds
[
0
],
x
,
HEIGHT
-
1
,
getPixel
(
&
globalVars
.
leds
[
0
],
x
,
counter
++
));
if
(
counter
==
HEIGHT
)
globalVars
.
prepare
=
0
;
setPixel
(
&
matrix
.
leds
[
0
],
x
,
HEIGHT
-
1
,
getPixel
(
&
globalVars
.
leds
[
0
],
x
,
counter
));
if
(
++
counter
==
HEIGHT
)
{
counter
=
0
;
globalVars
.
prepare
=
0
;
}
}
break
;
case
ANIMATION_SHIFT_UP
:
{
for
(
uint8_t
y
=
1
;
y
<
HEIGHT
;
y
++
)
for
(
uint8_t
y
=
HEIGHT
-
1
;
y
>
0
;
y
--
)
for
(
uint8_t
x
=
0
;
x
<
WIDTH
;
x
++
)
setPixel
(
&
matrix
.
leds
[
0
],
x
,
y
,
getPixel
(
&
matrix
.
leds
[
0
],
x
,
y
-
1
));
for
(
uint8_t
x
=
0
;
x
<
WIDTH
;
x
++
)
setPixel
(
&
matrix
.
leds
[
0
],
x
,
0
,
getPixel
(
&
globalVars
.
leds
[
0
],
x
,
(
HEIGHT
-
(
counter
++
)
-
1
)));
if
(
counter
==
HEIGHT
)
globalVars
.
prepare
=
0
;
setPixel
(
&
matrix
.
leds
[
0
],
x
,
0
,
getPixel
(
&
globalVars
.
leds
[
0
],
x
,
(
HEIGHT
-
counter
-
1
)));
if
(
++
counter
==
HEIGHT
)
{
counter
=
0
;
globalVars
.
prepare
=
0
;
}
}
break
;
case
ANIMATION_SHIFT_LEFT
:
...
...
@@ -100,18 +108,26 @@ void animate(uint16_t reciprocal_speed)
for
(
uint8_t
y
=
0
;
y
<
HEIGHT
;
y
++
)
setPixel
(
&
matrix
.
leds
[
0
],
x
,
y
,
getPixel
(
&
matrix
.
leds
[
0
],
x
+
1
,
y
));
for
(
uint8_t
y
=
0
;
y
<
HEIGHT
;
y
++
)
setPixel
(
&
matrix
.
leds
[
0
],
WIDTH
-
1
,
y
,
getPixel
(
&
globalVars
.
leds
[
0
],
counter
++
,
y
));
if
(
counter
==
WIDTH
)
globalVars
.
prepare
=
0
;
setPixel
(
&
matrix
.
leds
[
0
],
WIDTH
-
1
,
y
,
getPixel
(
&
globalVars
.
leds
[
0
],
counter
,
y
));
if
(
++
counter
==
WIDTH
)
{
counter
=
0
;
globalVars
.
prepare
=
0
;
}
}
break
;
case
ANIMATION_SHIFT_RIGHT
:
{
for
(
uint8_t
x
=
1
;
x
<
WIDTH
;
x
++
)
for
(
uint8_t
x
=
WIDTH
-
1
;
x
>
0
;
x
--
)
for
(
uint8_t
y
=
0
;
y
<
HEIGHT
;
y
++
)
setPixel
(
&
matrix
.
leds
[
0
],
x
,
y
,
getPixel
(
&
matrix
.
leds
[
0
],
x
-
1
,
y
));
for
(
uint8_t
y
=
0
;
y
<
HEIGHT
;
y
++
)
setPixel
(
&
matrix
.
leds
[
0
],
0
,
y
,
getPixel
(
&
globalVars
.
leds
[
0
],
(
WIDTH
-
(
counter
++
)
-
1
),
y
));
if
(
counter
==
WIDTH
)
globalVars
.
prepare
=
0
;
setPixel
(
&
matrix
.
leds
[
0
],
0
,
y
,
getPixel
(
&
globalVars
.
leds
[
0
],
(
WIDTH
-
counter
-
1
),
y
));
if
(
++
counter
==
WIDTH
)
{
counter
=
0
;
globalVars
.
prepare
=
0
;
}
}
break
;
}
...
...
@@ -267,15 +283,15 @@ void dashboard(Arg *arg)
if
(
globalVars
.
ppm
[
globalVars
.
freshPPM
]
>=
globalVars
.
maxPPM
-
CO2WINDOW
)
for
(
uint8_t
i
=
0
;
i
<
HEIGHT
;
i
++
)
{
setPixel
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
0
,
i
,
COLOR2
);
if
(
!
arg
->
ui
)
matrix
.
fade
(
0
,
i
,
abs
((
int16_t
)((
millis
()
/
16
)
%
256
)
-
128
));
setPixel
(
&
matrix
.
leds
[
0
],
0
,
i
,
COLOR2
);
matrix
.
fade
(
0
,
i
,
abs
((
int16_t
)((
millis
()
/
16
)
%
256
)
-
128
));
}
// Fresh room blinking
else
if
(
globalVars
.
ppm
[
globalVars
.
freshPPM
]
<=
globalVars
.
minPPM
+
CO2WINDOW
)
for
(
uint8_t
i
=
0
;
i
<
HEIGHT
;
i
++
)
{
setPixel
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
0
,
i
,
COLOR1
);
if
(
!
arg
->
ui
)
matrix
.
fade
(
0
,
i
,
abs
((
int16_t
)((
millis
()
/
16
)
%
256
)
-
128
));
setPixel
(
&
matrix
.
leds
[
0
],
0
,
i
,
COLOR1
);
matrix
.
fade
(
0
,
i
,
abs
((
int16_t
)((
millis
()
/
16
)
%
256
)
-
128
));
}
// Else show progress bar
else
...
...
@@ -283,18 +299,18 @@ void dashboard(Arg *arg)
uint8_t
ppmMapped
=
map
(
globalVars
.
ppm
[
globalVars
.
freshPPM
],
globalVars
.
minPPM
,
globalVars
.
maxPPM
,
0
,
HEIGHT
);
uint8_t
i
;
for
(
i
=
0
;
i
<=
ppmMapped
;
i
++
)
setPixel
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
0
,
i
,
barGrad
.
get
(
i
,
HEIGHT
));
setPixel
(
&
matrix
.
leds
[
0
],
0
,
i
,
barGrad
.
get
(
i
,
HEIGHT
));
for
(;
i
<
HEIGHT
;
i
++
)
setPixel
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
0
,
i
,
mBlack
);
setPixel
(
&
matrix
.
leds
[
0
],
0
,
i
,
mBlack
);
}
// Draw clock
#if(TIME_FORMAT > (10 - (OVERFLOW_WITHOUT_ZERO == 1)))
drawSmallNumber
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
2
,
1
,
globalVars
.
hours
/
10
,
COLOR1
);
drawSmallNumber
(
&
matrix
.
leds
[
0
],
2
,
1
,
globalVars
.
hours
/
10
,
COLOR1
);
#endif
drawSmallNumber
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
5
,
1
,
globalVars
.
hours
%
10
,
COLOR1
);
drawSmallNumber
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
8
,
1
,
globalVars
.
minutes
/
10
,
COLOR2
);
drawSmallNumber
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
11
,
1
,
globalVars
.
minutes
%
10
,
COLOR2
);
drawSmallNumber
(
&
matrix
.
leds
[
0
],
5
,
1
,
globalVars
.
hours
%
10
,
COLOR1
);
drawSmallNumber
(
&
matrix
.
leds
[
0
],
8
,
1
,
globalVars
.
minutes
/
10
,
COLOR2
);
drawSmallNumber
(
&
matrix
.
leds
[
0
],
11
,
1
,
globalVars
.
minutes
%
10
,
COLOR2
);
// Draw pomodoro bar
if
(
globalVars
.
pomodoroRunning
)
...
...
@@ -304,9 +320,9 @@ void dashboard(Arg *arg)
0
,
WIDTH
-
2
);
uint8_t
i
;
for
(
i
=
1
;
i
<
minuteMapped
+
1
;
i
++
)
setPixel
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
i
,
HEIGHT
-
1
,
globalVars
.
pomodoroState
?
mGreen
:
mRed
);
setPixel
(
&
matrix
.
leds
[
0
],
i
,
HEIGHT
-
1
,
globalVars
.
pomodoroState
?
mGreen
:
mRed
);
for
(;
i
<
WIDTH
;
i
++
)
setPixel
(
arg
->
ui
?
&
globalVars
.
leds
[
0
]
:
&
matrix
.
leds
[
0
],
i
,
HEIGHT
-
1
,
mBlack
);
setPixel
(
&
matrix
.
leds
[
0
],
i
,
HEIGHT
-
1
,
mBlack
);
}
}
break
;
...
...
@@ -323,8 +339,50 @@ void dashboard(Arg *arg)
void
dashboardPrepare
()
{
Arg
a
=
{.
ui
=
1
};
dashboard
(
&
a
);
// Draw CO₂ bar
// Drawing critical ppm is more important
if
(
globalVars
.
ppm
[
globalVars
.
freshPPM
]
>=
globalVars
.
maxPPM
-
CO2WINDOW
)
for
(
uint8_t
i
=
0
;
i
<
HEIGHT
;
i
++
)
{
setPixel
(
&
globalVars
.
leds
[
0
],
0
,
i
,
COLOR2
);
}
// Fresh room blinking
else
if
(
globalVars
.
ppm
[
globalVars
.
freshPPM
]
<=
globalVars
.
minPPM
+
CO2WINDOW
)
for
(
uint8_t
i
=
0
;
i
<
HEIGHT
;
i
++
)
{
setPixel
(
&
globalVars
.
leds
[
0
],
0
,
i
,
COLOR1
);
}
// Else show progress bar
else
{
uint8_t
ppmMapped
=
map
(
globalVars
.
ppm
[
globalVars
.
freshPPM
],
globalVars
.
minPPM
,
globalVars
.
maxPPM
,
0
,
HEIGHT
);
uint8_t
i
;
for
(
i
=
0
;
i
<=
ppmMapped
;
i
++
)
setPixel
(
&
globalVars
.
leds
[
0
],
0
,
i
,
barGrad
.
get
(
i
,
HEIGHT
));
for
(;
i
<
HEIGHT
;
i
++
)
setPixel
(
&
globalVars
.
leds
[
0
],
0
,
i
,
mBlack
);
}
// Draw clock
#if(TIME_FORMAT > (10 - (OVERFLOW_WITHOUT_ZERO == 1)))
drawSmallNumber
(
&
globalVars
.
leds
[
0
],
2
,
1
,
globalVars
.
hours
/
10
,
COLOR1
);
#endif
drawSmallNumber
(
&
globalVars
.
leds
[
0
],
5
,
1
,
globalVars
.
hours
%
10
,
COLOR1
);
drawSmallNumber
(
&
globalVars
.
leds
[
0
],
8
,
1
,
globalVars
.
minutes
/
10
,
COLOR2
);
drawSmallNumber
(
&
globalVars
.
leds
[
0
],
11
,
1
,
globalVars
.
minutes
%
10
,
COLOR2
);
// Draw pomodoro bar
if
(
globalVars
.
pomodoroRunning
)
{
uint8_t
minuteMapped
=
map
(
globalVars
.
pomodoroMinutes
,
0
,
globalVars
.
pomodoroState
?
globalVars
.
pomodoroSavedBreak
:
globalVars
.
pomodoroSavedWork
,
0
,
WIDTH
-
2
);
uint8_t
i
;
for
(
i
=
1
;
i
<
minuteMapped
+
1
;
i
++
)
setPixel
(
&
globalVars
.
leds
[
0
],
i
,
HEIGHT
-
1
,
globalVars
.
pomodoroState
?
mGreen
:
mRed
);
for
(;
i
<
WIDTH
;
i
++
)
setPixel
(
&
globalVars
.
leds
[
0
],
i
,
HEIGHT
-
1
,
mBlack
);
}
}
void
graph
(
Arg
*
arg
)
...
...
@@ -488,9 +546,9 @@ void settings(Arg *arg)
{
// Only handle gestures, update when needed
if
(
globalVars
.
swipeRight
)
changeScreen
(
SCREEN_SETTINGS
,
0
,
ANIMATION
_SHIFT_RIGHT
);
changeScreen
(
SCREEN_SETTINGS
,
0
,
NO_
ANIMATION
);
if
(
globalVars
.
swipeLeft
)
changeScreen
(
SCREEN_SETTINGS
,
1
,
ANIMATION
_SHIFT_LEFT
);
changeScreen
(
SCREEN_SETTINGS
,
1
,
NO_
ANIMATION
);
if
(
globalVars
.
tapLeft
&&
(
globalVars
.
currentState
!=
0
))
{
globalVars
.
currentState
--
;
...
...
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