extmod: Fix getting sector size when the max and min sizes are the

same.

Also switch the max size back to 512 for atmel-samd to save ram.
This commit is contained in:
Scott Shawcroft 2016-10-21 15:23:26 -07:00
parent 9eb86e8015
commit b8ef783052
2 changed files with 8 additions and 2 deletions

View File

@ -70,7 +70,9 @@
#define MICROPY_FATFS_VOLUMES (4)
#define MICROPY_FATFS_MULTI_PARTITION (1)
#define MICROPY_FSUSERMOUNT (1)
#define MICROPY_FATFS_MAX_SS (4096)
// Only enable this if you really need it. It allocates a byte cache of this
// size.
// #define MICROPY_FATFS_MAX_SS (4096)
#define FLASH_BLOCK_SIZE (512)

View File

@ -278,7 +278,11 @@ STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * fatfs->ssize); // f_bsize
#if _MIN_SS != _MAX_SS
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * fatfs->ssize); // f_bsize
#else
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * _MIN_SS); // f_bsize
#endif
t->items[1] = t->items[0]; // f_frsize
t->items[2] = MP_OBJ_NEW_SMALL_INT((fatfs->n_fatent - 2) * fatfs->csize); // f_blocks
t->items[3] = MP_OBJ_NEW_SMALL_INT(nclst); // f_bfree