Skip to content

Commit

Permalink
Merge pull request #31 from CazYokoyama/no-data-on-json
Browse files Browse the repository at this point in the history
Fix the bug where no data is read on json format.
  • Loading branch information
ToninoTarsi authored Dec 10, 2020
2 parents 6cbe004 + 369666e commit c78cf2b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions TX23/readTX23.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ printWindSpeedAndDirection(void)
// Set up the TX23 Pins
RPi_TX23_InitPins();

//Read from the TX23
if (RPi_TX23_GetReading(&WindDirection, &WindSpeed) != TRUE)
return false;
if (json_format) {
RPi_TX23_GetDateTimeUTC(thetime);
p = strchr(thetime, 'T');
Expand All @@ -56,14 +59,10 @@ printWindSpeedAndDirection(void)
mph,
(double)WindDirection*22.5);
} else {
//Read from the TX23
if (RPi_TX23_GetReading(&WindDirection, &WindSpeed) == TRUE) {
RPi_TX23_GetDateTimeLocal(thetime);
printf("(%d , %d )", WindDirection, WindSpeed);
// printf("%s,Wind Direction,%0.1f\n",thetime,((double)WindDirection)*22.5);
// printf("%s,Wind Speed,%d\n",thetime,WindSpeed);
} else
return false;
RPi_TX23_GetDateTimeLocal(thetime);
printf("(%d , %d )", WindDirection, WindSpeed);
// printf("%s,Wind Direction,%0.1f\n",thetime,((double)WindDirection)*22.5);
// printf("%s,Wind Speed,%d\n",thetime,WindSpeed);
}

fflush(stdout);
Expand Down

0 comments on commit c78cf2b

Please sign in to comment.