Merge branch 'dev-1.2.1' of https://github.com/HomeSpan/HomeSpan into dev-1.2.1
This commit is contained in:
commit
bcbe4c1d92
|
|
@ -151,6 +151,7 @@ This is a **base class** from which all HomeSpan Characteristics are derived, an
|
|||
* instantiated Characteristics are added to the HomeSpan HAP Database and associated with the last Service instantiated
|
||||
* instantiating a Characteristic without first instantiating a Service throws an error during initialization
|
||||
* a single, optional argument is used to set the initial value of the Characteristic at startup
|
||||
* throws a runtime warning if value is outside of the min/max range for the Characteristic, where min/max is either the HAP default, or any new values set via a call to `setRange()`
|
||||
* example: `new Characteristic::Brightness(50);`
|
||||
|
||||
The following methods are supported:
|
||||
|
|
@ -167,18 +168,20 @@ The following methods are supported:
|
|||
* returns *true* if a HomeKit Controller has requested an update to the value of the Characteristic, otherwise *false*. The requested value itself can retrieved with `getNewVal<>()`
|
||||
|
||||
* `void setVal(value)`
|
||||
* sets the value of the Characteristic to *value*, and notifies all HomeKit Controllers of the change. Works with any integer, boolean, or floating-based numerical value.
|
||||
* sets the value of the Characteristic to *value*, and notifies all HomeKit Controllers of the change. Works with any integer, boolean, or floating-based numerical value
|
||||
* throws a runtime warning if value is outside of the min/max range for the Characteristic, where min/max is either the HAP default, or any new values set via a prior call to `setRange()`
|
||||
|
||||
* `int timeVal()`
|
||||
* returns time elapsed (in millis) since value of the Characteristic was last updated (whether by `setVal()` or as the result of a successful update request from a HomeKit Controller)
|
||||
|
||||
## *SpanRange(int min, int max, int step)*
|
||||
|
||||
Creating an instance of this **class** overrides the default HAP range for a Characteristic with the *min*, *max*, and *step* values specified.
|
||||
|
||||
* instantiated Ranges are added to the HomeSpan HAP Database and associated with the last Characteristic instantiated
|
||||
* instantiating a Range without first instantiating a Characteristic throws an error during initialization
|
||||
* example: `new Characteristic::Brightness(50); new SpanRange(10,100,5);`
|
||||
* `SpanCharacteristic *setRange(min, max, step)`
|
||||
* overrides the default HAP range for a Characteristic with the *min*, *max*, and *step* values specified
|
||||
* only applicable for Characteristics that support value ranges, else error is thrown
|
||||
* can only set set once per Characteristic. Calling setRange twice for the same Characteristic throws an error
|
||||
* works with any integer or floating-based parameters, though HomeSpan will recast the values into the appropriate format for the Characteristic, which means if you specify *step*=0.5 for a UINT8 Characteristic, *step* will be truncated to zero
|
||||
* *step* is an optional parameter. If unspecified, or set to zero or a negative number, the default HAP step size remains unchanged
|
||||
* Returns a pointer to the Characteristic itself so that the method can be chained during instantiation
|
||||
* example: `(new Characteristic::Brightness(50))->setRange(10,100,5);`
|
||||
|
||||
## *SpanButton(int pin, uint16_t longTime, uint16_t singleTime, uint16_t doubleTime)*
|
||||
|
||||
|
|
@ -213,6 +216,17 @@ If REQUIRED is defined in the main sketch prior to including the HomeSpan librar
|
|||
```C++
|
||||
#define REQUIRED VERISON(2,1,3) // throws a compile-time error unless HomeSpan library used is version 2.1.3 or later
|
||||
```
|
||||
---
|
||||
|
||||
## *SpanRange(int min, int max, int step)*
|
||||
|
||||
Creating an instance of this **class** overrides the default HAP range for a Characteristic with the *min*, *max*, and *step* values specified.
|
||||
|
||||
* instantiated Ranges are added to the HomeSpan HAP Database and associated with the last Characteristic instantiated
|
||||
* instantiating a Range without first instantiating a Characteristic throws an error during initialization
|
||||
* example: `new Characteristic::Brightness(50); new SpanRange(10,100,5);`
|
||||
* this is a legacy function that is limited to integer-based parameters, and has been re-coded to simply call the more generic `setRange(min, max, step)` method
|
||||
* **please use setRange(min, max, step) for all new sketches**
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue