From 0d64ddaf8473854f3057786bd48b0e4850eef17a Mon Sep 17 00:00:00 2001
From: TG-Techie <39284876+TG-Techie@users.noreply.github.com>
Date: Wed, 15 May 2019 21:22:40 -0400
Subject: [PATCH 1/7] fixing showing rst tags

---
 README.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.rst b/README.rst
index 53ac4cbcd412..5cfae1aec528 100644
--- a/README.rst
+++ b/README.rst
@@ -131,9 +131,9 @@ Behavior
    ``samd.disable_autoreload()``)
 -  Entering the REPL after the main code is finished requires a key press which enters the REPL and
    disables autoreload.
--  Main is one of these: ``code.txt``, **``code.py``**, ``main.py``,
+-  Main is one of these: ``code.txt``, ``code.py``, ``main.py``,
    ``main.txt``
--  Boot is one of these: ``settings.txt``, ``settings.py``, **``boot.py``**,
+-  Boot is one of these: ``settings.txt``, ``settings.py``, ``boot.py``,
    ``boot.txt``
 
 API

From a7e97405e2f3de419723673db4facfc7bab27a7a Mon Sep 17 00:00:00 2001
From: TG-Techie <39284876+TG-Techie@users.noreply.github.com>
Date: Wed, 15 May 2019 21:34:14 -0400
Subject: [PATCH 2/7] Update README.rst

---
 README.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.rst b/README.rst
index 5cfae1aec528..f5f9cccea21d 100644
--- a/README.rst
+++ b/README.rst
@@ -115,8 +115,8 @@ Behavior
    output is written to ``boot_out.txt``.
 -  ``code.py`` (or ``main.py``) is run after every reload until it
    finishes or is interrupted. After it is done running, the vm and
-   hardware is reinitialized. **This means you cannot read state from
-   ``code.py`` in the REPL anymore.** CircuitPython's goal for this
+   hardware is reinitialized. **This means you cannot read state from**
+   ``code.py`` **in the REPL anymore.** CircuitPython's goal for this
    change includes reduce confusion about pins and memory being used.
 -  After ``code.py`` the REPL can be entered by pressing any key. It no
    longer shares state with ``code.py`` so it is a fresh vm.

From 008bbc944cde3f8cd567af24f442eda0cf916948 Mon Sep 17 00:00:00 2001
From: Dan Halbert <halbert@halwitz.org>
Date: Thu, 16 May 2019 10:52:52 -0400
Subject: [PATCH 3/7] correct USB PIDs for several boards

---
 ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk | 2 +-
 ports/atmel-samd/boards/pybadge/mpconfigboard.mk         | 2 +-
 ports/atmel-samd/boards/pygamer/mpconfigboard.mk         | 2 +-
 ports/atmel-samd/boards/pyportal/mpconfigboard.mk        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk
index b6df8d6e224b..3b54fb4d63b1 100644
--- a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk
@@ -1,6 +1,6 @@
 LD_FILE = boards/samd21x18-bootloader.ld
 USB_VID = 0x239A
-USB_PID = 0x8035
+USB_PID = 0x8050
 USB_PRODUCT = "Arduino MKRZero"
 USB_MANUFACTURER = "Arduino"
 
diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk
index aba0e333d749..bac85b57f3c9 100644
--- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk
@@ -1,6 +1,6 @@
 LD_FILE = boards/samd51x19-bootloader-external-flash.ld
 USB_VID = 0x239A
-USB_PID = 0x802C
+USB_PID = 0x8034
 USB_PRODUCT = "PyBadge"
 USB_MANUFACTURER = "Adafruit Industries LLC"
 
diff --git a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk
index 8523e31be5c6..179b75a9ea83 100644
--- a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk
@@ -1,6 +1,6 @@
 LD_FILE = boards/samd51x19-bootloader-external-flash.ld
 USB_VID = 0x239A
-USB_PID = 0x802E
+USB_PID = 0x803E
 USB_PRODUCT = "PyGamer"
 USB_MANUFACTURER = "Adafruit Industries LLC"
 
diff --git a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk
index 34a94ac2be7d..21332eb3a405 100644
--- a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk
@@ -1,6 +1,6 @@
 LD_FILE = boards/samd51x20-bootloader-external-flash.ld
 USB_VID = 0x239A
-USB_PID = 0x8032
+USB_PID = 0x8036
 USB_PRODUCT = "PyPortal"
 USB_MANUFACTURER = "Adafruit Industries LLC"
 

From c9a87eb7fd2732ea833147b6151f0128a485f9da Mon Sep 17 00:00:00 2001
From: Scott Shawcroft <scott@adafruit.com>
Date: Fri, 17 May 2019 11:02:18 -0700
Subject: [PATCH 4/7] Auto-build pygamer

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 6d849e2296c7..a9e0bc3cc9cd 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,7 @@ git:
 # that SDK is shortest and add it there.  In the case of major re-organizations,
 # just try to make the builds "about equal in run time"
 env:
-  - TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express capablerobot_usbhub pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini electronut_labs_papyr" TRAVIS_SDK=arm:nrf
+  - TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express capablerobot_usbhub pygamer pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini electronut_labs_papyr" TRAVIS_SDK=arm:nrf
   - TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo bast_pro_mini_m0" TRAVIS_SDK=arm
   - TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip escornabot_makech" TRAVIS_SDK=arm
   - TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10 kicksat-sprite ugame10 robohatmm1" TRAVIS_SDK=arm

From da77eedafae1d4f9f554f04ca787759f09e9560a Mon Sep 17 00:00:00 2001
From: Dan Halbert <halbert@halwitz.org>
Date: Fri, 17 May 2019 15:56:40 -0400
Subject: [PATCH 5/7] Enable MICROPY_PY_BUILTINS_ROUND_INT; make round() work
 beter when it's disabled as well

---
 py/circuitpy_mpconfig.h | 1 +
 py/modbuiltins.c        | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index f957886f424f..0575bcfe0d74 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -89,6 +89,7 @@
 #define MICROPY_PY_BUILTINS_MIN_MAX      (1)
 #define MICROPY_PY_BUILTINS_PROPERTY     (1)
 #define MICROPY_PY_BUILTINS_REVERSED     (1)
+#define MICROPY_PY_BUILTINS_ROUND_INT    (1)
 #define MICROPY_PY_BUILTINS_SET          (1)
 #define MICROPY_PY_BUILTINS_SLICE        (1)
 #define MICROPY_PY_BUILTINS_SLICE_ATTRS  (1)
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 124dcd05a30a..e764f1987eff 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -455,13 +455,13 @@ STATIC mp_obj_t mp_builtin_round(size_t n_args, const mp_obj_t *args) {
             return o_in;
         }
 
-        #if !MICROPY_PY_BUILTINS_ROUND_INT
-        mp_raise_NotImplementedError(NULL);
-        #else
         mp_int_t num_dig = mp_obj_get_int(args[1]);
         if (num_dig >= 0) {
             return o_in;
         }
+        #if !MICROPY_PY_BUILTINS_ROUND_INT
+        mp_raise_NotImplementedError(NULL);
+        #else
 
         mp_obj_t mult = mp_binary_op(MP_BINARY_OP_POWER, MP_OBJ_NEW_SMALL_INT(10), MP_OBJ_NEW_SMALL_INT(-num_dig));
         mp_obj_t half_mult =  mp_binary_op(MP_BINARY_OP_FLOOR_DIVIDE, mult, MP_OBJ_NEW_SMALL_INT(2));

From 0199d9810ba78c29734abc3a94d005279d9d9ccb Mon Sep 17 00:00:00 2001
From: Dan Halbert <halbert@halwitz.org>
Date: Tue, 21 May 2019 15:18:56 -0400
Subject: [PATCH 6/7] Make pinyin fit on cpx

---
 .../boards/circuitplayground_express/mpconfigboard.mk           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
index 652d2013794c..bc33be315d56 100644
--- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
@@ -27,7 +27,7 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
 
 # Tweak inlining depending on language.
 ifeq ($(TRANSLATION), zh_Latn_pinyin)
-CFLAGS_INLINE_LIMIT = 35
+CFLAGS_INLINE_LIMIT = 25
 else
 CFLAGS_INLINE_LIMIT = 55
 endif

From 9ae3d9217917bae9050bf9153224e62e3de6e410 Mon Sep 17 00:00:00 2001
From: Radomir Dopieralski <openstack@sheep.art.pl>
Date: Mon, 20 May 2019 22:04:23 +0200
Subject: [PATCH 7/7] Bump circuitpython-stage to 1.0.2

This fixes an OverflowError in the read_palette function.

(cherry picked from commit 4ebcca865cbda4b08dc917581438473f625e2a12)
---
 frozen/circuitpython-stage | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage
index 733cdf591639..397badae5863 160000
--- a/frozen/circuitpython-stage
+++ b/frozen/circuitpython-stage
@@ -1 +1 @@
-Subproject commit 733cdf591639f9dbb5d9187a21411f759e1ba82f
+Subproject commit 397badae5863a1ce932213ef527e82314ac498a1