@@ -193,7 +193,7 @@ static void flash_log_block_commit(void)
193
193
194
194
#if FLASH_LOG_COMPRESSION
195
195
196
- static void flash_log_write (uint8_t flush_buf )
196
+ static int flash_log_write (uint8_t flush_buf )
197
197
{
198
198
uint8_t * my_head = buf_head ;
199
199
uint16_t chunk_size ;
@@ -251,7 +251,7 @@ static void flash_log_write(uint8_t flush_buf)
251
251
status_flags |= ERROR_LOG_COMPRESS ;
252
252
heatshrink_encoder_reset (& hse );
253
253
buf_tail = my_head ;
254
- return ;
254
+ return 1 ;
255
255
}
256
256
257
257
/* if block buffer is almost full, or if we are flushing the ring buffer,
@@ -268,7 +268,7 @@ static void flash_log_write(uint8_t flush_buf)
268
268
status_flags |= ERROR_LOG_COMPRESS ;
269
269
heatshrink_encoder_reset (& hse );
270
270
buf_tail = my_head ;
271
- return ;
271
+ return 1 ;
272
272
}
273
273
274
274
/* if necessary, pull out remaining compressed data */
@@ -291,7 +291,7 @@ static void flash_log_write(uint8_t flush_buf)
291
291
status_flags |= ERROR_LOG_COMPRESS ;
292
292
heatshrink_encoder_reset (& hse );
293
293
buf_tail = my_head ;
294
- return ;
294
+ return 1 ;
295
295
}
296
296
} while (pres == HSER_POLL_MORE );
297
297
}
@@ -303,7 +303,7 @@ static void flash_log_write(uint8_t flush_buf)
303
303
status_flags |= ERROR_LOG_COMPRESS ;
304
304
heatshrink_encoder_reset (& hse );
305
305
buf_tail = my_head ;
306
- return ;
306
+ return 1 ;
307
307
}
308
308
309
309
/* reset encoder */
@@ -312,11 +312,13 @@ static void flash_log_write(uint8_t flush_buf)
312
312
/* commit block to flash */
313
313
flash_log_block_commit ();
314
314
}
315
+
316
+ return 0 ;
315
317
}
316
318
317
319
#else
318
320
319
- static void flash_log_write (uint8_t flush_buf )
321
+ static int flash_log_write (uint8_t flush_buf )
320
322
{
321
323
uint8_t * my_head = buf_head ;
322
324
uint16_t chunk_size ;
@@ -349,6 +351,8 @@ static void flash_log_write(uint8_t flush_buf)
349
351
commit block to flash memory */
350
352
if ( (LogBlock .env .len == LOG_BLOCK_DATA_SIZE ) || flush_buf )
351
353
flash_log_block_commit ();
354
+
355
+ return 0 ;
352
356
}
353
357
354
358
#endif /* FLASH_LOG_COMPRESSION */
@@ -369,7 +373,8 @@ void flash_log_flush(void)
369
373
370
374
/* flush ring buffer */
371
375
while (BUF_LEN (my_head ,buf_tail ) > 0 )
372
- flash_log_write (0 );
376
+ if (flash_log_write (0 ))
377
+ break ; /* on error */
373
378
374
379
/* flush block buffer */
375
380
flash_log_write (1 );
0 commit comments