Coder Social home page Coder Social logo

Comments (9)

ggmichael avatar ggmichael commented on July 28, 2024 1

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.

ggmichael avatar ggmichael commented on July 28, 2024 1

I confirm that update works, and also fixes the reboot problem.

from esp8266_pwm.

khoih-prog avatar khoih-prog commented on July 28, 2024

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.

khoih-prog avatar khoih-prog commented on July 28, 2024

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

  1. 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.

khoih-prog avatar khoih-prog commented on July 28, 2024

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

  1. Increase ESP8266 clock to 160MHz from 80MHz, if not yet
  2. 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.

ggmichael avatar ggmichael commented on July 28, 2024

from esp8266_pwm.

khoih-prog avatar khoih-prog commented on July 28, 2024

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.

khoih-prog avatar khoih-prog commented on July 28, 2024

Hi @ggmichael

Please test the new ESP8266_PWM releases v1.2.3


Releases v1.2.3

  1. Use float for DutyCycle and Freq, uint32_t for period.
  2. Optimize code by not calculation in ISR

from esp8266_pwm.

khoih-prog avatar khoih-prog commented on July 28, 2024

Glad to know it's working better now, thanks to your contribution anyway.

from esp8266_pwm.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.