Formerly, py/formatfloat would print whole numbers inaccurately with
nonzero digits beyond the decimal place. This resulted from its strategy
of successive scaling of the argument by 0.1 which cannot be exactly
represented in floating point. The change in this commit avoids scaling
until the value is smaller than 1, so all whole numbers print with zero
fractional part.
Fixes issue #4212.
Signed-off-by: Dan Ellis dan.ellis@gmail.com
* Tweak scroll area position so last line is complete and top is
under the title bar.
* Pick Blinka size based on the font to minimize unused space in
title bar. Related to #2791
* Update the title bar after terminal is started. Fixes#6078Fixes#6668
This uses the esp32-camera code instead of our own homebrewed camera code.
In theory it supports esp32, esp32-s2 and esp32-s3, as long as they have
PSRAM.
This is very basic and doesn't support changing any camera parameters,
including switching resolution or pixelformat.
This is tested on the Kaluga (ESP32-S2) and ESP32-S3-Eye boards.
First, reserve some PSRAM by putting this line in `CIRCUITPY/_env`:
```
CIRCUITPY_RESERVED_PSRAM=524288
```
and hard-reset the board for it to take effect.
Now, the following script will take a very low-resolution jpeg file and print
it in the REPL in escape coded form:
```python
import board
import esp32_camera
c = esp32_camera.Camera(
data_pins=board.CAMERA_DATA,
external_clock_pin=board.CAMERA_XCLK,
pixel_clock_pin=board.CAMERA_PCLK,
vsync_pin=board.CAMERA_VSYNC,
href_pin=board.CAMERA_HREF,
pixel_format=esp32_camera.PixelFormat.JPEG,
i2c=board.I2C(),
external_clock_frequency=20_000_000)
m = c.take()
if m is not None:
print(bytes(m))
```
Then on desktop open a python repl and run something like
```python
>>> with open("my.jpg", "wb") as f: f.write(<BIG PASTE FROM REPL>)
```
and open my.jpg in a viewer.
.. 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>
This helps with Python-compatibility (see issue #4171) but doesn't
completely resolve it.
Now, `dir()` still computes any properties of the underlying object,
HOWEVER, if the property raises an exception this expression is
captured.
This ability to capture exceptions always existed in
`mp_load_method_protected`, we just need to turn it on via the
`catch_all_exc` boolean parameter.
Make them CIRCUITPY_FULL_BUILD = 0 and rework the boards to have
the same modules enabled (ish.)
Also make ZLIB require FULL_BUILD and disable advanced `micropython`
module APIs by default on all builds.
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
Profiling shows that `est_net_savings` is one of the highest costs of
the whole process. Approximately, you can save storage only if a word
appears more than once, and doing this greatly reduces the number
of `est_net_savings` calls. Locally, it reduces the time for this
specific build step by 50% on ports/unix coverage build, without
affecting the size of the generated binary.
This breaks the translation dependency to all of the other objects
and therefore speeds up subsequent builds. Now, even when the big
translate() function is inlined in the header, it only needs to be
optimized once.
This allows the compile stage to optimize most of the translate()
function away and saves a ton of space (~40k on ESP). *However*, it
requires us to wait for the qstr output before we compile the rest
of our .o files. (Only qstr.o used to wait.)
This isn't as good as the current setup with LTO though. Trinket M0
loses <1k with this setup.
So, we should probably conditionalize this along with LTO.
Everything should be using the keypad module instead.
Note: there are several boards that still had gamepadshift enabled. I
did not contact their authors to make sure they already switched to
keypad in their code and documentation. We should probably wait with
merging this for their go ahead.
os.getenv() will use it (when available) to load variables from
/.env
This will also be useful when we need secrets or config for
CircuitPython outside of the VM (like WiFi credentials.)
Fixes#4212
This lets the BLE stack run through the wait period after a VM run
when it may be waiting for more writes due to an auto-reload.
User BLE functionality will have their events stopped. Scanning and
advertising is also stopped.
.. and enable it on atmel-samd and raspberrypi. On trinket_m0 this saves
96 net bytes of flash. There are 216 bytes actually saved by reducing
the flash storage size of the property descriptors, but added code in
several paths takes back over half of the 'raw savings'.
By organizing the "get-only" and "get-set" (but no delete) properties
each in a different section, we can represent then more efficiently.
Testing performed: that a get-only property can still be gotten but
can't be set or deleted; that a get-set property can sill be gotten or
set but can't be deleted. Tested on pygamer.
Because this requires linker file support, I only enabled it on two of
the ports.
This warning can happen on clang 13.0.1 building mpy-cross:
../py/vm.c:748:25: error: array index -3 refers past the last possible
element for an array in 64-bit address space containing 64-bit (8-byte)
elements (max possible 2305843009213693952 elements)
[-Werror,-Warray-bounds]
sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] = MP_OBJ_NULL;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using pointer access instead of array access works around this warning.
Fixes issue #8467.
Signed-off-by: Damien George <damien@micropython.org>
A macro in py/bc.h declares five variables that are used to hold data
temporarily, without their values being used after the assignments. This
causes "unused-but-set-variable" warnings in clang 13. We mark these
variables as explicitly ignored to avoid this new warning.
This allows you to list and explore connected USB devices. It
only stubs out the methods to communicate to endpoints. That will
come in a follow up once TinyUSB has it. (It's in progress.)
Related to #5986
There may be several reasons why we might want to remove the logo form
the REPL: a fork of CircuitPython that doesn't have the right to use the
logo, an especially small display that needs all the room it has to be
useful, displays that are especially vulnerable to burn-in, maybe even
the smaller chips where we want to save as much flash memory as
possible.
This fixes a problem preprocessing genhdr/moduledefs.h, which refers to it.
This file doesn't include the place that ulab normally defines
ULAB_HAS_USER_MODULE by default, so just force it.
.. and remove a stanza for the "cache map lookup in bytecode" option,
which has been removed by upstream in 1.18; it's superceded by these
other improvements.