Commit Graph

611 Commits

Author SHA1 Message Date
Gregg faa99e0fbb Added checks for use of setVal()
Throws warning, but still performs change, if setVal() is used within update() to change the value of a Characteristic that is being updated by the Home App, UNLESS the Characteristics has requested a write-response (in which case setVal() is expected).

Throw warning, and DOES NOT perform change, if setVal() is used on a Characteristic without EV permission, UNLESS it has been used in update() in response to a write-response request.

Also added diagnostic to 'i' CLI command that indicates which connections have currently asked to EV Notifications for each Characteristic.  Only applies if EV permission is set for a Characteristic.
2024-03-16 13:56:04 -05:00
Gregg 8ce80157b3 Added native support for WR (write-response)
HAPClient::putCharacteristics() now parses for "r":true in JSON, which is the HAP request for a write-response.  When found, HomeSpan will return with a full write-response for all Characteristics updated using "207 Multi-Status", where "value" will be included only if "r":true was specified for a Characteristic.

HomeSpan processes "r":true for any Characteristic regardless if permissions includes WR.

To change the value of the Characteristic from within an update() method, use setVal() WITH OPTIONAL SECOND ARGUMENT AS FALSE to supress an EV broadcast (in the unlikely event that there was a notification subscriber).

To do: Consider generally disallowing the changing of any Characteristic value from within update() using setVal() unless the Characteristic has WR permission.  And if so, automatically surpress EV notification.
2024-03-15 17:35:04 -05:00
Gregg 38e0b1efea Bug-fix in SpanPoint that caused a crash when receiveSize=0
When printing SpanPoint configuration data to the Serial Monitor info using the 'i' CLI command, HomeSpan did NOT check to see if the receiveSize was zero, in which case there would be no queue, which caused a crash when trying to report the queue depth.   Since all existing SpanPoint examples were based on receiving data from remote devices, this bug was never encountered (since the receiveSize was always greater than zero).

Fix: check to see if receiveSize==0.  If it is, do not retrieve queue depth, but report zero instead.
2024-03-03 17:27:45 -06:00
Gregg e3e0b11717 Converted HKDF from struct to simple functions in HKDF namespace
Eliminated the need to instantiate a static HKDF structure within HAPClient since there is no storage within HKDF itself, just a single function call (create).
2024-03-02 16:02:16 -06:00
Gregg 24f36bbccb Moved all NVS Handles into Span
Also added Span constructor that call nvs_open for each nvs_handle upon start-up instead of waiting for homeSpan.begin() and HAP::init()
2024-03-02 15:49:06 -06:00
Gregg 0d404ccf1b Fixed bug in setPairingCode() and added second "internal" argument
homeSpan.setPairingCode() operates silently if called from within a sketch, but will report error to Serial Monitor and HALT sketch if code is invalid.

Otherwise, if called from 'S', or from AP, or as default during start-up, diagnostics are printed as usual and sketch will NOT halt if invalid code is provided
2024-03-02 11:57:40 -06:00
Gregg 959e3cbcde Update Pixel.cpp 2024-02-27 06:17:46 -06:00
Gregg c16e0612be Added Pixel::isRGBW(), and added Other Example -> PixelTester sketch
Also flagged the original constructor, Pixel(int pin, boolean isRGBW), as being deprecated, though it will still work as expected.
2024-02-25 21:53:33 -06:00
Gregg a0bf2c8c8a Removed setColorMap and replaced as second parameter to Pixel constructor
Provides for full backwards compatibility with previous constructor.
2024-02-25 17:21:52 -06:00
Gregg 0cf12f3331 Completed Pixel::setColorMap() 2024-02-24 20:51:45 -06:00
Gregg 218e1f6611 added Pixel::setColorMap() 2024-02-24 18:15:52 -06:00
HomeSpan d10f73e3c7
Release 1.9.0 (#775)
* Converted various homeSpan.set() methods from void to Span& to enable chaining

* Update Reference.md

* Update Reference.md

* Update src.ino

* Update Pixel.ino

changed nPixels from uint8_t to int to allow for longer pixel strands (library is coded for int, so there is no need to limit to uint8_t in the example).

* Converted static HTTP Buffer to dynamic TempBuffer

Saved about 8K in RAM!

* Upgraded TempBuffer logic to use .get() to return pointer

Next up: update Network.cpp to use client.available() and reduce fixed memory usage.

* Update Network.cpp

* Replaced appropriate snprintf() with asprintf() and used *m in sscanf

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.

* Removed duplicate if(POST /pairings)

* modified HAP::receivedEncrypted() to use TempBuffer instead of fixed stack array

* Added HAPClient::listControllers()

Will be used for pairings list request

* Completed adding LIST to HAPClient::postPairingsURL()

HomeSpan now correctly responds to pairing list requests

* Refactored TLV

* 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)

* Simplified `uint8_t *TLV<tagType, maxTags>::buf(tagType tag, int len)`

Also updated HAP.cpp to use new `uint8_t *TLV<tagType, maxTags>::buf(tagType tag, uint8_t *src, int len)`

* Refactored Controller Structure and Add/Remove/List/Save Functions

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).

* Support Non-English WiFi name

* Preventing possibility of buffer overwrite.

* Update README.md

* Update README.md

* Bumped release to 1.8.1

* Added homeSpan.setWebLogCallback(String (*f)())

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.

* Change webLogCallback() to pass String as reference

* Verbose WiFi Reconnect
Add the ability to turn off WiFi reconnect messages.

* Update Reference.md

* Update Logging.md

* Update README.md

* Added homeSpan.setWifiCallbackAll(int n)

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.

* Update README.md

* Update Reference.md

* Update README.md

* Made conforming changes to setVerboseWiFiReconnect

* Update Reference.md

* Update README.md

* Update Reference.md

* Update Logging.md

* Changed Accessory Limit from 41 to 150 and added Memory Warning

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

* Update Reference.md

* Made vTaskDelay(5) in pollTask conditional of using autoPoll()

vTaskDelay(5) is only needed if polling is in its own task.  If calling poll() directly, there is no need for any delay.

* Update Logging.md

* Add hint for UTF8 usage in names

* Moved vTaskDelay(5) from pollTask() to homeSpan.autoPoll()

Adding the vTaskDelay(5) to the code that spawns the separate task is more consistent with how Arduino-ESP32 spawns the main loop() task.

* Update HomeSpan.h

Forgot braces in for-loop of autoPoll()

* Update 07-AccessoryNames.ino

fix typo

* Update Reference.md

* Add MAC Address output to RemoteDevice.ino

Prompts user with reminder of which MAC Address to use in Main Device.

* Added new homeSpan.rebootCallback() function

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)

* Update src.ino

* Update Reference.md

* Update src.ino

* Update README.md

* Update Reference.md

* Update README.md

* Update 07-AccessoryNames.ino

* Update HAPClient::sendEncrypted() to send individual frames to save memory

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.

* Changed storage of required and optional Characteristics from unordered_set to vector

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

* Changed unordered_set to vector when checking for duplicate AID

This eliminated the use of unordered_set everywhere in HomeSpan

* Added error checking for NVS storage

Also added NVS storage diagnostic to 'm' command.

* Fixing HTML syntax error in weblogs.

* PSRAM: Adds custom allocator and HS_MALLOC/HS_CALLOC macros

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()

* Added ps_new() macro

A more generic version of `new(*ptr)` that allocates from PSRAM if present, otherwise is that same a normal `new`

* Added HS_REALLOC macro for generalized realloc() when using PSRAM

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.

* Address WebLog size issue that limited number of entries

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.

* Change NVS storage for Characteristics to always use nvs_set_u64()

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.

* Override new operator for SpanAccessory, SpanService, and SpanCharacteristic

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.

* Streamlined NVS recall for String values

Avoids need for intermediate variable

* Create MaxAccessories.ino

Demonstrates use of custom partition and shows how PSRAM is used in background when available

* Create partitions.csv

* Changed various static and dynamic stack-based buffers to TempBuffer

Also added casting overload to TempBuffer so that get() method is no longer needed

* Eliminated .get() from TempBuffer objects where possible

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]

* Added Characteristic Constants

Added constants to Characteristics that describe states.

Example: Characteristic::SecuritySystemTargetState::ARM_STAY

* Correction to time server URL doc

* Addressed issue with new Characteristic enum constants

* Update MaxAccessories.ino

* Added ability to turn off SpanPoint encryption

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.

* Update NOW.md

* Update README.md

* Update README.md

* Update README.md

* Added new TLV8 class

To do: Refactor HAP.cpp to use new TLV8 class

* Starting to integrate new TLV8 into postPairVerify

* Completed re-factoring of postPairVerify using new TLV8

Next: re-factor postPairSetup

* Preparing for re-factoring postPairSetup

* Starting re-factoring of postPairSetup

* added TLV length function

Checks that iterator exists (i.e. does not equal end()) and returns length, else returns -1.  Can be used for checking for both the presence, and length, of a TLV record

* Completed initial re-factoring of postPairSetup - must test!

* Completed postPairSetup and fully tested - also changes TLV8 from vector to forward_list

Changed TLV8 from vector to forward_list to ensure iterators are always retained after adding new elements.

Nest: refactor postPairings

* Completed and fully tested refactoring of TLV8

Next up: remove old TLV code and clean up

* Removed all old TLV code

* Cleaning up postverify

* Added new initializer to TempBuffer

Allows TempBuffer to be initialized by concatenation of multiple existing buffers.

Constructor contains pairs of (T *buf), nElements, where last argument MUST BE NULL to signify end of variable argument list.

Will work with any type T, and nElements is in units of elements of type T.

* Start re-working SRP6A's use in Pair-Setup to make it local instead of global

* Initial integration of local SRP6A into Pair Setup

* Moved definitions of N3072 and other constants into SRP6A structure

* In process of updated Pair-Setup M3...

Cleaning up code by replacing calls to mbedTLS within Pair-Setup with arguments passed to/from SRP6A.  Much better and better encapsulates SRP6A

* Completed Pair-Setup M3 update

* Completed refactoring of SRP6A and integration into all steps of Pair-Setup

* Remove include HAP.h from SRP

SRP now only requires Utils (for TempBuffer).

Also, moved HS_ALLOC definitions into Utils so it can be re-used by others files

* Initial test of StreamBuffer added to WebLog

* Moved Streamer from Utils.h into separate Streamer.cpp

But declared Streamer inside HomeSpan.h instead of separate Streamer.h since it  should only be used when HomeSpan.h is used.

Also, changed class structure so that it is "final" by removing virtual tags and making all protected variables private.

* Begin integration of hapStream into HAP.ccp

* Moved StreamBuf parameter calls into HapOut

* Moved StreamBuf into HapOut as private nested class

* Added getSize() to HapOut and changed default behavior to NEVER output anything

Note: getSize() must be called before flush(), which resets byte counter

* Converted sprintfAttributes to printfAttributes and added encryption to HapOut

Success!

* Added SHA-384 hash computation to HapOut

Hashing of entire database is now done piecemeal within HapOut, preventing the need to load the entire database into a large buffer just to obtain a unique hash.

Modified updateDatabase() to use HapOut.getHash()

* Deleted sprintfAttributes for Span, SpanAccessory, and SpanService

These now use the new printfAttributes with HapOut

* Converted sprintfNotify and eventNotify to use HapOut

Successfully tested with MultiTest script

* Added back weblogCallback() functionality that uses hapOut

* Converted all remaining sprintfAttributes to printfAttributes

This removes last of large-sized JSON buffers - everything has now been converted to using hapOut.

Next up: Must add prettyPrint to hapOut to support 'd' command

* Moved prettyPrint into HapOut

This completes re-work of all JSON buffer memory management to use HAPOut.

Next up: Stress test with Max Accessories to see how many Accessories we can now handle.

* Changed HapOut delay from 1ms to 50ms for WiFi transmits.  Seems to be much more stable.

* Update MaxAccessories.ino

* fix for PSRAM with new hapOut

Force hapOut to use internal memory only.

Tested on ESP32-S2 with/without PSRAM.  However, crashes on ESP32-S3 when using PSRAM (?!)

* Changed hapOut delay back to 1ms - works fine

Identified issue with ESP32-S3 crashing when using PSRAM.  Problem was not the code, but that the sketch was using pins that are needed to run the Octal PSRAM that comes with the Espressif S3 DevKit.

* Fixed CSS in weblog

Missing conversion from String to c_str() when using hapOut.

* Added homeSpan.getWebLog()

* Update src.ino

* Update src.ino

* started work on TLV streaming with << operator

Goal - eliminate sendEncrypted() completely by using hapOut in tlvRepond().
Next up: use function call instead of << operator so logic can be moved into TLV.h

* moved tlv streaming into tlv class

* refactored tlvRespond() to use hapOut instead of sendEncrypted()

To do:

1) update putPrepareURL() to use hapOut instead of sendEncrypted()
2) remove sendEncrypted() since it is no longer needed
3) try moving MAllocator template into separate file (memory.h?) so it can be called from any other module
4) remove #include "HomeSpan.h" from TLV8

* Moved all PSRAM definitions into separate PSRAM.h file

Now allows #include "HomeSpan.h" to be removed from TLV dependencies

* updated putPrepareURL and deleted receiveEncrypted()

Must test with Door example, which uses putPrepare

* Modified range checks so that "NAN" gets picked up as error for FLOAT Characteristics

* Truncate all STRING-based Characteristics to 64 characters when adding to JSON

HAP default max length of STRING Characteristics is 64 characters

* Added homeSpan.getAutoPollTask() to return task handler of autoPoll

Returns NULL if autoPoll has not been used.

Also added low stack size for both main Arduino loop task and HomeSpan autoPoll task to 'm' command

* Added optional triggerType to homeSpan.setControlPin()

Default is SpanButton::TRIGGER_ON_LOW.  Follows same options as SpanButton, including the ability to provide your own triggerType function of form:

boolean f(int pin)

* Cleaned up some public/private permissioning inside PushButton and SpanButton

Ensure users can access constants like TRIGGER_ON_HIGH, TRIGGER_ON_LOW, etc. using any of these equivalent fully-qualified names:

* PushButton::TRIGGER_ON_HIGH
* SpanButton::TRIGGER_ON_HIGH
* SpanToggle::TRIGGER_ON_HIGH

* Update Reference.md

* Update Reference.md

* Added CustomNVSPartition Example

To do:  Add to list of Other Examples in documentation.

* Update CustomNVSPartition.ino

* Update Tutorials.md

* Create ExternalReference.ino

* Update Tutorials.md

* Update Logging.md

* Update Reference.md

* New Services and Characteristics List (#751)

* auto-generation of service list

* Update makeServiceList

* Update makeServiceList

* Update test.md

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* Update Span.h

* Update test.md

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* Create ServiceListHead.md

* Update ServiceListHead.md

* Update ServiceListHead.md

* Update test.md

* update

* update

* Update ServiceList.md

* update

* Update ServiceList.md

* update

* removed bold font for Characteristic Constants in ServiceList.md

* fix heavy_check_mark

* add <span> to ServiceList to prevent linebreaks before checkmark

* fixed typo in ServiceLabelNameSpace description

* Create ServistList_Expanded.md

* Update ServistList_Expanded.md

* Update ServiceList.md

* added ServiceList_Expanded

* added code to create pre-expanded Services and Characteristics List

* Update Tutorials.md

* Update Tutorials.md

* Added ConfiguredName to Switch and Lightbulb

* Moved error/warning output to end of 'i' output

* Add configuredName() to all applicable Services and deprecated Name()

* reformat ServiceList to remove expandable details

Expandable details are not as practical to navigate for a page this size.  Easier to see everything laid out all at once.

* Re-organized Services List into Service Groups

* Update ServiceList.md

* converted Service Group names to upper case

* Added linebreak after each Service

* updated some descriptions

* Delete ServiceList_Expanded.md

* Revised Example 11 (Service Names) to use ConfiguredName Characteristic

Complete re-work of Example 11 - fully tested for iOS 17.2.1

* Documentation update (#765)

* Update Stepper.md

* Update README.md

* Update FAQ.md

* Update TVServices.md

* Get Arduino-ESP32 Version from <esp_arduino_version.h> instead of <core_version.h>

This works fine for all versions after 2.0.3, but returns 2.0.0 for versions 2.0.2 and 2.0.1, as well as 2.0.0.  Not an issue since current version is 2.0.14.

* Update Solutions.md

* Added Stepper_UNIPOLAR and Stepper_UNL2003

ALSO:  Re-arranged include files so that StepperControl.h is now part of HomeSpan.h.   No need to include anything except for HomeSpan.h to use any of the Stepper Motor classes.  Must update documentation accordingly.

NOTE: Always including StepperControl.h DOES NOT increase size of compile if no stepper motors are instantiated.

To do:  Consider doing the same for Pixel, PWM, and RMT as well.

* Removed #include "extras/PwmPin.h" from all Tutorial Examples

Since PwmPin.h is already included in HomeSpan.h, there is no reason to separately include it in user sketches.

* Removed all #include "extras/*.h" from "Other Examples"

Including any extras/*.h files in a HomeSpan sketch is no longer necessary since these are already included in HomeSpan.h.

* Update PWM.md

* Update RMT.md

* Update Pixels.md

* Update RMT.md

* Update Stepper.md

* Update 17-LinkedServices.ino

* Update Stepper.md

* Update Stepper_TB6612.md

* Update Stepper_A3967.md

* Update Stepper.md

* Update Stepper.md

* Update Stepper.md

* Update StepperControl.h

* Update Stepper_A3967.md

* Create Stepper_ULN2003A.md

* Update Stepper_ULN2003A.md

* Update Stepper_ULN2003A.md

* Update Stepper_TB6612.md

* Update Stepper_A3967.md

* Create Stepper_UNIPOLAR

* Create Stepper_UNIPOLAR.md

* Update Stepper_UNIPOLAR.md

* Delete Stepper_UNIPOLAR

* Update Stepper_UNIPOLAR.md

* Update Stepper_UNIPOLAR.md

* Update Stepper_UNIPOLAR.md

* Update Stepper_UNIPOLAR.md

* Added option to specify NULL for 4th parameter of homeSpan.enableWebLog()

If 4th parameter (the statusURL) is NULL, web logging will NOT be enabled BUT time server will still acquire time if server address and time zone were specified as 2nd and 3rd parameters.

Note that not having web logging enabled only impacts ability to acquire weblog from HTTP request.  It has no effect on the actual logging of WEBLOG() messages and thus homeSpan.getWebLog() works as expected.

* Allow user-defined data when receiving weblogs from callback (#770)

* Adding userData to getweblogs callback.
Allows user-specific data to be available in the callback that returns weblog HTML data.

* Adding userData to getweblogs callback.
Allows user-specific data to be available in the callback that returns weblog HTML data.

Return HTTP response code and content type only when no weblog callback defined

* Small clean-up and formatting of comments

* Bump version to 1.9.0

* Updated copyright dates to 2024

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update Reference.md

* Update Logging.md

* Update README.md

* Update Logging.md

* Update README.md

* Update HomeSpan.h

* Update README.md

* Update FeatherPins.h

Changed F21 from pin 35 to pin 38 for ESP32-S3 to avoid conflicting with Octal PSRAM.

* Update README.md

* Update README.md

* Update Logging.md

* Update library.properties

---------

Co-authored-by: Yitao Jiang <jytscientist@hotmail.com>
Co-authored-by: Francois <franklamoureux@hotmail.com>
Co-authored-by: Michael Geramb <mail@michael-geramb.at>
Co-authored-by: frankonski <frankonski@users.noreply.github.com>
2024-02-17 17:11:17 -06:00
Gregg 57a85bf0c8 Bumped version to 1.8.0 in preparation for release 2023-07-08 21:09:48 -05:00
Gregg 6aedec5a2d Added ability to chain enable(), disable(), and brake() 2023-07-08 17:56:33 -05:00
Gregg f7419da35b Final test of motorized shades 2023-07-08 16:55:22 -05:00
Gregg db0f522297 Added DRAM/IRAM memory stats to 'm' CLI command 2023-07-05 06:05:10 -05:00
Gregg 62b1e9bd35 Update src.ino 2023-07-03 07:05:51 -05:00
Gregg 568c13fee3 Tested homeSpan.setStatusDevice() to create a reverseLED 2023-07-02 17:12:58 -05:00
Gregg 9a42f0885c Added [override] to onStep 2023-07-02 11:39:31 -05:00
Gregg 195095c891 Changed setAccel() and setStepType() to return StepperControl*
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)
2023-07-02 11:13:55 -05:00
Gregg 6ab047b011 Update extras.ino 2023-07-01 09:01:11 -05:00
Gregg 9bfc07041d Creating Stepper Motor images 2023-06-25 21:50:10 -05:00
Gregg c5a40c6e34 Added ability to set cpu and priority for motor task using pair {} 2023-06-22 21:25:18 -05:00
Gregg e422d3c9de Updated StepperMotorControl Window Shade Example to use setPosition()
Example now saves window shade position in NVS and uses setPosition() accordingly upon initialization.
2023-06-20 21:23:03 -05:00
Gregg fe4d83140f Completed motor control setPosition()
Updated logic of setPosition(), move(), and moveTo() to use waitForAck() so that an initial acknowledgment is received from the motorTask() before proceeding.
2023-06-19 21:24:23 -05:00
HomeSpan 480af6cf85 Added setPosition() to StepperControl
Needs testing and debugging
2023-06-18 17:55:29 -05:00
Gregg 2eb70f1d1b Changed links from HomeStep to HomeSpan 2023-06-09 23:15:38 -05:00
Gregg 536de53075 Added Stepper_TB6612 and Stepper_A3967 directly to HomeSpan
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.
2023-06-09 23:11:38 -05:00
Gregg 44e48a4534 Update extras.ino 2023-06-04 09:20:37 -05:00
Gregg 5e1d65f436 Renamed SpanStep to StepperControl and moved into HoneSpan Extras
Also updated StepperMotorControl Example.
2023-05-30 05:05:51 -05:00
Gregg 21da828f83 Update HomeSpan.cpp 2023-05-13 15:39:01 -05:00
Gregg d33bbf2477 Update src.ino 2023-05-13 10:36:17 -05:00
Gregg 40bb97215f Added homeSpan methods setSerialInputDisable() and getSerialInputDisable()
Provides ability to disable HomeSpan from reading from Serial port (which is otherwise normally enabled)
2023-05-13 10:34:21 -05:00
Gregg de97faee37 Converted Serial.printf in extra classes to ESP_LOGI and ESP_LOGW
Changed Serial.printf() diagnostic messages to either ESP_LOGI() or ESP_LOGW() macros in Blinker, PWM (LedPin and ServoPin), Pixel, and RFControl class
2023-05-12 21:32:21 -05:00
Gregg 7bc885dd26 Completed initial migration of Serial.print to LOG0
Finished all applicable cases in main source code.
TO DO: apply LOG0 to extras
2023-05-10 22:12:21 -05:00
Gregg 66bb13af03 Continued change from Serial.print to LOG0() 2023-05-08 22:43:42 -05:00
Gregg 368ce12c04 Started work on converting all Serial.print() to LOG0() macro 2023-05-08 17:07:21 -05:00
Gregg d5eb2ceeb8 Update src.ino 2023-05-07 13:41:27 -05:00
Gregg 0f3b798fcc Bumped version to 1.7.3 2023-04-29 15:18:33 -05:00
Gregg ec1cd44382 Small tweaks to reset reasons in web log 2023-04-27 19:53:33 -05:00
HomeSpan 5e71e5b4d5
Merge pull request #566 from frankonski/dev
Added description of Reset Reason Code to WebLog.
2023-04-27 20:36:52 -04:00
Gregg beb79538e9 Update to WebLog TimeServer Logic
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.
2023-04-27 19:29:05 -05:00
Francois 7e08e00734 Added description of Reset Reason Code to WebLog. 2023-04-26 13:51:42 -04:00
Gregg 2ce78fead6 Added charset=utf-8 to weblog to allow for utf-8 encoding 2023-04-23 15:14:57 -05:00
Gregg 947e2af012 Added homeSpan.setWebLogCSS(const char *css)
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
2023-04-23 10:01:00 -05:00
Gregg 6fca946dd5 Added Sodium and MbedTLS versions, and Pairing Status, to Web Log 2023-04-23 07:46:37 -05:00
HomeSpan 889a326e02 Address conflict between SpanButton and certain Adafruit Boards
Change enum from BUTTON and TOGGLE to HS_BUTTON and HS_TOGGLE to avoid conflict with #define BUTTON in certain Adafruit boards
2023-04-20 21:56:55 -04:00
Gregg 5853989651 Update src.ino 2023-04-08 17:17:47 -05:00
Gregg c287564aed Update HomeSpan.cpp 2023-04-03 17:15:51 -05:00
Gregg 2ba75c13ea Add CLI commands 'p' and 'P' to clone device pairing data 2023-04-03 08:28:51 -05:00
Gregg f466e12c7a some cleanup of LedPin comments in examples
Removed old references to "channels" which should have been deleted many versions ago
2023-04-01 12:16:15 -05:00
Gregg ce36174f93 Completed LED fading functionality; added new Fading LED example (in Other Examples) 2023-03-31 22:07:31 -05:00
Gregg fab94722d8 Revert "Added fadeTime parameter to LedPin::set()"
This reverts commit c2df57815c.
2023-03-26 07:48:22 -05:00
Gregg c2df57815c Added fadeTime parameter to LedPin::set() 2023-03-26 07:39:06 -05:00
Gregg a79b7569d1 Begin implementation of hardware LEDC fade 2023-03-25 23:05:22 -05:00
Gregg 6079b8edf7 Bump version to 1.7.2 2023-03-25 12:19:08 -05:00
Gregg ecd97e6e71 Added option to set Priority and CPU in autoPoll()
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.
2023-03-25 10:58:03 -05:00
Gregg 75930a1d6e Update FeatherPins.h
Changed from old ESP32-C3-DevKitM-1 to new ESP32-C3-DevKitC-02
2023-03-17 22:26:52 -05:00
Gregg cde3348b79 Update src.ino 2023-02-25 15:34:14 -06:00
Gregg 09063fb7dc Extended functionality of setValidValues() to allow INT, UINT8, UINT16, and UINT32 Characteristics 2023-02-25 15:07:02 -06:00
Gregg 7e3d26fe6e Removed initialization of WiFiClient in HAP.h
See #508 for details.
2023-02-18 22:21:54 -06:00
Gregg 69af3d59a3 Replaced Service definitions with macros CREATE_SERV and END_SERV
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
2023-02-16 07:23:22 -06:00
Gregg 0ecaf2ee7f Add CUSTOM_CHAR_HEADER logic
used to include custom Characteristics in a common header without redefining.
2023-02-12 13:24:19 -06:00
Gregg 22bd16e936 Added ability to set OTA password from within sketch
Adds second form of homeSpan.enableOTA(const char *pwd, boolean safeLoad=true)
2023-02-11 07:49:16 -06:00
Gregg 88897ee085 Updated copyright dates on source code 2023-02-04 11:41:57 -06:00
Gregg 2f713b3749 Update HomeSpan.h 2023-02-04 10:15:37 -06:00
Gregg e2678f5661 Added position() method to SpanToggle()
Created PushButton::OPEN and PushButton::CLOSED enums.

This completes all SpanToggle() functionality.  Will add a SpanToggle() to UnitTest.
2023-02-03 23:09:08 -06:00
Gregg c3d0c98e04 Created SpanToggle()
Derived from SpanButton()
2023-01-31 22:55:43 -06:00
Gregg 232362c807 Update Utils.h
Added comments for new toggled() functionality
2023-01-30 07:56:46 -06:00
Gregg 1a3887b6cf Added switch toggle logic to PushButton Class
Adds new method toggled() which is the analog of triggered().

Next step: Extend SpanButton to access this new logic.
2023-01-29 18:30:25 -06:00
Gregg 03ba061b9b Added logic to hide AP SSID from broadcasting when WIFI_AP_STA used for SpanPoint
This does NOT effect the HomeSpan Access Point from being broadcast as usual when launched.
2023-01-28 18:05:59 -06:00
Gregg eb53e7f6e7 Moved SpanPoint initialization message to main Info 'i' output
Created SpanPoint table within 'i' output
2023-01-25 22:22:49 -06:00
Gregg 7eca1e776b Add option to SpanPoint to use softAP MAC Address instead of STA
Needed to support ESP-NOW on ESP-8266 chips, which seem to only work if connecting into softAP MAC Address once HomeSpan is connected to WiFi network (prior to connection ESP-8266 will properly connect to normal STA address as well as softAP address).
2023-01-22 18:05:59 -06:00
Gregg 6d18d5a3dc Added "invert" option to LedPin()
If invert=true, PWM output will be phase-inverted.  This is useful when creating a pair of PWM pins that need to be out of phase by 180 degrees (e.g driving a piezo-electric buzzer via two PWM pins).
2023-01-07 20:44:19 -06:00
Gregg a8271c8724 Added homeSpan.refreshStatusDevice()
Provides for additional control over Status LED when a generic device has been used.  If the color of the device is changed, the change will only take effect when the LED is next turned on.  If the LED is blinking, the color changes upon the next blink.  But if the LED is ON, there is no next blink and color will not change.

This method check the status of the LED, and if it is ON, is calls the on() function again, which will result in an update of the color.  The method does nothing if the LED is OFF or BLINKING.
2023-01-07 17:09:22 -06:00
Gregg 9ef9a590da Added homeSpan.setStatusDevice()
Allows any Blinkable class to be used as the Status LED
2023-01-07 14:28:50 -06:00
Gregg 3cb8d27342 Added CUSTOM_CHAR_DATA() macro
Similar to CUSTOM_CHAR_STRING() macro, but does not include a parameter to set the default value (since the user can type an invalid string).  Instead, user setData after creating the Characteristic as needed.
2023-01-01 15:08:34 -06:00
Gregg 72b4ece64d Added DATA format
Includes 3 new methods: getData(), getNewData(), and setData()
2023-01-01 11:33:50 -06:00
Gregg 1f7c86621c Bumped version number to 1.7.1 2022-12-28 17:18:59 -06:00
Gregg eecce34848 Added NVS storage for last channel used in SpanPoint
Applicable only for remote devices (i.e. not a Hub device).  Last channel stored is used as initial channel upon reboot, provided that this channel is allowed by the channel mask (if not, the first allowed channel is selected instead).
2022-12-27 09:55:30 -06:00
Gregg 3fae9c24a9 Updated Television Characteristics
Removed Mute, Active, and Volume since they don't appear to do anything.
2022-12-23 18:39:14 -06:00
Gregg 7939624bf7 Added Service::TelevisionSpeaker
Also updated Television Example.  Volume buttons on remote now function as expected, though there does not seems to be a mute button
2022-12-23 16:51:55 -06:00
Gregg ea07da5ab0 Update HomeSpan.h
Fixed another compiler warning
2022-12-11 14:19:37 -06:00
Gregg 5daaf3d0cf Added #pragma once to extras header files 2022-12-03 11:12:30 -06:00
Gregg 484f1c4f2e Cleaned up compiler warnings
* Changed ~SpanService to virtual function to ensure any user-defined destructor is also called

* Found/corrected bug in error message related to defining a Characteristic without any Service

* Added warning/error ID numbers to warning/error messages

* Other misc changes to clean up compiler warnings
2022-12-02 17:49:54 -06:00
Gregg a761d992e8 Updated version number to 1.7.0 2022-11-08 05:37:25 -06:00
HomeSpan 5b1b9396a0 Update HomeSpan.h 2022-11-05 12:09:36 -04:00
Gregg dd3cc8ab3b Fixed bug in postPairingsURL logic 2022-10-31 21:08:45 -05:00
Gregg f775a63b7a Completed and tested all statusCallback and statusString logic 2022-10-30 08:49:53 -05:00
Gregg 0929a04270 Update HomeSpan.h 2022-10-29 18:38:01 -05:00
Gregg 05cbc03f12 Added homeSpan.statusString(HS_STATUS statusMessage)
Can be used in statusCallback to convert HS_STATUS to char string
2022-10-29 18:36:30 -05:00
HomeSpan 645c169a5e created STATUS_UPDATE macro
Combines statusLED updates with statusCallback updates
2022-10-29 11:34:48 -05:00
Gregg d55dad1529 Added more events to statusCallback() 2022-10-29 07:37:34 -05:00
HomeSpan bb1b599797 Completed homeSpan.setStatusCallback()
To Do: create documentation
2022-10-24 21:48:37 -04:00
HomeSpan 7ff91ccf02 Changed hsEventCallback to statusCallback 2022-10-24 19:03:15 -04:00
HomeSpan 4e23c5e357 Updating hsEventCallback with more events 2022-10-24 06:46:04 -04:00
HomeSpan 5b38c6a04a Started homeSpan.setEventCallback() 2022-10-23 21:26:41 -04:00
Gregg f8be2847bd Fixed bug in touch sensor logic that would cause failure to compile under 2.0.0-2.0.2
Verified that Unit Test compiles under all version 2.0.0 through 2.0.5 and works on 2.0.0 as well as 2.0.5
2022-10-22 15:25:31 -05:00
Gregg 74bbde2492 Changed SpanPoint::send(void *data) to SpanPoint::send(const void *data) 2022-10-16 16:53:11 -05:00
Gregg 2d411bab82 Updated SpanPoint so that WiFi_AP_STA is only used if receiveSize>0
Next up: explore power-reducing modes and sleep modes for remote sensors to extend battery life.
2022-10-03 22:04:51 -05:00