Commit Graph

1195 Commits

Author SHA1 Message Date
foamyguy
52be2b80c1
fix out of range
Co-authored-by: Mark <56205165+gamblor21@users.noreply.github.com>
2022-11-27 17:04:25 -06:00
foamyguy
3419b118fd
fix out of range
Co-authored-by: Mark <56205165+gamblor21@users.noreply.github.com>
2022-11-27 17:02:55 -06:00
foamyguy
57d7f7f2ad move to _pixelmap 2022-11-24 09:07:08 -06:00
foamyguy
e5ea1d2247 try to revert pixelbuf merge brokenness. remove second color_u def. 2022-11-22 18:47:25 -06:00
foamyguy
19f1119994 Merge branch 'main' into fastpixelmap
# Conflicts:
#	shared-module/adafruit_pixelbuf/PixelBuf.c
2022-11-21 20:25:58 -06:00
MicroDev
f637332de6
Merge pull request #7209 from jepler/code-optimize-pixelbuf
Save code space by packing rgbw values into C union
2022-11-18 14:46:55 +05:30
foamyguy
5b64a62c16 move hidden declare inside struct 2022-11-15 18:37:23 -06:00
Jeff Epler
14ba5a75a3
skip converting from long int if long ints aren't enabled
.. saves 20 bytes on proxlight trinkey
2022-11-14 21:26:58 -06:00
Jeff Epler
2d08473ee0
this version actually saves more code space on cortex-m0 with -Os (samd21s) 2022-11-14 21:18:40 -06:00
Jeff Epler
adca341d3b
Save code space by packing rgbw values into C union
It's more efficient passing one register-sized structure than 4
arguments or 4 pointers; working on intermediate values of 'int' size
is also more efficient in code size!

On raspberry pi pico w, this increased free flash space by +104 bytes.
It also increased the speed of my testing animation very slightly, from
187fps to 189fps when run 'unthrottled'
2022-11-14 09:29:45 -06:00
foamyguy
3c4d8c6926 implement self hidden property for vectorio shapes 2022-11-11 17:50:07 -06:00
Jeff Epler
f5c637dc10
Add adafruit_pixelmap.PixelMap
.. a fast helper for animations. It is similar to and inspired by the
PixelMap helper in Adafruit LED Animation library, but with an extremely
fast 'paste' method for setting a series of pixels. This is a common
operation for many animations, and can give a substantial speed improvement.

It's named `adafruit_pixelmap` so that we can package a compatible version
in pure Python for systems that can't fit it in C in flash, or for
Blinka.

This is a proof of concept and can make a very fast comet animation:
```python
import time
import adafruit_pixelbuf
import adafruti_pixelmap
import board
import neopixel
from supervisor import ticks_ms
from adafruit_led_animation.animation.solid import Solid
from adafruit_led_animation import color

pixel_pin = board.GP0
pixel_num = 96

pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=1, auto_write=False, pixel_order="RGB")

evens = adafruit_pixelmap.PixelMap(pixels, tuple(range(0, pixel_num, 2)))
odd_indices = tuple((i, i+2) for i in range(1, pixel_num, 4))
print(odd_indices)
odds = adafruit_pixelbuf.PixelMap(pixels, odd_indices)
assert len(odds) == len(odd_indices)


comet_length = 16

comet1 = [color.calculate_intensity(color.GREEN, ((1+i) / comet_length) ** 2.4)
        for i in range(comet_length)]
comet2 = [color.calculate_intensity(color.PURPLE, ((1+i) / comet_length) ** 2.4)
        for i in range(comet_length)]

pos1 = 0
pos2 = 96//4

while True:
    evens.paste(comet1, pos1, wrap=True, reverse=False, others=0)
    pos1 = (pos1 + 1) % len(evens)

    odds.paste(comet2, pos2, wrap=True, reverse=True, others=0)
    pos2 = (pos2 - 1) % len(odds)
    pixels.show()

    m = ticks_ms()
    if m % 2000 > 1000:
        time.sleep(.02)
```
2022-11-11 07:54:33 -06:00
Scott Shawcroft
eb1b2f38a0
Fix USB issues caused by early usb_cdc.Serial read
Check for connected before calling read. Otherwise TinyUSB may
setup the read on the wrong endpoint.

Fixes #6018
`
2022-10-21 20:42:26 -07:00
Jeff Epler
55519670a8
Fix parsing long dotenv values
Values that exceeded the stack buffer of 64 bytes were incorrectly
handled.

A new test is added.
2022-10-13 16:41:30 -05:00
Dan Halbert
de7a9c38fc Merge remote-tracking branch 'adafruit/main' into add-os-utime-function 2022-10-13 14:15:13 -04:00
Dan Halbert
7e4b2a09eb
Merge pull request #7000 from MicroDev1/storage-extend
Add Storage Extension Support
2022-10-13 10:05:55 -04:00
microDev
728fea4ca4
add storage extension python api 2022-10-13 09:53:33 +05:30
Dan Halbert
987030e706
Merge branch 'main' into add-os-utime-function 2022-10-07 22:45:51 -04:00
Dan Halbert
833f55922c
Remove multiterminal
This module has not been built in years, since the (removed) esp8266 port.
Delete the code, as it is not likely to be useful in its current form.

Closes: #7015
2022-10-06 14:02:47 -05:00
Jeff Epler
27e6623657
Add unicode support to dotenv
Newly passing tests:
```
aa🐍bb=key with emoji
value_with_emoji=aa🐍bb
```
2022-10-05 18:18:07 -05:00
Dan Halbert
91079279da Allow spaces before = in dotenv 2022-10-05 15:50:53 -04:00
Jeff Epler
52bca95208
Refactor dotenv module so that it can be tested on host
.. it needs to operate on a FILE* rather than FIL depending on
the build.

Note that this is comparing output to expected, not to cpython dotenv
package. Because run-tests.py starts the CPython interpreter with the
'-S' (skip site initialization) flag, pip-installed packages are
not available for import inside a test file. Instead, the exp
file is generated manually:
```
circuitpython/tests$ python3 circuitpython/dotenv_test.py > circuitpython/dotenv_test.py.exp
```

Unfortunately, the test fails on test e15:
```diff
FAILURE /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py
--- /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.exp	2022-10-04 09:48:16.307703128 -0500
+++ /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.out	2022-10-04 09:48:16.307703128 -0500
@@ -14,7 +14,7 @@
 line
 e13 e13value
 e14 None
-e15 e15value
+e15 None
 e16 #
 e17 def
 e18 #has a hash
```
2022-10-04 09:51:27 -05:00
Dan Halbert
6dc03ae3ce fix some dotenv parsing 2022-10-03 21:56:11 -04:00
Dan Halbert
0cd37376a0 finish status bar internal simplification 2022-09-27 15:14:40 -04:00
Jeff Epler
f7221d5895
simplify logic in _clobber_points_list 2022-09-22 08:39:34 -05:00
Jeff Epler
ef35ca1d3e
vectorio: Simplify argument checking of x/y values 2022-09-22 08:39:33 -05:00
Isaac Benitez
71d649613f Updated utime() to take a 2-tuple instead of a plain int 2022-09-22 00:56:44 -07:00
Isaac Benitez
5a21c30ab2 Added utime() to the os librady 2022-09-18 18:43:27 -07:00
gamblor21
863a8bce03 Fix with PWM for brightness slowing devices down 2022-09-11 20:34:53 -05:00
Dan Halbert
dd37c81136
Merge pull request #6847 from dhalbert/status-bar-control
Allow enabling and disabling of status bar
2022-09-08 10:48:36 -04:00
Pepijn de Vos
f69f517352
allow writing empty color frame 2022-09-06 19:32:15 +02:00
Dan Halbert
2c42a48962 Clear stale exception in _exec_result; more status_bar fixups 2022-09-01 19:29:32 -04:00
Dan Halbert
2fa671c0f8 avoid status bar updates immediately after hard restart 2022-08-30 22:33:29 -04:00
Dan Halbert
52080e24eb status bar control 2022-08-30 15:23:44 -04:00
Dan Halbert
b481411541
Merge pull request #6767 from maximkulkin/usb-hid-get-last-report-fix
shared-module/usb_hid: Fix behavior of Device.get_last_received_report()
2022-08-24 08:51:35 -04:00
Maxim Kulkin
aab5fac67b shared-module/usb_hid: Fix behavior of Device.get_last_received_report()
Documentation states that get_last_received_report() function should
return None if there was no report received previously, otherwise it
should return report. Moreover, same report should be returned only
once. That makes it possible to reliably process incoming OUT/Feature
reports.

This patch adds an array that stores flags if report with particular
ID was received and updates get_last_received_report() to match its
documentation.
2022-08-24 01:34:51 -04:00
gamblor21
f134f86291 Two small fixes, remove hardcoded height and non-scale issues 2022-08-19 15:13:38 -05:00
Hanns Holger Rutz
92231e88ca
Touchin.c - fix clean up in constructor before exception is thrown
When the constructor value reading times out, an exception is thrown, but the digital pin is not de-initialised. Make sure to run the clean up, so user could catch the exception and retry using the same pin.
2022-08-10 21:49:18 +02:00
Jeff Epler
c2a45c1f27
Merge pull request #6739 from jepler/qrio-esp32camera
Enable qrio to work with rgb565 data, including byte-swapped data
2022-08-10 13:54:40 -05:00
Jeff Epler
5168f6ec1f Add support for RGB565 images in qrio
Most cameras produce RGB565_SWAPPED data
2022-08-10 11:13:26 -05:00
Dan Halbert
02cc6c2aee Merge remote-tracking branch 'adafruit/main' into remove-autobrightness 2022-08-10 08:35:53 -04:00
Dan Halbert
41bcd7b260 Remove support for auto-brightness 2022-08-09 22:40:21 -04:00
Jeff Epler
1da8065d6b
Merge remote-tracking branch 'origin/main' into espressif-camera-2 2022-08-05 16:38:51 -05:00
Dan Halbert
8c10e09ba0
Merge pull request #6667 from jepler/esp-reserve-heap-for-idf
Add ability to reserve psram
2022-08-05 15:06:44 -04:00
Scott Shawcroft
125b276af0
Get CIRCUITPY FATFS directly.
Otherwise, you may actually get a non-root filesystem.

Fixes #6575
2022-08-04 16:06:27 -07:00
Jeff Epler
64b1d003df
Allow a Bitmap to be constructed from a buffer (in C anyway)
.. so that Camera.take() can return one without copying
2022-08-04 15:11:58 -05:00
Jeff Epler
82be75adb5 Add ability to reserve psram
.. the primary user of which will be the camera, since the framebuffers
must be allocated via esp-idf allocation function and never from the
gc heap.

A board can have a default value, and the value can also be set in the
/.env file using the key CIRCUITPY_RESERVED_PSRAM with the value being
the reserved size in bytes.

Co-authored-by: Dan Halbert <halbert@adafruit.com>
2022-08-03 16:19:40 -05:00
Neradoc
626296b613 implement root_group in framebufferio.FramebufferDisplay 2022-07-14 11:47:36 +02:00
Scott Shawcroft
6446010753
Wi-Fi autoconnect and title bar status
This adds support for CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD
in `/.env`. When both are defined, CircuitPython will attempt to
connect to the network even when user code isn't running. If the
user code attempts to a network with the same SSID, it will return
immediately. Connecting to another SSID will disconnect from the
auto-connected network. If the user code initiates the connection,
then it will be shutdown after user code exits. (Should match <8
behavior.)

This PR also reworks the default displayio terminal. It now supports
a title bar TileGrid in addition to the (newly renamed) scroll area.
The default title bar is the top row of the display and is positioned
to the right of the Blinka logo when it is enabled. The scroll area
is now below the Blinka logo.

The Wi-Fi auto-connect code now uses the title bar to show its
state including the IP address when connected. It does this through
the "standard" OSC control sequence `ESC ] 0 ; <s> ESC \` where <s>
is the title bar string. This is commonly supported by terminals
so it should work over USB and UART as well.

Related to #6174
2022-06-09 14:55:54 -07:00
Scott Shawcroft
b90563d504
Merge pull request #6442 from FoamyGuy/tilegrid_contains
tilegrid.contains() function
2022-06-06 11:02:43 -07:00