This was causing WebUI colorpicker to jump between positions in rgb mode, after the websocket immediately reported back rgb tuple containing different values
When building single source, enums for HTTP status codes have a name conflict.
ESP8266WebServer is included only in the OTA_WEB_SUPPORT=1 and WEB_SUPPORT=0,
so guard by checking for WEB_SUPPORT before including anything related to the async variant.
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.