Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Heizung
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Heizung
Commits
5898ee13
Commit
5898ee13
authored
1 year ago
by
Benjamin Koch
Browse files
Options
Downloads
Patches
Plain Diff
add test for DIGOUT1/2
parent
a1318bb8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
firmware/test1/heizung-test1/src/main.cpp
+76
-24
76 additions, 24 deletions
firmware/test1/heizung-test1/src/main.cpp
with
76 additions
and
24 deletions
firmware/test1/heizung-test1/src/main.cpp
+
76
−
24
View file @
5898ee13
...
@@ -53,7 +53,8 @@ Adafruit_MPR121 cap0, cap1;
...
@@ -53,7 +53,8 @@ Adafruit_MPR121 cap0, cap1;
bool
capAvailable
[
2
];
bool
capAvailable
[
2
];
Adafruit_NeoPixel
pixelsDisplay
(
60
,
WS2812_DISPLAY
,
NEO_GRB
+
NEO_KHZ800
);
Adafruit_NeoPixel
pixelsDisplay
(
60
,
WS2812_DISPLAY
,
NEO_GRB
+
NEO_KHZ800
);
Adafruit_NeoPixel
pixelsDigout1
(
2
,
DIGOUT1
,
NEO_GRB
+
NEO_KHZ800
);
Adafruit_NeoPixel
pixelsDigout1
(
50
,
DIGOUT1
,
NEO_GRB
+
NEO_KHZ800
);
Adafruit_NeoPixel
pixelsDigout2
(
50
,
DIGOUT2
,
NEO_GRB
+
NEO_KHZ800
);
void
setup
()
{
void
setup
()
{
rp2040
.
enableDoubleResetBootloader
();
rp2040
.
enableDoubleResetBootloader
();
...
@@ -456,31 +457,82 @@ void loop() {
...
@@ -456,31 +457,82 @@ void loop() {
}
}
}
}
static
int
digout1_timer
=
0
;
if
(
0
)
{
static
int
digout1_state
=
2
;
static
int
digout1_timer
=
0
;
if
(
digout1_timer
<
300
||
!
pixelsDigout1
.
canShow
())
static
int
digout1_state
=
2
;
digout1_timer
++
;
if
(
digout1_timer
<
300
||
!
pixelsDigout1
.
canShow
())
else
{
digout1_timer
++
;
digout1_timer
=
0
;
else
{
digout1_state
++
;
digout1_timer
=
0
;
digout1_state
++
;
for
(
int
i
=
0
;
i
<
pixelsDigout1
.
numPixels
();
i
++
)
{
switch
((
digout1_state
-
3
*
i
)
%
8
)
{
for
(
int
i
=
0
;
i
<
pixelsDigout1
.
numPixels
();
i
++
)
{
case
0
:
switch
((
digout1_state
-
3
*
i
)
%
8
)
{
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
255
,
0
,
0
));
case
0
:
break
;
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
255
,
0
,
0
));
case
1
:
break
;
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
255
,
0
));
case
1
:
break
;
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
255
,
0
));
case
2
:
break
;
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
0
,
255
));
case
2
:
break
;
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
0
,
255
));
default:
break
;
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
0
,
0
));
default:
break
;
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
0
,
0
));
break
;
}
}
pixelsDigout1
.
show
();
}
}
if
(
1
)
{
static
int
digout1_timer
=
0
;
static
int
digout1_state
=
2
;
if
(
digout1_timer
<
20
||
!
pixelsDigout1
.
canShow
()
||
!
pixelsDigout2
.
canShow
())
digout1_timer
++
;
else
{
digout1_timer
=
0
;
digout1_state
++
;
if
(
digout1_state
>=
3
)
digout1_state
=
0
;
for
(
int
i
=
0
;
i
<
pixelsDigout1
.
numPixels
();
i
++
)
{
switch
(
digout1_state
%
3
)
{
case
0
:
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
40
,
0
,
0
));
break
;
case
1
:
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
40
,
0
));
break
;
case
2
:
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
0
,
40
));
break
;
default:
pixelsDigout1
.
setPixelColor
(
i
,
pixelsDigout1
.
Color
(
0
,
0
,
0
));
break
;
}
}
pixelsDigout1
.
show
();
for
(
int
i
=
0
;
i
<
pixelsDigout2
.
numPixels
();
i
++
)
{
switch
((
digout1_state
+
1
)
%
3
)
{
case
0
:
pixelsDigout2
.
setPixelColor
(
i
,
pixelsDigout2
.
Color
(
40
,
0
,
0
));
break
;
case
1
:
pixelsDigout2
.
setPixelColor
(
i
,
pixelsDigout2
.
Color
(
0
,
40
,
0
));
break
;
case
2
:
pixelsDigout2
.
setPixelColor
(
i
,
pixelsDigout2
.
Color
(
0
,
0
,
40
));
break
;
default:
pixelsDigout2
.
setPixelColor
(
i
,
pixelsDigout2
.
Color
(
0
,
0
,
0
));
break
;
}
}
}
pixelsDigout2
.
show
();
}
}
pixelsDigout1
.
show
();
}
}
static
int
ledring_timer
=
0
;
static
int
ledring_timer
=
0
;
...
...
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