Skip to content

Commit ddf1384

Browse files
committed
Write min of 164 or swapSize to csv, expand size of swap in test-app to 164
1 parent 7011cef commit ddf1384

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

discon-client/client.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func init() {
4040
}
4141
recvSwapFile, err = os.Create(csvFileName + "_recv.csv")
4242
if err != nil {
43-
log.Fatal("discon-client: error creating sent swap file:", err)
43+
log.Fatal("discon-client: error creating recv swap file:", err)
4444
}
4545
}
4646

@@ -132,10 +132,11 @@ func DISCON(avrSwap *C.float, aviFail *C.int, accInFile, avcOutName, avcMsg *C.c
132132

133133
if debug {
134134
log.Println("discon-client: sent payload:\n", payload)
135-
for _, v := range payload.Swap[:163] {
135+
outSwapSize := min(swapSize, 163)
136+
for _, v := range payload.Swap[:outSwapSize-1] {
136137
fmt.Fprintf(sentSwapFile, "%g,", v)
137138
}
138-
fmt.Fprintf(sentSwapFile, "%g\n", payload.Swap[163])
139+
fmt.Fprintf(sentSwapFile, "%g\n", payload.Swap[outSwapSize-1])
139140
}
140141

141142
// Read response from server
@@ -152,10 +153,11 @@ func DISCON(avrSwap *C.float, aviFail *C.int, accInFile, avcOutName, avcMsg *C.c
152153

153154
if debug {
154155
log.Println("discon-client: received payload:\n", payload)
155-
for _, v := range payload.Swap[:163] {
156+
outSwapSize := min(swapSize, 163)
157+
for _, v := range payload.Swap[:outSwapSize-1] {
156158
fmt.Fprintf(recvSwapFile, "%g,", v)
157159
}
158-
fmt.Fprintf(recvSwapFile, "%g\n", payload.Swap[163])
160+
fmt.Fprintf(recvSwapFile, "%g\n", payload.Swap[outSwapSize-1])
159161
}
160162

161163
// Set fail flag

test-app/test-app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ typedef void (*DISCON_FUNC)(float *avrSWAP, int *aviFAIL, char *accINFILE, char
1111
#endif
1212

1313
// Length of the swap array
14-
#define SWAP_ARRAY_SIZE 130
14+
#define SWAP_ARRAY_SIZE 164
1515

1616
// Length of the character arrays
1717
#define CHAR_ARRAY_SIZE 32

0 commit comments

Comments
 (0)