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.
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
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.
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();
PWM has now been fully tested and verified with an ESP32 device under Arduino-ESP32 versions 1.0.6 and 2.0.0, and with an ESP32-S2 device under Arduino-ESP32 version 2.0.0. Tests confirmed using both high (5000 Hz) and low (1 Hz or 5Hz) frequencies to ensure timers are correctly configured.
Next Task: Update RFControl routines for 2.0.0 and ESP32-S2 compatibility.
Accounts for new *required* elements of the LEDC channel and timer structures to be set in later versions of the IDF. These elements are not available in earlier versions of the IDF and the program can't be compiled unless ignored.
Arduino-ESP32 has modified the Mbed TLS library so that it uses ESP32 hardware acceleration. However, there is a 512-byte limit to the size of the variables used in an exponential modulo calculation. One of the steps in the SRP code used a 768-byte variable, which cannot be handled in version 2.0.0 though it works fine in version 1.0.6. Solution was to simply reduce the 768-byte variable by modulo N prior to performing the exponential modulo calculation.
New IDF parameter in 2.0.0 for LEDC allows PWM signal to be inverted! Need to ensure flags.output_inverted is set to 0!
Also: Deleted old PWM class, which was saved for backwards compatibility. This "breaks" HomeSpan for those using the old PWM class (instead of LedPin).
Also: Added checks to ensure that frequency is achievable (for S2 and C3, the 14-bit duty resolution is insufficient to allow frequencies slower than 5 Hz - this is not a practical limit when using LedPin to drive actual LEDs and lights).
Should now work with ESP32-S2 and C3. Allows for as many LEDs and Servos as there are channels and timers across low and high (esp32 only) modes. Allows LED to be set with floating point precession instead of just uint8. Allows specification of LED frequency for each LED (1-65535 Hz). Automatically provides maximum duty resolution for frequency chosen.