Commit Graph

504 Commits

Author SHA1 Message Date
Gregg bddfb4658a Added 'm' CLI command to print free 8-bit heap memory 2022-05-06 22:19:37 -05:00
Gregg 7546350775 Added "C" CLI command and updated/fixed config number logic
The "C" command computes a hash of the current database config and updates the config number if needed.  If config number has changed, the MDNS "c#" record is updated and the new config number is rebroadcast.  This triggers HomeKit to immediately request an update of the HAP database so that the changes can be shortly reflected in the Home App without the need to close any Client connections or reboot the device.

The config number logic has also been updated/fixed.  Previously it would create a hash from the full HAP database, which includes the value of each characteristic.  Thus, initial value changes of Characteristics, as a result of stored values in NVS, would cause an update to the config number upon reboot.
 This is not problematic, but also not intended, as a change in value is not really a change in the database config.  The new logic computes a hash of the database that EXCLUDES all Characteristic values.
2022-05-06 17:04:15 -05:00
Gregg 628c29c6b6 Updating logic that determined HAP Configuration Number (MDNS=c#) 2022-05-06 16:13:25 -05:00
Gregg f48cea8afb Completed refactoring of 'i' CLI command
All error checking and database validation is now done dynamically every time the 'i' command is run.
2022-05-01 17:03:07 -05:00
Gregg 18414d8856 Continuing refactor of 'i' CLI command 2022-05-01 12:47:08 -05:00
Gregg 7b30f971e2 Continued refactoring of 'i' CLI command 2022-05-01 09:24:45 -05:00
Gregg 9f71c67f14 Updated logic for required/optional Characteristics
Logic now embedded in 'i' CLI command.
2022-04-30 22:20:42 -05:00
Gregg 0e6f7d27f9 Continuing with 'i' refactoring
Next up: Re-do optional/required Characteristics logic
2022-04-30 18:18:15 -05:00
Gregg 5f463b013e Continuing to refactor 'i' CLI command 2022-04-30 16:29:31 -05:00
Gregg 88f2373a71 Continued refactoring of 'i' CLI command 2022-04-30 11:04:57 -05:00
Gregg 212900f624 Initial re-factoring of "i" command
Instead of creating a static configLog for display upon start-up, an info log will be generated based on real-time data whenever the 'i' CLI command is requested.  This provides for more streamlined error-checking as well.
2022-04-30 07:57:01 -05:00
Gregg 82035df0a7 Removed enabling of IPv6
Not having an IPv6 address is NOT the cause of the Arduino 2.0 OTA network port problem.
2022-04-29 18:16:43 -05:00
Gregg 6a8b3653da Update FeatherPins.h
Mappings are now based on specific boards, not just the architecture (e.g. S2 vs. C3).
2022-04-27 21:11:44 -05:00
Gregg 4659e6f660 Enabled IPV6 Address Broadcast
Added to see if this addresses the mdns-discovery issue in Arduino IDE 2.0.0 interface.
2022-04-27 20:42:38 -05:00
Gregg 6dacbb0a8c Update FeatherPins.h
Changed mapping for S2 to Espressif ESP32-S2 (instead of UM Featherboard)
2022-04-27 06:31:32 -05:00
Gregg 044fe22b1f Made FirmwareRevision Characteristic PR+EV instead of just PR
Allows for updating FirmwareRevision, which HomeKit seems to poll every 60 seconds.
2022-04-26 21:45:29 -05:00
Gregg 54dbda9484 Changed homeSpan.start() to homeSpan.autoPoll() 2022-04-24 08:42:18 -05:00
Gregg c290c8637e Added homeSpan.start() method as alternative to homeSpan.poll()
Rather than call homeSpan.poll() in the main Arduino loop() function, you can instead call homeSpan.start() at the end of the set-up function.  This keeps the main Arduino loop() function free for user-defined code that will not block, and does not get blocked by, homeSpan.poll().

If using a dual-core processor, polling now occurs on core 0, instead of the core 1 (where all other Arduino stuff normally runs).

HomeSpan will throw a fatal error and halt processing if both homeSpan.poll() and homeSpan.start() are used in the same sketch.
2022-04-23 07:22:45 -05:00
Gregg 0507f26b13 Updated "Other Examples" and added SPAN_ACCESSORY() Macro
Need to revisit Television sketch - the latest iOS seemed to have disabled the ability to dynamically set visibility of input sources.  Checking/Un-Checking the visibility radio buttons either during pairing, or after pairing on the settings screen, seems to be ignored by the Home App (the same input sources are shown in the selector regardless of any changes made).  However, dynamically changing the name of an input source seems to work fine.
2022-04-16 15:21:13 -05:00
Gregg 92ece5413f Removed requirement to include HAP Protocol in Accessory Information Service
HAP Protocol does not appear to be needed anymore (as of iOS 15?)
2022-04-08 17:54:50 -05:00
Gregg d20df43a58 Eliminated HAP Protocol Service and updated Examples 1-8
Experimentation reveals that the HAP Protocol Information Service no longer seems to be required by HomeKit.  Examples work fine without it.
2022-04-08 17:46:33 -05:00
Gregg 98f812ba0c Updating examples 1-7 to conform with latest iOS changes 2022-04-04 06:13:30 -05:00
Gregg 240a995c86 Added LOG0() macro 2022-04-02 22:10:05 -05:00
Gregg 057901b5bb Update src.ino 2022-03-14 22:14:59 -05:00
Gregg 6409157180 Completed all SpanOTA safemode logic and cleaned up previous iterations of the logic
Must document in safemode in API as well as discuss in OTA documentation.
2022-03-14 22:01:28 -05:00
Gregg ffdf0296c6 Dramatically simplified OTA enable check in safemode
Rather than auto-enable OTA if not already enabled in safemode, changed the logic to simply rollback to previous app if OTA was used to download a sketch that does not itself have OTA enabled, unless OTA was previously enabled without safemode.

To do:  Delete all complicated SpanOTA logic that (unsuccessfully) tried to track OTA status and check SHA246 partition codes to determine if reboot was OTA or Serial.  None of this is need, but some of the code may be useful for other things in the future.
2022-03-14 21:46:37 -05:00
Gregg 1b0c4835cb Progress on additional SafeMode logic to Auto-enable OTA 2022-03-13 14:42:19 -05:00
Gregg b6eb5afcbf Started work on auto-enabling OTA to start even if not enabled. 2022-03-13 10:19:11 -05:00
Gregg eac06129fc Moved all OTA logic into SpanOTA and completed "safeLoad" protocol 2022-03-12 16:31:50 -06:00
Gregg f3d5092340 SpanOTA in progress 2022-03-12 14:31:15 -06:00
Gregg 2f1044b013 Adding Custom Magic Cookie to OTA Partition
Will prevent uploading a non-HomeSpan sketch via OTA to an existing HomeSpan device.
2022-03-12 08:24:01 -06:00
Gregg 7ddbfd55cc Slight OTA cleanup plus confirmed that you cannot enable ROLLBACK in Arduino-ESP32
Since much of the Arduino-ESP32 library is precompiled, you cannot use -DCONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE to define this during compile time (it gets defined but is not used by the precompiled libraries).

TO DO:  create an NVS entry that flags whether last update was via OTA.  If so, automatically enable OTA regardless of enableOTA setting.  This would ensure that OTA cannot be disabled accidentally by uploading a non-enabledOTA sketch to  remote device.
2022-03-07 22:02:23 -06:00
Gregg 3336ac7fbe Small clean-up of OTA
Researching potential use of rollback of OTA.
2022-03-06 18:39:05 -06:00
Gregg db3bea3b5c Completed Example 19 - Web Logs
Also updated SpanWebLog::addLog() so that the log message is also output to the Serial Monitor if the HomeSpan Log Level is set to 1 or greater.

To do: DOCUMENT ALL THIS!
2022-03-06 09:25:17 -06:00
Gregg 1be40ad6fc Converted LOG1() and LOG2() to variadic macros!
If LOG1() or LOG2() is only provided with a SINGLE argument, then Serial.print() is called.  This allows you to continue using LOG1() and LOG2() to directly print any variable or object that is handled by Serial.print(), such as an int, double, or even an IPAddress.

If LOG1() or LOG2() is provided with multiple arguments, the first is considered the format and Serial.printf(format...) is called.  This allows you to use printf-like functionality within LOG1() and LOG2().
2022-03-06 07:48:12 -06:00
Gregg 33042f191e Added logURL to MDNS broadcast
Broadcast as "logURL" only if Web Logging is enabled.
2022-03-05 22:34:30 -06:00
Gregg f37889f8da Added ClientIP as permanent part of Web Log ; DELETED homeSpan.getClientIP()
ClientIP will show as "0.0.0.0" if log message is not related to client request
2022-03-05 22:24:23 -06:00
Gregg cf22ff1a92 Added homeSpan.getClientIP()
Gets IP address (as char *) of last client to send a request.  Useful as part of web log messages.  Will return 0.0.0.0 if used outside of any code that is responding to a client request.
2022-03-05 22:06:34 -06:00
Gregg e3b9ed99cb Added homeSpan.setTimeServerTimeout(uint32_t tSec);
Sets timeout when connecting to Time Server (default is 10 seconds if not specified)
2022-03-05 20:35:01 -06:00
Gregg 2787966c48 Converted webLog.addLog() to variadic form
Also created WEBLOG() variadic macro
2022-03-05 18:13:27 -06:00
Gregg d9a9e6f31c Changed webLog in HomeSpan from pointer to instantiated variable
Added isEnabled to SpanWebLog to indicate whether Web Log has been enabled.  This allows the use of homeSpan.webLog.addLog() without ever enabling (in which case the log entries are ignored).
2022-03-05 12:50:20 -06:00
Gregg acc64f863a Added addLog(const char *) to SpanWebLog()
Also included logic so that clockTime is set to "Unknown" is addLog() is called prior to WiFi being established.

Next up: replace addLog(const char *) with a variadic set of parameters with dynamic storage allocation.
2022-03-05 10:40:01 -06:00
Gregg 168be05586 Progress on SpanWebLog() 2022-03-05 10:03:13 -06:00
Gregg 91ab626d6c Update HomeSpan.h 2022-03-04 06:15:48 -06:00
Gregg b6c019d1a8 Finished Time Stamping - Started Web Log Structure 2022-03-03 21:37:20 -06:00
Gregg 20ce79ef34 Added check to ensure time server is available
If not, homeSpan.timeServer is reset to NULL
2022-03-02 21:41:06 -06:00
Gregg 571bc55852 Added optional homeSpan.setTimeServer() method
If specified, HomeSpan will try to get internet time after establishing WiFi connection.  Consumes one socket connection.
2022-02-27 18:29:58 -06:00
Gregg ae4b6e8df1 Initial creation of getStatusURL() web log
Built basic framework to response to "GET /status".  Next up:  Add timeclock.
2022-02-27 18:04:12 -06:00
Gregg 170e0b61b1 Add new macro CUSTOM_SERV() to created custom services
Also, updated error checking so that the UUID for both custom Services and custom Characteristics are checked for syntax.  A fatal error is thrown if an ill-formatted UUID is found, since this will definitely prevent pairing with the HomeApp.

The UUID for HAP Services and Characteristics are NOT error checked, since these are fixed in HomeSpan.

Also, the custom Characteristics are not validated against the optional list for a service.  If the user adds a custom Characteristic to a HAP Service, it is assumed to be valid.  Similarly, none of the Characteristics (HAP of Custom) in a Custom Service are validated at all.
2022-02-27 09:51:27 -06:00
Gregg bf2e1354b1 Added second version of SpanUserCommand() that takes a void *arg
Useful for passing a pointer to a Service that can be used in the CLI command.
2022-02-22 21:53:17 -06:00
Gregg ea09e5c8f3 Create FeatherPins.h
For developer use only - facilitates testing the same code across an ESP32, ESP32-S2, and ESP32-C3 without re-wiring by using an Adafruit FeatherBoard as a common jig.
2022-02-21 15:08:19 -06:00
Gregg 02d841390c Updated License Dates 2022-02-20 13:05:03 -06:00
Gregg 7bfc1d48fb Updated version to 1.5.0 2022-02-20 12:09:03 -06:00
Gregg b141a83630 Update extras.ino 2022-02-19 18:29:34 -06:00
Gregg a83d3a7fda Added static HSV and RGB color methods to Pixel() and Dot()
Updated Pixel example to demonstrate use of the static HSV method
2022-02-17 18:27:31 -06:00
Gregg a4fb99a684 Updated Pixel Example 2022-02-13 11:57:34 -06:00
Gregg eee0eb6954 Embedded HSV and RGB methods inside Color object
Makes coding with Pixel() and Dot() easier
2022-02-12 15:31:55 -06:00
Gregg c40c744702 Small modification to status message 2022-02-11 09:24:51 -06:00
Gregg ac88329d34 Deprecated setMaxConnections(); Added reserveSocketConnections()
Use homeSpan.reserveSocketConnections(n) to reserve n sockets *not* to be used for HAP.  Multiple calls can be used to cumulate a total number of reserved sockets.  This makes is easy to add reserveSocketConnections(n) at multiple point in the code whenever a certain number of sockets need to be reserved for use with that portion of the code.  For example enableOTA() calls reserveSocketConnections(1).

If both setMaxConnections(), and one or more reserveSocketConnections(), methods are called HomeSpan will use the more restrictive net value.
2022-02-10 21:55:03 -06:00
Gregg 4973d1aaa1 Revert "Initial coding of protectPinISR(pin) method"
This reverts commit 852a916d61.
2022-02-10 21:09:42 -06:00
Gregg 32b417a1da Added homeSpan method deleteStoredValues()
Provides a programmatic way of deleting all stored Characteristic values from NVS.  Identical to the 'V' CLI Command.
2022-02-10 21:02:10 -06:00
Gregg f955ff689b Added homeSpan.setPairCallback() method
Callback function must be of type void()(boolean isPaired).  Will be called when device is paired and when device is unpaired.  Allows for user-defineable actions upon device pairing/unpairing.
2022-02-06 08:39:47 -06:00
Gregg 9e40666231 Added Pixel() and Dot() operator overloads to Color struct
Color now supports a==b, a!=b, a+b, a-b, a+=b, and a-=b operators
2022-02-05 23:30:28 -06:00
Gregg acdcab1132 Verified Pixel() and Dot() classes work on ESP32-C3 2022-02-05 16:24:01 -06:00
Gregg d0a13e5417 Updated Pixel() class to use more streamlined methods implemented in Dot() class
Pixel() and Dot() classes are now complete.  Tested DotStar RGB, NeoPixel RGB, and NeoPixel RGBW, all running at same time on a single ESP32.

Next up: Must update Pixel Example as well as Holiday Lights Project
To Do: Add documentation page for Pixel() and Dot()
2022-02-05 12:35:01 -06:00
Gregg a21cc0679d Add two-wire addressable DotStar RGB LEDs to Pixel.h
Pixel.h now contains Pixel() and Dot() classes.
Dot() class uses more streamlined methods; must next update Pixel() to use similar methods, which will allow Pixel and Dot to be more "interchangeable".
2022-02-05 09:17:56 -06:00
Gregg 852a916d61 Initial coding of protectPinISR(pin) method
Works for all NVS calls in homeSpan.h.  To Do:  Add logic to all other NVS calls.
2022-01-30 22:33:07 -06:00
Gregg d2bbd4f56c Added logic for RGB vs. RGBW
Tested with original 8-pixel RGB and 60-pixel RGBW.  Works as expected.
2022-01-29 18:26:17 -06:00
HomeSpan 877f47a64d Split RFControl constructor into public and private versions
Private constructor only used for Pixel, which is friend class of RFControl
2022-01-27 21:41:05 -06:00
Gregg 4588669cd2 Added ARDUINO_VARIANT (type of board) to MDNS 2022-01-23 16:40:46 -06:00
Gregg 46820c66a2 Add Arduino-ESP32 version number to MDNS output 2022-01-23 15:00:12 -06:00
Gregg a09b8d0b85 Update Pixel.cpp 2022-01-22 07:18:19 -06:00
Gregg 95b41fd929 Revert "Update logic so Pixel uses only ONE channel and shares across all instances"
This reverts commit 4af3a22764.
2022-01-22 07:09:48 -06:00
Gregg 4af3a22764 Update logic so Pixel uses only ONE channel and shares across all instances 2022-01-21 21:56:51 -06:00
Gregg e060856b78 corrected an issue in loadData ISR that would cause a hang
Also updated Pixel example with Knight Rider Effect.
Testing on C3 seems to be working.  Must test on S2 and ESP32 next.
2022-01-20 21:01:31 -06:00
Gregg 4419a91bef verified functionality on ESP32-S2 2022-01-17 13:15:24 -06:00
Gregg fd3955f0c2 verified functionality on ESP32 original 2022-01-17 12:52:09 -06:00
Gregg b6d21fd2c0 streamlined identification of interrupt masks and memory size 2022-01-17 12:36:02 -06:00
Gregg 89f0d0dd94 verified works on C3 when either channel 0 or 1 is used 2022-01-17 11:30:55 -06:00
Gregg 5f513c4c34 updated 2022-01-17 08:25:26 -06:00
Gregg 79c028c057 moved loadData into interrupt 2022-01-17 07:16:31 -06:00
Gregg 40c05bd53f some more cleanup
Next up:  Move loadData into isrHandler, if possible.
To Do: redo single-color methods
2022-01-16 23:24:54 -06:00
Gregg 1a99df4214 check in progress 2022-01-16 23:14:12 -06:00
Gregg 46d7ade046 Re-doing Pixel class once again
This time using customized interrupts to fill RMT memory on-the-fly.

* Added getChannel() to RFControl
* Add 3rd, optional, boolean argument to RFControl(int pin, bool refTick, bool defaultDrive) to that RMT can be initialized but without the default driver (allows for use of custom interrupt code instead)
2022-01-16 14:16:52 -06:00
Gregg 6f4cea1b4d Updated version number to 1.4.3
Also updated Pixel example.
2022-01-10 22:52:08 -06:00
Gregg aefa737675 Completed "optimization"
Pixels now lets you reserve memory for pixels so that the call to start the RF transmission can be done for multiple pixels at once.  However, gain is not as much as expected.  May need to revisit if driving a large matrix of pixels is needed.
2022-01-08 17:28:43 -06:00
Gregg ee6c270de3 optimizing to allow for pulse train batching 2022-01-08 16:18:37 -06:00
Gregg 9d0c56799c Update extras.ino 2022-01-07 06:58:40 -06:00
Gregg 1b402b5ebc changed range of S and V to be 0-100 instead of 0-1
But still use float so that values of 50.3, 99.5, etc. are still distinguishable.
2022-01-07 06:25:11 -06:00
Gregg 3020b800a6 testing 2022-01-06 21:43:54 -06:00
Gregg f10f5cffcd Normalized and optimized Pixel methods
created color_t typedef and use as basis for all RGB and HSV methods
2022-01-06 21:15:03 -06:00
Gregg d5b27d6e14 Added ability to set same color on multiple pixels
Added 4th, optional argument, nPixels, to setRGB() and setHSV().
2022-01-06 18:09:22 -06:00
Gregg e8c7afae00 Increased default max number of connections to 14!
Reflects increase in max number of LWIP sockets from 10 (Arduino-ESP32 v2.0.0) to 16 (Arduino-ESP32 v2.0.1).  Since HomeSpan needs at least 2 (one for Server and 1 free for new connections), this leaves 14 connections for controllers.  A big improvement over only having 8!
2022-01-02 15:36:54 -06:00
Gregg 5d3a4bfc38 Added simple Pixel example to Other Examples 2022-01-01 08:14:32 -06:00
Gregg 12c283e8c3 Update Pixel.h 2022-01-01 07:14:30 -06:00
Gregg 368a06301a renamed sk68xx class to Pixel and made it generic
Constructor now allows you to specify high/low timings for 1-bit and 0-bit, as well as timing for reset delay.  Default parameters are included if none are specified.
2021-12-31 18:10:51 -06:00
Gregg 3b6bc13b1c Added setHSV() to sk68xx class 2021-12-31 15:34:20 -06:00
Gregg facba4c02a Added Pixel.h and Pixel.cpp and implemented SK68XX Addressable LED Class
Also add getPin() to RFControl (which is used by SK68XX Class) as well as boolean operator overrides for both RFControl and PwmPin/ServoPin so that instances can be checked for validity.
2021-12-31 14:51:42 -06:00
Gregg d667f5e81d Added homeSpan.setStatusAutoOff(uint16_t duration)
Optional method to automatically turn off Status LED after a *duration* seconds.  LED will resume normal operation any time it is re-triggered with a new pattern.  This also resets the elapsed time used to check for autoOff.
2021-12-26 23:07:37 -06:00
Gregg 8737efea14 Added setUnit(char *) as method to SpanCharacteristic
Optional method to add or override the units for a Characteristic (i.e., "percentage", or "celsius") as per HAP-R2 Table 6-6.
2021-12-23 22:28:26 -06:00
Gregg 3cc14c3a8d Addressed automation issue by extending true/false parsing
Added true/false parsing to all integer-based Characteristics.  Previously true/false was only parsed for BOOL Characteristics.  For integer-based on/off Characteristics, the Home App would send a 0 for off, and a 1 for on, consistent with HAP-R2.  BUT...when using Home App AUTOMATIONS, the Home App would send true/false for integer-based Characteristics, which is inconsistent with HAP-R2.  This meant automations worked with lights (that use the boolean ON Characteristic) but not with fans (that use the uint8 ACTIVE Characteristic).

With this "fix", true/false will be recognized all the time (except for float- and string-based Characteristics.  Confirmed that fans now work with Home App Automations.
2021-12-23 15:37:26 -06:00
Gregg 715adf44f1 Added setDescription(const char *) method to SpanCharacteristic
This allows you to add an optional "description" to a Characteristic.  This is not the same as the name of a Service and is generally not used by the Home App.  However, it appears to be consumed by the Eve app, which can be helpful in some circumstances when developing custom characteristics.
2021-12-17 06:44:27 -06:00
Gregg a872111743 Fixed bug in CUSTOM_CHAR() when applied to STRING Characteristic
Created a new CUSTOM_CHAR_STRING(NAME,UUID,PERMISISONS,DEFVAL) macro specifically for STRING Characteristics
2021-12-03 07:02:25 -06:00
Gregg bc5299cf57 Updated version number to 1.4.2
Ready for release!
2021-11-27 09:48:07 -06:00
Gregg 83170306f5 Updated Blinker class for compatibility with Arduino-ESP32 v2.0.1
The update from Arduino-ESP32 2.0.0 to 2.0.1 contained significant changes to the structures used by the IDF for generic timers.  This broke the Blinker code (would not compile for ESP32-S2 and C3 chips).

The solution: Modified Blinker::isrTimer() to use a *generic* interrupt-clearing function when available (IDF version >= 4.0.0).  Below 4.0.0 the code continues to manually clear the interrupt flag by resetting specific structure variables, though the logic is simpler since this is only needed for the ESP32 chip (the S2 and C3 are not supported in earlier versions of Arduino-ESP32).

This provides for full compatibility with Arduino-ESP32 versions 2.0.1, 2.0.0, and 1.0.6.  The use of a generic interrupt clearing function when IDF>=4.0.0 will hopefully make this future-proof to any further changes by Espressif to the underlying timer structures.
2021-11-25 10:03:57 -06:00
Gregg d8bb51902f Fixed Bug in TimedWrites
The loop over TimedWrites incorrectly erased iterators inside a for-loop.  For some reason this never caused an issue on the ESP32, but crashed on the ESP32-C3.  Solution is to change the for-loop to a while-loop with proper handling of the iterator when an element is deleted.  This appears to fix the problem.
2021-11-24 18:27:55 -06:00
Gregg 48b21df329 Created method setPairingCode(const char *s)
Allows for programmatic creation of Pairing Setup Code.  Not recommended, but added for a convenience - should use 'S' from CLI instead.
2021-11-12 18:01:27 -06:00
Gregg b5f4592b29 Removed Characteristic::ConfiguredNameStatic() end updated Television Example
Characteristic::ConfiguredNameStatic() is no longer needed since you can now change permissions on ConfiguredStatic to remove PW with removePerms(PW).  Updated Television Example accordingly.

To Do:  Add getLinks() and setPerms/addPerms/removePerms to API Reference Documentation
2021-11-10 05:54:19 -06:00
HomeSpan fcf715d874 Added getLinks() method to SpanServices
This returns a vector of linked Services that can be used in a for-each loop as such:

for(auto services : getLinks()){ ... }

Must cast services into specific Service type to access anything not generic to the SpanService   class
2021-11-09 21:18:34 -06:00
HomeSpan 3f833beb74 Added ability to change permissions for Characteristics
New methods for Characteristics:

setPerms(uint8_t perms);
addPerms(uint8_t dPerms);
removePerms(uint8_t dPerms);

where perms and dPerms = PR|PW|EV...
2021-11-09 21:08:52 -06:00
Gregg 6f765e8988 Added non-notify option to setVal()
Second optional argument to setVal() determines whether or not HomeSpan sends notification of new value to HomeKit.  Default if left blank is "true" for backwards compatibility.
2021-11-07 20:45:44 -06:00
HomeSpan 08c92f8eb0 Update Span.h
Make Characteristic::Identifier required for Service::InputSource
2021-10-31 17:20:56 -05:00
HomeSpan a53d98070c Update version numbers to 1.4.1 2021-10-30 22:06:02 -05:00
Gregg 226548defa Added check to ensure Custom Characteristic has valid UUID
And also converted ERRORS to WARNINGS when a Characteristic that is not in the REQ or OPT list is specified for a Service.   This allows the user to add any Characteristic to any Service without forcing an Error (just a Warning).
2021-10-29 22:54:10 -05:00
Gregg 61a2be533b Moved Range checking to a standalone routine checkRanges()
Ranges are now checked for all Characteristics at the end of the configuration, instead of at the end of each Accessory definition.  This is much cleaner and the output is easier to read.

To do:  Revisit use of REQ and OPT - what should constitute a fatal error and what should be a warning.

To do:  Revisit Character definitions - attempt to normalize using the methods implemented for Custom Characteristics
2021-10-26 22:05:44 -05:00
Gregg 65b15b5628 Added AID info to Set Range log message 2021-10-26 05:39:54 -05:00
Gregg 92c198d01a Update src.ino 2021-10-25 22:10:44 -05:00
Gregg b6001f9418 Update Span.h 2021-10-25 21:58:51 -05:00
Gregg eb9530800e Created typedef for HAP types - used to simplify CUSTOM_CHAR
No need to specify both FORMAT and TYPE.   For example, specifying UINT16 automatically sets type to be uint16_t.

To do:  Explore if this can be used for standard Characteristics - revisit standard Characteristics definitions and structure to see if it can be simplified.
2021-10-25 21:57:29 -05:00
Gregg eeb3c334ac Update src.ino 2021-10-24 21:24:45 -05:00
Gregg 4309be8f91 Finalized CUSTOM_CHAR() macro to add a custom Characteristic 2021-10-24 21:19:38 -05:00
Gregg d5fa8335fb Update src.ino 2021-10-24 20:58:45 -05:00
Gregg 96d74e5920 Adding Macros to allow for creation of custom Characteristics and Service 2021-10-24 18:45:46 -05:00
Gregg 37e0486cf7 Removed all unusable TV Characteristics from TV and Input Source Services
But retained the actual Characteristics in the Characteristics lists in the event that they may be activated in the Home App in the future.
2021-10-23 22:58:16 -05:00
Gregg 4eb1ebf806 Update HomeSpan.h 2021-10-23 13:21:21 -05:00
Gregg b90fc5aad5 Updated logic re STRING Characteristics
Added setString() as analog to setVal().  This complements getString and getNewString() which are analogs to getVal() and getNewVal().
2021-10-23 13:16:49 -05:00
Gregg dcbfbc3e15 Correct setVal() logic to properly check for EV permissions, not PW permissions 2021-10-22 09:17:26 -05:00
Gregg 8a24819955 Added Characteristic::ConfiguredNameStatic()
This "custom" Characteristic is identical to ConfiguredName() but only allows paired-read and notifications.  By excluding paired-write it prevents the user from editing the name of a TV input source from the Home App.  This is useful when some sources are fixed, such as "netflix" instead of generic, such as "hdmi 1".
2021-10-22 06:35:33 -05:00
Gregg 7c32f7a364 Fix bug in PushButton()
Ensure a pin value of -1 is retained so that any further calls to other methods are disabled if the pin is not defined.
2021-10-21 20:32:25 -05:00
Gregg d4603df58d Creating Television Example 2021-10-20 06:15:12 -05:00
Gregg 26c15c9ca2 Fixed strncpy() warnings
Changed strncpy() to strcpy() when copying new string values
2021-10-18 22:48:56 -05:00
Gregg f07fa4e9c7 Testing TV functions 2021-10-17 22:02:11 -05:00
HomeSpan 353749baea
Merge pull request #121 from unreality/master
add support for Televisions
2021-10-17 16:10:50 -05:00
HomeSpan 82d86001e2 Update extras.ino 2021-10-16 14:49:50 -05:00
HomeSpan 1566f93274 Update extras.ino 2021-10-16 11:33:49 -05:00
Gregg 760abae5ce Testing pronto codes 2021-10-16 08:16:22 -05:00
Gregg 5976fd3d0d Add enableCarrier(uint32_t frequency, float duty) and disableCarrier() to RFControl
Allows you to overlay a carrier wave on the RF Signal - in practice this is only used for IR signals (not RF).  Automatically scales frequency to account for 80x difference between APB Clock and Ref Tick Clock depending on which is used.   Checks to ensure resulting parameters (high period and low period) are all in bounds (0,65536) and reports an error if they are not.
2021-10-15 22:32:03 -05:00
Gregg 4ad607951f Add clock selection to RFControl (80 MHz or 1 MHz)
Added second argument to RFControl(uint8_t pin, boolean refClock=true) to allow choice of Ref Tick (1 MHz) clock or APB (80 MHz) clock.  Default is to use 1 MHz Ref Tick.

Also fixed bug in logic that divides clock for ESP32-C3.  Factor should be 79, not 80, since divider is apparently configured to divide by factor+1.
2021-10-15 18:16:18 -05:00
Gregg 5bced71345 Changed rf.add() and rf.phase() to allow for uint32_t durations
Instead of limiting number of ticks to 15-bits (32767), RFControl allows for tick size to be any 32-bit number.  If ticks > 32767, RFControl adds repeated LOW or HIGH phases as needed to match full duration.  This provides for much more flexibility in creating pulse trains that include very long-duration "spaces" between repeats.
2021-10-15 17:42:17 -05:00
Gregg 7d6265d543 Upgrade version number from 1.3.0 to 1.4.0 2021-10-09 08:12:29 -05:00
Gregg 7295803dde Remove LED_BUILTIN as default for statusPin
HomeSpan default is that there is NO control button and NO status LED.  Must use setStatusPin() or setControlPin() to enable.
2021-10-08 05:47:51 -05:00
Gregg 8236b6fb9a Marked old SpanRange() class as [[deprecated]]
This will cause a Warning (not an Error) at compile time indicating the class has been deprecated and that the Characteristic::setRange() method should be used instead.  Sketch will still run and SpanRange will still function correctly if used.  Will delete from code base at some point in the future.
2021-10-05 21:27:41 -05:00
Gregg 6de645216c CHANGED default settings for StatusPin and ControlPin
Re-worked code to allow for NO Status LED Pin and NO Control Pin.  If Control Pin is not set explicitly with homeSpan.setControlPin(), there will be no Control Pin.  There is no longer a default since there are too many board variations with S2 and C3 chips now supported.  Same for Status Pin - it will not be defined unless set explicitly with homeSpan.setStatusPin(), with the exception that if LED_BUILTIN is defined (i.e. there is a built-in LED), then the Status LED Pin will default to LED_BUILTIN if not explicitly defined.  MUST UPDATE DOCUMENTATION - THIS CHANGES DEFAULT BEHAVIOR OF HOMESPAN AND MAY REQUIRE UPDATES TO EXISTING SKETCHES
2021-10-05 21:10:24 -05:00
Gregg b95ebcb4fa Added ARDUINO_ESP_VERSION Macro
Will be "1.0.6", "2.0.0", etc.  Can be used as anywhere as a c-string
2021-10-05 20:08:34 -05:00
Gregg 56c09c44aa Updated Blinker again to ensure C3 compatibility
moved gpio_set_direction to start() method so that it is called every time needed in case another part of the program (i.e. DEV_Identify) calls pinMode() and resets the pin to a strict OUTPUT.
2021-10-05 06:32:19 -05:00
Gregg 0fd9424d79 Added Arduino-ESP32 Version Number to initial output 2021-10-04 21:14:16 -05:00
Gregg d82566158a Disabled watchdog timeout messages when running on ESP32-C3 2021-10-04 20:39:32 -05:00
Gregg 641e2ca955 Added check in RFControl to allow for backwards compatibility with Arduino-ESP 1.0.6
To do: Disable watchdog timer in ESP32-C3
2021-10-03 22:01:37 -05:00
Gregg ae1037946a Update Blinker() to fix inherent problem with digitalRead() in ESP32-C3
Pin must be INPUT_OUTPUT for digitalRead to work with ESP32-C3 (the IDF uses a new protocol for the C3).
2021-10-03 21:39:23 -05:00
Gregg 7980273609 Completed update of RFControl for ESP32-S2 and -C3 compatability
Testing completed for RFControl and PWM on all three ESP32 chip types.

To Do: update RFControl documentation to include total number of usable channels per chip, as well as the alternate version of start();
2021-10-03 18:08:07 -05:00