File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 4040#include "lib/fatfs/diskio.h" /* FatFs lower layer API */
4141#include "extmod/fsusermount.h"
4242
43+ #if _MAX_SS == _MIN_SS
44+ #define SECSIZE (fs ) (_MIN_SS)
45+ #else
46+ #define SECSIZE (fs ) ((fs)->ssize)
47+ #endif
48+
4349STATIC fs_user_mount_t * disk_get_device (uint id ) {
4450 if (id < MP_ARRAY_SIZE (MP_STATE_PORT (fs_user_mount ))) {
4551 return MP_STATE_PORT (fs_user_mount )[id ];
@@ -122,7 +128,7 @@ DRESULT disk_read (
122128 }
123129 } else {
124130 vfs -> readblocks [2 ] = MP_OBJ_NEW_SMALL_INT (sector );
125- vfs -> readblocks [3 ] = mp_obj_new_bytearray_by_ref (count * 512 , buff );
131+ vfs -> readblocks [3 ] = mp_obj_new_bytearray_by_ref (count * SECSIZE ( & vfs -> fatfs ) , buff );
126132 mp_call_method_n_kw (2 , 0 , vfs -> readblocks );
127133 // TODO handle error return
128134 }
@@ -159,7 +165,7 @@ DRESULT disk_write (
159165 }
160166 } else {
161167 vfs -> writeblocks [2 ] = MP_OBJ_NEW_SMALL_INT (sector );
162- vfs -> writeblocks [3 ] = mp_obj_new_bytearray_by_ref (count * 512 , (void * )buff );
168+ vfs -> writeblocks [3 ] = mp_obj_new_bytearray_by_ref (count * SECSIZE ( & vfs -> fatfs ) , (void * )buff );
163169 mp_call_method_n_kw (2 , 0 , vfs -> writeblocks );
164170 // TODO handle error return
165171 }
You can’t perform that action at this time.
0 commit comments