Commit Graph

2755 Commits

Author SHA1 Message Date
Max Prokhorov
fcba0ce0fb Fix rfbridge function names and order (#2236)
* rfbridge: fix names and ordering

* build rfbridge
2020-04-30 22:08:44 +03:00
Max Prokhorov
4d39c5fdb6 Add extraSetup() signature
main.cpp setup() needs to know about it
2020-04-30 14:26:26 +03:00
Max Prokhorov
edb23dbfc4 Convert .ino -> .cpp (#2228)
- general conversion from .ino modules into a separate .cpp files
- clean-up internal headers, place libraries into .h. guard .cpp with _SUPPORT flags 
- fix some instances of shared variables instead of public methods
- tweak build system to still build a single source file via os environment variable ESPURNA_BUILD_SINGLE_SOURCE
2020-04-30 13:55:07 +03:00
Max Prokhorov
732e84c45e Various sensor fixes (#2230)
* hlw8012: load hardware-specific ratios
* hlw8012: read energy in pre() callback
* dcz: nvalue should be integer
* sns: fix pressure constrain
* sns: load ratios based on index too
* sns: per-magnitude corrections (still limited by type)
* sns: attach units to index
2020-04-28 07:12:42 +03:00
Alexander
49995d92d1 Add HDC1080, fix ADC_MODE_VALUE use in preprocessor (#2227)
* ADC_VCC is not macro

* In esp.h ADC_VCC and ADC_TOUT is not macro, so define macro.

* ADC_VCC and ADC_TOUT fixes in utils.ino and sensors.h

* Adding support for I2C temperature and humidity sensor HDC1080 / 831R

* Added HDC1080 to test\build\sensor.h and arduino.h

* added brackets

* Revert ADC_MODE_VALUE to initial values

* Eof newline

* Eof newline

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2020-04-25 07:46:37 +03:00
Maxim Prokhorov
2dcf1b2bd8 cfg: move DEVICE and MANUFACTURER to functions
Avoids useless logs like this one:
https://travis-ci.com/github/mcspr/espurna-nightly-builder/jobs/316891026#L449
2020-04-08 23:28:43 +03:00
Maxim Prokhorov
492a35926f ci: rework build.sh & release.sh generator
- don't depend on TRAVIS environment variables
- depend on CI flag to add release variables
- chmod +x
2020-04-08 23:28:43 +03:00
Max Prokhorov
945652f806 btn: key0 should override key
https://github.com/xoseperez/espurna/pull/1772#issuecomment-609847420
> Without the patch btnRepDel overrides every btnRepDel0, btnRepDel1 etc., btnRepDel0 read second, then hard-coded value.
With the patch btnRepDel0 is read first, then btnRepDel, then hard-coded value.

Indexed key can only be set via settings upload or in terminal, WebUI can change only the global override setting. Allow more 'specific' key to override global setting.
2020-04-08 02:41:09 +03:00
Max Prokhorov
92bdf211eb Update platformio.ini comments
Clarify flash size settings, fix old comment regarding build_flags
2020-04-08 02:33:26 +03:00
Max Prokhorov
b500273029 sns: add SI1145 sensor (#2216)
Co-authored-by: Joop Hilverink <33230021+HilverinkJ@users.noreply.github.com>
2020-04-08 01:48:45 +03:00
Max Prokhorov
5de6330890 dcz: add workaround for pressure sensors (#2215)
- Domoticz only accepts svalue <pressure>;<forecast>,
  failing to display anything otherwise.
  We don't have any forecast calculation (yet?), simply send dummy value.
- Move Domoticz code outside of sensor.ino
2020-04-08 01:35:33 +03:00
Max Prokhorov
cae50fa544 sensor/emon: refactoring (#2213)
- Update sensor classes to support a generic way to store energy values
- Update sensor conversion code to deal with units and not magnitudes
- Add magnitude<->unit for sensors, generic way of defining used unit. Convert from sensor magnitude unit to the one used for display.
- Reset energy value based on index through external means (MQTT, HTTP)
- Rework energy timestamping, update webui with 'last saved' value

While this solves the energy conversion issues and we are finally seeing the real value, what I don't really like:
- KilowattHour and WattHour are separate enum tags, thus sort-of are different types altogether
- Conversion code in Energy object should probably use some generic 'ratio' calculation? (https://en.cppreference.com/w/cpp/numeric/ratio/ratio)
- We are still using runtime checks to do calculations and depend that sensor outputs only one specific value type.

Consider this a fix for energy display / storage and preliminary work on sensor.ino
Further sensor refactoring... soon.
2020-04-08 00:37:26 +03:00
Max Prokhorov
49b6d351d9 PIO/hardware.h: Update naming (#2214)
* update platformio.ini comments
* espurna-base -> espurna-core-webui
* esp8266-<flavour>-<size>-base -> esp8266-<size>-<flavour>-base
* clean-up ESPURNA_CORE detection, use boards function
2020-04-07 21:48:43 +03:00
Max Prokhorov
db50be91bc PIO: fix env definitions (again) (#2212)
* base envs

* CI: speed up release process (since we still want some .bin files)

* fixup! CI: speed up release process (since we still want some .bin files)

* release dry run

* fixup! release dry run

* adjust

* fix .bin name

* it works

* minor cleanup for current git

* use pio suggestion about ldscript, reduce build_flags impact

* fix linker

* parse ${vars} instead of ignoring them

* add filtering and override file (sneak peak into tasmota's pio config)

* don't generate secure client (for now)

* formatting

* codacy
2020-04-07 21:20:32 +03:00
ziggurat29
e2e0409c59 correct Gosund WP3 LED documentation and provide reasonable default actions (#2200)
* correct Gosund WP3 led color documentation; provide reasonable default actions for button and the two LEDs

* reverse red/blue led roles, as requested, to be consistent with other existing products

Co-authored-by: ziggurat29 <xxx@yyy.zzz>
2020-04-02 02:06:19 +03:00
Max Prokhorov
83339605aa webui: ledGPIO is a list (#2202) 2020-03-30 13:41:11 +03:00
ziggurat29
387d4cea58 Board definition for the Gosund WP3 smart socket (#2191)
Co-authored-by: ziggurat29 <xxx@yyy.zzz>
2020-03-24 22:34:14 +03:00
Max Prokhorov
a71f233caa Remove OTA from ESP01 build
https://github.com/xoseperez/espurna/pull/2185#issuecomment-601198322
-11KiB
2020-03-20 21:38:03 +03:00
Max Prokhorov
43c2c41cba mqtt(async): buffer some data (#2181)
* mqtt: enum state

* mqtt: async client buffer with MQTT_MAX_PACKET_SIZE

* mqtt: rework debug messages

* mqtt: MQTT_BUFFER_MAX_SIZE

* mqtt/test: debug log for async callback

* mqtt/test: don't log things we don't handle

* button: fix typo
2020-03-20 21:07:02 +03:00
ziggurat29
7496606140 Example for Generic ESP01 boards with 512KiB flash (#2185)
Co-authored-by: ziggurat29 <xxx@yyy.zzz>
2020-03-20 21:06:12 +03:00
Max Prokhorov
917ce8de83 Optional Web(UI) OTA (#2190)
* web: optional OTA support

* add prototype

* hide under websupport
2020-03-20 21:05:04 +03:00
Maxim Prokhorov
032f921fc4 btn: store actions as uint8_t instead of uint16_t 2020-03-14 01:20:32 +03:00
Maxim Prokhorov
2172bc6cb1 btn: rename pin status / state -> value 2020-03-14 01:20:32 +03:00
Maxim Prokhorov
b289c77021 cfg: clean-up hardware.h 2020-03-13 09:28:15 +03:00
Maxim Prokhorov
ee7356b91a relay: clean-up for ota .bin 2020-03-13 09:28:15 +03:00
Maxim Prokhorov
1f5b22ebcf ir: fix syntax issue 2020-03-13 09:28:15 +03:00
Max Prokhorov
3243dafb61 cfg: check for led and button GPIO settings (#2177)
In case board configuration is empty, loop should try to check at least once
2020-03-13 07:15:07 +03:00
Max Prokhorov
80825590a5 LED Updates (#2170)
* support GPIO setting in WebUI
* experimental led pattern support
* support loading settings in setup() (not yet fully working)
2020-03-13 07:01:14 +03:00
Max Prokhorov
bdedb2b7ae wifi: unconditionally erase all settings after fixed index (#2175) 2020-03-13 04:43:54 +03:00
Max Prokhorov
f2ed94f230 cfg: update migrate configuration (#2176) 2020-03-13 04:43:35 +03:00
Max Prokhorov
ba3e6267e6 Button pin provider & runtime settings (#2162)
* wip

* cleanup buttons-through-serial code, remove hw mention from button module

* remove wip

* implement mqtt settings

* fixup struct members, dual no longer allocates debouncer

* add missing debounceevent lib

* fix missing event_handler, update names

* fix namespace

* drop lib

* fix int<->bool comparison

* Move gpio16 handling from DigitalPin to EventHandler

* Cleanup debounceevent headers

* Don't expect system headers to be included

* re 70b54c489f - no allocation, for real

* Adjust settings names

* dont retain by default

* unused

* typo

* Fix length type (ref 6017ad9474)

* Move pin class outside of debounce lib, lowercase ns

* move event handling inside of button_t

* refactor config. ..._MODE -> _CONFIG, ..._MODE_... -> ..._ACTION_...

* fix test

* naming

* move indexed value to header

* refactor actions into direct opts

* fix webui, fix buttons not respecting old user setting

* change button config format from bitmask to a struct, adjust settings conversion

* proxy some more header defautls, fix web kv

* gpiopin

* adjust webui func to support every setting

* clarify single-return event->string

* fix dual setting

* fix dual packet condition, de-duplicate funcs

* fix bogus warning
2020-03-13 04:42:40 +03:00
Rui Caridade
ae232c9381 Add support for read PIO-A of DS2406 (#2174)
* Add support for read PIO-A of DS2406

* Verify reset() reseult
2020-03-12 06:03:46 +03:00
irmishappy
c02a981b1c Apparent, reactive power measurement unit corrections (#2161)
* Update sensor.ino

Apparent, reactive power measurement unit corrections.

* Update sensor.ino
2020-03-12 06:03:17 +03:00
DmitryBlinov
373dd27d60 Fixes and updates for thermostat and display (#2173)
* Fixes and updates for thermostat and display:

- Switch to original esp8266-oled-ssd1306 library
- Fixes and updates for thermostat and display
- Add display switching off after interval
- If THERMOSTAT_DISPLAY_SUPPORT enabled, then one click enable display, long click switch relay. This functionality also depend on fix for long click. See pull request https://github.com/xoseperez/espurna/pull/2172

* Move buttons definitions for display to dependencies.h

* Pin ThingPulse/esp8266-oled-ssd1306#3398c97
2020-03-08 18:15:27 +03:00
DmitryBlinov
6017ad9474 Fix for long click (#2172)
With uint8_t length function _buttonMapReleased never returned BUTTON_EVENT_LNGCLICK. BUTTON_EVENT_CLICK returned instesd. I verified that with uint16_t length it returns BUTTON_EVENT_LNGCLICK when correspondent delay passed.
2020-03-08 02:31:16 +03:00
julianwb
8f7d77b2a1 Config for Teckin SP23 & Maxcio W-UK007S (#2157) 2020-02-18 22:23:52 +03:00
Max Prokhorov
8f4f1beb54 mqtt+api: move action handler (#2158) 2020-02-18 22:23:08 +03:00
Max Prokhorov
980b736fc8 ir: move button structs outside of config headers (#2155) 2020-02-18 12:19:32 +03:00
Max Prokhorov
be7ca13d76 influxdb: fix http response parsing, refactor module scope (#2153) 2020-02-18 12:16:13 +03:00
Max Prokhorov
3747d2ef46 Merge pull request #2154 from mcspr/mqtt/bump
mqtt: bump arduino-mqtt version, tweak keepalive
2020-02-18 12:15:44 +03:00
Max Prokhorov
f403ea06cf wifi: respect hardcoded settings when checking for deletion (#2151) 2020-02-18 12:15:12 +03:00
Max Prokhorov
79e45324ca Bump RFM69 version (#2148)
* Check patched RFM69 with relative includes

* merged upstream, point to the commit
2020-02-18 12:14:52 +03:00
Max Prokhorov
0d5129db4d Fix latched pulse always being HIGH (#2145)
see https://gitter.im/tinkerman-cat/espurna?at=5e44563355b6b04bf6aac94b
2020-02-18 12:14:35 +03:00
Max Prokhorov
fd50e95e9e Thingspeak: tweak SecureClient connection (#2144)
- continue #2140 , use the correct implementation for http requests not confuse code readers with our parsing
- fix data sender data duplication, run build test
- add note that this is actually really RAM heavy, some connection failures are not easily distinguishable from any code errors and are simply OOM.

also
- fix arduinoota prototype error when building without it (... ino2cpp, again)
- add comment about 160mhz into the platformio.ini
2020-02-18 12:14:07 +03:00
Maxim Prokhorov
d0c9b6d5eb mqtt: keepalive less than hb interval 2020-02-18 11:57:52 +03:00
Maxim Prokhorov
098de0cb0b mqtt: pin arduino mqtt version 2020-02-18 09:46:39 +03:00
Max Prokhorov
7862b52060 Fix "Fix AsyncTCP dependency" (#2149)
* Revert "Fix AsyncTCP dependency (#2147)"

This reverts commit d5093b4d18.

* Ignore AsyncTCP
2020-02-14 14:40:51 +03:00
Max Prokhorov
d5093b4d18 Fix AsyncTCP dependency (#2147)
PIO 4.2.1a default soft does not work
2020-02-14 13:27:18 +03:00
Max Prokhorov
cacc7584d3 hlw8012: gpio cfg (#2142) 2020-02-09 04:54:33 +03:00
Max Prokhorov
d9482b917b rfm69: fix types of settings (#2141)
* rfm69: fix types of settings

* down
2020-02-09 04:41:31 +03:00