Commit Graph

3095 Commits

Author SHA1 Message Date
Maxim Prokhorov
976176cfaa ws: use the same type for the schema keys array
Plus, it's not really a constexpr in this context
2021-04-15 21:41:39 +03:00
Maxim Prokhorov
a9be47937b settings: delete both variations of GPIO keys 2021-04-15 21:41:39 +03:00
Maxim Prokhorov
1488c088d8 mdns: more strict check for older Core and wifi mode fixes 2021-04-15 21:41:39 +03:00
Maxim Prokhorov
aeabbb389c mdns: set hostname early and run update()
Don't depend on the ArduinoOTA to do this.
Also fixes addService using nullptr as a name, since the hostname was never set.
2021-04-15 21:41:39 +03:00
Maxim Prokhorov
7e2739c8cc led: some refactoring
Regenerate pattern code and make it not depend on the Led struct.
Move private structs into the .cpp, clean-up naming and some common code.
2021-04-15 21:41:39 +03:00
Maxim Prokhorov
c27911f294 system: revert to calling the heartbeat in the loop() 2021-04-15 17:33:28 +03:00
Maxim Prokhorov
52b35cf35a debug: formatting 2021-04-15 17:33:28 +03:00
Maxim Prokhorov
0d119324dd led: fix relay ID associations
Relays list is indexed through the LED ids, don't use relayCount()
Also delay the LED update until the status actually changes, b/c
the relayStatus() value is used.

resolve #2436
2021-04-15 17:33:28 +03:00
Maxim Prokhorov
94169dcbb1 relay: fix sync reentrancy lock
Fix not resetting the lock when checking the size.

Don't lock in the boot and in the processing, both are executed in CONT
context. Still lock the relaySync() itself, since it will call relayStatus().
This goes back to the original implementation, but does not seem to be
relevant right now.
2021-04-15 17:33:28 +03:00
Maxim Prokhorov
dfba0de410 ha: cannot use shared context in the ctor
Fix crash / undefined behaviour when using the old object.
2021-04-12 03:13:01 +03:00
Maxim Prokhorov
1ed00f5768 pio: make sure the .map path is properly quoted
fix #2435
2021-04-12 01:56:27 +03:00
Maxim Prokhorov
32ccab920e wifi: fix builds without terminal 2021-04-12 01:55:10 +03:00
Maxim Prokhorov
3ebd8d1cc3 wifi: naming 2021-04-12 01:54:33 +03:00
Maxim Prokhorov
302700867e wifi: use event as trigger for the connection loop
SDK status is an unreliable source of info even when connecting.
Make sure to register both GotIp and onDisconnected and wait for the
events in the wait-loop, checking which one arrived first.

Plus, make sure the connection task object was actually created, before
proceeding with the connect-loop.
2021-04-12 01:47:03 +03:00
Maxim Prokhorov
6cdef8994b wifi: correct number of retries 2021-04-12 01:42:29 +03:00
Maxim Prokhorov
db42a94bb0 nofuss: fix typo 2021-04-07 23:06:58 +03:00
Maxim Prokhorov
7362eeb8d6 web: dynamic buffer for the config response 2021-04-07 22:56:24 +03:00
Maxim Prokhorov
778566d080 debug: not all functions accept flash strings
At least right now. These break ArduinoJson serializer and the MQTT client code,
since both try to read these as common char ptr
2021-04-07 18:54:35 +03:00
Maxim Prokhorov
45261f34ea alexa: fix invalid format and trying to fix initialization 2021-04-07 04:14:19 +03:00
Maxim Prokhorov
21794b7892 pio: create .map file for the resulting .elf 2021-04-07 03:53:40 +03:00
Maxim Prokhorov
941ec74baf alexa: fauxmoesp 3.4 2021-04-07 03:53:40 +03:00
Maxim Prokhorov
22fbfbb6eb wifi: cannot depend on the sleep value 2021-04-07 03:53:40 +03:00
Maxim Prokhorov
ae63e5fc0b terminal: construct the commandline only once 2021-04-07 03:53:40 +03:00
Maxim Prokhorov
273d19f3c6 debug: dump log buffer into the print-like object 2021-04-07 03:53:40 +03:00
Maxim Prokhorov
c734ef13e0 terminal: can directly use the char ptr
Constexpr values for the TerminalIO struct
Also move the debug-related method into the debug module
2021-04-07 03:53:40 +03:00
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