* The default timings were chosen vastly outside specification. On COTS servos, this causes much confusion for the user, because a wide range of angle starting from 0 degress, and a just a large range of angle leading up to 180 degrees, is dead - in fact, the servo doesn't move at all, from any position.
Not investigated further for obvious reasons, as this may have also destroyed servos that ran hot trying to abide by the PWM signal but could not mechanically!
* Change timing limits to safe values. With previous default timings and safety limits, popular servos
could force against internal physical endstops, which could overload and destroy them.
* Review action: revert changes to hard boundary for min/max duty cycle timings. Internal review, fix/drop legacy comments.
* A Servo on each available ESP8266 GPIO (D0-D8), no observed interference.
* Remove possible jerk due to force-cancelling duty cycle.
* Overload attach: can specify initial angle for servo, too.
* Stricter checks for configured, and default, bounded timings.
* Missed the min/max in a comment.
* Default microsecond lower bound of 1000 causes confusing behavior - 200 is minimum enforced elsewhere, so use it here too as nearest multiple of 100 from 180.
* Comment rationale for changed defaults of min/max pulse widths.
Comment rationale for changed defaults of min/max pulse widths.
Fix/clarify comments.
Fix redundancies in Tone, end Tone waveform on exact period limit for proper sound.
Fix redundancies in wiring_pwmExtend Servo to map in-use pins, Tone already has this.
Remove and rewrite all the parts of the core/libraries using TIMER1
and consolidate into a single, shared waveform generation interrupt
structure. Tone, analogWrite(), Servo all now just call into this
shared resource to perform their tasks so are all compatible
and can be used simultaneously.
This setup enables multiple tones, analogWrites, servos, and stepper
motors to be controlled with reasonable accuracy. It uses both TIMER1
and the internal ESP cycle counter to handle timing of waveform edges.
TIMER1 is used in non-reload mode and only edges cause interrupts. The
interrupt is started and stopped as required, minimizing overhead when
these features are not being used.
A generic "startWaveform(pin, high-US, low-US, runtime-US)" and
"stopWaveform(pin)" allow for further types of interfaces. Minimum
high or low period is ~1 us.
Add a tone(float) method, useful when working with lower frequencies.
Fixes#4321. Fixes 4349.
Use platform.local.txt to add -Werror to GCC for the build of all
code. Any warnings on a submitted patch will cause an error.
Several examples and libraries had warnings/errors (missing returns
on functions, types, etc.). Clean those up with this commit as well.
Values that were written and then read would be different due to using
map.
If user defined a different min/max pulse width would cause the
read/write to incorrectly calculate the pulse width.
detaching could leave a running timer which would cause issues.
Further, detaching could truncate the last pulse causing a invalid
movement.
This change moves detaching into the ISR so it can maintain the last
pulse and not start any more timers if not needed.
Use unique name values in library.properties for the esp8266 libraries
that are also Arduino IDE Built-In libraries. This solves the issue of
SD and Servo libraries always appearing as Type: Updatable in the
Arduino IDE 1.6.6 Library Manager when an esp8266 board is selected.
Fixes issue of reentrant calls to nointerrupts()
exposed functional replacements to cli sei and SREG when dealing with
interrupts
InterruptLock class to auto stop and restore interrupt level
Fix user ISR calls to be like Arduino with interrupts disabled fully.
This exposes the Timer0
This provides a Servo library support compatible with Arduino Servo
library but only supports the two timers the esp8266 has available