Commit Graph

3113 Commits

Author SHA1 Message Date
Maxim Prokhorov
74e18a59bc scripts: update build.sh
- remove version handling, PIO already does this for us
- directly set generate_release_sh.py arguments instead of having a
getopt proxy for each one (and having to deal with short-arg support)
- slightly more logs for the build process
2021-06-07 03:54:47 +03:00
Maxim Prokhorov
4c33cacfdb pio: add build-and-copy, more configuration options for version
Multiple ways to specify version string through environment variables:
- `ESPURNA_BUILD_FULL_VERSION` to set full version string
By default it is empty, and the version is combined using the values specified below
- `ESPURNA_BUILD_VERSION` to modify the first part of the version string (1.15.0-dev)
By default, uses espurna/config/version.h APP_VERSION value
- `ESPURNA_BUILD_REVISION` to specify revision part of the version string
For example 12345678, which is expanded as either .git12345678 or -git12345678
(depending on whether the version string contains hyphen)
By default, use git to retrieve the first 8 characters of the current HEAD SHA value
- `ESPURNA_BUILD_VERSION_SUFFIX` to specify build metadata part of the string
For example nightly20210607, which is added to the full version as 1.15.0-dev+nightly20210607
Empty by defauld

Adds -t build-and-copy which uses the values above to copy firmware.bin, configurable with:
- `ESPURNA_BUILD_NAME` to set the suffix of the filename.
By default, uses the $PIOENV (aka the string after the env: in the .ini file)
- `ESPURNA_BUILD_DESTINATION` to specify where to copy the .bin files
By default, uses $PROJECT_DIR

Resulting file is stored at:
${ESPURNA_BUILD_DESTINATION}/${ESPURNA_BUILD_FULL_VERSION}/espurna-${ESPURNA_BUILD_FULL_VERSION}-${ESPURNA_BUILD_NAME}.bin

In addition, modify generate_release_sh.py to use the new environment variables.
2021-06-07 03:54:28 +03:00
Maxim Prokhorov
c945c239ea scheduler: fixup web api and functions usage
- make use of scheduler::settings when listing schedules
- do not be overzealous with settings validation & parsing
- cleaner wildcard() usage, we return a String not a ref to something internal.
but, it is techically allowed to use `const T&` for a `T` temporary which will be destroyed
after the apiRegister() callback returns
2021-05-30 05:53:13 +03:00
Maxim Prokhorov
492693054f scheduler: bump cfg version 2021-05-30 05:53:13 +03:00
Maxim Prokhorov
e298217ed1 scheduler: rebuild webui 2021-05-30 05:53:13 +03:00
Maxim Prokhorov
e22f67e5d6 scheduler: fix schedule restore flag & refactoring
Restore was unintentionally broken after switching from per-relay to
per-schedule setting. Instead of using schedules count it used the
number of relays (or curtains), and never light channels.

Instead, loop over available schedules and check the 'restore' flag,
calling the action when the schedule was supposed to be active.
Similar to the old approach, check for the most recent action and call
it (also, discarding the same type & target pairs, to avoid scheduling
conflicting actions)

time_t seconds offset is refactored into tm.tm_mday offset.
this causes the function to only work with local time, however
it *should* correctly offset day-by-day in case it somehow stumbles
upon dst transition

For settings:
- schSwitch renamed into schTarget
- schTarget default is no longer 0xff, but 0
- schType is a mandatory setting, instead of 1 (switch) default to 0 (none)
- move getSetting into functions to reduce code size
- delSetting case moved into the initial block that runs before restore() and check()

Plus, refactor C-style naming into namespaces similar to the other modules
2021-05-30 05:53:13 +03:00
Maxim Prokhorov
71ddf35022 settings: fix saving base2 integers
Buffer size of 16 is not enough for the output, bump to 32

Specific bug can be triggered by adding >16 relays and using RelayMask
Since the used API does not check buffer size at all, it ended up
overwriting the stack just before the callsite. e.g. relay boot would
show relay count as 48 (aka '0')

Remove explicit reserve() as well, buffer concat will take care of that
2021-05-20 16:02:34 +03:00
Maxim Prokhorov
3078ad16c7 webui: input name should match key prefix 2021-05-17 03:51:13 +03:00
Maxim Prokhorov
f1d1ed01da scheduler: fix order of keys for the webui 2021-05-17 03:50:27 +03:00
Maxim Prokhorov
648b45087d webui: select[.isrelay] was missing names 2021-05-17 03:47:20 +03:00
Maxim Prokhorov
8892122091 webui: rebuild static files 2021-05-13 08:21:23 +03:00
dependabot[bot]
18e1d3a6d2 webui: bump hosted-git-info from 2.8.8 to 2.8.9 (#2446)
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 08:18:43 +03:00
dependabot[bot]
1f7ede8334 webui: bump lodash from 4.17.20 to 4.17.21 (#2445)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 08:18:19 +03:00
Xose Pérez
bb7ffe9b3c sensor: add support for SmartMeasure SM300D2-VO2 air quality multi-sensor (#2447)
* Support for SmartMeasure SM300D2-VO2 air quality multi-sensor

* Fix temperature sign, using hexDecode

* Update README.md
2021-05-12 16:24:59 +03:00
m-kozlowski
4612948d95 webui: fix dcz and thingspeak templates not being populated (#2443)
* Fix for domoticz relay IDs not being populated with stored values

* Fix for domoticz relay IDs not being populated with stored values - part 2: magnitudes

Co-authored-by: mkozlowski <gitcmt@empeka.pl>
2021-05-05 03:20:21 +03:00
Maxim Prokhorov
2c91a44334 wifi: handle static config without WiFi::config
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
2021-04-25 02:01:14 +03:00
Maxim Prokhorov
9f64684656 wifi: try to workaround unexpected STAMODE_DISCONNECTED event
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.
2021-04-25 02:01:14 +03:00
Andrew Leech
2fc559fa55 hardware: add support for Mirabella Genio White A60 globe (#2439) 2021-04-23 02:16:31 +03:00
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