-
Notifications
You must be signed in to change notification settings - Fork 307
Added default temperature for ESP32 and NRF52 repeaters in telemetry #1163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
0c31cd6
1068d9a
d70bbbc
280fdb6
28da9ae
3f0f193
9815e9d
c173a04
3908295
25e5329
4088f66
0271c9b
b870d74
0fa72b6
8fb7f64
fff34bb
2b94ff4
8e276b0
8331e40
841129a
f61811a
2581245
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,6 +42,7 @@ namespace mesh { | |||||
| class MainBoard { | ||||||
| public: | ||||||
| virtual uint16_t getBattMilliVolts() = 0; | ||||||
| virtual float getMCUTemperature() { return -273.15; } // Default to absolute zero degree | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using zero degrees Kelvin as a default, better just use the
Suggested change
|
||||||
| virtual bool setAdcMultiplier(float multiplier) { return false; }; | ||||||
| virtual float getAdcMultiplier() const { return 0.0f; } | ||||||
| virtual const char* getManufacturerName() const = 0; | ||||||
|
|
@@ -88,4 +89,4 @@ class RTCClock { | |||||
| } | ||||||
| }; | ||||||
|
|
||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #if defined(NRF52_PLATFORM) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really like the preprocessor guards here. Better put the file into the |
||
| #include "NRF52Board.h" | ||
|
|
||
| // The default is from the built-in temperature sensor of MCU | ||
| float NRF52Board::getMCUTemperature() { | ||
| NRF_TEMP->TASKS_START = 1; // Start temperature measurement | ||
|
|
||
| while (NRF_TEMP->EVENTS_DATARDY == 0) { } // Wait for completion | ||
| NRF_TEMP->EVENTS_DATARDY = 0; // Clear event flag | ||
|
|
||
| int32_t temp = NRF_TEMP->TEMP; // In 0.25°C units | ||
| NRF_TEMP->TASKS_STOP = 1; | ||
|
|
||
| return temp * 0.25f; // Convert to °C | ||
| } | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #pragma once | ||
|
|
||
| #include <MeshCore.h> | ||
| #include <Arduino.h> | ||
|
|
||
| #if defined(NRF52_PLATFORM) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, let me try and test the suggestion this weekend. Should be no issue.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use what I did in #1201 if you want. Or maybe just rebase after this was merged. |
||
|
|
||
| class NRF52Board : public mesh::MainBoard { | ||
| public: | ||
| float getMCUTemperature() override; | ||
| }; | ||
|
|
||
| #endif | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
NANis used as default, then the second check can be removed.