Skip to content

Commit 2f6a7cd

Browse files
committed
update msc_external_flash to tell user where to format spiflash.
other minor clean up, separate sketch and log in issue template
1 parent 6d82f22 commit 2f6a7cd

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,20 @@ body:
5252

5353
- type: textarea
5454
attributes:
55-
label: Sketch & compiled Log (as attached txt files)
55+
label: Sketch as ATTACHED TXT
5656
placeholder: |
5757
e.g examples/MassStorage/msc_ramdisk.
5858
If it is custom sketch, please provide it as **ATTACHED** files or link to it.
59-
Compiled log must be attached as txt files for readability
59+
Pasting raw long code that hurts readibility can get your issue **closed**
60+
validations:
61+
required: true
62+
63+
- type: textarea
64+
attributes:
65+
label: Compiled Log as ATTACHED TXT
66+
placeholder: |
67+
Compiled log from Arduino IDE as **ATTACHED** txt.
68+
Pasting raw long log that hurts readibility can get your issue **closed**
6069
validations:
6170
required: true
6271

examples/MassStorage/msc_external_flash/msc_external_flash.ino

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ FatFile file;
4242
Adafruit_USBD_MSC usb_msc;
4343

4444
// Check if flash is formatted
45-
bool fs_formatted;
45+
bool fs_formatted = false;
4646

4747
// Set to true when PC write to flash
48-
bool fs_changed;
48+
bool fs_changed = true;;
4949

5050
// the setup function runs once when you press reset or power the board
5151
void setup()
@@ -74,32 +74,33 @@ void setup()
7474
Serial.begin(115200);
7575
//while ( !Serial ) delay(10); // wait for native usb
7676

77-
if ( !fs_formatted )
78-
{
79-
Serial.println("Failed to init files system, flash may not be formatted");
80-
}
81-
8277
Serial.println("Adafruit TinyUSB Mass Storage External Flash example");
8378
Serial.print("JEDEC ID: 0x"); Serial.println(flash.getJEDECID(), HEX);
8479
Serial.print("Flash size: "); Serial.print(flash.size() / 1024); Serial.println(" KB");
85-
86-
fs_changed = true; // to print contents initially
8780
}
8881

8982
void loop()
9083
{
91-
if ( fs_changed )
84+
// check if formatted
85+
if ( !fs_formatted )
9286
{
93-
fs_changed = false;
87+
fs_formatted = fatfs.begin(&flash);
9488

95-
// check if host formatted disk
9689
if (!fs_formatted)
9790
{
98-
fs_formatted = fatfs.begin(&flash);
91+
Serial.println("Failed to init files system, flash may not be formatted");
92+
Serial.println("Please format it as FAT12 with your PC or using Adafruit_SPIFlash's SdFat_format example:");
93+
Serial.println("- https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/SdFat_format");
94+
Serial.println();
95+
96+
delay(1000);
97+
return;
9998
}
99+
}
100100

101-
// skip if still not formatted
102-
if (!fs_formatted) return;
101+
if ( fs_changed )
102+
{
103+
fs_changed = false;
103104

104105
Serial.println("Opening root");
105106

examples/MassStorage/msc_external_flash_sdcard/msc_external_flash_sdcard.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* Note: Adafruit fork of SdFat enabled ENABLE_EXTENDED_TRANSFER_CLASS and FAT12_SUPPORT
1818
* in SdFatConfig.h, which is needed to run SdFat on external flash. You can use original
1919
* SdFat library and manually change those macros
20+
*
21+
* Note2: If your flash is not formatted as FAT12 previously, you could format it using
22+
* follow sketch https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/SdFat_format
2023
*/
2124

2225
#include "SPI.h"

src/arduino/cdc/Adafruit_USBH_CDC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void Adafruit_USBH_CDC::begin(unsigned long baud) {
4747

4848
void Adafruit_USBH_CDC::begin(unsigned long baudrate, uint16_t config) {
4949
(void)config; // TODO support line coding later
50-
begin(115200);
50+
begin(baudrate);
5151
}
5252

5353
void Adafruit_USBH_CDC::end(void) { _idx = TUSB_INDEX_INVALID; }

0 commit comments

Comments
 (0)