Commit Graph

3070 Commits

Author SHA1 Message Date
Maxim Prokhorov
7ea735548b debug: rework boot info and terminal commands
- reduce info lines on boot
- more compact `info` command. show versions, modules and crash info when there is one
- add `storage` command to display flash layout (experimental)
- display full chip id aka MAC, including the oui
- fix telnet never printing the crash data b/c telnet in not yet authorized
- fix eeprom size not reflecting the space used by the backup sectors
- use static flash strings when possible for the fw info
2021-04-07 03:53:40 +03:00
Maxim Prokhorov
0ee55ba5c0 tuya: fix harmless warning
Just handle this thing with a plain if for the time being
2021-04-03 20:34:34 +03:00
Maxim Prokhorov
612e22c992 wifi: avoid getting stuck in the WaitConnected state
Perform actual checks in the connect() method.
Make sure empty SSID, too-big SSID, too-small or too-big passphrases fail it and force a retry.
Fixes the comment that claimed the WiFi.begin() result was checked...

Local copy of the ::begin, since it is easier to work with the SDK API directly.
2021-04-03 20:34:34 +03:00
Maxim Prokhorov
b2d4a0bc59 wifi: similar, but different struct 2021-04-03 20:34:34 +03:00
Maxim Prokhorov
b80a2e9ffa terminal: trying to fix Print API usage
- more static flash strings and flash string formats
- println() will write \r\n when we mostly just use the \n
(and avoid mixing it up in the same function)
2021-04-03 20:34:34 +03:00
Maxim Prokhorov
8ffd026a6a mdns: tag offset starts from 2.7.2 2021-04-03 19:35:25 +03:00
profawk
ac983242bc scheduler: API support (#2431)
* basic json api - get all schedules

* rename func and change check func

* added _setKey helper funcs and add schedule api

* added specific schedule control

* removed unnecessary include

* fixed according to comments: removed redundent std::moves and switched to build namespace when possible
2021-04-01 22:43:09 +03:00
Maxim Prokhorov
7226a7d37f webui: new format for the scan 2021-04-01 01:10:34 +03:00
Maxim Prokhorov
da5bc88916 webui: fix wifi and typos 2021-04-01 00:28:57 +03:00
Maxim Prokhorov
cb23c9444b wifi: typo 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
4d8dc5d2a6 system: finish up cleaning broker code 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
474f0e9369 system: rework stability counter
- remove public function from the header
- initial log for both states, log counted number
- fixup terminal reset triggering unstable state
2021-03-31 09:41:05 +03:00
Maxim Prokhorov
5cabdeea1c rpn: wifi method is no longer instant 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
2de44ed5d9 ntp: remove legacy module 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
b18322a853 ws: clean-up max client setting 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
577e859d77 mdns: space in the info 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
13cbc0310a ntp: simplify tick callback, dont use broker 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
8c97eacff7 terminal: tweak dns command to print into the ctx output 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
5a97329832 wifi: refactoring / rewrite
- replace JustWifi with a custom WiFi module
- re-implemented Core methods that deal with scanning, directly work with the SDK callback
- re-implemented Core method for opmode to avoid dealing with the 2.7.x pseudo modes
- re-implemented Core method for forced-(modem)-sleep (with the intention to merge with OpmodeNull... todo)
- disable reconnect and autoconnect from SDK, avoid unintentionally storing ssid & pass for these and
  make connection routine watch for events instead. timeout is implemented as a local timer
- do not store runtime data that can be retrieved via SDK calls
- settings are loaded only when starting AP or STA, networks are no longer kept in memory
- settings STA ssidN must be unique
- remove char buffer from the event callback
- trigger station-disconnected event when actually disconnected, not when connecting or explicitly requesting it
- generic rssi sorting method for initial connection, do rssi checks while connected to find a better network

Drop (temporarily?) wps and smartconfig. Both are implementable with the new approach,
but come with some weird expectations from the SDK side (no extra heap with wps, broadcasting plain-text
passphrase with smartconfig, storing station config implicitly, etc.).

Both are sort-of fixed with RTOS SDK, but it is still a big question of whether to support them at all in the current state.
2021-03-31 09:41:05 +03:00
Maxim Prokhorov
b6934d395d led: fixup configuration in the webui
Also fix the rogue typos from the scheduler change
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
f92116341e system: refactor build configurations
Namespace build configurations of modules, make more things into constexpr
(not fully finished though)

Unify code using ...Count() to parse IDs

Avoid using unsigned char aka uint8_t as index, prefer size_t
as most code already uses it anyway. Making sure we never accidentally
truncate the value or try to read it as 32bit-wide. Also, simplify
access to built in containers, since those use the wide type as well.

Renames led and button types, more consistent initialization and field access.
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
ec220b7dd1 settings: clean-up helper classes & functions
Move inline classes into a separate file.
Make serialize() into a basic function, support numeric conversions with base option
Refactor numeric conversions and add some more helper functions for the
build flags.
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
78b4007f01 system: use direct status updates instead of broker
Get rid of status & config brokers, register status callbacks directly with the module.
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
6f4a8387ef relay: fixup sub topic generator for older gcc
Also fix a logic bug where the vector element is not actually initialized
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
f5940b7083 webui: rework initialization for relay and scheduler
Send out keys as schema, fill given template based on the 4 common input types.
Also, refactor relayLastSch into schRestore and move into the schedule template.

Moving relayCount to a wide int, this will probably not build...
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
04569c6a10 relay: stable configuration IDs
Custom provider cannot 'shadow' the relays from the config.
e.g. lights will use the id=0 when relay control is enabled, and
we should not use relayGpio0, relayPulse0, relayBoot0 and etc.
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
14c69a4a52 webui: get rid of tabindex completely
Prefer tabindex=-1 to ignore elements instead of listing them
explicitly, as browsers already handle that based on what is visible
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
d60fb47ca9 webui: external url clean-up
- .js injects both target and rel when class=external
- also inject tabindex so that TAB skips those links
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
1627e3119f webui: remove hard-coded group key list
Custom attribute for key inputs to send them as lists.
Template proxy function to make sure we don't have to type that out each time.
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
458fb7d936 webui: send alert messages directly 2021-03-31 09:41:04 +03:00
Maxim Prokhorov
dcc423ecaf relay: mqtt events and group topics refactoring
- fix relay-id check breaking group topics
- group -> pub and sub topics
- wildcard in subscription topic will be properly handled
- make sure on disconnect event only triggers when mqtt is changing
state from connected to disconnected, don't trigger every failed re-try
- replace receive-only mode with separate sub and pub topics
- some more build time settings (and some... questionable code to handle that)
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
cab98cfd8e mqtt: fix relay dependency and some comments
Plus, heartbeat will send this regardless

For the clean session stuff... when changing configuration of something like RPN,
the old subscription never goes away and we also receive old messages when QoS > 0 is used

Pending changes in the MQTT client(s) to make this work more reliably
2021-03-31 09:41:03 +03:00
Maxim Prokhorov
06c9b4947b ha: call stop() when out of retries
Also, more logging
2021-03-31 09:41:03 +03:00
Maxim Prokhorov
4854f91b3d api: allow to use path helper without api enabled 2021-03-31 09:41:03 +03:00
Maxim Prokhorov
39c08fc1e5 api: fix parsing of values after a wildcard 2021-03-31 09:41:03 +03:00
Rui Marinho
bfa704c2fd sns: remove need to patch bme680 static library (#2429)
Upstream released a version of their proprietary library which does not require any modification to the linker script.
2021-03-31 08:48:09 +03:00
DmitryBlinov
acfead4229 garland: add waves animation (#2430)
* Add anim_waves

* Minor fixes

Co-authored-by: Dmitry Blinov <dblinov@blackberry.com>
2021-03-30 16:36:59 +03:00
Maxim Prokhorov
f013e04e22 lights: make sure channel target stays consistent
Make gamma & invert flags only apply to the transition itself.
Revert to previous behaviour, where the modified value is only ever seen
by the provider function.
2021-02-26 23:33:32 +03:00
Maxim Prokhorov
707d0f0ea2 lights: update webui 2021-02-26 18:44:12 +03:00
Maxim Prokhorov
f9cbd507de mqtt: cancel heartbeat when disconnected 2021-02-26 18:44:12 +03:00
Maxim Prokhorov
1a5f95c02e lights: more color refactoring
- clamp values via helper functions
- unify channel access as long
  slightly more ram, but we no longer cast values that are 32bit-wide anyway
- remove css option, send unconditionally as /hex
- reimplement hsv conversion functions (based on HA / python's colorsys)
  simplify calculations and allow to return standalone value structs for
  RGB and HSV
- named channel accessors
- implement HA color inputs / outputs
2021-02-26 18:44:12 +03:00
Maxim Prokhorov
2a08ccb211 tuya: always run the discovery
ref. https://github.com/xoseperez/espurna/issues/2422#issuecomment-786242302
2021-02-26 18:34:47 +03:00
Maxim Prokhorov
65c8db72fb lights: fix rtcmem implementation shifts
ref. https://github.com/xoseperez/espurna/issues/2422#issuecomment-786171934

stop including mireds into the brightness when unpacking uint64 value
clamp brightness via the helper function
2021-02-26 18:34:06 +03:00
Maxim Prokhorov
59269789dc mqtt: improve qos support an additional callbacks
- return PID when sending and subscribing, allow to subscribe
to a special event when receiving acknowledgement from the broker
(separate from normal lifecycle callback, since we allow a generic callable)
- rework HomeAssistant to publish with QoS 1 and wait until the broker responds.
lwmqtt sync library already did that, so this change only affects async library
- re-add `ha.send` command
- don't send HomeAssistant config when disabled, unless requested
- some more comments
2021-02-26 18:19:17 +03:00
Maxim Prokhorov
33f6f2b124 hass: remove pointless check for buffer size 2021-02-26 18:19:12 +03:00
Maxim Prokhorov
16b3f16902 garland: clean-up whitespace 2021-02-26 16:55:50 +03:00
DmitryBlinov
46daa929f5 garland: add anim_fountain 2021-02-26 16:52:38 +03:00
DmitryBlinov
a79c7c4e95 ntp: timelib header is no longer included by default 2021-02-26 16:52:34 +03:00
DmitryBlinov
d11f82d098 garland: update documentation
- instructions for mqtt commands in the source
- update README
2021-02-26 16:52:31 +03:00
DmitryBlinov
4923377eac garland: animation improvements
- add hidden animation Glow for one color glowing
- implement one color Palette for mqtt controlled animation.
2021-02-26 16:52:27 +03:00