mirror of
https://github.com/gillham/logic_analyzer.git
synced 2026-05-01 15:10:43 +03:00
Fix off by one on the capture buffer due to earlier debugging. I finally realized I was checking if an unsigned int was less than zero. Thanks Szilárd for the correct indexes in the issue comments.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* SUMP Protocol Implementation for Arduino boards.
|
||||
*
|
||||
* Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021 Andrew Gillham
|
||||
* Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023 Andrew Gillham
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -45,7 +45,7 @@
|
||||
*/
|
||||
|
||||
void captureInline2mhz() {
|
||||
unsigned int i;
|
||||
signed int i;
|
||||
|
||||
/*
|
||||
* basic trigger, wait until all trigger conditions are met on port.
|
||||
@@ -14441,7 +14441,7 @@ void captureInline2mhz() {
|
||||
* dump the samples back to the SUMP client. nothing special
|
||||
* is done for any triggers, this is effectively the 0/100 buffer split.
|
||||
*/
|
||||
for (i = readCount ; i > 0; i--) {
|
||||
for (i = readCount-1 ; i >= 0; i--) {
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[i] >> 2);
|
||||
#else
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* SUMP Protocol Implementation for Arduino boards.
|
||||
*
|
||||
* Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021 Andrew Gillham
|
||||
* Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023 Andrew Gillham
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -45,7 +45,7 @@
|
||||
*/
|
||||
|
||||
void captureInline4mhz() {
|
||||
unsigned int i;
|
||||
signed int i;
|
||||
|
||||
/*
|
||||
* basic trigger, wait until all trigger conditions are met on port.
|
||||
@@ -14441,7 +14441,7 @@ void captureInline4mhz() {
|
||||
* dump the samples back to the SUMP client. nothing special
|
||||
* is done for any triggers, this is effectively the 0/100 buffer split.
|
||||
*/
|
||||
for (i = readCount ; i > 0; i--) {
|
||||
for (i = readCount-1 ; i >= 0; i--) {
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[i] >> 2);
|
||||
#else
|
||||
|
||||
@@ -177,8 +177,8 @@ void captureInline2mhz(void);
|
||||
#define DEBUG_OFF PORTD = B00000000
|
||||
#endif /* USE_PORTD */
|
||||
|
||||
//#define DEBUG_MENU
|
||||
//#define DEBUG
|
||||
#define DEBUG_MENU
|
||||
#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define MAX_CAPTURE_SIZE DEBUG_CAPTURE_SIZE
|
||||
@@ -533,7 +533,7 @@ void getCmd() {
|
||||
*/
|
||||
|
||||
void captureMicro() {
|
||||
unsigned int i;
|
||||
signed int i;
|
||||
|
||||
/*
|
||||
* basic trigger, wait until all trigger conditions are met on port.
|
||||
@@ -622,7 +622,7 @@ void captureMicro() {
|
||||
* dump the samples back to the SUMP client. nothing special
|
||||
* is done for any triggers, this is effectively the 0/100 buffer split.
|
||||
*/
|
||||
for (i = readCount ; i > 0; i--) {
|
||||
for (i = readCount-1 ; i >= 0; i--) {
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[i] >> 2);
|
||||
#else
|
||||
@@ -649,7 +649,7 @@ void captureMicro() {
|
||||
* this basic functionality.
|
||||
*/
|
||||
void captureMilli() {
|
||||
unsigned int i = 0;
|
||||
signed int i = 0;
|
||||
|
||||
if (rleEnabled) {
|
||||
/*
|
||||
@@ -697,7 +697,7 @@ void captureMilli() {
|
||||
delay(delayTime);
|
||||
}
|
||||
}
|
||||
for (i = readCount ; i > 0; i--) {
|
||||
for (i = readCount-1 ; i >= 0; i--) {
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[i] >> 2);
|
||||
#else
|
||||
@@ -715,7 +715,7 @@ void captureMilli() {
|
||||
*
|
||||
*/
|
||||
void triggerMicro() {
|
||||
unsigned int i = 0;
|
||||
signed int i = 0;
|
||||
|
||||
logicIndex = 0;
|
||||
triggerIndex = 0;
|
||||
@@ -890,7 +890,7 @@ void triggerMicro() {
|
||||
|
||||
for (i = 0 ; i < readCount; i++) {
|
||||
if (logicIndex < 0) {
|
||||
logicIndex = readCount;
|
||||
logicIndex = readCount - 1;
|
||||
}
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[logicIndex--] >> 2);
|
||||
|
||||
Reference in New Issue
Block a user