Search found 31 matches

by hdsjulian
Mon Mar 25, 2019 9:29 pm
Forum: Programs, Libraries and Tools
Topic: Fast RGB to HSV (And vice versa) calculations?
Replies: 18
Views: 12564

Re: Fast RGB to HSV (And vice versa) calculations?

If I wrote the C code and showed you how to merge it into the firmware, would you do it? Sent from my iPhone using Tapatalk Pro i found this btw, a basic implementation of FastLED, for an older version of micropython, but it was discontinued. i'd guess you can just pull this out. https://github.com...
by hdsjulian
Sun Mar 24, 2019 2:52 pm
Forum: Programs, Libraries and Tools
Topic: urandom.randint() replacement?
Replies: 1
Views: 3717

urandom.randint() replacement?

I want to generate a random number between 0 and 360. However, urandom only has getrandbits() implemented. Any other clean way in Micropython to do what i'm trying to achieve?
by hdsjulian
Thu Mar 21, 2019 11:57 pm
Forum: Programs, Libraries and Tools
Topic: Fast RGB to HSV (And vice versa) calculations?
Replies: 18
Views: 12564

Re: Fast RGB to HSV (And vice versa) calculations?

Seems a perfect application for viper. https://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers Sent from my iPhone using Tapatalk Pro unfortunately viper doesn't seem to support divisions? as there are quite a few going on (and necessary for HSV to RGB calculation) t...
by hdsjulian
Thu Mar 21, 2019 5:16 pm
Forum: Programs, Libraries and Tools
Topic: Fast RGB to HSV (And vice versa) calculations?
Replies: 18
Views: 12564

Re: Fast RGB to HSV (And vice versa) calculations?

Seems a perfect application for viper. https://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers Sent from my iPhone using Tapatalk Pro unfortunately viper doesn't seem to support divisions? as there are quite a few going on (and necessary for HSV to RGB calculation) t...
by hdsjulian
Tue Mar 19, 2019 6:19 pm
Forum: Programs, Libraries and Tools
Topic: Fast RGB to HSV (And vice versa) calculations?
Replies: 18
Views: 12564

Re: Fast RGB to HSV (And vice versa) calculations?

unfortunately the whole reason i started using micropython on my esp8266 was that i just don't do well with C and i'd rather focus on getting my actual projects done (otherwise i could also just use arduino) :) so i doubt any c-stuff will come from me :/
by hdsjulian
Sun Mar 17, 2019 12:55 pm
Forum: Programs, Libraries and Tools
Topic: Fast RGB to HSV (And vice versa) calculations?
Replies: 18
Views: 12564

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: 15
Views: 32950

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: 2567

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: 15
Views: 32950

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: 15
Views: 32950

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