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
7480904c
Commit
7480904c
authored
3 years ago
by
egorguslyan
Browse files
Options
Downloads
Patches
Plain Diff
millis() reset, no animations
parent
8368008c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dashboard/Dashboard.ino
+24
-4
24 additions, 4 deletions
Dashboard/Dashboard.ino
Dashboard/screens.h
+6
-4
6 additions, 4 deletions
Dashboard/screens.h
Dashboard/textbox.h
+11
-2
11 additions, 2 deletions
Dashboard/textbox.h
with
41 additions
and
10 deletions
Dashboard/Dashboard.ino
+
24
−
4
View file @
7480904c
...
...
@@ -82,14 +82,21 @@ struct
uint8_t
currentState
;
uint8_t
animation
:
4
;
uint8_t
prepare
:
2
;
uint
64
_t
timer
;
uint
32
_t
timer
;
uint8_t
tapLeft
:
1
;
uint8_t
tapRight
:
1
;
uint8_t
swipeLeft
:
1
;
uint8_t
swipeRight
:
1
;
uint8_t
holdLeft
:
1
;
uint8_t
holdRight
:
1
;
mData
leds
[
0
/*NUMLEDS*/
];
// Sorry, but this buffer drains a lot of memory
// mData leds[NUMLEDS];
void
leds
;
// Sorry, but this buffer drains a lot of memory
// Measured data
uint16_t
ppm
:
13
;
// CO2 ppm (surely cant be more than 8192)
uint8_t
hours
:
5
;
uint8_t
minutes
:
6
;
uint8_t
seconds
:
6
;
}
globalVars
;
microLED
<
NUMLEDS
,
LEDsPin
,
MLED_NO_CLOCK
,
LED_WS2812
,
ORDER_GRB
,
CLI_AVER
,
SAVE_MILLIS
>
matrix
(
WIDTH
,
HEIGHT
,
ZIGZAG
,
RIGHT_TOP
,
DIR_LEFT
);
...
...
@@ -98,6 +105,8 @@ textbox tb;
#include
"configScreens.h"
MHZ19_uart
co2
;
extern
volatile
unsigned
long
timer0_millis
;
void
setup
()
{
// Hardware init
...
...
@@ -108,7 +117,7 @@ void setup()
co2
.
setAutoCalibration
(
false
);
Serial
.
begin
(
9600
);
// For safe debugging
while
(
!
Serial
.
available
())
{}
//
while (!Serial.available()) {}
Serial
.
println
(
"Hello"
);
// Reading settings from nonvolatile memory
...
...
@@ -130,7 +139,7 @@ void setup()
void
loop
()
{
// Terminate if buttuns are holded
static
uint
64
_t
timer_debug0
=
0
;
static
uint
32
_t
timer_debug0
=
0
;
static
bool
button
=
0
;
static
bool
last_button
=
0
;
last_button
=
button
;
...
...
@@ -156,4 +165,15 @@ void loop()
}
matrix
.
show
();
// Monthly preventative safe reset of the millis() timer
TIMER
(
0
,
3456000000
)
{
noInterrupts
();
timer0_millis
=
0
;
interrupts
();
globalVars
.
timer
=
0
;
tb
.
resetTimers
();
timer_debug0
=
0
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Dashboard/screens.h
+
6
−
4
View file @
7480904c
...
...
@@ -26,11 +26,11 @@ void changeScreen(uint8_t current, uint8_t next)
void
animate
(
uint16_t
reciprocal_speed
)
{
static
uint8_t
counter
=
0
;
TIMER
(
globalVars
.
timer
,
reciprocal_speed
)
//if(globalVars.animation == NO_ANIMATION)
if
(
true
)
{
globalVars
.
timer
=
millis
()
;
globalVars
.
prepare
=
0
;
return
;
}
}
...
...
@@ -74,12 +74,14 @@ void welcome(Arg *arg)
globalVars
.
currentState
++
;
globalVars
.
timer
=
millis
();
break
;
// Setup textbox
case
2
:
char
S
[
20
];
strcpy_P
(
S
,
pgm_read_word
(
strings
[
0
]));
tb
.
setup
(
S
,
LANGMASK
(
0
),
COLOR2
,
TB_REPEAT
,
1
,
1
,
14
,
100
);
globalVars
.
currentState
++
;
break
;
// Render until it disappears
case
3
:
if
(
tb
.
render
())
globalVars
.
timer
=
millis
();
if
(
globalVars
.
swipeLeft
)
...
...
This diff is collapsed.
Click to expand it.
Dashboard/textbox.h
+
11
−
2
View file @
7480904c
...
...
@@ -33,7 +33,7 @@ private:
uint64_t
langMask
;
bool
native
;
void
getLetter
(
uint8_t
i
,
bool
skipBitmap
=
0
);
uint
64
_t
timer0
;
uint
32
_t
timer0
;
public:
textbox
(
void
);
...
...
@@ -45,6 +45,7 @@ public:
uint8_t
render
(
void
);
void
disable
(
void
);
void
changeCords
(
uint8_t
newx
,
uint8_t
newy
);
void
resetTimers
(
void
);
};
textbox
::
textbox
(
void
)
...
...
@@ -115,6 +116,7 @@ void textbox::setup(char _text[], uint64_t _langMask,
uint8_t
textbox
::
render
(
void
)
{
uint8_t
r
=
1
;
// Return 1 if rendered, 2 if rendered with new cycle
if
(
mode
!=
TB_DISABLED
)
{
// If static or kickstart
...
...
@@ -134,6 +136,7 @@ uint8_t textbox::render(void)
{
if
((
!
direction
&&
offset
==
-
textwidth
+
w
)
||
(
direction
&&
offset
==
0
))
{
r
=
direction
+
1
;
direction
=
!
direction
;
state
=
0
;
}
...
...
@@ -147,6 +150,7 @@ uint8_t textbox::render(void)
{
offset
=
0
+
(
mode
==
TB_REPEAT
)
*
w
;
state
=
0
;
r
=
2
;
}
}
}
...
...
@@ -206,7 +210,7 @@ uint8_t textbox::render(void)
index
=
0
;
}
}
return
1
;
return
r
;
}
void
textbox
::
disable
(
void
)
...
...
@@ -244,4 +248,9 @@ void textbox::changeCords(uint8_t newx, uint8_t newy)
{
cord_x
=
newx
;
cord_y
=
newy
;
}
void
textbox
::
resetTimers
(
void
)
{
timer0
=
0
;
}
\ No newline at end of file
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