Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Revert "Fix slice indices failure." #32

Merged
merged 1 commit into from
Jul 12, 2021

Conversation

dunkmann00
Copy link
Contributor

Now that indices are once again enabled in CP (#4857), revert the changes from #31.

Tested with an itsybitsy M0.

@evaherrada evaherrada changed the base branch from master to main June 7, 2021 18:20
@dunkmann00
Copy link
Contributor Author

@kattni Have you had a chance to look at this?

@kattni
Copy link
Contributor

kattni commented Jun 10, 2021

@dunkmann00 Unless I'm missing something, the CircuitPython change is not present in the current stable version of CircuitPython, 6.3.0. This means anyone using the stable version would still run into this bug. Until 7.0.0 is stable, we should not revert this change.

@dunkmann00
Copy link
Contributor Author

@kattni In CP 6.x branches the change wasn't needed because the flag that turned off slice indices functionality didn't yet exist. This flag was introduced when the newer versions of micropython were merged into CP in the main branch. But since 6.3.0 didn't have this, indices should work just fine.

@kattni
Copy link
Contributor

kattni commented Jun 10, 2021

@dunkmann00 Appreciate the follow-up. I'll test this out in the next day or two and get it merged if successful. Thanks for the fix!

@dunkmann00
Copy link
Contributor Author

@kattni Np! I'll try to test it out myself as well.

@dunkmann00
Copy link
Contributor Author

I can confirm this works on CP 6.3.0. Tested on an itsybitsy M0.

@dunkmann00
Copy link
Contributor Author

Hey @kattni, just curious if you've had a chance to test this out on 6.3 yet?

@kattni
Copy link
Contributor

kattni commented Jun 21, 2021

@dunkmann00 I have not. Apologies for the delay. I should have time this week.

Copy link
Contributor

@kattni kattni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on QT Py M0 on both 6.3.0 and 7.0.0-alpha.3.

Thanks for the fix!

Copy link
Contributor

@kattni kattni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just tested it with a basic slice, upon remembering that was the original issue, and it fails with the same error.

@dunkmann00 Thoughts?

On 7.0.0-alpha.3:

import board
import neopixel

pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)

while True:
    pixel[0:1] = (255, 0, 0) * 1

Fails with:
AttributeError: 'slice' object has no attribute 'indices'

@kattni
Copy link
Contributor

kattni commented Jun 23, 2021

The slice code above works on 6.3.0 with this PR, but it turns the LED blue.

@dunkmann00
Copy link
Contributor Author

Actually, I just tested it with a basic slice, upon remembering that was the original issue, and it fails with the same error.
@dunkmann00 Thoughts?

Thats actually kind of funny. It appears the change missed making it into 7.0.0-alpha-3 by about 10 hours 😆. So if you build from the tip of the main branch, it will be in there.

The slice code above works on 6.3.0 with this PR, but it turns the LED blue.

Not sure about that, I'll look into it. I wonder, do you see that same effect without this PR as well?

@kattni
Copy link
Contributor

kattni commented Jun 23, 2021

I just pulled an adafruit_pypixelbuf.mpy out of a previous 6.x bundle folder, and yes the LED is still blue.

@dunkmann00
Copy link
Contributor Author

Interesting, I don't have any neopixels with me at the moment so I'll look into it more later. One more question, does it only happen when you set them using a slice, or also when setting just one?

i.e.
pixel[0:1] = (255, 0, 0) * 1 - Result: Blue LED
AND
pixel[0] = (255, 0, 0) - Result: ?

As another thought, I wonder if this is a board specific problem?

@kattni
Copy link
Contributor

kattni commented Jun 23, 2021

Setting a single pixel with [0] results in red.

@dunkmann00
Copy link
Contributor Author

@kattni I think you just need:
pixel[0:1] = ((255, 0, 0)) * 1
Because then it is a tuple of tuples, rather than a tuple of integers.

@kattni
Copy link
Contributor

kattni commented Jun 23, 2021

@dunkmann00 Actually it's supposed to be [(255, 0, 0)], if I bothered to look up what I was doing and not try to do LED slices on the fly (I never get it right on the first try).

The blue LED was my fault. So that's not an issue.

However, I still need to test it on main. I would like to hold off on merging this until we do another 7 alpha release if that's necessary, because otherwise it won't work properly with both releases available on circuitpython.org.

@dunkmann00
Copy link
Contributor Author

Sounds good to me!

Copy link
Contributor

@kattni kattni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with 7.0.0-alpha.4 successfully!

@kattni kattni merged commit 4f005e5 into adafruit:main Jul 12, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 17, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107 to 1.3.0 from 1.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SH1107#7 from ladyada/main
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SH1107#6 from lesamouraipourpre/max-size
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305 to 1.2.0 from 1.1.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305#12 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306 to 1.4.0 from 1.3.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#21 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_HX8357 to 1.3.0 from 1.2.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#15 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_IL0373 to 1.3.9 from 1.3.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_IL0373#22 from lesamouraipourpre/ondiskbitmap-changes
  > Moved default branch to main
  > Moved CI to Python 3.7

Updating https://github.com/adafruit/Adafruit_CircuitPython_IL0398 to 1.1.7 from 1.1.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_IL0398#11 from lesamouraipourpre/ondiskbitmap-changes
  > Moved default branch to main
  > Moved CI to Python 3.7

Updating https://github.com/adafruit/Adafruit_CircuitPython_ILI9341 to 1.3.0 from 1.2.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_ILI9341#27 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1327 to 1.3.0 from 1.2.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1327#10 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1331 to 1.3.0 from 1.2.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1331#14 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1351 to 1.3.0 from 1.2.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1351#16 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1608 to 1.2.8 from 1.2.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1608#11 from lesamouraipourpre/ondiskbitmap-changes
  > Moved default branch to main
  > Moved CI to Python 3.7

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1675 to 1.1.7 from 1.1.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1675#10 from lesamouraipourpre/ondiskbitmap-changes
  > Moved default branch to main
  > Moved CI to Python 3.7

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1680 to 1.0.2 from 1.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1680#2 from lesamouraipourpre/ondiskbitmap-changes
  > Moved CI to Python 3.7

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1681 to 1.0.4 from 1.0.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1681#5 from lesamouraipourpre/ondiskbitmap-changes
  > Moved CI to Python 3.7

Updating https://github.com/adafruit/Adafruit_CircuitPython_ST7735 to 1.2.0 from 1.1.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_ST7735#15 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_ST7789 to 1.5.0 from 1.4.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_ST7789#23 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.20.0 from 2.18.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#154 from lesamouraipourpre/refactor

Updating https://github.com/adafruit/Adafruit_CircuitPython_Gizmo to 1.3.3 from 1.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Gizmo#20 from lesamouraipourpre/ondiskbitmap-changes
  > Merge pull request adafruit/Adafruit_CircuitPython_Gizmo#19 from lesamouraipourpre/max-size
  > Moved default branch to main

Updating https://github.com/adafruit/Adafruit_CircuitPython_MIDI to 1.4.1 from 1.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MIDI#36 from lesamouraipourpre/patch-1
  > Moved default branch to main
  > Merge pull request adafruit/Adafruit_CircuitPython_MIDI#35 from 4dcu-be/master
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 5.1.0 from 5.0.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#84 from PhearZero/patch-1
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyBadger to 3.3.0 from 3.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyBadger#45 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "
  > Merge pull request adafruit/Adafruit_CircuitPython_PyBadger#43 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_PYOA to 2.3.0 from 2.2.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_PYOA#23 from lesamouraipourpre/max_size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf to 2.2.6 from 2.2.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_Pypixelbuf#32 from dunkmann00/revert-31-slice-fix
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template

Updating https://github.com/adafruit/Adafruit_CircuitPython_turtle to 2.2.0 from 2.1.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_turtle#24 from lesamouraipourpre/max-size
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_Pixelbuf
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants