Comments (9)
I can confirm that the new code gets rid of the 'glitch' on changing duty cycle - that's great - thanks. I think you're right that analogWrite() doesn't do this, but there's no harm in having a better implementation. (However, something is now causing the ESP8266 to reboot periodically - I have to check over my integration of the library)
from esp8266_pwm.
I confirm that update works, and also fixes the reboot problem.
from esp8266_pwm.
HI @ggmichael
I'll publish a new release to add this enhancement within half an hour for you to test the new feature. Be ready.
Regards,
from esp8266_pwm.
Hi @ggmichael
The new ESP8266_PWM releases v1.2.2 has just been published. Your contribution is noted in Contributions and Thanks. Please test and verify the new feature is supported and working OK now.
The library is better and better everyday, thanks to contributing users like you, who spot bugs, test and request enhancements. We, the library writers, normally can't never have enough time, knowledge and experience to know all the use-cases in the world to add the new features.
Best Regards,
Releases v1.2.2
- DutyCycle to be optionally updated at the end current PWM period instead of immediately. Check DutyCycle to be updated at the end current PWM period #2
from esp8266_pwm.
HI @ggmichael
However, something is now causing the ESP8266 to reboot periodically - I have to check over my integration of the library
If you still have that problem, I suggest you try these mods to see if it's any better
- Increase ESP8266 clock to 160MHz from 80MHz, if not yet
- Increase the
HW_TIMER_INTERVAL_US
from 20uS to higher, such as 30, 50, 100uS. For example
ISR_Modify_PWM.ino#L46
#define HW_TIMER_INTERVAL_US 50L
The reason is the ISR-based function run()
now take more time to process (double
accuracy, dutycycle check, etc.)
I'm thinking, in future releases, about letting users optionally select double
, float
or uint32_t
for dutycycle / frequency / period, depending on the use-case.
from esp8266_pwm.
from esp8266_pwm.
I did use floats for the duty cycle instead of double (I think double is more precision than you could ever need). The period remained uint32_t (this also makes sense to me, since this is the actual count). Frequency could also be a float, since it is always converted.
I agree with you and will make float
for DC and Freq, period uint32_t
. Sorry for to be too unreasonably aggressive.
Will have a new release within today.
from esp8266_pwm.
Hi @ggmichael
Please test the new ESP8266_PWM releases v1.2.3
Releases v1.2.3
- Use
float
forDutyCycle
andFreq
,uint32_t
forperiod
. - Optimize code by not calculation in ISR
from esp8266_pwm.
Glad to know it's working better now, thanks to your contribution anyway.
from esp8266_pwm.
Related Issues (3)
- Change Duty Cycle HOT 7
- calculate pwm resolution HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp8266_pwm.