Search found 26 matches

by hdsjulian
Sun Mar 17, 2019 12:55 pm
Forum: Programs, Libraries and Tools
Topic: Fast RGB to HSV (And vice versa) calculations?
Replies: 1
Views: 40

Fast RGB to HSV (And vice versa) calculations?

I'm looking for a way to calculate hsv and rgb values respectively. So far I just have used straight forward python implementation that does it, but it is _very_ slow (1.7ms on an esp8266). h = float(h) s = float(s) v = float(v) h60 = h / 60.0 h60f = math.floor(h60) hi = int(h60f) % 6 f = h60 - h60f...
by hdsjulian
Sat Mar 16, 2019 2:45 pm
Forum: General Discussion and Questions
Topic: fastest way to fill large bytearrays? (Neopixel, APA102 et al)
Replies: 13
Views: 543

Re: fastest way to fill large bytearrays? (Neopixel, APA102 et al)

This strikes me as a reasonable compromise: 478μs here on ESP8266. import utime import micropython ba = bytearray(120*4) @micropython.viper def fill(b:ptr8, n:int, v:int): # Generic bytearray populate for x in range(n): b[x] = v start = utime.ticks_us() fill(ba, len(ba), 255) end = utime.ticks_us()...
by hdsjulian
Fri Mar 15, 2019 11:24 am
Forum: General Discussion and Questions
Topic: Simple web interface for my ESP?
Replies: 1
Views: 77

Simple web interface for my ESP?

I basically want to control my ESP8266 (or ESP32) via a simple web interface. Couple of dropdown or checkbox form fields, maybe a text input field. The programme i run has different modes and each mode comes with a few parameters which i'd like to control using my smartphone. Is there any good sampl...
by hdsjulian
Fri Mar 15, 2019 12:26 am
Forum: General Discussion and Questions
Topic: fastest way to fill large bytearrays? (Neopixel, APA102 et al)
Replies: 13
Views: 543

Re: fastest way to fill large bytearrays? (Neopixel, APA102 et al)

First, if this code wasn’t in a function, put it in one: local variables are faster than global ones. This takes 9 ms on my ESP8266: def run(): ba = bytearray(120*4) start = utime.ticks_us() for i in range(120): ba[i*4+0] = 255 ba[i*4+1] = 255 ba[i*4+2] = 255 ba[i*4+3] = 255 end = utime.ticks_us() ...
by hdsjulian
Thu Mar 07, 2019 12:04 pm
Forum: General Discussion and Questions
Topic: fastest way to fill large bytearrays? (Neopixel, APA102 et al)
Replies: 13
Views: 543

Re: fastest way to fill large bytearrays? (Neopixel, APA102 et al)

mattyt wrote:
Thu Mar 07, 2019 12:26 am
Also, if you are using APA102's you might want to take a look at my micropython-dotstar library. As discussed in this forum post, @bill-e was able to update 3000 APA102's in about a second using it. Hope that helps!
thanks, the problem isn't the updating, it's the writing of the values...
by hdsjulian
Wed Mar 06, 2019 5:03 pm
Forum: General Discussion and Questions
Topic: fastest way to fill large bytearrays? (Neopixel, APA102 et al)
Replies: 13
Views: 543

Re: fastest way to fill large bytearrays? (Neopixel, APA102 et al)

Update: This takes 42ms to run. is there any option to speed it up?

Code: Select all

import utime
ba = bytearray(120*4)
 
start = utime.ticks_us()
for i in range(120):
    ba[i*4+0] = 255
    ba[i*4+1] = 255
    ba[i*4+2] = 255
    ba[i*4+3] = 255
end = utime.ticks_us()
print("Total time: "+str(end-start))
by hdsjulian
Wed Mar 06, 2019 4:22 pm
Forum: General Discussion and Questions
Topic: fastest way to fill large bytearrays? (Neopixel, APA102 et al)
Replies: 13
Views: 543

fastest way to fill large bytearrays? (Neopixel, APA102 et al)

So i'm working on a project with 120 APA102 LEDs and it's insanely slow. Same goes for Neopixels. The problem isn't the writing itself (this takes about 2ms) but rather the filling / overwriting of the bytearray (which takes about 100ms for the 120*4 Values).
Any pointers on how i can speed this up?
by hdsjulian
Wed Mar 06, 2019 1:56 pm
Forum: General Discussion and Questions
Topic: Running two concurrent threads
Replies: 16
Views: 553

Re: Running two concurrent threads

using the ADC interface. it's a max4466 electret microphone
by hdsjulian
Wed Mar 06, 2019 1:55 pm
Forum: General Discussion and Questions
Topic: Running two concurrent threads
Replies: 16
Views: 553

Re: Running two concurrent threads

sorry my second comment was useless. don't know how i double posted this
by hdsjulian
Tue Mar 05, 2019 1:06 pm
Forum: General Discussion and Questions
Topic: Running two concurrent threads
Replies: 16
Views: 553

Re: Running two concurrent threads

true. but this won't keep me from only sampling 1000 inputs per second?