Full initialization now depends on "isInitialized" flag instead of monitoring Wifi connection, to protect against a loss of WiFi causing a re-initialization, instead of just a wifi reconnect with initWifi() alone.
No need for any new methods - default is now that longPress repeats every longTime milliseconds provided button continues to be held down. Once a longPress is triggered, a shortPress will not be triggered until button is released.
SpanButton now instantiates PushButton instead of keeping track of its own triggering logic. This means that SpanButton longPress() is triggered by holding down the button for longTime WITHOUT the need to release. This is a desired change.
Next: Must update Example 15 to state that SpanButtons trigger a long press withouth needing to be released.
To do: Consider adding a "repeating mode" for longPress in which the SpanButton re-triggers every longTime while button continues to be pressed. Best way to implement is probably by creating a PushButton::extend() method.
Also moved StatusCode definitions from Settings.h to HAPConstants.h. There was no reason to have the user return a StatusCode of OK or UNABLE from update() since the only other choice was BUSY and HomeKit does not seem to distinguish errors. Either it's okay or not okay, which can more easily be represented by a simply return of TRUE or FALSE from update().
The user now needs to know nothing about StatusCodes. All Examples were modified to change StatusCode update() to boolean update() and return(StatusCode:OK) to return (true).
Much simpler.
Convention is that every *.cpp references, in this order:
1) Any required core librries
2) Its own *.h (i.e. Foo.cpp -> Foo.h)
3) All other *.h files needed by the cpp, UNLESS those *.h files are already in its own *.h file. Must include all *.h files that are not in its own *.h file even if it is others that are referenced.
This change allows the user to set the log-level with homeSpan.setLogLevel() instead of needing to change in Settings.h. Next up: Update Example that introduces VERBOSE to instead use setLogLevel(). Consider adding an interactive 'L' command to change this during run-time.
Also, added "#pragma once" to every *.h file to prevent duplication of definitions. TO DO: Review all #include to ensure sanity across all files.
These optional methods can be "chained" when instantiating a new SpanService to configure the Service as Primary or Hidden (or both). This alleviates the need to ServiceType to be propogated through the Service constructor.
Next Up: Eliminate ServiceType construct and update Examples to use setPrimary instead.
Created separate init() methods for PushButton and Blinker. Created HomeSpan:setControlPin and HomeSpan:setStatusPin that can be called from main setup() to modify the defaults. All default settings being migrated to Settings.h
Next Up: Add method to break out of WiFi connection loop by using push button in case WiFi SSID/PWD has changed but there is no desire to unpair controllers. To Do: Move blinking status light setting to named macros.
Setup Code now saved after serialConfig() or apConfig().
Next up: Create 'U' command to unpair controller. Change function of control button so it unpairs (short press) or resets WiFi (long press).
To do: Revisit statusLED blinking paterns to make sure they are clear and consistent - save them as macros in settings.h
Verified all functionality works as expected. Next Up: Add this code to both serial and AP network configurations. To Do: alter 'H' command so it removes controllers (unpairs) but retains HAP ID and other data. - perhaps make this 'U' command?
And updated other SRP routines to complete implementation of use of stored verification code instead of live setup code.
Next up: Add method to change setup code in serial interface and implement similar code after network configuration routines.
This generates an SRP verification code from a setupCode and randomly-generated salt. Function creates the salt internally and returns both the resulting verification code and salt that was used. These are stored in NVS permanently.
Next Step: create SRP6A:loadVerifycode()
Move all configuration code into Network.cpp, eliminating any calls or connection to HAP.cpp. Network.cpp is now standalone for HomeSpan.cpp to call directly to handle ALL apects of WiFI and Setup Code initialization.
Also move TempBuffer from HAP.h to Utils.h so it can be used by Network.h
Includes abilty to change brightness of light through HomeKit as well as with button. However, the vent light is too unstable to do this perfectly, and increasing brightness by stepping through multiple decreases is annoying. To do: Create Zephyr3 without brightness control and test to see how it works in practice.