Skip to content

Commit 1049be7

Browse files
authored
Merge branch 'master' into docs/troubleshooting_python_not_found
2 parents 49f525c + 2fb2ef5 commit 1049be7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: cores/esp32/FirmwareMSC.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static size_t msc_update_get_required_disk_sectors(){
113113
log_d("USING FAT12");
114114
mcs_is_fat16 = false;
115115
}
116+
log_d("FAT sector size: %u", DISK_SECTOR_SIZE);
116117
log_d("FAT data sectors: %u", data_sectors);
117118
log_d("FAT table sectors: %u", msc_table_sectors);
118119
log_d("FAT total sectors: %u (%uKB)", total_sectors, (total_sectors * DISK_SECTOR_SIZE) / 1024);

Diff for: cores/esp32/firmware_msc_fat.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static const char * FAT12_FILE_SYSTEM_TYPE = "FAT12";
3939

4040
static uint16_t fat12_sectors_per_alloc_table(uint32_t sector_num){
4141
uint32_t required_bytes = (((sector_num * 3)+1)/2);
42-
return (required_bytes / DISK_SECTOR_SIZE) + ((required_bytes & DISK_SECTOR_SIZE)?1:0);
42+
return (required_bytes / DISK_SECTOR_SIZE) + ((required_bytes & (DISK_SECTOR_SIZE - 1))?1:0);
4343
}
4444

4545
static uint8_t * fat12_add_table(uint8_t * dst, fat_boot_sector_t * boot){
@@ -68,7 +68,7 @@ static const char * FAT16_FILE_SYSTEM_TYPE = "FAT16";
6868

6969
static uint16_t fat16_sectors_per_alloc_table(uint32_t sector_num){
7070
uint32_t required_bytes = sector_num * 2;
71-
return (required_bytes / DISK_SECTOR_SIZE) + ((required_bytes & DISK_SECTOR_SIZE)?1:0);
71+
return (required_bytes / DISK_SECTOR_SIZE) + ((required_bytes & (DISK_SECTOR_SIZE - 1))?1:0);
7272
}
7373

7474
static uint8_t * fat16_add_table(uint8_t * dst, fat_boot_sector_t * boot){
@@ -129,7 +129,7 @@ fat_boot_sector_t * fat_add_boot_sector(uint8_t * dst, uint16_t sector_num, uint
129129
boot->num_heads = 1;
130130
boot->hidden_sectors_count = 0;
131131
boot->total_sectors_32 = 0;
132-
boot->physical_drive_number = 0x00;
132+
boot->physical_drive_number = 0x80;
133133
boot->reserved0 = 0x00;
134134
boot->extended_boot_signature = 0x29;
135135
boot->serial_number = serial_number;

0 commit comments

Comments
 (0)