see #2578
* deep sleep api without ESP class dependency
* rf + cpu light sleep for cases when deep sleep cannot be used
* generic time-based light sleep; nonos does not halt cpu,
unlike the wakeup variant. timers also keep going, so
this has to be used with extra care
pending some 'deferred' variant and before and after sleep actions
see #2578
make TurnOff action select sleep mode from available settings
wifi.off and wifi.on commands in addition to existing AP & STA
overriding buttons is... problematic?
e.g. selecting LO trigger and existing hw pushbutton GPIO,
we are most likely to trigger long-click event
c/p PSTR attribute from Core files
dostring declaration with a macro instead of a scary looking boilerplate
saves varying amount of code space, mostly deals with our key and cmd strings
* globally accessible system timer class; help out with our internal
scheduling by always using strongly typed duration and dynamic
time adjustment for durations longer than system limits
(see `os_timer_t` documentation)
* our own class for scheduled callbacks which are either choosing a
simple function pointer or std function wrapper, depending on the type
passed into the constructor. specifically for scheduled functions,
this allows us to filter globally scheduled functions and push them to
the front of the queue when necessary to ensure certain order of calls
* replace Ticker instances with SystemTimer
* allow types {h, cpp} in unit tests
- clean-up comparison routines and get rid of most of the casts
- reduces total number of calls to terminalRegisterCommand
replace with a func accepting list of commands, which in
turn get instantiated as constexpr PROGMEM arrays
- reduce ram fragmentation, since we don't need to alloc as much
- reduce flash consumption b/c of lambda -> standalone func conversion
get rid of board module, replace with system calls for hostname, board
and password. move boot (quirks) handlers to system as well
espurna::build { ... } namespace for our app const values
rework more namespaces to use `espurna` root
makes internal references much easier (and shorter)
view class is not specific to settings, could use it across the app
remove duplicate code from IR
Settling on naming 'options' for enumerations (...possibly, everything
else in the future, would that make sense to store for 'setting' object)
Update terminal commands that were reporting status to also report a
full list of 'indexed' settings for the specific entity
Also updates the WebUI outputs which are (hopefuly) are already handled
as-is through the .js processing pipeline and the .html properties
receiving certain special string values
More namespacing and save ~2KiB of RAM by reducing the amount of loaded keys strings
However, ROM side of things may suffer b/c of template specializations for the
generic conversion functions when there are many different types involved.
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)
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.
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
```
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) {
| ^
```
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
For when scanning is disabled. Remove uniqueness requirement, since
settings may contain multiple SSID with different BSSID values.
wifi::Mac conversion helpers for both xxxxxxxxxx and xx:xx:xx:xx:xx:xx
Generate initial connection list with all suitable networks, not only the best ones.
When scanning for a better network, remove results with worse rssi.
Don't remove extra scan results in the delayed scan function,
allow consumer to filter by itself.
Immediatly try to connect when reloading settings and previous attempt
had failed. Because of locking, previously this caused a soft-lock of the
internal loop that required waiting for the long Reconnect timeout to
expire first.
Refactor the module to include namespace { ... } and move build settings into .cpp
Saves ~1.5Kb and also allows gcc to issue unused warnings for declared functions.
As a side-effect of refactoring, (temporarily?) remove softAp leases support.
Current Core moved dhcps support into a C++ code, forcing internal logic
to reference a specific object. Better to wait a bit until that
stabilizes and try again. Plus, it is not currently available in the esp-idf.
Refactor WebUI:
- remove jquery dependency from the base custom.js and use vanilla JS
- remove jquery + jquery-datatables dependency from the RFM69 module
- replace jquery-datatables handlers with pure-css table + some basic cell filtering
(may be incomplete, but tbh it is not worth additional 50Kb to the .bin size)
- introduce a common way to notify about the app errors, show small text notification
at the top of the page instead of relying on user to find out about errors by using the Web Developer Tools
- replace <span name=...> with <span data-settings-key=...>
- replace <div> templates with <template>, disallowing modification
without an explicit DOM clone
- run `eslint` on html/custom.js and `html-validate` on html/index.html,
and fix issues detected by both tools
Streamline settings group handling in custom.js & index.html
- drop module-specific button-add-... in favour of button-add-settings-group
- only enforce data-settings-max requirement when the property actually exists
- re-create label for=... and input id=... when settings group is
modified, so checkboxes refer to the correct element
- introduce additional data-... properties to generalize settings group additions
- introduce Enumerable object to track some common list elements for
<select>, allow to re-create <option> list when messages come in
different order
Minor fixes that also came with this:
- fix relay code incorrectly parsing the payload, causing no relay names
to be displayed in the SWITCHES panel
- fix scheduler code accidentally combining keys b/c of the way C parses
string literals on separate lines, without any commas in-between
- thermostat should not reference tmpUnit directly in the webui, replace with
module-specific thermostatUnit that is handled on the device itself
- fix index.html initial setup invalid adminPass ids
- fix index.html layout when removing specific schedules
Referencing currently used code for the NONOS, plus some Core-specific
things to handle lwip1.4 <-> lwip2 layer
Saves a bit of code handling Arduino WiFi Shield compatibility,
which we don't really need
Or, at least try to.
wifi_station_disconnect() queues the event, but receiving it will confuse the
connection loop waiting for the one right after wifi_station_connect()
Event SSID is the last connected one, reason is REASON_AUTH_FAIL (202)
Simply switch contexts to allow the event handler to run.