Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
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
card10
firmware
Commits
6346e241
Commit
6346e241
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
fix(ecgtest): Fix scaling
parent
9103870e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#591
passed
5 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hw-tests/ecgtest/main.c
+12
-10
12 additions, 10 deletions
hw-tests/ecgtest/main.c
with
12 additions
and
10 deletions
hw-tests/ecgtest/main.c
+
12
−
10
View file @
6346e241
...
...
@@ -26,6 +26,8 @@
static
bool
ecg_switch
;
static
bool
internal_pull
;
#define Y_OFFSET 36
#define Y_SCALE 35
/***** Functions *****/
static
uint32_t
ecg_read_reg
(
uint8_t
reg
)
...
...
@@ -146,17 +148,17 @@ static uint8_t prev;
static
void
clear
(
void
)
{
Paint_Clear
(
BLACK
);
prev
=
32
;
prev
=
Y_OFFSET
;
}
static
void
set
(
uint8_t
index
,
int8_t
val
)
{
if
(
val
<
-
31
)
val
=
-
31
;
if
(
val
>
32
)
val
=
32
;
if
(
val
<
-
Y_SCALE
)
val
=
-
Y_SCALE
;
if
(
val
>
Y_SCALE
)
val
=
Y_SCALE
;
int8_t
pos
=
32
+
val
;
int8_t
pos
=
Y_OFFSET
+
val
;
int
min
,
max
;
if
(
prev
<
pos
)
{
...
...
@@ -179,11 +181,6 @@ void update(void)
{
clear
();
char
buf
[
128
];
sprintf
(
buf
,
"Switch: %d Pull: %d"
,
ecg_switch
,
internal_pull
);
Paint_DrawString_EN
(
0
,
0
,
buf
,
&
Font8
,
0x0000
,
0xffff
);
int16_t
max
=
0
;
for
(
int
i
=
0
;
i
<
SIZE_X
;
i
++
)
{
if
(
abs
(
samples
[
i
])
>
max
)
{
...
...
@@ -191,7 +188,12 @@ void update(void)
}
}
int16_t
scale
=
max
/
32
;
int16_t
scale
=
max
/
Y_SCALE
+
1
;
char
buf
[
128
];
sprintf
(
buf
,
"Switch: %d Pull: %d Scale: %d"
,
ecg_switch
,
internal_pull
,
scale
);
Paint_DrawString_EN
(
0
,
0
,
buf
,
&
Font8
,
0x0000
,
0xffff
);
for
(
int
i
=
0
;
i
<
SIZE_X
;
i
++
)
{
set
(
i
,
(
samples
[
i
]
/
scale
));
...
...
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