* wip based on early draft. todo benchmarking
* fixup eraser, assume keys are unique
* fix cursor copy, test removal at random
* small benchmark via permutations. todo lambdas and novirtual
* fix empty condition / reset
* overwrite optimizations, fix move offsets overflows
* ...erase using 0xff instead of 0
* test the theory with code, different length kv were bugged
* try to check for out-of-bounds writes / reads
* style
* trying to fix mover again
* clarify length, defend against reading len on edge
* fix uncommited rewind change
* prove space assumptions
* more concise traces, fix move condition (agrh!!!)
* slightly more internal knowledge (estimates API?)
* make sure cursor is only valid within the range
* ensure 0 does not blow things
* go back up
* cursor comments
* comments
* rewrite writes through cursor
* in del too
* estimate kv storage requirements, return available size
* move raw erase / move into a method, allow ::set to avoid scanning storage twice
* refactor naming, use in code
* amend storage slicing test
* fix crash handler offsets, cleanup configuration
* start -> begin
* eeprom readiness
* dependencies
* unused
* SPI_FLASH constants for older Core
* vtables -> templates
* less include dependencies
* gcov help, move estimate outside of the class
* writer position can never match, use begin + offset
* tweak save_crash to trigger only once in a serious crash
* doh, header function should be inline
* foreach api, tweak structs for public api
* use test helper class
* when not using foreach, move cursor reset closer to the loop using read_kv
* coverage comments, fix typo in tests decltype
* ensure set() does not break with offset
* make codacy happy again
Change the underlying command line handling:
- switch to a custom parser, inspired by redis / sds
- update terminalRegisterCommand signature, pass only bare minimum
- clean-up `help` & `commands`. update settings `set`, `get` and `del`
- allow our custom test suite to run command-line tests
- clean-up Stream IO to allow us to print large things into debug stream (for example, `eeprom.dump`)
- send parsing errors to the debug log
As a proof of concept, introduce `TERMINAL_MQTT_SUPPORT` and `TERMINAL_WEB_API_SUPPORT`
- MQTT subscribes to the `<root>/cmd/set` and sends response to the `<root>/cmd`. We can't output too much, as we don't have any large-send API.
- Web API listens to the `/api/cmd?apikey=...&line=...` (or PUT, params inside the body). This one is intended as a possible replacement of the `API_SUPPORT`. Internals introduce a 'task' around the AsyncWebServerRequest object that will simulate what WiFiClient does and push data into it continuously, switching between CONT and SYS.
Both are experimental. We only accept a single command and not every command is updated to use Print `ctx.output` object. We are also somewhat limited by the Print / Stream overall, perhaps I am overestimating the usefulness of Arduino compatibility to such an extent :)
Web API handler can also sometimes show only part of the result, whenever the command tries to yield() by itself waiting for something. Perhaps we would need to create a custom request handler for that specific use-case.
* Completed kingart curtain switch support:
Added Web UI controls and view in status
Added power up behaviour (nothing, close, open, last position)
Added curtain style (Roller, etc...) for UI status and to be used in MQTT
* Checked commit before PR. Added html gulp static files generated.
* Corrected a code refactor error which make the MQTT messages not handling position from received messages. Added comment to debug tab to show how to enable debug
* Use the maximum compression for gzip. A byte is a byte :)
* Update code/espurna/curtain_kingart.cpp
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
* Variable name prefix update
Added public set position function and curtain count
* Added Scheduler new type : curtain
* Add curtain schedule support and correct the 12h bug when adding a slot (00:00 after refresh). Default Hour is 12h
* Code cleaning.
Schedule support.
Light support is having an issue with new schedules corrected here.
* I let do better by the specialists
* Curtain init statues
* Coding style corrections
* Removed debug stuff from now - will be back later with the right way
* rebuild webui
* revert 435f1c5e03 schHour default, rebuild ui
Co-authored-by: Eric Chauvet <eric.chauvet@test-tree.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
This will add support for the KingArt Wifi Curtain Switch. There are no buttons in the web interface as I could not figure out how to create them (any help on that is welcome).
For now the switch can be controlled over MQTT:
"{hostname}/curtain/set"
"{hostname}/curtain"
* hardware: Add support for Aoycocr X5P Plug.
This change allow espurna to control Aoycocr X5P Plug devices, which has
the same behaviour as the GOSUND WP3 but using different GPIO pins for
relay, button and leds.
* Update platformio.ini
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
* 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>
- 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.
* 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
* 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>
* 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
- 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
* Permit thingspeak urn edit
* Update thinkspeak.ino
* Update index.html
* Replace Host, Port, and URL with Address in Thingspeak
* Create AsyncThingspeak object
Create AsyncThingspeak object to contain the url of the component.
* replace pointer by class member
Thingspeak class improvement to answer Max's question:
why use a pointer when it can be a class member?
So now address parameter isn't a pointer anymore.
* Update Thingspeak address on post
* ntp: try using sntp app from lwip, drop ntpclientlib
* fix display
* thermostat: fix day and month getters
* test build sizes with scheduler
* use system timers for once-a-minute scheduling, no polling
* tick
* avoid timestamps, use tm
* drop utc rpn operator, add utc_hour and utc_dow
* try to build with old implementation too
* dep
* notify ws
* progmem
* cleanup types
* offset tm values by 1 to match existing schedules
* avoid using ntpclientlib with rpn
* test. show debug strings in sch
* fix secureclient
* consts, fix unsyncing when changing tz (and not triggering sntp after reinit for some reason)
* startup time in seconds
* same delay as lwip
* header
* assume build timestamp is unixtime
* cache server value
* fmt
* typo
* handle dhcp request
* rename
* web
* TZ.h
* add notice about what alias means
* fix disabling NTP_SUPPORT
* scheduled ticker
* same behaviour as old module
* rollback rpn dependency check, utc_ prefixes
* ...
* comments, refactor naming
- add ltDimmerGPIO<index> & ltDimmerInv<index> to override / add to hardware configuration. Add pin defaults, mapped as GPIO_NONE. pwm_init() receives resulting GPIO mapping based on settings loader.
- remove bogus _light_channels variable, use this name for channel array instead (...which is vector and has size(). functions always use that value anyway)
* Sensors: refactor configuration
- move sensor implementaion to the .ino,
remove dependency undef / define from sensor files
- update test/build/sensor.h from SENSOR_SUPPORT
- allow to change sensor config variables externally
- `#include <...>` for global headers and libraries,
fix relative path for math library
* add missing sns <-> i2c dependency
* ledrelay should return relay_none as default
* rollback to original test header
* include debug header when requested (relative)
- use similar to relay & wifi, configuration through helper methods that
use indexed defines
- clock cycles for led delay polling
- button mode defaults
* PIO: remove -ota envs, handle OTA condition in extra script
* Tweak ESPURNA_BOARD variable
* Support git and latest in ota script
* Handle ESPURNA_FLAGS too
* Try to handle env and projenv in pylint
* Add deprecation comment about -ota envs
* regen arduino.h
* debug: store boot log
* order
* roll single header
* hide when not implemented
* fix capacity check
* dependencies
* refactor names, can just use malloc
* settings formatting
* dbgBuf prefix
* show size
* release memory after buffer is displayed
* fix uptime unused warning, combine printer
* comments
* use arg flag instead of static to handle boot
* ci test fix
* Hide whole info() without debug
* typo
* cleanup setDebugOutput condition