Skip to content

Commit

Permalink
Merge branch 'main' of github.com:CivicTechTO/proj-noisemeter-device …
Browse files Browse the repository at this point in the history
…into ota-support
  • Loading branch information
tcsullivan committed Mar 10, 2024
2 parents 3c84ec8 + eade115 commit e06b63f
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 103 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
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
2 changes: 1 addition & 1 deletion noisemeter-device/access-point.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AccessPoint

public:
AccessPoint():
server(80) {}
server(80), funcOnCredentialsReceived(nullptr) {}

// Configure the WiFi radio to be an access point.
void begin();
Expand Down
3 changes: 2 additions & 1 deletion noisemeter-device/board.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef BOARD_H
#define BOARD_H

#include "config.h"

#undef SERIAL

#if defined(BOARD_ESP32_PCB)
Expand Down Expand Up @@ -46,4 +48,3 @@ extern HWCDC USBSerial;
#endif

#endif // BOARD_H

27 changes: 27 additions & 0 deletions noisemeter-device/data-packet.h
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

Loading

0 comments on commit e06b63f

Please sign in to comment.