Commit Graph

17578 Commits

Author SHA1 Message Date
Jeff Epler 0eee93729a Fix decompression of unicode values above 2047
Two problems: The lead byte for 3-byte sequences was wrong, and one
mid-byte was not even filled in due to a missing "++"!

Apparently this was broken ever since the first "Compress as unicode,
not bytes" commit, but I believed I'd "tested" it by running on the
Pinyin translation.

This rendered at least the Korean and Japanese translations completely
illegible, affecting 5.0 and all later releases.
2020-09-08 20:54:47 -05:00
Kevin Matocha d600759bc8 Utilize MIN and MAX functions from py/misc.h 2020-09-08 20:02:34 -05:00
Jeff Epler bdb07adfcc translations: Make decompression clearer
Now this gets filled in with values e.g., 128 (0x80) and 159 (0x9f).
2020-09-08 19:07:53 -05:00
Scott Shawcroft 99f5011d74
Fix heap without PSRAM. Never set heap_size. 2020-09-08 17:06:09 -07:00
Jeff Epler b49099c8f3 additional asf4 updates 2020-09-08 15:31:13 -05:00
Scott Shawcroft bbd802940e
Merge pull request #3377 from jepler/support-udecimal
core: Enable some features neede for a port of python3's decimal module
2020-09-08 13:10:57 -07:00
Jeff Epler baa2d7fd56 add new board to CI 2020-09-08 14:08:52 -05:00
Jeff Epler e066448e36 atmel-samd: add same51, feather_m4_can
This is compile-tested, and requires updates in the related submodules:

https://github.com/adafruit/samd-peripherals/pull/35
https://github.com/adafruit/asf4/pull/37

This should not be merged until those can also be merged.
2020-09-08 13:06:45 -05:00
microDev 14af8e4b42
Added temp_sensor_stop
Co-authored-by: hierophect <hierophect@gmail.com>
2020-09-08 21:07:00 +05:30
microDev c68723db3c
Update Processor.c 2020-09-08 15:13:48 +05:30
Jeff Epler 540e6d4285
Merge pull request #3352 from jepler/fix-release-build
shared_bindings_matrix revert to using shared-bindings
2020-09-07 16:13:53 -05:00
Jeff Epler d2d5fe938d
Merge pull request #3380 from weblate/weblate-circuitpython-main
Translations update from Weblate
2020-09-07 16:12:09 -05:00
Jonny Bergdahl 19594f4adf
Translated using Weblate (Swedish)
Currently translated at 100.0% (785 of 785 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/
2020-09-07 21:36:07 +02:00
DavePutz 918a4733b4
Merge pull request #25 from DavePutz/main
update from main
2020-09-07 10:14:36 -05:00
DavePutz 7c162cd1c6
Merge pull request #24 from adafruit/main
Update from adafruit/main
2020-09-07 10:12:13 -05:00
Jeff Epler 7d58cdb12c update expected result with new method 2020-09-07 07:11:23 -05:00
root 8d27533cd4 Make sure SPI lock is free initially 2020-09-06 18:03:25 -05:00
Jeff Epler 73858ea682 circuitpy_mpconfig: enable 3-arg pow() with CIRCUITPY_FULL_BUILD
This is needed for a port of python3's decimal.py module.
2020-09-06 10:07:57 -05:00
Jeff Epler 20c2dd0c08 core: add int.bit_length() when MICROPY_CYPTHON_COMPAT is enabled
This method of integer objects is needed for a port of python3's
decimal.py module.

MICROPY_CPYTHON_COMPAT is enabled by CIRCUITPY_FULL_BUILD.
2020-09-06 09:53:16 -05:00
Jeff Epler a9779b99fa
Merge pull request #3371 from weblate/weblate-circuitpython-main
Translations update from Weblate
2020-09-05 18:59:09 -05:00
root 2690faec43 Moved checks for invalid pin to common-hal/microcontroller/Pin.c 2020-09-05 11:42:06 -05:00
Kevin Matocha 297b7195b0 Delete unnecessary comment 2020-09-04 22:03:57 -05:00
root ed6cc64c49 Corrected issue with BLE not working on nrf52840 2020-09-04 16:59:41 -05:00
Kevin Matocha 95db456a7e Add final newline 2020-09-04 14:23:53 -05:00
Kevin Matocha 9edad9ea85 Delete trailing blank lines from Shape.c 2020-09-04 14:21:49 -05:00
Kevin Matocha f7714649ee Add dirty rectangle tracking to Shape display element 2020-09-04 14:15:15 -05:00
Wellington Terumi Uemura e13698f8f7 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (785 of 785 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/
2020-09-04 17:15:26 +02:00
Dan Halbert 42df254683
Merge pull request #3373 from dhalbert/trellis-m4-board-i2c
fix pins for trellis_m4 board.I2C()
2020-09-04 11:15:18 -04:00
Scott Shawcroft 96cf60fbbd
Merge remote-tracking branch 'adafruit/main' into native_wifi 2020-09-03 16:34:56 -07:00
Scott Shawcroft 0b94638aeb
Changes based on Dan's feedback 2020-09-03 16:32:12 -07:00
Dan Halbert 960888a3bd fix pins for trellis_m4 board.I2C() 2020-09-03 14:22:18 -04:00
Jeff Epler cbfd38d1ce Rename functions to encode_ngrams / decode_ngrams 2020-09-02 19:09:23 -05:00
Scott Shawcroft 5d17d6402d
Merge pull request #3366 from kmatch98/refresh_now
Update refresh to force immediate redraw with `display.refresh()`
2020-09-02 16:37:46 -07:00
Scott Shawcroft 786f4ed114
Merge pull request #3344 from jepler/issue-3184
Fix RGBMatrix, FrameBufferDisplay bugs
2020-09-02 15:32:30 -07:00
Jeff Epler c34cb82ecb makeqstrdata: correct range of low code points to 0x80..0x9f inclusive
The previous range was unintentionally big and overlaps some characters
we'd like to use (and also 0xa0, which we don't intentionally use)
2020-09-02 15:52:02 -05:00
Jeff Epler f1c7389b29 locales: Replace NBSP characters with true spaces
These characters, at code point 0xa0, are unintended.
2020-09-02 15:50:51 -05:00
Jeff Epler 17a5a85528 rgbmatrix: Move struct definition to shared-module, rename 'core' member 2020-09-02 13:34:16 -05:00
Kevin Matocha d224183a7e Delete trailing whitespace 2020-09-02 11:26:37 -05:00
Kevin Matocha 8256bf7ea6 Add backticks to function references in docs 2020-09-02 11:20:30 -05:00
Lucian Copeland 4733a67226 Add GDB debugging capability 2020-09-02 11:27:42 -04:00
Kevin Matocha 4b9306aa7c Cleanup for sphinx 2020-09-01 18:10:40 -05:00
Jeff Epler 07740d19f3 add bigram compression to makeqstrdata
Compress common unicode bigrams by making code points in the range
0x80 - 0xbf (inclusive) represent them.  Then, they can be greedily
encoded and the substituted code points handled by the existing Huffman
compression.  Normally code points in the range 0x80-0xbf are not used
in Unicode, so we stake our own claim.  Using the more arguably correct
"Private Use Area" (PUA) would mean that for scripts that only use
code points under 256 we would use more memory for the "values" table.

bigram means "two letters", and is also sometimes called a "digram".
It's nothing to do with "big RAM".  For our purposes, a bigram represents
two successive unicode code points, so for instance in our build on
trinket m0 for english the most frequent are:
['t ', 'e ', 'in', 'd ', ...].

The bigrams are selected based on frequency in the corpus, but the
selection is not necessarily optimal, for these reasons I can think of:
 * Suppose the corpus was just "tea" repeated 100 times.  The
   top bigrams would be "te", and "ea".  However,
   overlap, "te" could never be used.  Thus, some bigrams might actually
   waste space
    * I _assume_ this has to be why e.g., bigram 0x86 "s " is more
      frequent than bigram 0x85 " a" in English for Trinket M0, because
      sequences like "can't add" would get the "t " digram and then
      be unable to use the " a" digram.

 * And generally, if a bigram is frequent then so are its constituents.
   Say that "i" and "n" both encode to just 5 or 6 bits, then the huffman
   code for "in" had better compress to 10 or fewer bits or it's a net
   loss!
    * I checked though!  "i" is 5 bits, "n" is 6 bits (lucky guess)
      but the bigram 0x83 also just 6 bits, so this one is a win of
      5 bits for every "it" minus overhead.  Yay, this round goes to team
      compression.
    * On the other hand, the least frequent bigram 0x9d " n" is 10 bits
      long and its constituent code points are 4+6 bits so there's no
      savings, but there is the cost of the table entry.
    * and somehow 0x9f 'an' is never used at all!

With or without accounting for overlaps, there is some optimum number
of bigrams.  Adding one more bigram uses at least 2 bytes (for the
entry in the bigram table; 4 bytes if code points >255 are in the
source text) and also needs a slot in the Huffman dictionary, so
adding bigrams beyond the optimim number makes compression worse again.

If it's an improvement, the fact that it's not guaranteed optimal
doesn't seem to matter too much.  It just leaves a little more fruit
for the next sweep to pick up.  Perhaps try adding the most frequent
bigram not yet present, until it doesn't improve compression overall.

Right now, de_DE is again the "fullest" build on trinket_m0.  (It's
reclaimed that spot from the ja translation somehow)  This change saves
104 bytes there, increasing free space about 6.8%.  In the larger
(but not critically full) pyportal build it saves 324 bytes.

The specific number of bigrams used (32) was chosen as it is the max
number that fit within the 0x80..0xbf range.  Larger tables would
require the use of 16 bit code points in the de_DE build, losing savings
overall.

(Side note: The most frequent letters in English have been said
to be: ETA OIN SHRDLU; but we have UAC EIL MOPRST in our corpus)
2020-09-01 17:12:22 -05:00
Jeff Epler f27b89632d
Merge pull request #3357 from weblate/weblate-circuitpython-main
Translations update from Weblate
2020-09-01 16:13:25 -05:00
Kevin Matocha 554cc356db Delete trailing whitespace 2020-09-01 15:43:18 -05:00
Kevin Matocha 7b6d805580 Add Optional[int] to docs string 2020-09-01 15:40:55 -05:00
Kevin Matocha 649a955a74 Modified docs to try to pass sphinx build 2020-09-01 15:02:37 -05:00
Kevin Matocha c6529daac5 Added some backticks to clarify the docs 2020-09-01 14:44:32 -05:00
Kevin Matocha f5015e4485 Add hanging tab to doc 2020-09-01 14:36:43 -05:00
Kevin Matocha e14de38528 Revise .refresh input default value for target_frames_per_second to None 2020-09-01 13:57:19 -05:00
Jeff Epler bb17882065
Translated using Weblate (Japanese)
Currently translated at 68.7% (536 of 780 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/
2020-09-01 20:44:01 +02:00