backward-compatible: support super floppy disk (SFD) by default

- sfd may be used in existing board (with SdFormat), this allow to use
v2 without reformat board
- add backward-compatible define
This commit is contained in:
hathach 2022-10-12 15:22:39 +07:00
parent 21862d20d3
commit 0b713a014c
2 changed files with 18 additions and 3 deletions

View file

@ -64,9 +64,18 @@ class FatVolume : public FatPartition {
* \return true for success or false for failure.
*/
bool begin(FsBlockDevice* dev, bool setCwv = true,
uint8_t part = 1, uint32_t volStart = 0) {
if (!init(dev, part, volStart)) {
return false;
uint8_t part = 0, uint32_t volStart = 0) {
// Adafruit modification to support SFD in existing board for backward-compatible
// part is default to 0 (changed from 1)
if (part) {
if (!init(dev, part, volStart)) {
return false;
}
}else {
// try with both part = 1 (mbr) and part = 0 (sfd)
if ( !init(dev, 1, volStart) && !init(dev, 0, volStart) ) {
return false;
}
}
if (!chdir()) {
return false;

View file

@ -46,6 +46,12 @@
#define FAT12_SUPPORT 1
#endif
// Backward-compatible define
#define ENABLE_EXTENDED_TRANSFER_CLASS USE_BLOCK_DEVICE_INTERFACE
#define BaseBlockDriver FsBlockDeviceInterface
#define FatFileSystem FatVolume
#define SdFatEX SdFat
//
// To try UTF-8 encoded filenames.
// #define USE_UTF8_LONG_NAMES 1