Skip to content

Commit 39383ba

Browse files
committed
Error naming cleanup & separate block overflow error
1 parent ca08b58 commit 39383ba

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

firmware/nRF51/tag-proximity/inc/openbeacon-proto.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
#define FLAG_MOVING (1 << 4)
4747
#define ERROR_FLASH_FULL (1 << 5)
4848
#define ERROR_FLASH_WRITE (1 << 6)
49-
#define ERROR_LOG_BUF_OVERRUN (1 << 7)
49+
#define ERROR_LOG_BUF_OVERFLOW (1 << 7)
5050
#define ERROR_LOG_COMPRESS (1 << 8)
51+
#define ERROR_LOG_BLK_OVERFLOW (1 << 9)
5152

5253

5354
typedef struct

firmware/nRF51/tag-proximity/src/log.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static uint16_t seq = 1;
5555
static uint16_t flash_error_count = 0;
5656
static uint8_t log_running = 0;
5757
static uint16_t log_wrap_count = 0;
58-
static uint16_t log_buffer_overrun_count = 0;
58+
static uint16_t log_buffer_overflow_count = 0;
5959
static uint16_t log_compression_error = 0;
6060

6161
#if FLASH_LOG_COMPRESSION
@@ -71,8 +71,8 @@ uint16_t flash_log(uint16_t len, uint8_t *data)
7171
/* check for buffer overflow */
7272
if ( BUF_SIZE - BUF_LEN(buf_head,my_tail) <= len )
7373
{
74-
log_buffer_overrun_count++;
75-
status_flags |= ERROR_LOG_BUF_OVERRUN;
74+
log_buffer_overflow_count++;
75+
status_flags |= ERROR_LOG_BUF_OVERFLOW;
7676
return 0;
7777
}
7878

@@ -272,8 +272,10 @@ static int flash_log_write(uint8_t flush_buf)
272272
LogBlock.env.len += poll_sz;
273273

274274
/* handle block buffer overflow */
275-
if (LogBlock.env.len >= LOG_BLOCK_DATA_SIZE)
275+
if (LogBlock.env.len >= LOG_BLOCK_DATA_SIZE) {
276+
status_flags |= ERROR_LOG_BLK_OVERFLOW;
276277
goto cleanup;
278+
}
277279
} while (pres == HSER_POLL_MORE);
278280
}
279281

@@ -378,14 +380,14 @@ void flash_log_flush(void)
378380
void flash_log_status(void)
379381
{
380382
debug_printf(
381-
"\n\rflash log status:\n\rrunning %i, wrapped %i, block: %i, block len: %i, head: %i, tail: %i, errors: %i, overruns: %i, compression: %i\n\r",
383+
"\n\rflash log status:\n\rrunning %i, wrapped %i, block: %i, block len: %i, head: %i, tail: %i, errors: %i, overflows: %i, compression: %i\n\r",
382384
log_running,
383385
log_wrap_count,
384386
current_block,
385387
LogBlock.env.len,
386388
buf_head - buffer, buf_tail - buffer,
387389
flash_error_count,
388-
log_buffer_overrun_count,
390+
log_buffer_overflow_count,
389391
log_compression_error
390392
);
391393
}

0 commit comments

Comments
 (0)