Code Monkey home page Code Monkey logo

Comments (11)

Gadgetoid avatar Gadgetoid commented on June 15, 2024

The area of interest for this problem is the interrupt polling loop here: https://github.com/pimoroni/cap1xxx/blob/master/library/cap1xxx.py#L360-L371

I suspect that delay needs increasing- in fact there must be a minimum sensible time for it which I could look up or derive. I kept it low because I wanted a good response in Piano HAT, but never tried raising it.

Piano HAT uses the alert pins, however, so the GPIO read is way less expensive than the round trip to an i2c register that the library needs to make for DotHAT.

from displayotron.

Gadgetoid avatar Gadgetoid commented on June 15, 2024

I've updated cap1xxx to increase the delay from a microsecond ( completely bonkers and probably not even meaningful in Python ) to 5ms, which I think should be plenty fast enough for even Piano HAT. pimoroni/cap1xxx-python@ef34015

If you grab the cap1xxx library from GitHub and install it, hopefully your CPU usage will drop dramatically.

from displayotron.

jorisvervuurt avatar jorisvervuurt commented on June 15, 2024

Cool.
Will re-running the dot3k installation script update the cap1xxx library?

I'll take a look at it ASAP. ;-)

from displayotron.

Gadgetoid avatar Gadgetoid commented on June 15, 2024

Nope, you'd have to git clone the cap1xxx library and install that separately.

from displayotron.

jorisvervuurt avatar jorisvervuurt commented on June 15, 2024

Ah, okay.
Maybe a stupid question, but where and how do I install it?

Also, since other Display-O-Tron HAT owners might not be aware of the CPU usage, you might want to make sure that re-running the dot3k installation script also updates the cap1xxx library. ;-)

from displayotron.

Gadgetoid avatar Gadgetoid commented on June 15, 2024

Under normal circumstances it should go, but I haven't pushed the change up to pip yet. Try something like:

git clone https://github.com/pimoroni/cap1xxx
cd cap1xxx/library
sudo python setup.py install
sudo python3 setup.py install

from displayotron.

capfuji avatar capfuji commented on June 15, 2024

I was wondering, is this issue solved in the official installation? I still have CPU usage around 20% with active dothat.touch event handlers, but it could also be my crappy Python code šŸ˜…

from displayotron.

wujku avatar wujku commented on June 15, 2024

Issue still exists.

from displayotron.

Gadgetoid avatar Gadgetoid commented on June 15, 2024

I've pushed up version 0.1.1 to pip which should contain this fix: https://pypi.python.org/pypi/Cap1xxx

Would be interested in feedback! @capfuji @wujku

from displayotron.

capfuji avatar capfuji commented on June 15, 2024

Thanks! CPU usage is down from around 20 to 2.3 %. Touch buttons are still working as expected. Perfect šŸ˜Š

from displayotron.

jorisvervuurt avatar jorisvervuurt commented on June 15, 2024

I guess this issue can be closed. Good work!

from displayotron.

Related Issues (20)

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.