Update PwmPin.cpp
Tested new functionality on RGB LED. Works well with using floating point precision.
This commit is contained in:
parent
60cb20f132
commit
98a5a895cc
|
|
@ -63,15 +63,6 @@ void LedPin::set(float level){
|
||||||
if(!channel)
|
if(!channel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Serial.printf("LED pin=%d, ch=%d, mode=%d, timer=%d, freq=%d, res=%d\n",
|
|
||||||
channel->gpio_num,
|
|
||||||
channel->channel,
|
|
||||||
channel->speed_mode,
|
|
||||||
channel->timer_sel,
|
|
||||||
timer->freq_hz,
|
|
||||||
timer->duty_resolution
|
|
||||||
);
|
|
||||||
|
|
||||||
if(level>100)
|
if(level>100)
|
||||||
level=100;
|
level=100;
|
||||||
|
|
||||||
|
|
@ -161,15 +152,6 @@ void ServoPin::set(double degrees){
|
||||||
if(!channel)
|
if(!channel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Serial.printf("Servo pin=%d, ch=%d, mode=%d, timer=%d, freq=%d, res=%d\n",
|
|
||||||
channel->gpio_num,
|
|
||||||
channel->channel,
|
|
||||||
channel->speed_mode,
|
|
||||||
channel->timer_sel,
|
|
||||||
timer->freq_hz,
|
|
||||||
timer->duty_resolution
|
|
||||||
);
|
|
||||||
|
|
||||||
double usec=(degrees-minDegrees)*microsPerDegree+minMicros;
|
double usec=(degrees-minDegrees)*microsPerDegree+minMicros;
|
||||||
|
|
||||||
if(usec<minMicros)
|
if(usec<minMicros)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue