Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qthing
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
Jens Nolte
qthing
Commits
0c342591
Commit
0c342591
authored
5 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Revert to old led render loop
parent
3de03782
Branches
feature/bme280
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/peripherals/led_strip.cpp
+3
-16
3 additions, 16 deletions
main/peripherals/led_strip.cpp
with
3 additions
and
16 deletions
main/peripherals/led_strip.cpp
+
3
−
16
View file @
0c342591
...
@@ -18,34 +18,21 @@ qthing::led_color_t dummy_handler(uint8_t strip, uint16_t led, qthing::led_color
...
@@ -18,34 +18,21 @@ qthing::led_color_t dummy_handler(uint8_t strip, uint16_t led, qthing::led_color
static
qthing
::
led_color_handler_t
led_handler
=
dummy_handler
;
static
qthing
::
led_color_handler_t
led_handler
=
dummy_handler
;
void
render_loop
(
void
*
ignored
)
{
void
render_loop
(
void
*
ignored
)
{
// latch time or at least one tick, whatever is longer
const
TickType_t
latchTime
=
std
::
max
(
6
/
portTICK_PERIOD_MS
,
(
TickType_t
)
1
);
digitalLeds_initStrands
(
leds
,
strips_cfged
);
digitalLeds_initStrands
(
leds
,
strips_cfged
);
TickType_t
lastEndOfUpdate
=
xTaskGetTickCount
();
TickType_t
lastWakeTime
=
xTaskGetTickCount
();
TickType_t
lastWakeTime
=
xTaskGetTickCount
();
while
(
true
)
{
while
(
true
)
{
// generate led data
for
(
uint8_t
strip
=
0
;
strip
<
strips_cfged
;
strip
++
)
{
for
(
uint8_t
strip
=
0
;
strip
<
strips_cfged
;
strip
++
)
{
for
(
uint16_t
led
=
0
;
led
<
leds
[
strip
].
numPixels
;
led
++
)
{
for
(
uint16_t
led
=
0
;
led
<
leds
[
strip
].
numPixels
;
led
++
)
{
pixelColor_t
last
=
leds
[
strip
].
pixels
[
led
];
pixelColor_t
last
=
leds
[
strip
].
pixels
[
led
];
qthing
::
led_color_t
last_led
=
qthing
::
led_color_t
(
last
.
r
,
last
.
g
,
last
.
b
,
last
.
w
)
;
qthing
::
led_color_t
last_led
=
{
last
.
r
,
last
.
g
,
last
.
b
,
last
.
w
}
;
qthing
::
led_color_t
pixel
=
led_handler
(
strip
,
led
,
last_led
);
qthing
::
led_color_t
pixel
=
led_handler
(
strip
,
led
,
last_led
);
leds
[
strip
].
pixels
[
led
]
=
pixelFromRGBW
(
pixel
.
r
,
pixel
.
g
,
pixel
.
b
,
pixel
.
w
);
leds
[
strip
].
pixels
[
led
]
=
pixelFromRGBW
(
pixel
.
r
,
pixel
.
g
,
pixel
.
b
,
pixel
.
w
);
}
}
}
}
// before sending data: wait until led latch time has expired
for
(
uint8_t
i
=
0
;
i
<
strips_cfged
;
i
++
)
digitalLeds_updatePixels
(
&
leds
[
i
]);
// this returns immediately when the minimum time has expired already
vTaskDelayUntil
(
&
lastWakeTime
,
1000
/
render_frequency
/
portTICK_PERIOD_MS
);
vTaskDelayUntil
(
&
lastEndOfUpdate
,
latchTime
);
for
(
uint8_t
i
=
0
;
i
<
strips_cfged
;
i
++
)
{
digitalLeds_updatePixels
(
&
leds
[
i
]);
}
// store time after sending data so we know later when the led latch time has expired
lastEndOfUpdate
=
xTaskGetTickCount
();
}
}
}
}
...
...
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