(possibly) noticed in the gitter
https://gitter.im/tinkerman-cat/espurna?at=61abba5a76e37917551e4a2f
refactoring causality, as there's no longer an explicit Serial.begin
for RFB_PROVIDER_EFM8BB1 in the hardware setup in the system.cpp
(also, from not including wip serial changes that did serial port setup :/)
Generate resulting .cpp in the $BUILD_DIR, no need for atexit
Register middleware only once, there's no need to manually walk the
project directory since fnmatch.fnmatch(...) supports globs
Provide a SCons Action instead of simple function, so there's a way to
generate things on demand via command line
```
$ pio run -e $env -t .pio/build/$env/espurna_single_source/src/main.cpp
```
- just pass `-include ${cfg}` to the compiler instead of a
temporary custom.h. also do `-DDEVICE=...` and `-DMANUFACTURER=...`
- rework test_build to print using `logging` module
- report leftover configurations, after the failed one exits
- prettify the output and highlight relevant info instead of the whole lines
- BREAKING replace loadavg and system check from millis to seconds
- implement all available system clocks, make sure it is correctly
scaled with the origin type
- fix duration::{millis(),ccount(),seconds()} and return a respective
clock's time_point instead of duration. just like led sources, make
sure every module stores timestamps as time_point and intervals as
duration
- no need to track millis overflow on top of existing overflow counter
of the micros64 in getUptime
- remove class overhead in led static delays conversion, just try to
inline the required calculations and use NAME as unique id
also fix some non-apparent issues with heartbeat
- allow zero interval when it is also Mode::Once
- iterating runners to find the interval might return zero
* Add support for Yagusmart 1, 2 ad 3 gang switches
https://www.amazon.co.uk/gp/product/B086MV5MC8
These don't come with an esp8266 anymore, but can be trivially converted
as the new chip is pin compatible. Note, GPIO15 needs to be connected to
GND on 1 and 2 gang switches in order to enable the ESP to boot.
* Update code/platformio.ini
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
* Adjust build flags and name to be conformant to project culture and conventions
* changelog
* sorting
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
```
In file included from espurna\espurna_single_source.cpp:62:
espurna\wifi.cpp:282:38: error: specialization of 'T settings::internal::convert(const String&) [with T = IPAddress]' after instantiation
282 | IPAddress convert(const String& value) {
| ^
```
simplify isr code, since esp{8266,32} Cores allow to pass void* argument to the isr
also allows to seamlessly lock the gpio (but, outside does not yet check it's result)
- remove 'local' index and replace sensor code depending on it with the
existing 'slot' aka 'magnitude index' used in value() and type()
- common method to store and retrieve ratios for voltage, current,
active power and energy. default implementation is no-op, sensor
should implement ratio adjustment & calculations to use 'slot' indexes
- re-implement 'expected' values ui. display the actual ratio values,
and have a separate page for updating them in a more apparent way
- remove legacy settings that were adjusting expected values
- remove legacy settings that were resetting ratios and analog calibration
- generic webui action caller, add ratios and analog calibration resets
all of 'emon' sensors were updated to utilize the new approach to the
ratio handling. pulsemeter is somewhat an outlier, but it is unclear
whether removing the energy ratio is justified
terminal part was also updated
- implement `expected` command that hooks into the new ratioFromValue
(and what webui uses to calculate ratios)
- implement `energy` command to list only MAGNITUDE_ENERGY
- remove old pzem004t commands doing ratio reset and total energy count
another global update is related to espurna::duration
- rework module-local heartbeat and led durations into a global
espurna::duration
- update sensor internals to use specific units instead of multiplying things
on line-by-line basis. export count() to the api
Clean-up the sensor code to have intermediate 'raw' representation of
every value read from the sensor.
Update energy code to include 'actual' value that can be read directly
from the chip. Adjust the 'expected' value that we were already calculating.
Generic way to find out which units the magnitude type supports.
Clean-up UI related to temperature, energy and power units.
Resolves#2482
Also apply some refactoring to the 'schema'-generated
payloads by using the EnumerableConfig helper class.
Class received some new features:
- optional callback, verifying that index should be used at all
specific use-case is magnitudes list that needs only 'counted' ones
- std::iota / ranges::iota_view -like helper object for sequences
starting with something other than 0
Reordered payloads, prefer queueing over sending everything at once.
given that relay, button and led settings may be hardcoded,
explicitly remove from -core and -core-webui
restore telnet debugging though, since the terminal output needs it
for -core-webui, disables mdns and the generic webui server + webui blob
per 56f74cfe, make the resulting .bin even smaller
* Add SERIAL_SENSOR support
* Implement "MQTT.SEND" command, remove all other commands (#2477)
* Move command to mqtt.cpp and drop extra files
* Update CHANGELOG.md
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
As noticed in the #2472
Internal implemementation still lacks the support for the GPIO16,
as it needs to use 'special' IO16 registers (and due to the fact that the 'normal'
registers only fit in an u16[16], from 0 to 15, so internals need to change as well)
One possible way is to attach certain implementation funcs to the
struct handling the isr, avoiding a bunch of in-line checks for `pin == 16`
Another option is to just use Core's `analogWrite`, which hides the
implementation from us and should work pretty seamlessly.
(...but, currently has 2 different waveform generator types, and it is
not really clear which one is a better default, as it needs to be set at
build-time)
Implement strongly-typed time units via std::chrono,
compile-time checks with static delays and limit possible values in the
pattern parser. Clamp 'repeats' as well, instead of relying on overflow
Rework internal loop & template runners, so there's no need to
proxy status and led struct all over. Instead, simply declare two
separate funcs that are supposed to be run during the pattern and at
it's end.
Instead of cloning the 'delays' array, implement a sequence iterator
that is tracking the currently used delay and it's repeats, and which
also jumps to the next entry in the list.
(but, this uses c++ iterators, and *may* be prone to errors)
Implement small terminal command 'led <ID> [<PATTERN STRING>]'.
Running without the 'PATTERN STRING' resets the LED to the values in settings.
Move re2c-generated parser back into a separate file, use .cpp.inc as
include and .re as the source
ref. #2476, fix 'finite' pattern handling
Another type of payload from the IRremoteESP8266, intended to be used
with HVAC devices. Also add a bunch of comments in regards to IRac.h
More tweaks to the internal StringView and ParseResult, make
sure the implementation closely follows the STL alternatives.
More configuration options for the:
- Transmitter, support INPUT_PULLUP
- Receiver, allow to set signal inversion and modulation.
Correctly implement buffer size setting.
- MQTT topics, allow to override both in and out
Also fix the 'simple' parser HEX range, accepting 8byte payloads (16chars)
and allowing lowercase inputs.