Skip to content

Commit e721078

Browse files
committed
Minor fix to ignore 0x0a0d at end of data
- 0x0a0d is sent along with the last archive data packet, so have to ignore it when checking the length of the data packet - Minor modification of the verbose sending command message
1 parent 62ec779 commit e721078

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

main.c

+17-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include "dhandler.h"
4242
#include "byte.h"
4343

44-
#define VERSION "1.3.0"
44+
#define VERSION "1.3.1"
4545

4646
/* local Data */
4747
static char szttyDevice[255]; /* Serial device string */
@@ -720,7 +720,7 @@ int runCommand(char* command, int commandLength, int expectedLength, char* dataL
720720
}
721721

722722
if(bVerbose) {
723-
printf("Getting %s data set...\n", dataLabel);
723+
printf("Sending %s...\n", dataLabel);
724724
}
725725

726726
if (bDebug) {
@@ -775,15 +775,25 @@ int runCommand(char* command, int commandLength, int expectedLength, char* dataL
775775

776776
if(bVerbose) {
777777
printf("Got %d of %d characters...", nCnt, totalLength);
778+
}
779+
780+
// Check for 0x0a0d at end
781+
if (nCnt == totalLength + 2) {
782+
if (szSerBuffer[totalLength] == 0x0a
783+
&& szSerBuffer[totalLength + 1] == 0x0d) {
784+
printf("Good\n");
785+
}
786+
} else {
778787
if(nCnt != totalLength)
779788
printf("Bad\n");
780789
else
781790
printf("Good\n");
782-
}
783-
if(nCnt != totalLength) {
784-
fprintf(stderr, "vproweather: Didn't get all data. Try changing delay parameter.\n");
785-
return -1;
786-
exit(2);
791+
792+
if(nCnt != totalLength) {
793+
fprintf(stderr, "vproweather: Didn't get all data. Try changing delay parameter.\n");
794+
return -1;
795+
exit(2);
796+
}
787797
}
788798
if (expectingCrc) {
789799
if((nCnt = CheckCRC(expectedLength,

0 commit comments

Comments
 (0)