v0.14. Rearrange DEBUG functionality, disable by default.

v0.14. Add ‘DEBUG_MENU’ which can be uncommented to enable the basic
debug menu with the ability to run a capture / dump the data etc.
DEBUG and DEBUG_MENU are commented out by default to save RAM.
This commit is contained in:
Andrew Gillham
2015-12-16 11:15:10 -08:00
parent 9a065516e2
commit 5fb67c666d
2 changed files with 26 additions and 6 deletions

13
README
View File

@@ -36,6 +36,17 @@ below 1MHz. 1MHz works for a basic busy wait trigger that doesn't store
until after the trigger fires. until after the trigger fires.
Please try it out and report back. Please try it out and report back.
Debugging
=========
You can uncomment the '#define DEBUG_MENU' line to add some diagnostic menu
options for capturing or dumping the capture buffer.
You can uncomment the '#define DEBUG' and '#define DEBUG_MENU' for a couple
extra menu options and logging of the received commands. The DEBUG option
is generally only useful for development, while the DEBUG_MENU option is
good for troubleshooting when the logic_analyzer sketch isn't working for you.
Both are disabled by default to conserve RAM for improved stability.
Older Notes Older Notes
=========================================================================== ===========================================================================
NOTE: With v0.11 you can now sample at 4MHz & 2MHz rates in addition to the NOTE: With v0.11 you can now sample at 4MHz & 2MHz rates in addition to the
@@ -69,5 +80,5 @@ NOTE: This master branch now supports Arduino 1.0 only.
Checkout branch logic_analyzer_v0_5 for Arduino 22 support. Checkout branch logic_analyzer_v0_5 for Arduino 22 support.
Release: v0.13 February 7, 2015. Release: v0.14 December 16, 2015.

View File

@@ -62,7 +62,7 @@
* until after the trigger fires. * until after the trigger fires.
* Please try it out and report back. * Please try it out and report back.
* *
* Release: v0.13 February 7, 2015. * Release: v0.14 December 16, 2015.
* *
*/ */
@@ -172,7 +172,10 @@ void prettydump(void);
#define DEBUG_ON PORTD = B10000000 #define DEBUG_ON PORTD = B10000000
#define DEBUG_OFF PORTD = B00000000 #define DEBUG_OFF PORTD = B00000000
#endif /* USE_PORTD */ #endif /* USE_PORTD */
#define DEBUG
//#define DEBUG_MENU
//#define DEBUG
#ifdef DEBUG #ifdef DEBUG
#define MAX_CAPTURE_SIZE DEBUG_CAPTURE_SIZE #define MAX_CAPTURE_SIZE DEBUG_CAPTURE_SIZE
#else #else
@@ -391,20 +394,23 @@ void loop()
case SUMP_SELF_TEST: case SUMP_SELF_TEST:
/* ignored. */ /* ignored. */
break; break;
#ifdef DEBUG #ifdef DEBUG_MENU
/* /*
* a couple of debug commands used during development. * a couple of debug commands used during development.
*/ */
case '?': case '?':
Serial.println(""); Serial.println("");
#ifdef DEBUG
Serial.println("0 = clear cmd buffer"); Serial.println("0 = clear cmd buffer");
Serial.println("1 = print cmd buffer"); Serial.println("1 = print cmd buffer");
#endif /* DEBUG */
Serial.println("2 = print data buffer"); Serial.println("2 = print data buffer");
Serial.println("3 = pretty print buffer"); Serial.println("3 = pretty print buffer");
Serial.println("4 = capture at 4MHz"); Serial.println("4 = capture at 4MHz");
Serial.println("5 = capture at 1MHz"); Serial.println("5 = capture at 1MHz");
Serial.println("6 = capture at 500KHz"); Serial.println("6 = capture at 500KHz");
break; break;
#ifdef DEBUG
case '0': case '0':
/* /*
* This resets the debug buffer pointer, effectively clearing the * This resets the debug buffer pointer, effectively clearing the
@@ -425,6 +431,7 @@ void loop()
blinkled(); blinkled();
debugprint(); debugprint();
break; break;
#endif /* DEBUG */
case '2': case '2':
/* /*
* This dumps the sample data to the serial port. * This dumps the sample data to the serial port.
@@ -465,7 +472,7 @@ void loop()
Serial.println(""); Serial.println("");
Serial.println("500KHz capture done."); Serial.println("500KHz capture done.");
break; break;
#endif /* DEBUG */ #endif /* DEBUG_MENU */
default: default:
/* ignore any unrecognized bytes. */ /* ignore any unrecognized bytes. */
break; break;
@@ -1028,6 +1035,8 @@ void debugprint() {
Serial.println("done..."); Serial.println("done...");
} }
#endif /* DEBUG */
#ifdef DEBUG_MENU
/* /*
* This is used by the '2' debug command to dump the contents * This is used by the '2' debug command to dump the contents
* of the sample buffer. * of the sample buffer.
@@ -1081,7 +1090,7 @@ void prettydump() {
Serial.print("\r\n"); Serial.print("\r\n");
} }
} }
#endif /* DEBUG */ #endif /* DEBUG_MENU */