pico_python_ws2812b icon indicating copy to clipboard operation
pico_python_ws2812b copied to clipboard

Weird results in interactive mode

Open benevpi opened this issue 4 years ago • 3 comments

Sometimes I'm getting weird results when using the interactive REPL. No idea why. I'm investigating. I've just put this issue here incase anyone else comes across it.

benevpi avatar Jan 27 '21 14:01 benevpi

Looks like it's due to MicroPython not keeping up when in interactive mode. Not quite sure why but the following works:

    def show_unroll(self):
        self.sm.put(self.pixels[0],8)
        self.sm.put(self.pixels[1],8)
        self.sm.put(self.pixels[2],8)
        self.sm.put(self.pixels[3],8)
        self.sm.put(self.pixels[4],8)
        self.sm.put(self.pixels[5],8)
        self.sm.put(self.pixels[6],8)
        self.sm.put(self.pixels[7],8)
        self.sm.put(self.pixels[8],8)
        self.sm.put(self.pixels[9],8)

While the following does not

    def show(self):
        for i in range(self.num_leds):
            self.sm.put(self.pixels[i],8)
        time.sleep(self.delay)

Not too sure what the best way of solving this is ATM

benevpi avatar Jan 27 '21 15:01 benevpi

Not sure that this will be solvable until DMA is implemented on MicroPython, but ideas welcome!

benevpi avatar Jan 27 '21 15:01 benevpi

Have you tried putting a delay after the put? In the working example, there is time between the execution of the puts (the time it takes for the line being sent) In the failed example, there is no time between the execution of the puts. Only after all the puts have been executed. I don't have my pico yet, so I cannot try it myself.

rasperen avatar Jan 29 '21 22:01 rasperen