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
static char debugbuf[1024];
static uint32_t debugpos;
static uint32_t debugpos = 0;

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

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

pos += cpy;
length -= cpy;
}


Loading…
Cancel
Save