@@ -87,7 +87,7 @@ void supervisor_start_bluetooth(void) {
8787 characteristic_list .items = characteristic_list_items ;
8888 mp_seq_clear (characteristic_list .items , 0 , characteristic_list .alloc , sizeof (* characteristic_list .items ));
8989
90- const uint32_t err_code = _common_hal_bleio_service_construct (& supervisor_ble_service , & supervisor_ble_service_uuid , false /* is secondary */ , & characteristic_list );
90+ _common_hal_bleio_service_construct (& supervisor_ble_service , & supervisor_ble_service_uuid , false /* is secondary */ , & characteristic_list );
9191
9292 // File length
9393 supervisor_ble_version_uuid .base .type = & bleio_uuid_type ;
@@ -186,7 +186,7 @@ void open_current_file(void) {
186186 path [length ] = '\0' ;
187187
188188 FATFS * fs = & ((fs_user_mount_t * ) MP_STATE_VM (vfs_mount_table )-> obj )-> fatfs ;
189- FRESULT result = f_open (fs , & active_file , (char * ) path , FA_READ | FA_WRITE );
189+ f_open (fs , & active_file , (char * ) path , FA_READ | FA_WRITE );
190190
191191 update_file_length ();
192192}
@@ -246,40 +246,39 @@ void supervisor_bluetooth_background(void) {
246246 //uint32_t data_shift_length = fileLength - offset - remove_length;
247247 int32_t data_shift = insert_length - remove_length ;
248248 uint32_t new_length = file_length + data_shift ;
249- FRESULT result ;
250249
251250 // TODO: Make these loops smarter to read and write on sector boundaries.
252251 if (data_shift < 0 ) {
253252 for (uint32_t shift_offset = offset + insert_length ; shift_offset < new_length ; shift_offset ++ ) {
254253 uint8_t data ;
255254 UINT actual ;
256255 f_lseek (& active_file , shift_offset - data_shift );
257- result = f_read (& active_file , & data , 1 , & actual );
256+ f_read (& active_file , & data , 1 , & actual );
258257 f_lseek (& active_file , shift_offset );
259- result = f_write (& active_file , & data , 1 , & actual );
258+ f_write (& active_file , & data , 1 , & actual );
260259 }
261260 f_truncate (& active_file );
262261 } else if (data_shift > 0 ) {
263- result = f_lseek (& active_file , file_length );
262+ f_lseek (& active_file , file_length );
264263 // Fill end with 0xff so we don't need to erase.
265264 uint8_t data = 0xff ;
266265 for (size_t i = 0 ; i < (size_t ) data_shift ; i ++ ) {
267266 UINT actual ;
268- result = f_write (& active_file , & data , 1 , & actual );
267+ f_write (& active_file , & data , 1 , & actual );
269268 }
270269 for (uint32_t shift_offset = new_length - 1 ; shift_offset >= offset + insert_length ; shift_offset -- ) {
271270 UINT actual ;
272271 f_lseek (& active_file , shift_offset - data_shift );
273- result = f_read (& active_file , & data , 1 , & actual );
272+ f_read (& active_file , & data , 1 , & actual );
274273 f_lseek (& active_file , shift_offset );
275- result = f_write (& active_file , & data , 1 , & actual );
274+ f_write (& active_file , & data , 1 , & actual );
276275 }
277276 }
278277
279278 f_lseek (& active_file , offset );
280279 uint8_t * data = (uint8_t * ) (current_command + 4 );
281280 UINT written ;
282- result = f_write (& active_file , data , insert_length , & written );
281+ f_write (& active_file , data , insert_length , & written );
283282 f_sync (& active_file );
284283 // Notify the new file length.
285284 update_file_length ();
0 commit comments