diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-07-30 07:24:48 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-07-30 07:24:48 -0500 |
| commit | d69f081c04f32c93054335470cdd4c063fd7cbcb (patch) | |
| tree | 53f00a8fd4efa3f2c59ec3085808a9fc2cafc7d4 /shared-module | |
| parent | 57464998c0c97010f6fc5ed1aea009ce6b010272 (diff) | |
| parent | 531c1e046cf46e626268995de4c34097addc9b60 (diff) | |
Merge remote-tracking branch 'origin/main' into blm_badge
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/storage/__init__.c | 3 | ||||
| -rw-r--r-- | shared-module/vectorio/Polygon.c | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c index aa3bcc686..5864307fd 100644 --- a/shared-module/storage/__init__.c +++ b/shared-module/storage/__init__.c @@ -30,6 +30,7 @@ #include "extmod/vfs.h" #include "py/mperrno.h" +#include "py/mphal.h" #include "py/obj.h" #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" @@ -159,6 +160,8 @@ void common_hal_storage_remount(const char *mount_path, bool readonly, bool disa } void common_hal_storage_erase_filesystem(void) { + usb_disconnect(); + mp_hal_delay_ms(1000); filesystem_init(false, true); // Force a re-format. common_hal_mcu_reset(); // We won't actually get here, since we're resetting. diff --git a/shared-module/vectorio/Polygon.c b/shared-module/vectorio/Polygon.c index c44c13fd7..e00a4696b 100644 --- a/shared-module/vectorio/Polygon.c +++ b/shared-module/vectorio/Polygon.c @@ -143,13 +143,13 @@ uint32_t common_hal_vectorio_polygon_get_pixel(void *obj, int16_t x, int16_t y) int y2 = self->points_list[i % self->len]; VECTORIO_POLYGON_DEBUG(" (%3d, %3d)}\n", x2, y2); if ( y1 <= y ) { - if ( y2 > y && line_side(x1, y1, x2, y2, x, y) > 0 ) { - // Wind up, point is to the right of the edge vector + if ( y2 > y && line_side(x1, y1, x2, y2, x, y) < 0 ) { + // Wind up, point is to the left of the edge vector ++winding_number; VECTORIO_POLYGON_DEBUG(" wind:%2d winding_number:%2d\n", 1, winding_number); } - } else if ( y2 <= y && line_side(x1, y1, x2, y2, x, y) < 0 ) { - // Wind down, point is to the left of the edge vector + } else if ( y2 <= y && line_side(x1, y1, x2, y2, x, y) > 0 ) { + // Wind down, point is to the right of the edge vector --winding_number; VECTORIO_POLYGON_DEBUG(" wind:%2d winding_number:%2d\n", -1, winding_number); } |
