Commit Graph

3489 Commits

Author SHA1 Message Date
Maxim Prokhorov
b366d77a5e sns: namespace, fix init function(s)
One namespace for sensor functions and types.
Fix discrepancy between topic and indexed topic funcs.
Energy types fixes, make sure we use known ratios.

Sensor fixes, moving certain pin settings and defaults into the sensor
classes, using those in the actual sensor init code.
Energy is still within the sensor module, pending version bump before moving.
2022-07-20 20:32:55 +03:00
Maxim Prokhorov
91eb010fea ina219: fix invalid shift 2022-07-15 04:43:16 +03:00
Maxim Prokhorov
ad8e30fcda rfm69: clean-up *after* max ID, not before
fixes #2507
2022-06-13 14:29:49 +03:00
Maxim Prokhorov
fb31449ed9 ntc: formatting & actually return the value
fixup 4d4b8461dd
(if only the compiler warned about an empty branch...)
2022-06-13 02:14:40 +03:00
Maxim Prokhorov
a461d2c18a board: fix 2.7.4 build 2022-06-13 00:12:36 +03:00
Maxim Prokhorov
65db8e6112 board: spi_flash_read size is in bytes 2022-06-12 23:55:29 +03:00
Maxim Prokhorov
01047c3b80 sns: type prefixes should be in flash 2022-06-12 22:18:53 +03:00
Maxim Prokhorov
4d4b8461dd ntc: make sure we handle adc value of 0
plus, move reading into pre()
2022-06-12 22:04:24 +03:00
Maxim Prokhorov
84017214d2 webui: detect when sensor unit changes
also split energy info into a separate payload & handler
2022-06-12 20:36:01 +03:00
Maxim Prokhorov
68374bba9e sns: refactoring
make sure we have access to magnitude formatters early in the file
more namespacing, where possible
2022-06-12 20:36:01 +03:00
Maxim Prokhorov
e3a2294ef0 sns: handle basic metric units conversion
proper support for both conversion directions
ratio object stores the scaling, no need to deduce it through the enum
name anymore

we still don't really enforce incompatible units, though,
but it is unclear at what stage the error should come in
2022-06-12 20:36:01 +03:00
Maxim Prokhorov
7dfb10905c sns: handle both directions when converting temperature unit
when types are the same, handle things directly in the class base
plus, reduce the amount of explicit comparisons
2022-06-12 20:36:01 +03:00
Maxim Prokhorov
c937b10d86 analog: raw and advanced scaling in the base class 2022-06-12 20:36:01 +03:00
Maxim Prokhorov
425027223c sns: sensor ratio helpers 2022-06-11 23:43:10 +03:00
Maxim Prokhorov
09c0750c69 sns: change magnitude filter 2022-06-11 23:04:35 +03:00
Maxim Prokhorov
c58b37c173 ina219: correctly scale raw values
fix gain multipliers, last two scaled down instead of up
bus voltage is in mV, using datasheet value of lsb (4mV)
2022-06-11 23:04:35 +03:00
Maxim Prokhorov
8059f1a4ca ina219: invalid max expected current is a config error 2022-06-09 23:52:17 +03:00
Maxim Prokhorov
4572dd3d6c ina219: we already know the type 2022-06-09 23:51:09 +03:00
Maxim Prokhorov
15f6446479 ina219: shunt resistance and expected current
address #2516, implement through ratio setting
2022-06-09 23:49:58 +03:00
Maxim Prokhorov
a52f0b0ce4 ws: fix multiple clients 2022-06-01 22:27:11 +03:00
Maxim Prokhorov
567b9d7769 web: also check for ap state 2022-06-01 22:20:25 +03:00
Maxim Prokhorov
2c728074f9 web: image length is a compile time constant 2022-06-01 21:52:18 +03:00
Maxim Prokhorov
81e4d423e2 board: type of webui image 2022-06-01 21:50:10 +03:00
Maxim Prokhorov
1f9f4998cc pio: bump platform_latest to 4.0.x 2022-06-01 21:35:25 +03:00
Maxim Prokhorov
ef15c20c04 web: more experiments with captive portal
fixing redirect, authenticate softap connection implicitly
further support needs DHCP helper, at least that's a standard...

plus, pass F(...) strings where String is accepted by the server
2022-06-01 20:14:39 +03:00
Maxim Prokhorov
a64631ebd6 wifi: opmode can be changed directly 2022-06-01 18:34:25 +03:00
Maxim Prokhorov
3d9fbf0469 web: some captive portal pages 2022-06-01 18:33:25 +03:00
Maxim Prokhorov
8fb1a49881 system: reset sdk config when unstable
similar to the tasmota ota, reset SDK when AP settings somehow are not
set to default *and* we are in safe mode already
move both even earlier in boot, before the wifi setup happens
2022-06-01 18:32:36 +03:00
Maxim Prokhorov
1078459350 system: clangd warning fix 2022-06-01 15:13:19 +03:00
Maxim Prokhorov
ce5e8d53a2 ota: instruct to crash instead of undefined behaviour
follow-up a684348b17
2022-06-01 15:12:43 +03:00
Maxim Prokhorov
54b275de4d ota: no need for fence 2022-06-01 15:12:12 +03:00
Maxim Prokhorov
2b2c20f383 gpio: direct hardware access for pin peripheral
using most recent RTOS for reference, allows us to skip Arduino
layer when configuring things. especially useful for UART
re-implementation that does not involve magic pin function modes

adjust our terminal command to really show valid pins and their modes
2022-06-01 13:13:51 +03:00
Maxim Prokhorov
6a0d6b0c49 sns: more flash strings 2022-05-25 05:07:04 +03:00
Maxim Prokhorov
b23137f414 dcz: flash strings and our own namespace 2022-05-25 03:50:17 +03:00
Maxim Prokhorov
d2c7f7ea28 ws: module names in flash 2022-05-25 03:50:17 +03:00
Maxim Prokhorov
c52002a397 ws: always fpstr() cast name of the module 2022-05-25 03:50:17 +03:00
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