Commit Graph

3360 Commits

Author SHA1 Message Date
Maxim Prokhorov
95b89daaea webui: bump again for html-validate 2022-01-14 04:05:06 +03:00
Maxim Prokhorov
52a47a6cfb webui: bump dependencies lock 2022-01-14 03:50:36 +03:00
Maxim Prokhorov
05c696f869 webui: fix lint 2022-01-14 03:50:23 +03:00
Maxim Prokhorov
288b79c549 webui: reposition elements and trying to fix autoscroll
Since 'Enter' is also a submit button and another style gets applied,
both seem to overlap. Not very important on a desktop, but might be
easier to navigate on mobile screen
(plus, move settings backup buttons back at the top, accidentally moved
those to the bottom in the previous commit)

On the DEBUG page as well, trying to fix the scrolling behaviour when the
logging stream just started and will only jump after it spends some time at
the top row. Watching the element state to pause the autoscroll when we
manually move the slider, and resume it once the slider touches the bottom
of the textarea. Entering the command will reset the state and enable
the autoscrolling immediately
2022-01-14 03:28:32 +03:00
Maxim Prokhorov
29cac10192 mqtt: settings have a common prefix 2022-01-13 06:38:05 +03:00
Maxim Prokhorov
8e1ef04bc3 ci: make sure to ignore cmake cache in git 2022-01-13 06:21:36 +03:00
Maxim Prokhorov
170b791924 mqtt: settings query and rename mqtt.info command
Separate variables that are used just for the internal loop,
and the ones that are supposed to go into the client as args

Clean up logging and the terminal output, certain things are
now visible through the settings query and there's no need to
dump the build value
2022-01-13 06:20:28 +03:00
Maxim Prokhorov
19d56652cd btn: missing namespace 2022-01-13 06:07:26 +03:00
Maxim Prokhorov
eaa2e370eb ci: use esp8266 mock framework
Resolve the issue with the UnixHostDuino not really being compatible
with the esp8266 Core String (...and the rest of the Core, as well)

Port the CMakeLists.txt from the rpnlib and update it use FetchContent
instead of either manually fetching dependencies or using PIO artifacts
Caching is *expected* to work, but might need slight adjustments
2022-01-13 04:04:37 +03:00
Maxim Prokhorov
594763e349 webui: update blobs 2022-01-13 02:21:35 +03:00
Maxim Prokhorov
4c178948b5 webui: revamp grid elements
Make more use of control-groups instead of adding a manual alignment
class to each element. Surprisingly, this is slightly larger than the
previous .gz.html output, but not enough to not consider the readability.

Status page updated to take the lengthy hostnames and version strings
into an account, remove those from the sidebar.

Clean-up terminal module. Use the same style for both input and output,
move the terminal handler and debug handler into an appropriate .cpp
2022-01-13 02:16:28 +03:00
Maxim Prokhorov
b5dca42cbc webui: revamp group addition & deletion
Generate explicit events. Don't have a separate group observer that
tracks deletion, but handle it immediately from the 'button' event

Replace kv array with a direct key updates. While the backed part still
must optimize for size, from this side we should operate on keys directly
2022-01-12 17:26:30 +03:00
Maxim Prokhorov
2b83a883be relay: missing build flag check 2022-01-12 17:20:11 +03:00
Maxim Prokhorov
71231e0d7d ws: more flashstrings as keys 2022-01-12 17:19:51 +03:00
Maxim Prokhorov
38456d9ab7 debug: crash offset should increment by 4 2022-01-12 17:19:11 +03:00
Maxim Prokhorov
2c663ccbff btn: nicer structs 2022-01-12 17:18:36 +03:00
Maxim Prokhorov
034be83c52 sch: settings query 2021-12-30 02:03:03 +03:00
Maxim Prokhorov
1d9ac9e14f webui: always create Enumerable{Payload,Config} list 2021-12-30 02:03:03 +03:00
Maxim Prokhorov
2e254f2d60 webui: update blobs 2021-12-30 02:03:03 +03:00
Maxim Prokhorov
5dd2009214 webui: fix checkbox styling under pure-form
Using a more 'specific' CSS rule to override it's width and height
2021-12-30 02:03:03 +03:00
Maxim Prokhorov
9e390084c9 system: these are in ROM 2021-12-30 02:03:03 +03:00
Maxim Prokhorov
3aef6adf7d webui: update "select" options to use text values 2021-12-30 02:03:03 +03:00
Maxim Prokhorov
710f45c2b1 webui: magnitude should not print missing unit
In case the measurement is unitless, make sure to substitute the empty
.units[id] value with an empty string instead of the ambigious 'undefined'
2021-12-30 02:03:03 +03:00
Maxim Prokhorov
40c50f910e webui: do not lose select original=value when nothing is selected 2021-12-30 02:03:03 +03:00
Maxim Prokhorov
e213b58db2 settings: continue refactoring internal constants
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.
2021-12-30 02:03:03 +03:00
Maxim Prokhorov
7727d7f824 light: __cplusplus match only needed for < c++17 2021-12-23 14:42:10 +03:00
Maxim Prokhorov
76b11470f0 led: add more PROGMEM to the internal constants
Since we know the key-defaults ahead of time, move those there as well
Also tweak alignment of the resulting structs to be % 4
2021-12-23 14:42:03 +03:00
Maxim Prokhorov
5865654950 led: fixup findme-wifi and relays modes
Renamings, and fix duplicate code paths and actually use all of relays
for the status check instead of just one (like the FOLLOW does)
2021-12-23 12:51:43 +03:00
Maxim Prokhorov
167eb6c939 sensor: send action results to the specific client 2021-12-23 12:51:43 +03:00
Maxim Prokhorov
e78cfd00cb relay: use both settings and build flags for mqtt disconnection event
And since WebUI payload used it, this was not reported as 'unused'
2021-12-23 12:51:43 +03:00
Maxim Prokhorov
514bc938c2 settings: rework string<->enum conversion
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)
2021-12-23 12:51:43 +03:00
Maxim Prokhorov
ec33ee3242 relay: disarm and reset the timer after callback 2021-12-20 14:23:37 +03:00
Maxim Prokhorov
196bb5bc7a api: relax 'accept:' requirements
If the endpoint receives no header, treat it as '*/*'

Don't fail prematurely, since asyncwebserver handler needs to claim the
request to issue a custom response code.
ref.
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406
- https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.6
2021-12-20 14:11:52 +03:00
Maxim Prokhorov
b67269f9ef relay: fixup pulse handlers
cstring's *cmp* return result is integer, not boolean
Pulse processing should only trigger when *current* state is not normal
2021-12-20 14:00:20 +03:00
Maxim Prokhorov
0c57f0bcf9 relay: synchronize in loop task
Remove the ticker dependency, and make sure 'save' callback does not
override itself when at least one relay does not set the 'persist' flag
2021-12-20 14:00:20 +03:00
Maxim Prokhorov
f7ba4eda72 relay: pulse command status is for 'normal' state
Also fixing accidental copies of the timer object.
2021-12-19 20:43:28 +03:00
Maxim Prokhorov
b2c900b799 ntp: fix terminal newlines 2021-12-19 17:48:40 +03:00
Maxim Prokhorov
64d70b1324 utils: mode is always null 2021-12-19 17:48:40 +03:00
Maxim Prokhorov
907cba1518 utils: comments 2021-12-19 17:48:40 +03:00
Maxim Prokhorov
bffc484c47 relay: comments 2021-12-19 17:48:40 +03:00
Maxim Prokhorov
3f2d2308f8 relay: set initial status for pulse 2021-12-19 17:48:40 +03:00
Maxim Prokhorov
ba90b76020 relay: pulse api returns seconds 2021-12-19 17:48:40 +03:00
Maxim Prokhorov
e271eaa019 sensor: fix crash when trying to read ratio settings 2021-12-18 23:47:20 +03:00
Maxim Prokhorov
a5bb8e457a system: fix ticker arg cast
Don't introduce our callback to the type system, continue to bind the
ticker instance as the timer's arg and just use the lambda to pass the
argument to the reset function

```
libraries/Ticker/src/Ticker.h:136:41: warning: cast between incompatible function types from 'void (*)(CustomResetReason)' to 'Ticker::callback_with_arg_t' {aka 'void (*)(void*)'} [-Wcast-function-type]
  136 |         _attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void*>(arg));
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2021-12-18 23:47:20 +03:00
Maxim Prokhorov
19963fb8ce system: some unused params 2021-12-18 23:47:20 +03:00
Maxim Prokhorov
20fc3a655c system: clean-up types 2021-12-18 23:46:37 +03:00
Maxim Prokhorov
81862e420a api: check content-type detected by the server
Don't fail when the header also has charset=...
Also, fallback to text/plain when there's no Accept
2021-12-18 23:46:37 +03:00
Maxim Prokhorov
493bbcfa2a relay: accept {hh}h{mm}m{ss}s syntax for pulse
Attempt to either parse with newer syntax, or fallback to the floating
point seconds as default. Settings also return a 'result' instead of the
default zero, fallback to build value otherwise (which is still floating point, though)

Update /pulse API endpoint to report the actual pulse timer value that
is active right now, not just the value attached via the setting
2021-12-18 23:40:53 +03:00
Maxim Prokhorov
f4813fe303 api: fix warnings
Unused variables, bogus const-qualifiers and some strict switch-case rules with -Wextra
2021-12-18 23:40:53 +03:00
Maxim Prokhorov
5940f0aa8c alexa: always read the specified length of the payload
Make sure we don't try to strlen some empty space or neighbouring
segments, that may or may not contain nulls

Also tweak the function to warn about large messages, since it is not
(yet) clear whether we actually want those. At least something to log.
2021-12-18 23:40:53 +03:00