Using Core's ESP8266WebServer + some additional handlers.
Includes barebones page, without authorization.
Allows to explicitly set OTA_WEB_SUPPORT=1 with the ESPURNA_CORE and still get a web page.
Around the same size as ArduinoOTA + MDNS, so it might also be a good
suggestion to disable those when web support is enabled.
Replace with a postponed message, where it is actually relevant.
For the NoFUSS - as with all OTA methods, page will be reloaded automatically.
And no more strlen_P into a variable-length array.
Indexed address settings & build flags.
Old parsing code is still here, but depends on the old build flag presence.
Remove most of the singleton-related code, update terminal commands to
use ctx instead of just dumping debug strings.
Since the initialization happens in the sensor setup, and we know the
pzem pointer - simply pass the 'sensor' address to the function and
utilize the c++ local static variable feature that allows their use in
the function body and any lambdas declared within it.
Multiplexing is still happening with the index-math, due for a change at
a later date (...with serial / hwserial / stream changes...)
Reading clang-tidy reports... Make sure to explicitly handle instances
of float -> (unsigned) long silently removing the fractional part.
Also, small adjustments to the way these values are parsed.
Specifically:
- calculating step & time in the transition function
- rgb channels temperature adjustment from kelvins
Get rid of input & target as bool param. Replace it with more
specific functions, named accordingly, returning the Rgb struct.
(also fixes `rgb` command not returning what the rest of the API returns)
As a side-effect, make RGB payload conversion use a more paranoid parsing & serialization methods.
So it's no longer required to change any values or the state
Slightly changed the inputValue -> value transformation classes,
actually using the recursive template to apply things in order.
Still a bit quirky, but nothing better comes to mind for this.
Fixes color+(white or cct) brightness function factor calculation
to actually do what the comment says it does.
No more unsigned char for value, consistent integer math and
explicit clamping of the input & output values.
As a follow-up for the a55cf0b, reworks brightness functions:
- value input and application implemented as part of the channel class
- track value changes externally, no need for OnceFlag
- simple all, only-rgb, color+white and color+cct are distinct
functions, where brightness classes implement the actual math
- avoid accidentally doing an actual function call through
`lightChannels()` by not accessing channels elements & size directly
through the vector (yay c++ strictness regarding *public* symbols)
In case the rgb+white(cct) brightness function was selected by the
configuration, internal calculations will always result in 'changed' being 'true'
and as a result it will continiously re-create the transition object.
fix#2467 (at least for now, the brightness function should be actually fixed)
Otherwise, some things are still hidden
(or, depend on the order of incoming messages)
Make thermostat code use those as well, instead of injecting
thermostatVisible in every json payload
Since there are no dynamic callbacks registered at setup(),
use simple function pointers as the input type.
Internal type is still std::func, though
(and not yet sure how to get rid of it correctly)
Previous version used add_timestamp=false for outputs, this one
accidentally used const char*, size_t overload in place of const char*, boolean
Make sure this can't happen by using a stronger constexpr boolean
specifically for the timestamp conversion.
Also, naming clean-up and making sure raw bytes sender does not enable
already disabled debugging output.
As well as previous commits, remove ..._config.h header in favour of .cpp
Refactor loop to only use the `Led` instance, without needing to know
it's ID. Link relay<->led on demand instead of using a flat list.
Import LedPattern implementation into the .cpp, preserve existing .in
file to generate the constructor code (when needed).
Use accessor methods instead of plain members where possible, try to
hide the actual implementation details behind some common ones.
Introduce default settings query for `led` prefix. Setting function
reworked to use common string `prefix` checker instead of requiring the
consumer to provide a onKeyCheck-like lambda / standalone function.
Resolve the code generation issue with vector methods being unable to
store the exception info string in the same elf section
(which apparently becomes duplicated, somehow, when building single .cpp)
Error messages look like something like this:
```
vector.tcc:405
error: __c causes a section type conflict with __c
_M_check_len(size_type(1), __EXCSTR("vector::_M_emplace_back_aux"));
vector.tcc:71
note: '__c' was declared here
__throw_length_error(__EXCSTR(__N("vector::reserve")));
```
Common functions moved into namespace domoticz { ... }
Module functions moved into namespace { ... }
Remove templates and favour simple function for nvalue & svalue formatting,
and also use ArduinoJson for the JSON serialization.
Detach lights from the 1st relay, introduce `dczLightIdx`
Use named channel functions instead of counting channels manually.
Try to migrate the old settings.
Introduce stronger type for Idx to avoid entity id vs. domoticz idx confusion in function arguments,
since both are numeric and there's no distinction besides the name itself.
Don't use variable length array and remove `debugSend_P`, directly give the format to `vsnprintf_P`.
Common functions moved into namespace debug { ... }
Module functions moved into namespace { ... }
Provide len argument to most outputs, so it's calculated exactly once.
Early checks for nullptr and zero length.
Fix include order once again, try not to depend on config in header and
only use it in the actual .cpp code.
Still involves strlen for flash strings, but that needs to be addressed by using a custom type like:
```
struct PstrWithLength {
const char* const ptr;
size_t size;
};
```
And define PSTR macro to return:
```
PstrWithLength{&__pstr__[0], sizeof(__pstr__)};`
```
(and, probably, for any `const char (&fixed)[Size]` arrays as well)