some cleanup of LedPin comments in examples
Removed old references to "channels" which should have been deleted many versions ago
This commit is contained in:
parent
ce36174f93
commit
f466e12c7a
|
|
@ -53,8 +53,8 @@ void setup() {
|
||||||
// output to drive the brightness of an LED. The ESP32 code base itself includes a set of functions to create PWM output
|
// output to drive the brightness of an LED. The ESP32 code base itself includes a set of functions to create PWM output
|
||||||
// and the ESP32 chip has built-in PWM functionality specifically for this purpose. There are numerous libraries
|
// and the ESP32 chip has built-in PWM functionality specifically for this purpose. There are numerous libraries
|
||||||
// you can download that mimics or reproduces analogWrite() in some form or another. HomeSpan conveniently comes with
|
// you can download that mimics or reproduces analogWrite() in some form or another. HomeSpan conveniently comes with
|
||||||
// it own version of a wrapper around the ESP32 PWM classes that make it very easy to define PWM "channel," attach a pin,
|
// its own version of a wrapper around the ESP32 PWM classes that make it very easy to define LED pins, and set the
|
||||||
// and set the PWM level (or duty cycle) from 0-100%. These functions are encapsualted in the LedPin class, as defined in
|
// PWM level (or duty cycle) from 0-100%. These functions are encapsualted in the LedPin class, as defined in
|
||||||
// extras/PwmPin.h. We will include this file in our updated DEV_LED.h for use with DEV_DimmableLED.
|
// extras/PwmPin.h. We will include this file in our updated DEV_LED.h for use with DEV_DimmableLED.
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ struct DEV_RgbLED : Service::LightBulb { // RGB LED (Command Cathode)
|
||||||
sprintf(cBuf,"RGB=(%d,%d,%d)\n",R,G,B);
|
sprintf(cBuf,"RGB=(%d,%d,%d)\n",R,G,B);
|
||||||
LOG1(cBuf);
|
LOG1(cBuf);
|
||||||
|
|
||||||
redPin->set(R); // update the ledPin channels with new values
|
redPin->set(R); // update each ledPin with new values
|
||||||
greenPin->set(G);
|
greenPin->set(G);
|
||||||
bluePin->set(B);
|
bluePin->set(B);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
|
||||||
int powerPin; // NEW! pin with pushbutton to turn on/off LED
|
int powerPin; // NEW! pin with pushbutton to turn on/off LED
|
||||||
int raisePin; // NEW! pin with pushbutton to increase brightness
|
int raisePin; // NEW! pin with pushbutton to increase brightness
|
||||||
int lowerPin; // NEW! pin with pushButton to decrease brightness
|
int lowerPin; // NEW! pin with pushButton to decrease brightness
|
||||||
int channel; // PWM channel used for this LED (should be unique for each LED)
|
|
||||||
SpanCharacteristic *power; // reference to the On Characteristic
|
SpanCharacteristic *power; // reference to the On Characteristic
|
||||||
SpanCharacteristic *level; // reference to the Brightness Characteristic
|
SpanCharacteristic *level; // reference to the Brightness Characteristic
|
||||||
int favoriteLevel=50; // NEW! keep track of a 'favorite' level
|
int favoriteLevel=50; // NEW! keep track of a 'favorite' level
|
||||||
|
|
@ -53,8 +52,6 @@ struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
|
||||||
|
|
||||||
Serial.print("Configuring Dimmable LED: Pin="); // initialization message
|
Serial.print("Configuring Dimmable LED: Pin="); // initialization message
|
||||||
Serial.print(ledPin->getPin());
|
Serial.print(ledPin->getPin());
|
||||||
Serial.print(" Channel=");
|
|
||||||
Serial.print(channel);
|
|
||||||
Serial.print("\n");
|
Serial.print("\n");
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ LedPin::LedPin(uint8_t pin, float level, uint16_t freq, boolean invert) : LedC(p
|
||||||
if(!channel)
|
if(!channel)
|
||||||
Serial.printf("\n*** ERROR: Can't create LedPin(%d) - no open PWM channels and/or Timers ***\n\n",pin);
|
Serial.printf("\n*** ERROR: Can't create LedPin(%d) - no open PWM channels and/or Timers ***\n\n",pin);
|
||||||
else
|
else
|
||||||
Serial.printf("LedPin=%d: mode=%d channel=%d, timer=%d, freq=%d Hz, resolution=%d bits %s\n",
|
Serial.printf("LedPin=%d: mode=%d, channel=%d, timer=%d, freq=%d Hz, resolution=%d bits %s\n",
|
||||||
channel->gpio_num,
|
channel->gpio_num,
|
||||||
channel->speed_mode,
|
channel->speed_mode,
|
||||||
channel->channel,
|
channel->channel,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue