@@ -53,17 +53,6 @@ void do_str(const char *src, mp_parse_input_kind_t input_kind) {
53
53
}
54
54
}
55
55
56
- // TODO(tannewt): Remove these default files in favor a very simple README with
57
- // a url to all of the files that ship on boards.
58
-
59
- static const char fresh_code_txt [] =
60
- "# code.txt -- put your code here!\r\n"
61
- ;
62
-
63
- static const char fresh_readme_txt [] =
64
- "https://learn.adafruit.com/category/micropython\r\n"
65
- ;
66
-
67
56
extern void flash_init_vfs (fs_user_mount_t * vfs );
68
57
69
58
// we don't make this function static because it needs a lot of stack and we
@@ -91,38 +80,18 @@ void init_flash_fs(void) {
91
80
vfs -> flags &= ~FSUSER_USB_WRITEABLE ;
92
81
93
82
res = f_mkfs ("/flash" , 0 , 0 );
94
- if (res == FR_OK ) {
95
- // success creating fresh LFS
96
- } else {
97
- printf ("PYB: can't create flash filesystem\n" );
83
+ if (res != FR_OK ) {
98
84
MP_STATE_PORT (fs_user_mount )[0 ] = NULL ;
99
85
return ;
100
86
}
101
87
102
88
// set label
103
89
f_setlabel ("MICROPYTHON" );
104
90
105
- // create empty code.txt
106
- FIL fp ;
107
- f_open (& fp , "/flash/code.txt" , FA_WRITE | FA_CREATE_ALWAYS );
108
- UINT n ;
109
- f_write (& fp , fresh_code_txt , sizeof (fresh_code_txt ) - 1 /* don't count null terminator */ , & n );
110
- f_close (& fp );
111
-
112
- // TODO(tannewt): Create an .inf driver file for Windows.
113
-
114
- // create readme file
115
- f_open (& fp , "/flash/README.txt" , FA_WRITE | FA_CREATE_ALWAYS );
116
- f_write (& fp , fresh_readme_txt , sizeof (fresh_readme_txt ) - 1 /* don't count null terminator */ , & n );
117
- f_close (& fp );
118
-
119
91
if (usb_writeable ) {
120
92
vfs -> flags |= FSUSER_USB_WRITEABLE ;
121
93
}
122
- } else if (res == FR_OK ) {
123
- // mount successful
124
- } else {
125
- printf ("PYB: can't mount flash\n" );
94
+ } else if (res != FR_OK ) {
126
95
MP_STATE_PORT (fs_user_mount )[0 ] = NULL ;
127
96
return ;
128
97
}
@@ -242,8 +211,9 @@ bool start_mp(void) {
242
211
#endif
243
212
244
213
// Wait for connection or character.
245
- new_status_color (ALL_DONE );
246
214
bool cdc_enabled_before = false;
215
+ #if defined(MICROPY_HW_NEOPIXEL ) || (defined(MICROPY_HW_APA102_MOSI ) && defined(MICROPY_HW_APA102_SCK ))
216
+ new_status_color (ALL_DONE );
247
217
uint32_t pattern_start = ticks_ms ;
248
218
249
219
uint32_t total_exception_cycle = 0 ;
@@ -267,6 +237,7 @@ bool start_mp(void) {
267
237
if (result .return_code == PYEXEC_EXCEPTION ) {
268
238
total_exception_cycle = EXCEPTION_TYPE_LENGTH_MS * 3 + LINE_NUMBER_TOGGLE_LENGTH * digit_sum + LINE_NUMBER_TOGGLE_LENGTH * num_places ;
269
239
}
240
+ #endif
270
241
while (true) {
271
242
#ifdef MICROPY_VM_HOOK_LOOP
272
243
MICROPY_VM_HOOK_LOOP
@@ -292,6 +263,7 @@ bool start_mp(void) {
292
263
}
293
264
cdc_enabled_before = mp_cdc_enabled ;
294
265
266
+ #if defined(MICROPY_HW_NEOPIXEL ) || (defined(MICROPY_HW_APA102_MOSI ) && defined(MICROPY_HW_APA102_SCK ))
295
267
uint32_t tick_diff = ticks_ms - pattern_start ;
296
268
if (result .return_code != PYEXEC_EXCEPTION ) {
297
269
// All is good. Ramp ALL_DONE up and down.
@@ -366,6 +338,9 @@ bool start_mp(void) {
366
338
new_status_color (BLACK );
367
339
}
368
340
}
341
+ #else
342
+ (void ) found_main ; // Pretend to use found_main so the compiler doesn't complain.
343
+ #endif
369
344
}
370
345
}
371
346
0 commit comments