3866 Commits

Author SHA1 Message Date
Maxim Prokhorov
c668e546a8 light: capture report value 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
af0cf39682 types: view default init missing 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
2471c16f93 light: do not update brightness in hsv 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
fe002258fc system: fstr -> pstr 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
657061bfb1 system: do not disarm non-repeating timer 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
5d1dc124e0 light: update provider readiness 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
81866dad44 hass: clean-up 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
9f5abad48e settings: gc 'empty' keys aswell 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
639b558100 settings: raw erase fixes
solves edge-case when we move our storage nearby a previously erased kv,
causing it to be treated as a key or a value with length 255 (... 0x00 0xff)

also stop set() from erasing data when it is not possible to store it in
the first place

additional test case similar to permutations one, make sure keys don't
disappear while we write to the storage a lot of times and possibly
introduce the two cases above
2022-10-23 03:18:57 +03:00
Maxim Prokhorov
f61b0738bd build: using __DATE__ and __TIME__
fixing previous builds getting stuck on Sep 21st

turns out it *really* uses file modification time
updating VERSION does not change a thing, it does not work like scons :>
2022-10-23 03:18:57 +03:00
Maxim Prokhorov
a11942fd7b mqtt: string views in API and internal callbacks
* stateless callbacks for mqttRegister. no module uses the lambda / std
  func with captures or otherwise, so it is kind of pointless to have it
* make sure we know topic and payload length at all invocations and
  not constantly trying to re-parse the same string over and over again
* clean-up api related to string parsing and make sure we allow
  stringview as input
* clean-up id / unsigned number parsing to work with views instead of
  using a generic strto{,u}l; sometimes this works, sometimes doesn't.
  as noticed previously with IR implementation, it *will* parse until
  the '\0' is found in the input and we can't interpret parts of the
  string without doing a copy for the strtoul
* fixing additional bugs caught in ifan, leds, sensors and lights that
  were causing build failures. plus, more range-based parsing code for
  the same reason as described above
2022-10-23 03:18:57 +03:00
Maxim Prokhorov
0970269033 util: more string views for internal funcs 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
76dd26b9b2 rpc: string views, fix led command status 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
951fceff05 pio: no need to init Serial when debugging 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
e6a2de0094 button: commands are uppercase 2022-10-23 03:18:57 +03:00
Maxim Prokhorov
510d68d079 system: fixup timers and loop callbacks
* globally accessible system timer class; help out with our internal
  scheduling by always using strongly typed duration and dynamic
  time adjustment for durations longer than system limits
  (see `os_timer_t` documentation)
* our own class for scheduled callbacks which are either choosing a
  simple function pointer or std function wrapper, depending on the type
  passed into the constructor. specifically for scheduled functions,
  this allows us to filter globally scheduled functions and push them to
  the front of the queue when necessary to ensure certain order of calls
* replace Ticker instances with SystemTimer
* allow types {h, cpp} in unit tests
2022-10-23 03:18:57 +03:00
Maxim Prokhorov
179a6a84c6 hass: trying to fix lights
see #2539

separate color and white channel availability from settings;
allow color, hs, mired inputs but do not send anything when those are disabled

advertise `color_mode` support, match specific number of channels
with some special mode that should be used on the remote
(which are, currently, shown in separate control tabs)
2022-10-23 03:18:52 +03:00
Maxim Prokhorov
27a665a04d debug: restore serial output 2022-10-08 15:33:38 +03:00
Maxim Prokhorov
d59e7715f8 telnet: restore web setup 2022-10-08 15:33:22 +03:00
Maxim Prokhorov
35656314aa sns: typo 2022-09-28 14:59:25 +03:00
Maxim Prokhorov
0028effc48 sns: read and report values independent from settings
also replace external function calls that are already handled by Info
2022-09-26 15:22:18 +03:00
Maxim Prokhorov
b0af0afd19 hw: deprecated flag 2022-09-25 18:41:19 +03:00
Maxim Prokhorov
ea881b12d1 hw: fix port checks 2022-09-25 18:40:33 +03:00
Maxim Prokhorov
3eaba2883d uart: fix building when disabled 2022-09-25 14:28:38 +03:00
Maxim Prokhorov
73e3bdac2f cfg: inverse -> invert 2022-09-25 12:09:47 +03:00
Maxim Prokhorov
b52b128f5e cfg: more warnings about uart changes 2022-09-25 11:31:41 +03:00
Maxim Prokhorov
9e0dc73865 pzem004t(v3): commands need private access
also fix typos in the pzem004t lib import
2022-09-25 10:29:45 +03:00
Maxim Prokhorov
164d217bf7 sch: missing undef 2022-09-25 10:28:47 +03:00
Maxim Prokhorov
ae25402daa rfb: typo 2022-09-25 10:28:33 +03:00
Maxim Prokhorov
66a351b012 relay: fix stm & dual init with external port 2022-09-25 10:28:24 +03:00
Maxim Prokhorov
5361e3d3df cfg: clean-up 2022-09-25 08:26:22 +03:00
Maxim Prokhorov
4ee1aa61a2 cfg: update arduino.h 2022-09-25 08:26:22 +03:00
Maxim Prokhorov
56affe713d cfg: formatting 2022-09-25 08:26:22 +03:00
Maxim Prokhorov
574fbf1960 uart: standalone configuration
- setup uart at boot instead of delaying until some module needs it
  removes global `SERIAL_BAUDRATE` and `DEBUG_PORT` in favour or
  globally accessible numbered port configurations with `MODULE_NAME_PORT`
- automagically enable uart support for sensors that need it
- allow every sensor to configure uart0 (normal and swapped), uart1
  and an optional software-serial mode support with an extra build flag
  remove individual includes across the sensors
- settings queries and runtime port configuration (prefixed with uart)
- update dependencies header to cross-reference used ports at build time
- update deprecations header with serial baudrate notice
2022-09-25 08:26:22 +03:00
Maxim Prokhorov
3d580f3577 terminal: __FlashStringHelper -> StringView
- clean-up comparison routines and get rid of most of the casts
- reduces total number of calls to terminalRegisterCommand
  replace with a func accepting list of commands, which in
  turn get instantiated as constexpr PROGMEM arrays
- reduce ram fragmentation, since we don't need to alloc as much
- reduce flash consumption b/c of lambda -> standalone func conversion
2022-09-25 06:14:54 +03:00
Maxim Prokhorov
1c9a4bd864 terminal: fix include
previous fix did not apply to builds without single-source env setup
ci builds with it enabled at all times
2022-09-25 06:14:54 +03:00
Maxim Prokhorov
4c75c2a070 sns: export sensors list
fix #2538
2022-09-24 08:02:59 +03:00
Maxim Prokhorov
75a518c6ca telnet: fix 'reverse' implementation
sync and async dns functions for both terminal and this

both use callbacks with IPAddress helper instead of using ip_addr_t
(at least, for now. seems like it is in need of our own wrapper, too)
2022-09-23 07:43:40 +03:00
Maxim Prokhorov
360a2f14e7 scripts: update core -> minimal
amend 5bc55cd1a5
2022-09-23 06:09:58 +03:00
Maxim Prokhorov
ac14cbca4f pio: .gz and two-step hint on upload target 2022-09-23 05:04:26 +03:00
Maxim Prokhorov
6d982284c9 uartmqtt: clean-up and hex encode / decode
- fix initialization routine to auto-select appropriate port between
  either hardware-only serial or hardware-plus-software serial
  both depend on which TX and RX pins are selected
- allow to use 'swapped' uart0 mode with pinx 13 and 15
- software serial is no longer forced upon the user, setup depends on
  which tx and rx are used in config
- allow to either send or receive data as HEX strings
  mqtt received `616263` gets written as `abc` and vice versa
- (optional) send termination byte when writing to serial
2022-09-23 03:09:13 +03:00
Maxim Prokhorov
a8fe3e4664 build: directly use __TIMESTAMP__
avoid weird conversion from string -> time_t -> string

remove magic inline macros converting string value to time_t.
instead, just pick specific string regions and explicitly constexpr'ify conversion
(ref. https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html)

ntp could lose the value, since we never use it properly
(although, ctime functions do; it is rather tricky with timezones, though)

nofuss could use any value, might as well use the string that is already
provided by the compiler that has the same property as the used timestamp
2022-09-21 18:12:37 +03:00
Maxim Prokhorov
af12762eb6 wifi: fix blocking-delay oopsie
blockingDelay uses inverse logic; passed function should return false
when the condition is satisfied
only broken on 2.7.x, 3.x.x skips the check
2022-09-21 04:31:20 +03:00
Maxim Prokhorov
7fc8ccdf72 system: fix view comparison
note that it is equality, not byte comparison based on
memcmp or strcmp return values
2022-09-21 04:31:20 +03:00
Maxim Prokhorov
009d1b0014 mqtt: comments 2022-09-21 04:31:20 +03:00
Maxim Prokhorov
79ef68b435 telnet: directly use our async networking API
One server implementation instead of two, plus simplify I/O operations
scheduling by processing everything in loop regardless of the server
type used.

Make it possible to accept authorization and several commands in a
single packet. If we fail the check, clients discards rest of the data.
Since we finally track connection state, debug info gets set *only* to
authorized clients.
2022-09-21 04:31:20 +03:00
Maxim Prokhorov
95e659fa58 decoder: spacing for lines prefixed with (inlined by) 2022-09-21 04:31:20 +03:00
Maxim Prokhorov
5a9cd59ca9 debug: show uart banner before telnet 2022-09-21 04:31:20 +03:00
Maxim Prokhorov
d32c4b45d0 web: json adapter for our string view
effectively, same thing as `const __FlashStringHelper*`
but, we know the actual size at build time vs. calling `strlen_P`

can't specialize the way things are read until v6; current implemenation
simply attaches arbitrary char pointer to the internal buffer, which is
then read byte-by-byte when writing output json stream

revert to static json buffer class in `/discovery`
will move more things to it, but probably should move to v6 first
2022-09-21 04:21:23 +03:00
Maxim Prokhorov
60194e9069 settings: clean-up weird keys 2022-09-21 04:21:23 +03:00