Commit Graph

1221 Commits

Author SHA1 Message Date
Dan Halbert 398b7c26ca
Merge pull request #7321 from jepler/dotenv-becomes-toml
Dotenv becomes toml
2022-12-13 19:56:36 -05:00
Jeff Epler d40ba94449
explain why this is its own file 2022-12-13 13:19:10 -06:00
Jeff Epler 35f2046ab2
Fix returning GETENV_ERR_LENGTH for over-long strings 2022-12-13 12:02:07 -06:00
Radomir Dopieralski 6412d971fa displayio: Set in_group to false when removing a layer from a group
Otherwise the removed layer cannot be re-added.
2022-12-11 02:59:56 +01:00
Jeff Epler dd6dd5df21
rework the getenv test again
* use a virtual fat filesystem during the test
 * this makes the file I/O part more closely patch runtime which is nice
 * side-steps the need to add a special function for testing
   * but test still can't be run on a device, because the vfs calls
     are incompatible, and you intentionally can't remount "/" anyway
 * and side-steps problems with storing 'bad' toml files
2022-12-10 12:58:08 -06:00
Jeff Epler 040fac0724
No need to track excess length
.. this is a relic from when the actual required length was given
back to the caller
2022-12-09 14:29:14 -06:00
Jeff Epler cc7d550407
Really finish renaming to getenv 2022-12-09 14:28:46 -06:00
Jeff Epler 44f15d563d
Rename "environ" errors to "getenv" errors 2022-12-09 14:14:53 -06:00
Jeff Epler 3a92c079fc
Finish renaming os_environ_get_key to os_getenv
.. for consistency.
2022-12-09 14:07:23 -06:00
Jeff Epler 3459fe322b
Withdraw the _environ module
This existed solely for testing, so expose it a different way during
the unix coverage build

Also turn off os.getenv support on samd21.
2022-12-08 15:33:10 -06:00
Jeff Epler ef2bfdb5db
dotenv becomes settings.toml 2022-12-08 12:44:20 -06:00
Scott Shawcroft 9e104c04ae
Merge pull request #7215 from FoamyGuy/set_root_group
displayio.show() API change
2022-12-02 08:45:20 -08:00
foamyguy 57462092b5 return None instead of NULL for framebuffer and epaper 2022-12-01 17:34:43 -06:00
foamyguy 42f1d50acc remove extra function call. handle show(None) for framebuffer and epaper 2022-12-01 17:25:36 -06:00
Dan Halbert 082b0d1aed
Merge pull request #7191 from jepler/fastpixelmap
Add a fast PixelMap-like class
2022-12-01 11:43:00 -05:00
foamyguy 0563487433 get slicing 2022-11-30 19:16:20 -06:00
Jeff Epler db01dfea20
use a standard length validator 2022-11-30 12:06:19 -06:00
foamyguy 1bbdc820c0 make show(None) show the terminal 2022-11-28 17:02:46 -06:00
foamyguy 553d48f887 return None for NULL 2022-11-28 09:03:03 -06:00
foamyguy b8d6605cff code format, extra space 2022-11-27 17:26:46 -06:00
foamyguy 6844dc0cb7 code format, extra space 2022-11-27 14:20:15 -06:00
foamyguy 15a9e63fda remove is_null troubleshooting function. remove empty line 2022-11-27 14:08:38 -06:00
foamyguy 738b73d4b4 check for NULL in fill_area. moved start_terminal to reset_display. 2022-11-27 13:54:53 -06:00
foamyguy 2c479f4fce working on None behavior 2022-11-26 11:00:09 -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
foamyguy fa4b480439 looking into how null show works 2022-11-21 20:21:39 -06:00
foamyguy ef3398422a allow set_root_group for FrameBufferDisplay instead of show() 2022-11-19 11:41:48 -06:00
foamyguy e3cae22297 allow set_root_group for EPaperDisplay instead of show() 2022-11-18 17:34:03 -06:00
foamyguy 403e3ef430 change to CIRCUITPYTHON_TERMINAL. change internal API to use set_root_group 2022-11-18 16:53:18 -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