-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update sensor classes to support a generic way to store energy values - Update sensor conversion code to deal with units and not magnitudes - Add magnitude<->unit for sensors, generic way of defining used unit. Convert from sensor magnitude unit to the one used for display. - Reset energy value based on index through external means (MQTT, HTTP) - Rework energy timestamping, update webui with 'last saved' value While this solves the energy conversion issues and we are finally seeing the real value, what I don't really like: - KilowattHour and WattHour are separate enum tags, thus sort-of are different types altogether - Conversion code in Energy object should probably use some generic 'ratio' calculation? (https://en.cppreference.com/w/cpp/numeric/ratio/ratio) - We are still using runtime checks to do calculations and depend that sensor outputs only one specific value type. Consider this a fix for energy display / storage and preliminary work on sensor.ino Further sensor refactoring... soon.
- Loading branch information
Showing
61 changed files
with
5,976 additions
and
5,298 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,40 @@ | ||
// ----------------------------------------------------------------------------- | ||
// Sum Filter | ||
// Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com> | ||
// ----------------------------------------------------------------------------- | ||
|
||
#if SENSOR_SUPPORT | ||
|
||
#pragma once | ||
|
||
#include "BaseFilter.h" | ||
|
||
class SumFilter : public BaseFilter { | ||
|
||
public: | ||
|
||
void add(double value) { | ||
_value += value; | ||
} | ||
|
||
unsigned char count() { | ||
return 1; | ||
} | ||
|
||
void reset() { | ||
_value = 0.0; | ||
} | ||
|
||
double result() { | ||
return _value; | ||
} | ||
|
||
void resize(unsigned char size) {} | ||
|
||
protected: | ||
|
||
double _value = 0; | ||
|
||
}; | ||
|
||
#endif // SENSOR_SUPPORT |
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
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
Oops, something went wrong.