Commit Graph

12 Commits

Author SHA1 Message Date
Maxim Prokhorov
9211dcd785 system: lock reent object in ctor 2023-01-18 06:14:34 +03:00
Maxim Prokhorov
e53e25c8bb test: utils 2022-12-12 14:25:01 +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
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
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
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
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
2a5756e1b5 terminal: fix escaped characters parsing
also fix test entry incorrectly using an already escaped string
2022-09-08 13:39:26 +03:00
Maxim Prokhorov
ef202109e7 terminal: remove shared output
Make every available call site 'private'
e.g. typing command in telnet no longer prints to serial or WebUI

Serial input is now optional, see `TERMINAL_SERIAL_SUPPORT`.
Telnet using async server is a proper Print implementation now.
WebUI, MQTT and HTTP input is allowed to inject multiple lines at once.

Modernize our helper classes and remove legacy 2.3.0 quirks.
Replace global Terminal object and allow to separately
split, parse ARGV list and perform command search and invocation with
standalone function calls.
(but, notice that we still depend on a globally shared 'commands' list)

This greatly reduces used RAM (but, slightly increases our ROM).

Update our test suite to use namespaces and new calling convention.
2022-09-08 13:39:11 +03:00
Maxim Prokhorov
ff19c0889d test: fix namespaces 2022-08-29 06:01:21 +03:00
Maxim Prokhorov
456d1cc586 ci: reference dump() method for the settings storage 2022-02-11 13:53:34 +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