New class-level method SpanPoint::setEncryption(boolean encrypt). Default is to use encryption unless method is called with encrypt=false.
With encryption, 7 connections max; without encryption, 20 connections max.
Serial Monitor provides warnings if connections are exceeded.
Stylistic only. Cannot remove .get() when a TempBuffer is being re-cast. Also can't remove .get() when cast can't be determined, such as when used in Serial.printf() [potential to do: explore if this can be addressed, though this is stylistic only and has no impact on code]
New Operator now uses PSRAM if available, else uses Internal RAM. Obviates the need for the ps_new() macro, though will keep definition since it may be useful for any class that does not already override malloc() to use PSRAM.
Reduces NVS consumption by from 3 to only 1 records when storing numerical values.
Also: Fixed memory problem in getCharacteristics by replacing dynamically-sized stack buffers with TempBuffer (must do this everywhere), which was causing stack probllem when combination number of Accessories and number of Characteristics got very large.
Added logic to sequentially transmit chunks of the HTML response String whenever it grows beyond 1024 bytes. This ensures the number of WebLog entries does not create a very large HTML String that eats up all the free heap space. WebLog entries are now only limited by storage of the entries themselves. Tested successfully with 500 entries.
When using PSRAM, changing the number of Accessories no longer creates any change to heap usage on internal RAM. The entire Accessory will be stored in PSRAM.
Forces all heap requests to be drawn from PSRAM, unless the device does not contain PSRAM.
To do: Provide easy-to-use NEW() macro; add custom allocator to unordered sets; auto-shrink vectors after updateDatabase()
Significantly reduces memory usage - unordered_sets take up much more memory and using std::find from <algorithm> is as efficient as using find() method of an unordered_set.
To do: Remove all uses of unordered_set across HomeSpan wherever possible
Rather than use a large temporary buffer to store all encrypted frames to transmit all at once, each encrypted frame is transmitted as soon as created, which means the temporary buffer only needs to be large enough to store a single encrypted frame.
For a device with a large number of Accessories, this can save 15-20 KB of temporary storage, allowing for more Accessories.
Note this change does not reduce the size of the unencrypted message that is initially produced and can also be quite large. Potential for future project.
An optional callback used to track the number of times the device reboots, where a reboot is defined as any restart where the uptime was less than a specified number of milliseconds (default=5000)
Low Memory Watermark is compared to DEFAULT_LOW_MEM_THRESHOLD (currently set at 80,000 bytes) after HAP initialization but before WIFI connection. If Low Memory Watermark is below DEFAULT_LOW_MEM_THRESHOLD, a WARNING is issued.
Note: memory is based on heap with MALLOC_CAP_DEFAULT capabilities
Adds a second type of WiFi Callback that is called every time WiFi is established OR re-established after a disconnect. Passes the number of times WiFi has been connected as an argument.
Allows extension of initial table produced in WebLog, where f is a function that returns a String. The returned String is copied into the WebLog HTML just before the </table> tag is printed in the initial table.
Changed fixed-size array `struct Controller[MAX_CONTROLLERS]` to a dynamic linked-list of Controllers. Re-coded all related functions. MAX_CONTROLLERS no sets the size of any buffers but is only used to limit the ultimate size of the linked-list.
Saved about 1K of RAM since most of the time there are only 2 Controllers defined (as opposed to the 16 allowed).
* Added support for zero-length TLV
* Added SEPARATOR as a formal kTLVType (and updated listControllers() to use)
* Added `uint8_t *buf(tagType tag, uint8_t *src, int len);` to load buffer needing external memcpy (and updated listControllers() to use)
Optimized use of heap memory instead of stack memory for temporary variables, and makes code easier to read, provided all heap usage is free() at end of each function.
Also removed char *hostName as a member variable of homeSpan. It's never actually used since MDNS constructs its own copy of hostName as needed.
Allows for daisy-chaining of configuration parameters.
Also added initialization of upLinkData in motorTask to prevent time-outs if setMove() is never called (by initializing msDelay=10)
Updated logic of setPosition(), move(), and moveTo() to use waitForAck() so that an initial acknowledgment is received from the motorTask() before proceeding.
HomeSpan now includes both drivers as part of the "extras" functionality.
The StepperMotorControl Window Shade Example has been updated accordingly to use the built-in TB6612 driver.
Changed Serial.printf() diagnostic messages to either ESP_LOGI() or ESP_LOGW() macros in Blinker, PWM (LedPin and ServoPin), Pixel, and RFControl class
Acquiring time from a timeserver is now spawned as a separate task running in the background. This avoids blocking HomeSpan while setting the time.
Default wait time has been extended from 10 seconds to 2 minutes, since there are no problems with blocking.
Allows user to define a custom style sheet to change the webLog output. Style sheet is based on pre-defined class:
bod1 = main body of web page, including header (in format of <h2>)
tabl1 = top table showing general status
tab2 = bottom table showing all weblog entries
Also added vTaskDelay(5) in pollTask to make sure competing tasks can operate (for example, if priority was set to greater than 2, touch sensor did not operate). Adding vTaskDelay(5) solved this problem.
This has no effect on the code but the names of the macros can be used as flags for an external script to autogenerate documentation in the form of a list of all services and characteristics supported by HomeSpan