Commit Graph

3207 Commits

Author SHA1 Message Date
Maxim Prokhorov
ef8e7fa0dd webui: rebuild once again
amends 03573b783e
2021-08-27 04:09:45 +03:00
Maxim Prokhorov
fd913f15a1 thermostat: typo 2021-08-22 06:54:25 +03:00
Maxim Prokhorov
03573b783e webui: apply modules-... style globally
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
2021-08-22 06:42:16 +03:00
Maxim Prokhorov
5b5f104db3 ha: const-correct normalization
And init directly in the members list
2021-08-21 02:50:46 +03:00
Maxim Prokhorov
6087becf86 mqtt: remove unnecessary const_cast of the topic 2021-08-21 02:48:27 +03:00
Maxim Prokhorov
e6a0e505b3 mqtt: payload is not const
Even if std::function compiles with the wrong (but compatible) signature
2021-08-21 02:48:27 +03:00
Maxim Prokhorov
31688f1bf0 ota: missing space in the outgoing http request
fix #2465
2021-08-21 02:42:25 +03:00
Maxim Prokhorov
bdd821db86 pio: check returncode of the git process
Since the Popen instance won't do that by itself. Handles the case
where there is `git` command present, but it's not a git repo underneath.
2021-08-17 14:35:20 +03:00
Maxim Prokhorov
459591b0df webui: slightly reduce wsRegister() overhead
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)
2021-08-17 04:11:01 +03:00
Maxim Prokhorov
3e835cbc33 debug: Timestamp is constexpr struct 2021-08-17 01:12:26 +03:00
Maxim Prokhorov
efcb863ca2 debug: fix off-by-one error when formatting to allocated buffer 2021-08-17 01:11:56 +03:00
Maxim Prokhorov
d9662bd66a debug: don't show timestamps for terminal outputs
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.
2021-08-16 17:46:56 +03:00
Maxim Prokhorov
1ca8d5e7a0 pio: update platform_latest
Build with Core 3.0.2 release
2021-08-16 17:00:57 +03:00
Maxim Prokhorov
5aa43d4bf1 all: suppress -Wunused-function for serialization helpers 2021-08-16 07:31:00 +03:00
Maxim Prokhorov
ba69eba460 all: suppress BasePin copies and moves
ref. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-copy-virtual
2021-08-16 04:31:37 +03:00
Maxim Prokhorov
8bcac5f6ec gpio: clean-up
Clarify vtable anchoring, move the comment to the .cpp (near the anchor itself)
Use constexpr instead of preprocessor for GPIO_NONE
2021-08-16 04:31:37 +03:00
Maxim Prokhorov
aa5e0d46b1 led: refactor module to use namespace(s)
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.
2021-08-16 04:31:36 +03:00
Maxim Prokhorov
2ad187e529 mdns: do not use espurna.h include in the header 2021-08-16 04:31:36 +03:00
Maxim Prokhorov
d482baa725 light: refactor to use namespace(s)
Also clamp the value in setters / getters.
2021-08-16 04:31:36 +03:00
Maxim Prokhorov
ef9b95b68e button: refactor inline getSetting into functions 2021-08-16 04:17:13 +03:00
Maxim Prokhorov
1522087112 relay: refactor inline getSetting into functions 2021-08-16 04:16:30 +03:00
Maxim Prokhorov
7d7bbef2d1 wifi: clean-up
Value init Mac array, both compiler versions support this.
Named constants for conversion function lengths / sizes.
2021-08-12 17:26:48 +03:00
Maxim Prokhorov
921bf08483 settings: no need to test ::keys() 2021-08-12 10:49:09 +03:00
Maxim Prokhorov
85184db09c ota: fix invalid ::update args and tweak ns nesting 2021-08-12 10:48:25 +03:00
Maxim Prokhorov
1aa4e2fed4 rpn: simplify the handler of expiring runners 2021-08-11 18:50:34 +03:00
Maxim Prokhorov
144fbe9b89 settings: no need for vector in the base class 2021-08-11 18:50:34 +03:00
Maxim Prokhorov
11f06cf0a5 ota: fix the build without both flags 2021-08-11 18:50:34 +03:00
Maxim Prokhorov
85e70d8a07 relay: workaround for gcc4.8 single-source build
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")));
```
2021-08-11 18:45:55 +03:00
Maxim Prokhorov
37b46a040f domoticz: update changelog and webui 2021-08-11 14:25:12 +03:00
Maxim Prokhorov
94f31241dc domoticz: refactoring
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.
2021-08-11 14:11:20 +03:00
Maxim Prokhorov
b167d61615 debug: refactoring & remove special case for PROGMEM
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)
2021-08-11 13:58:24 +03:00
Maxim Prokhorov
d3551ed169 mqtt: limit received messages in log 2021-08-11 12:31:31 +03:00
Maxim Prokhorov
401b678ec6 ota: refactoring & remove deprecated secure client
Remove AXTLS mentions from asynctcp and httpupdate
More namespace MODULE and namespace { ... }
2021-08-10 17:01:27 +03:00
Maxim Prokhorov
c3c929ea34 rpn: refactoring & initialization clean-up
Use namespace instead of custom prefix everywhere.
Multiple init() funcs per namespace, instead of one large one for all
of available operators

Continue to apply namespace { ... }
2021-08-07 16:50:30 +03:00
Maxim Prokhorov
453157c5db all: more static symbols 2021-08-07 16:49:07 +03:00
Maxim Prokhorov
658648d270 core: naming cleanup
Set -> On, when the handler could be added multiple times
Remove unused functions from the headers, and add correct names for the used ones.
2021-08-06 18:45:14 +03:00
Maxim Prokhorov
7a77d23bc5 pio: upstream toolchain
More strict than the current platform-espressif8266 and also prefer this version to for the release tag.
2021-08-06 15:07:43 +03:00
Maxim Prokhorov
cfb58a3f52 alexa: fix unused warning for relay vs. lights functions 2021-08-06 15:03:16 +03:00
Maxim Prokhorov
cf79259189 ci: release workflow 2021-08-06 14:45:52 +03:00
Maxim Prokhorov
814a708fdc config: comments and default(s) 2021-08-06 13:40:31 +03:00
Maxim Prokhorov
c5f70286d1 wifi: allow to set bssid and channel from settings
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
2021-08-06 13:21:39 +03:00
Maxim Prokhorov
4be2d370af garland: fixed-size LED arrays
Shuffle std::vector usage, trying out std::array for static data and
std::unique_ptr where common use-case is reserve / resize + emplace

Also try to workaroud exception string issue with gcc4.8, which should
not be a problem with gcc10.3 coming with Core 3.0.0, but... one solution at a time
2021-08-06 12:53:19 +03:00
Maxim Prokhorov
2012a90592 wifi: no need for template 2021-08-05 18:25:04 +03:00
Maxim Prokhorov
426b5bf4a5 garland: remove public includes from private namespace 2021-08-05 18:24:14 +03:00
Maxim Prokhorov
841e4f29d5 garland: correct header order and use namespace { ... }
Header exposes module functions, no need to check for config.
Hide module-local functions from the global namespace.
2021-08-05 18:07:17 +03:00
Maxim Prokhorov
d39aeb61a3 garland: fixup std::vector and std::swap usage
Initialize the vector with the values directly, ::reserve(len) instead of ::resize(len) (throught the ctor)
Use assignment when the intent is to replace the target value, not to exchange with something else.
2021-08-05 18:02:59 +03:00
Maxim Prokhorov
f71a9cc658 garland: fix fountain off-by-one for reverse direction 2021-08-05 17:59:40 +03:00
Maxim Prokhorov
caa7752daa ws: clean-up adminPass handler
- queue the actual response, as sending immediatly seems to have
  inconsistent results with the initial setup page
- allow single string password, just like a normal key
- provide default value for adminPass wsStore variant
- `reload` & `saved` are mutually exclusive
2021-08-05 17:54:15 +03:00
Maxim Prokhorov
f0f7dcc874 wifi: sort and filter by rssi only when actually connecting
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.
2021-08-05 17:46:51 +03:00
Maxim Prokhorov
27f701773f settings: simplify migrateVersion() checks in modules
Just `if (version < N)` instead of `if (version && (version < N))`
Fix existing functions that were not checking for `version > 0`
2021-08-02 07:50:52 +03:00