Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
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
Model registry
Analyze
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
Avionics
Software Development
Skyward Boardcore
Commits
b5c2497e
Commit
b5c2497e
authored
3 years ago
by
Alberto Nidasio
Browse files
Options
Downloads
Patches
Plain Diff
[MAX] Changed conversion function
parent
99e5fb3d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/shared/sensors/MAX31855/MAX31855.cpp
+1
-5
1 addition, 5 deletions
src/shared/sensors/MAX31855/MAX31855.cpp
src/shared/sensors/MAX6675/MAX6675.cpp
+1
-3
1 addition, 3 deletions
src/shared/sensors/MAX6675/MAX6675.cpp
with
2 additions
and
8 deletions
src/shared/sensors/MAX31855/MAX31855.cpp
+
1
−
5
View file @
b5c2497e
...
@@ -78,12 +78,8 @@ TemperatureData MAX31855::sampleImpl()
...
@@ -78,12 +78,8 @@ TemperatureData MAX31855::sampleImpl()
TemperatureData
result
{};
TemperatureData
result
{};
result
.
temperatureTimestamp
=
TimestampTimer
::
getInstance
().
getTimestamp
();
result
.
temperatureTimestamp
=
TimestampTimer
::
getInstance
().
getTimestamp
();
// Extract data bits
sample
=
sample
>>
2
;
// Convert the integer and decimal part separately
// Convert the integer and decimal part separately
result
.
temperature
=
static_cast
<
float
>
(
sample
>>
2
);
result
.
temperature
=
static_cast
<
float
>
(
sample
>>
2
)
*
0.25
;
result
.
temperature
+=
static_cast
<
float
>
(
sample
&
0x3
)
*
0.25
;
return
result
;
return
result
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/shared/sensors/MAX6675/MAX6675.cpp
+
1
−
3
View file @
b5c2497e
...
@@ -79,11 +79,9 @@ TemperatureData MAX6675::sampleImpl()
...
@@ -79,11 +79,9 @@ TemperatureData MAX6675::sampleImpl()
// Extract bits 14-3
// Extract bits 14-3
sample
&=
0x7FF8
;
sample
&=
0x7FF8
;
sample
>>=
3
;
// Convert the integer and decimal part separately
// Convert the integer and decimal part separately
result
.
temperature
=
static_cast
<
float
>
(
sample
>>
2
);
result
.
temperature
+=
static_cast
<
float
>
(
sample
>>
3
)
*
0.25
;
result
.
temperature
+=
static_cast
<
float
>
(
sample
&
0x3
)
*
0.25
;
return
result
;
return
result
;
}
}
...
...
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