22 Commits

Author SHA1 Message Date
Maxim Prokhorov
bdf87e1a51 led(pattern): refactoring
w/ another -fsanitize=address hint, use separate objects instead of
relying on pattern itself holding everything api *may* need

combine pattern and preset patterns currently separate timers
pattern container reworked to allow small-size optimization

introduce a special '0,0' marker, repeating the whole pattern (instead
of just one delay at the end)

since pattern is part of the led struct proper, display it in settings query
update tests & reuse time parsing routines from utils
2025-11-10 02:53:35 +03:00
Maxim Prokhorov
bb7bd06d67 terminal(test): known memory leakage
allow -fsanitize=address without warnings

avoid extra attributes and just fix the usage in tests,
deprecate for everything else
2025-11-09 18:52:44 +03:00
Maxim Prokhorov
a189c5f33f test(delimiter): split and delimiter view
using comparison macro for tests referencing string views
move all local code related to unity to a separate object
2025-03-05 18:12:59 +03:00
Maxim Prokhorov
2a40e505fc test: clean-up esp8266 repo & version bump 2024-11-29 20:04:09 +03:00
Maxim Prokhorov
2611b6294f test: emon sensor parser test
sensor_emon .ipp for energy and kwh & ws objects
system_time .h for clock definitions. delay not implemented (yet)

ignoring energy calc for the current test, since samples are out-of-sync
also ignoring timeout state, as it syncs with the clock time
2024-10-22 09:28:42 +03:00
Maxim Prokhorov
d997cb2c20 sch: fix sun incompatible fmod arguments
use stdlib cmath when building on host
bump to unity 2.6.0 to fix isnan conflict with stdlib
2024-09-16 00:31:16 +03:00
Maxim Prokhorov
ef7603db89 mqtt: settings topic
refactor mqtt root topic & topic handling, add external module for mqtt validation
check whether root topic contains #, error out when it is missing
check whether generic topics or suffixes contain # or +, error out when they are present

special handling for settings topic to pick a single level /+/ as a key and payload as a value
resolve #2617

tests for mqtt topic filtering and validation
2024-09-10 16:11:28 +03:00
Maxim Prokhorov
f3f797f93b scheduler: refactor restore, proper sun state
certain actions need to happen when
- starting restore()
- switching date within restore()
- stopping restore()

pretty good fit for an object and raii. so, using context struct to handle
sun{rise,set} initialization and per-schedule time match updates

sun{rise,set} event happens on a specific date, make sure it is also checked
fix double action trigger by comparing minutes, not raw timestamp seconds

experimenting with 'invalid state' i.e. when timestamp was not generated

include restore logic in tests, as code now lives in .ipp
2024-05-23 00:58:36 +03:00
Maxim Prokhorov
b070b908a7 test: scheduler 2024-05-16 01:25:50 +03:00
Maxim Prokhorov
b44c293fca test: expected sensor filter values 2024-02-08 22:17:38 +03:00
Maxim Prokhorov
0f5fc5acc3 test: allow double comparison in tests 2024-02-08 22:17:38 +03:00
Maxim Prokhorov
fd7f97eb24 settings: test conversions properly
separate convesions from the main source to allow test builds
extra unit to verify that both duration plain input and
spec work as intended

also fix wdt triggered when unknown symbols are encountered at the end
of duration string (e.g. 10000y)
2023-03-15 17:06:13 +03:00
Maxim Prokhorov
312c3ef2ba test: bump esp8266 version used for unit tests 2022-12-12 15:13:25 +03:00
Maxim Prokhorov
24c3ff8954 test: arduinojson header 2022-12-12 14:29:22 +03:00
Maxim Prokhorov
e53e25c8bb test: utils 2022-12-12 14:25:01 +03:00
Maxim Prokhorov
74ad71bf74 tests: fix device-only macro 2022-10-23 05:45:42 +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
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
677f368cfa test: bump esp8266 version used for unit tests 2022-09-08 13:39:26 +03:00
Maxim Prokhorov
5f67212935 test: generate compile_commands.json 2022-09-08 13:39:26 +03:00
Maxim Prokhorov
c37bbb42a6 ci: make sure ctest prints it's failures 2022-02-11 13:53:05 +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