Make sure we seamlessly handle 'convert' for the number and the string version.
And since it is a two-way map, update 'serialize' to use it as well instead of
either a simple static_cast<int> or duplicating the same strings used in 'convert'
Only string literals or static vars can be used in constexpr context,
but those can still be shoved into the flash region via PROGMEM.
Notably, PSTR(...) inside of a lambda is not a constexpr.
Some quirks to work out
- we don't 'enumerate' things through compiler, enum values may go
missing since it is not a switch-case
- 'get' default value via query still requires us to know the settings
key in the first place. and it still needs an explicit call to
'serialize'
- sensor units are stringified as their display value.
but, this also avoids two different 'string' versions of those
- EnumOptions struct instance may also be in PROGMEM, but one needs
to be very careful to only allow aligned access to it's members
(which currently means we can't use 8bit or 16bit 'enum class'es)
Don't introduce our callback to the type system, continue to bind the
ticker instance as the timer's arg and just use the lambda to pass the
argument to the reset function
```
libraries/Ticker/src/Ticker.h:136:41: warning: cast between incompatible function types from 'void (*)(CustomResetReason)' to 'Ticker::callback_with_arg_t' {aka 'void (*)(void*)'} [-Wcast-function-type]
136 | _attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void*>(arg));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Attempt to either parse with newer syntax, or fallback to the floating
point seconds as default. Settings also return a 'result' instead of the
default zero, fallback to build value otherwise (which is still floating point, though)
Update /pulse API endpoint to report the actual pulse timer value that
is active right now, not just the value attached via the setting
Make sure we don't try to strlen some empty space or neighbouring
segments, that may or may not contain nulls
Also tweak the function to warn about large messages, since it is not
(yet) clear whether we actually want those. At least something to log.
Make sure to properly clamp delay times, as the recent issue had shown
it is possible to go below the update limit. SNTP app does not do any
runtime checks, so it's up to us to enforce these limits
Update internal random number generator from raw `secureRandom()` to a custom
'std::random_device'-look-alike, where we could also use it with STL functions
(current implementation is `os_random()` aka `esp_random()`)
Not as clean as other modules, but at least prepare for the further changes.
Implement settings for float duration conversion, and test it out with pulse
and flood window time values.
More safe-guards for an externally-defined pulse time, make sure it is
not either inf or nan and is an actual finite number
Also use EnumerableConfig for the WebUI output, and make sure to use
internal _relays.size() instead of doing a function call
Make sure it could be moved further along, and the values inside of it
can be safely moved as well.
Also fixup commands that were missing ctx in OK / Error.
Use internal duration types, store time in seconds and propogate as
uint32_t when it is necessary. Update tick values as well.
Instead of generic `toInt(), overload between `strtol` and `strtoll`.
Current implementation of `settimeofday` rejects `struct tz` pointer,
make sure it's nullptr.
Sync is a simple enough routine... But, expect an already synced system
before triggering the sntp restart.
For this, keep things as milliseconds (at least for now)
Make sure to use __builtin_strlen in constexpr context
Remove `has*()` functions that are no longer used
Update WebUI callback to use EnumerableConfig
There's no need to move a temporary which is already an rvalue
Clean-up some redundant attributes and function in settings.
Make sure C types are proxied to fixed-sized ones, not the other way around.
Clean-up webprint implementation
- use typed duration for the backlog
- don't duplicate members and types for config, just re-use the struct as-is
- don't go over-the-top with const members, just proxy through a method