Commit Graph

281 Commits

Author SHA1 Message Date
Michael Geramb 1569019fab Add handling for updateDatabase() in call context 2023-11-12 19:38:19 +01:00
Michael Geramb 3cd8f8469a First version with SendEncryptedContext 2023-11-12 16:44:44 +01:00
Michael Geramb 3d955be629 Add temp buffer statistic 2023-11-11 19:48:11 +01:00
Gregg 713c5c65bf 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)
2023-11-04 10:43:28 -05:00
Gregg 8b3192e122 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.
2023-10-31 18:11:09 -05:00
Gregg 42f69adf49 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.
2023-10-30 06:29:38 -05:00
Gregg 56a2f0bece 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
2023-10-29 20:55:02 -05:00
Gregg 5ce7211539 Made conforming changes to setVerboseWiFiReconnect 2023-10-28 18:40:04 -05:00
HomeSpan 871eba3c1d
Merge branch 'release-1.8.1-dev' into verbose_reconnect 2023-10-28 18:16:48 -05:00
Gregg 81ee9e2dbc 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.
2023-10-28 17:06:40 -05:00
Francois 2bda112780 Verbose WiFi Reconnect
Add the ability to turn off WiFi reconnect messages.
2023-10-27 08:17:06 -04:00
Gregg 3396a5ff96 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).
2023-08-03 22:29:31 -05:00
Gregg a84429f930 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)
2023-07-30 21:37:47 -05:00
Gregg 17410e825e Completed adding LIST to HAPClient::postPairingsURL()
HomeSpan now correctly responds to pairing list requests
2023-07-29 08:35:01 -05:00
Gregg 7325baa1a5 Added HAPClient::listControllers()
Will be used for pairings list request
2023-07-29 01:21:55 -05:00
Gregg 793f7882b1 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.
2023-07-26 22:46:20 -05:00
Gregg 62f68cb33c Upgraded TempBuffer logic to use .get() to return pointer
Next up: update Network.cpp to use client.available() and reduce fixed memory usage.
2023-07-26 06:27:54 -05:00
Gregg 4557e3866f Converted various homeSpan.set() methods from void to Span& to enable chaining 2023-07-21 13:27:31 -05:00
Gregg db0f522297 Added DRAM/IRAM memory stats to 'm' CLI command 2023-07-05 06:05:10 -05:00
Gregg 21da828f83 Update HomeSpan.cpp 2023-05-13 15:39:01 -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 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 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
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 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 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 09063fb7dc Extended functionality of setValidValues() to allow INT, UINT8, UINT16, and UINT32 Characteristics 2023-02-25 15:07:02 -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 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 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 72b4ece64d Added DATA format
Includes 3 new methods: getData(), getNewData(), and setData()
2023-01-01 11:33:50 -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 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 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 f775a63b7a Completed and tested all statusCallback and statusString logic 2022-10-30 08:49:53 -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 74bbde2492 Changed SpanPoint::send(void *data) to SpanPoint::send(const void *data) 2022-10-16 16:53:11 -05:00