Branch: master

6630bb1a 2019-04-12 05:17:35 Timothy Pearson
Allow GPIB server to read full storage of TDS744A scopes
M servers/gpib_server_lin/src/scope_functions.cpp

servers/gpib_server_lin/src/scope_functions.cpp

diff --git a/servers/gpib_server_lin/src/scope_functions.cpp b/servers/gpib_server_lin/src/scope_functions.cpp
index 6b6f61a..a60ce3f 100644
--- a/servers/gpib_server_lin/src/scope_functions.cpp
+++ b/servers/gpib_server_lin/src/scope_functions.cpp
@@ -36,10 +36,12 @@
 
 #include <tqimage.h>
 
+#define SCOPE_TRACE_MAX_POINTS 131072
+
 extern char falpha[1024];
 unsigned char scope_raw_screenshot_data[4194304];
-double scope_raw_trace_data[65535];
-double scope_raw_position_data[65535];
+double scope_raw_trace_data[SCOPE_TRACE_MAX_POINTS];
+double scope_raw_position_data[SCOPE_TRACE_MAX_POINTS];
 
 char scope_segarray[4194304];
 
@@ -788,7 +790,7 @@
 				printf("[DEBG] Writing: %s\n\r", falpha);
 				#endif
 				if (gpib_write(gpibDevice, falpha) == 0) {
-					sprintf(falpha,"DATA:STOP 65535");
+					sprintf(falpha,"DATA:STOP %d", SCOPE_TRACE_MAX_POINTS-1);
 					#ifdef ENABLE_EXTRA_DEBUGGING
 					printf("[DEBG] Writing: %s\n\r", falpha);
 					#endif
@@ -841,7 +843,7 @@
 		if (gpib_write(gpibDevice, falpha) != 0) {
 			return -1;
 		}
-		sprintf(falpha,"DATA:STOP 65535");
+		sprintf(falpha,"DATA:STOP %d", SCOPE_TRACE_MAX_POINTS-1);
 		#ifdef ENABLE_EXTRA_DEBUGGING
 		printf("[DEBG] Writing: %s\n\r", falpha);
 		#endif
@@ -915,9 +917,9 @@
 printf("[PROFILE] %f s\n\r", ((tp5.tv_nsec+(tp5.tv_sec*1e9))-(tp4.tv_nsec+(tp4.tv_sec*1e9)))/1e9);
 #endif
 						#ifdef ENABLE_EXTRA_DEBUGGING
-						printf("[DEBG] Trying to read %i bytes from GPIB device...\n", 65535*2);
+						printf("[DEBG] Trying to read %i bytes from GPIB device...\n", (SCOPE_TRACE_MAX_POINTS-1)*2);
 						#endif
-						ai = gpib_read_array(gpibDevice, 65535*2, scope_segarray);
+						ai = gpib_read_array(gpibDevice, (SCOPE_TRACE_MAX_POINTS-1)*2, scope_segarray);
 						if (ai == -1) {
 							return -1;
 						}
@@ -1083,7 +1085,7 @@
 			return 2;
 		}
 
-		sprintf(falpha,"DATA:STOP 65535");
+		sprintf(falpha,"DATA:STOP %d", SCOPE_TRACE_MAX_POINTS-1);
 		#ifdef ENABLE_EXTRA_DEBUGGING
 		printf("[DEBG] Writing: %s\n\r", falpha);
 		#endif
@@ -1177,7 +1179,7 @@
 			return 2;
 		}
 
-		sprintf(falpha,"DATA:STOP 65535");
+		sprintf(falpha,"DATA:STOP %d", SCOPE_TRACE_MAX_POINTS-1);
 		#ifdef ENABLE_EXTRA_DEBUGGING
 		printf("[DEBG] Writing: %s\n\r", falpha);
 		#endif