Skip to content

Commit 9bcc38e

Browse files
authored
Merge pull request adafruit#1519 from tannewt/speed_debug
Add fast seek support and turn on auto brightness by default
2 parents 3d07571 + b249243 commit 9bcc38e

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

extmod/vfs_fat_file.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,23 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
197197
m_del_obj(pyb_file_obj_t, o);
198198
mp_raise_OSError(fresult_to_errno_table[res]);
199199
}
200+
// If we're reading, turn on fast seek.
201+
if (mode == FA_READ) {
202+
// one call to determine how much space we need.
203+
DWORD temp_table[2];
204+
temp_table[0] = 2;
205+
o->fp.cltbl = temp_table;
206+
f_lseek(&o->fp, CREATE_LINKMAP);
207+
DWORD size = (temp_table[0] + 1) * 2;
208+
o->fp.cltbl = m_malloc_maybe(size * sizeof(DWORD), false);
209+
if (o->fp.cltbl != NULL) {
210+
o->fp.cltbl[0] = size;
211+
res = f_lseek(&o->fp, CREATE_LINKMAP);
212+
if (res != FR_OK) {
213+
o->fp.cltbl = NULL;
214+
}
215+
}
216+
}
200217

201218
// for 'a' mode, we must begin at the end of the file
202219
if ((mode & FA_OPEN_ALWAYS) != 0) {

lib/oofatfs/ffconf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
7575

7676

77-
#define _USE_FASTSEEK 0
77+
#define _USE_FASTSEEK 1
7878
/* This option switches fast seek function. (0:Disable or 1:Enable) */
7979

8080

ports/atmel-samd/boards/hallowing_m0_express/board.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void board_init(void) {
9494
display_init_sequence,
9595
sizeof(display_init_sequence),
9696
&pin_PA00);
97+
common_hal_displayio_display_set_auto_brightness(display, true);
9798
}
9899

99100
bool board_requests_safe_mode(void) {

ports/atmel-samd/boards/pyportal/board.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ void board_init(void) {
9191
display_init_sequence,
9292
sizeof(display_init_sequence),
9393
&pin_PB31);
94+
common_hal_displayio_display_set_auto_brightness(display, true);
9495
}
9596

9697
bool board_requests_safe_mode(void) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy