-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:CivicTechTO/proj-noisemeter-device …
…into ota-support
- Loading branch information
Showing
7 changed files
with
159 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
reference/** linguist-vendored | ||
noisemeter-device/certs.py linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef DATAPACKET_H | ||
#define DATAPACKET_H | ||
|
||
#include "timestamp.h" | ||
|
||
#include <algorithm> | ||
|
||
struct DataPacket | ||
{ | ||
constexpr DataPacket() = default; | ||
|
||
void add(float sample) noexcept { | ||
count++; | ||
minimum = std::min(minimum, sample); | ||
maximum = std::max(maximum, sample); | ||
average += (sample - average) / count; | ||
} | ||
|
||
int count = 0; | ||
float minimum = 999.f; | ||
float maximum = 0.f; | ||
float average = 0.f; | ||
Timestamp timestamp = Timestamp::invalidTimestamp(); | ||
}; | ||
|
||
#endif // DATAPACKET_H | ||
|
Oops, something went wrong.