From 870014f45d88bd269b93e4e0545ff3fce1e76569 Mon Sep 17 00:00:00 2001 From: Zilog80 Date: Thu, 4 Jun 2020 23:56:23 +0200 Subject: [PATCH] rs41: battery voltage, one byte enough for Volt*10 --- demod/mod/rs41mod.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/demod/mod/rs41mod.c b/demod/mod/rs41mod.c index d176c58..ab66392 100644 --- a/demod/mod/rs41mod.c +++ b/demod/mod/rs41mod.c @@ -369,14 +369,14 @@ static int get_BattVolts(gpx_t *gpx, int ofs) { int i; unsigned byte; ui8_t batt_bytes[2]; - float batt_volts; + ui16_t batt_volts; // signed voltage? for (i = 0; i < 2; i++) { byte = gpx->frame[pos_BattVolts+ofs + i]; batt_bytes[i] = byte; } - - batt_volts = (float)(batt_bytes[0] + (batt_bytes[1] << 8)); + // 2 bytes? V > 25.5 ? + batt_volts = batt_bytes[0]; // + (batt_bytes[1] << 8); gpx->batt = batt_volts/10.0; return 0; @@ -895,10 +895,10 @@ static int get_Calconf(gpx_t *gpx, int out, int ofs) { byte = gpx->frame[pos_CalData+ofs+1+i]; fprintf(stdout, "%02x ", byte); } -/* + /* if (err == 0) fprintf(stdout, "[OK]"); else fprintf(stdout, "[NO]"); -*/ + */ fprintf(stdout, " "); } @@ -1160,7 +1160,7 @@ static int prn_sat3(gpx_t *gpx, int ofs) { pDOP = gpx->frame[pos_pDOP+ofs]/10.0; if (gpx->frame[pos_pDOP+ofs] == 0xFF) pDOP = -1.0; fprintf(stdout, "numSatsFix: %2d sAcc: %.1f pDOP: %.1f\n", numSV, sAcc, pDOP); -/* + /* fprintf(stdout, "CRC: "); fprintf(stdout, " %04X", pck_GPS1); if (check_CRC(gpx, pos_GPS1+ofs, pck_GPS1)==0) fprintf(stdout, "[OK]"); else fprintf(stdout, "[NO]"); @@ -1173,7 +1173,7 @@ static int prn_sat3(gpx_t *gpx, int ofs) { //fprintf(stdout, "[%+d]", check_CRC(gpx, pos_GPS3, pck_GPS3)); fprintf(stdout, "\n"); -*/ + */ return 0; }