Browse Source

wrap debugpos when at end of buffer..

main
John-Mark Gurney 2 years ago
parent
commit
11f6b086db
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      misc.c

+ 4
- 1
misc.c View File

@@ -54,7 +54,7 @@ wait_for_vcp(void)


#if MEM_DEBUG_BUF #if MEM_DEBUG_BUF
static char debugbuf[1024]; static char debugbuf[1024];
static uint32_t debugpos;
static uint32_t debugpos = 0;


void void
debug_printf(const char *format, ...) debug_printf(const char *format, ...)
@@ -75,6 +75,9 @@ debug_printf(const char *format, ...)
memcpy(&debugbuf[debugpos], pos, cpy); memcpy(&debugbuf[debugpos], pos, cpy);


debugpos += cpy; debugpos += cpy;
if (debugpos >= sizeof debugbuf)
debugpos = 0;

pos += cpy; pos += cpy;
length -= cpy; length -= cpy;
} }


Loading…
Cancel
Save