Commit Graph

3453 Commits

Author SHA1 Message Date
Maxim Prokhorov
2598c4a77b tspk: pass sensor data as string, rework http parser
schedule immediately with module functions, don't wait
more flash-strings in the module and utility functions

support rare condition when body cannot be sent on connect, use poll to send it
don't wait for header line in body, and bail out when done parsing
make sure data is copied into the async variant, and remains there for
the duration of the connection

general async api is... more complicated that it needs to be
until wolfssl / brssl port is here, though, there is no other choice
secureclient config becomes a simple struct, pending further rework
2022-05-25 03:50:17 +03:00
Maxim Prokhorov
821df407c0 sns: separate report from modules 2022-05-24 20:38:31 +03:00
Maxim Prokhorov
699edf1b08 sns: typo, reported value was not yet set 2022-05-24 20:23:25 +03:00
Maxim Prokhorov
307a41f5a9 sht3x: crc is a static function 2022-05-24 19:47:42 +03:00
Maxim Prokhorov
946f5f0dfa sht3x: formatting, fix visibility of virtual
also experiment a bit with status register in log
2022-05-24 19:29:50 +03:00
Maxim Prokhorov
b23845bfb9 compat: should apply to both Core versions 2022-05-24 19:29:13 +03:00
Maxim Prokhorov
53b0f452a0 sns: fix order of values 2022-05-24 19:03:07 +03:00
drc38
adca49232a sht3x: add crc and status debug (#2518)
* sht3x: add crc and status debug

* reduce delays, add sensor debug

* add full status output
2022-05-24 18:32:48 +03:00
Maxim Prokhorov
6fd70aae82 sns: typo 2022-05-24 00:28:03 +03:00
Maxim Prokhorov
c6ab437c1a dcz: also use sensor value struct 2022-05-23 23:47:35 +03:00
Maxim Prokhorov
d5e59bb232 sns: log all three value states 2022-05-23 23:47:35 +03:00
Maxim Prokhorov
133edc801a sns: only keep the last elem when size is >2
fixing reset always keeping the last value, not the intended size 3... and above.
revert to the previous behaviour where the last element is preserved and
real `capacity` becomes `capacity + 1`. adjust methods accordingly.
and a slightly more verbose median funciton
2022-05-23 21:08:28 +03:00
Maxim Prokhorov
09273b1bc1 sns: fix for thermostat readings
amends 5fcac5d27f
2022-05-22 00:17:34 +03:00
Maxim Prokhorov
a232f5b917 sns: show real magnitude topic value in the terminal 2022-05-21 18:17:15 +03:00
Maxim Prokhorov
5fcac5d27f sns: read / report handlers with a prepared structure
generalize topic and value representation
breaking change for rpn, since the magnitude *may not* be indexed

also fixes debug logs, where we would always see units of the 1st
magnitude instead of the one being processed
2022-05-21 18:13:10 +03:00
Maxim Prokhorov
683347c8d7 sns: overwrite median filter storage with capacity of one
keeping the last value will prevent us from updating
anything due to capacity check

also see #2519
2022-05-21 18:04:09 +03:00
Maxim Prokhorov
b5e467d451 sns: fix settings key generator
see #2519
2022-05-21 17:09:18 +03:00
Maxim Prokhorov
61ac1c0778 sns: single value filter has no reason to override capacity 2022-05-21 17:09:05 +03:00
Maxim Prokhorov
c980acbd10 i2c: reserved addresses 2022-05-20 10:04:43 +03:00
Maxim Prokhorov
08f752689a i2c: search for more addresses when already locked
third time's a charm... reorganize external funcs to reference internal
ones, and there's no need for an extra check of address
2022-05-20 09:56:20 +03:00
Maxim Prokhorov
29472b667e kingart: same type for position value 2022-05-18 23:02:56 +03:00
Maxim Prokhorov
e4b068ec7d pzem004tv30: fixing static <-> instance member init order
since we don't have multiple instances yet, move everything into the
existing sensor instance class. for the multi-device migration, we will
only need port and it's read timeout setting. address will be stored per
device instance, where the main one will work with the port
2022-05-18 22:50:12 +03:00
Maxim Prokhorov
d9e87552ce ina219: another case of constexpr static binding 2022-05-18 22:48:30 +03:00
Maxim Prokhorov
c9e3cd65f4 sns: constrain only works on a single type
make sure we use clamp instead of constrain
2022-05-18 22:18:33 +03:00
Maxim Prokhorov
49cd7fc3f4 sns: fixes for gcc4.8 2022-05-18 22:11:33 +03:00
hamed
660d8c339b sns: add INA219 (current / power monitor)
resolves #2501

Co-Authored-by: Maxim Prokhorov <prokhorov.max@outlook.com>
2022-05-18 21:22:32 +03:00
Maxim Prokhorov
8f194848ee sns: some more error types 2022-05-18 21:22:32 +03:00
Maxim Prokhorov
396733d1fb sns: show locked address in the description
and make sure we use it when trying to read/write something
2022-05-18 21:21:02 +03:00
Maxim Prokhorov
77b9cbcb36 sns: flash strings in description 2022-05-18 21:20:10 +03:00
Maxim Prokhorov
6f426da2b6 sns: v9261 instance-local state 2022-05-18 21:20:10 +03:00
Maxim Prokhorov
d8d49b046c sns: handle modbus errors, make sure to wait for warm-up 2022-05-18 21:20:10 +03:00
Maxim Prokhorov
db550a3f59 sns: fixed-size arguments when dealing with containers
make sure we don't just hope that pointer logic works
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
9e6fb0c61d sns: allow to reload max6675 instance 2022-05-18 21:20:10 +03:00
Maxim Prokhorov
f896d9863d sns: fix implementation method qualifiers
some swserial migrations
also make sure we use pstrs
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
24a8905e87 sns: using stream helpers in ezoph 2022-05-18 21:20:10 +03:00
Maxim Prokhorov
56449c41e6 sns: update dallas to use instance variables
simplify the internals and allow to use multiple instances

possibly fix comparison issue with raw int vs. float, when checking for
errors. division may not actually succeed
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
d800445442 sns: bme680 updates for the i2c change 2022-05-18 21:20:10 +03:00
Maxim Prokhorov
79110c1f65 sns: more i2c sensor updates
migrate to the new structure
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
93f2608753 sns: vl53l1x updates
stronger time types, overrides

init underlying lib object as a member
this might be changed to unique_ptr, in case we really want begin() to
be idempotent and being able to re-init things
(which might not be actually possible?)
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
20203633ed sns: similar updates to pulse meter 2022-05-18 21:20:10 +03:00
Maxim Prokhorov
34f8f04c94 sns: mics* sensor updates
structure, overrides, strong time types

actually use the analog sensor base to read
(and fixing yet another pinmode accident)
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
9cd798ba1a sns: geiger sensor updates
fixed structure, overrides. strong time types
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
d670e85b10 sns: update events sensor
updated structure, overrides. strong time type
testing timesource changes. this should work, but might need to tweak
things if it starts to fail b/c of flash code loads
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
c0d6ed1288 sns: actually load bmx280 fixed address from settings
conversion is not working for signed ints, only unsigned
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
080d7ab930 sns: more abstract properties for base sensor
do not force to implement constructor, just update vtable
continue testing with bme280 class, update structure
2022-05-18 21:20:10 +03:00
Maxim Prokhorov
91b137e92f sns: do not auto-detect when i2c address is set
make sure there's an option for direct address setup
sensor updates are wip, since base sensor code is also changing
2022-05-18 21:20:01 +03:00
Maxim Prokhorov
0005c659e7 i2c: simplify find and locking logic
use bitset when locking, avoid manual index & mask calculation
update check() to use boolean logic instead of returning int status
remove wip address-range, just use the {begin, end} pair
uint8_t instead of unsigned char when dealing with data
2022-05-18 21:16:31 +03:00
Maxim Prokhorov
864a8c84fe i2c: remove extra {begin,end} transmission when reading 2022-05-18 21:16:31 +03:00
Maxim Prokhorov
092db6b3a5 sns: generic wrappers for sensor and filter pointer
Avoid confusion between ref and pointer when looping over sensors
Re-use helper class in the magnitude object as well

Remove custom code related to filter movement, just use unique_ptr
Plus, updates filter code to use stl vector where possible

Experimening with dynamic cls id. Perhaps this should be something
else... but, at least there are no longer any header-defined values.
2022-05-18 21:16:31 +03:00
Maxim Prokhorov
85ee526c8a sns: more flash strings for type prefix and value suffix 2022-05-11 18:12:55 +03:00