Print all digits of frequency.
This commit is contained in:
parent
dbbcbdaaa0
commit
37592a6554
56
md380.c
56
md380.c
@ -472,10 +472,16 @@ static void print_freq(FILE *out, unsigned data)
|
|||||||
(data >> 20) & 15, (data >> 16) & 15,
|
(data >> 20) & 15, (data >> 16) & 15,
|
||||||
(data >> 12) & 15, (data >> 8) & 15);
|
(data >> 12) & 15, (data >> 8) & 15);
|
||||||
|
|
||||||
if ((data & 0xff) == 0)
|
if ((data & 0xff) == 0) {
|
||||||
putc(' ', out);
|
fputs(" ", out);
|
||||||
else
|
} else {
|
||||||
fprintf(out, "%d", (data >> 4) & 15);
|
fprintf(out, "%d", (data >> 4) & 15);
|
||||||
|
if ((data & 0x0f) == 0) {
|
||||||
|
fputs(" ", out);
|
||||||
|
} else {
|
||||||
|
fprintf(out, "%d", data & 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -546,6 +552,25 @@ static int freq_to_hz(uint32_t bcd)
|
|||||||
return (((((((a*10 + b) * 10 + c) * 10 + d) * 10 + e) * 10 + f) * 10 + g) * 10 + h) * 10;
|
return (((((((a*10 + b) * 10 + c) * 10 + d) * 10 + e) * 10 + f) * 10 + g) * 10 + h) * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print frequency as MHz.
|
||||||
|
//
|
||||||
|
static void print_mhz(FILE *out, uint32_t hz)
|
||||||
|
{
|
||||||
|
if (hz % 1000000 == 0)
|
||||||
|
fprintf(out, "%-8u", hz / 1000000);
|
||||||
|
else if (hz % 100000 == 0)
|
||||||
|
fprintf(out, "%-8.1f", hz / 1000000.0);
|
||||||
|
else if (hz % 10000 == 0)
|
||||||
|
fprintf(out, "%-8.2f", hz / 1000000.0);
|
||||||
|
else if (hz % 1000 == 0)
|
||||||
|
fprintf(out, "%-8.3f", hz / 1000000.0);
|
||||||
|
else if (hz % 100 == 0)
|
||||||
|
fprintf(out, "%-8.4f", hz / 1000000.0);
|
||||||
|
else
|
||||||
|
fprintf(out, "%-8.5f", hz / 1000000.0);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Print the transmit offset or frequency.
|
// Print the transmit offset or frequency.
|
||||||
//
|
//
|
||||||
@ -556,21 +581,16 @@ static void print_offset(FILE *out, uint32_t rx_bcd, uint32_t tx_bcd)
|
|||||||
int delta = tx_hz - rx_hz;
|
int delta = tx_hz - rx_hz;
|
||||||
|
|
||||||
if (delta == 0) {
|
if (delta == 0) {
|
||||||
fprintf(out, "+0 ");
|
fprintf(out, "+0 ");
|
||||||
} else if (delta > 0 && delta/50000 <= 255) {
|
} else if (delta > 0 && delta/50000 <= 255) {
|
||||||
if (delta % 1000000 == 0)
|
fprintf(out, "+");
|
||||||
fprintf(out, "+%-7u", delta / 1000000);
|
print_mhz(out, delta);
|
||||||
else
|
|
||||||
fprintf(out, "+%-7.3f", delta / 1000000.0);
|
|
||||||
} else if (delta < 0 && -delta/50000 <= 255) {
|
} else if (delta < 0 && -delta/50000 <= 255) {
|
||||||
delta = - delta;
|
fprintf(out, "-");
|
||||||
if (delta % 1000000 == 0)
|
print_mhz(out, -delta);
|
||||||
fprintf(out, "-%-7u", delta / 1000000);
|
|
||||||
else
|
|
||||||
fprintf(out, "-%-7.3f", delta / 1000000.0);
|
|
||||||
} else {
|
} else {
|
||||||
// Cross band mode.
|
fprintf(out, " ");
|
||||||
fprintf(out, " %-7.4f", tx_hz / 1000000.0);
|
print_mhz(out, tx_hz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +716,7 @@ static void print_chan_base(FILE *out, channel_t *ch, int cnum)
|
|||||||
fprintf(out, " ");
|
fprintf(out, " ");
|
||||||
print_offset(out, ch->rx_frequency, ch->tx_frequency);
|
print_offset(out, ch->rx_frequency, ch->tx_frequency);
|
||||||
|
|
||||||
fprintf(out, " %-4s ", POWER_NAME[ch->power]);
|
fprintf(out, "%-4s ", POWER_NAME[ch->power]);
|
||||||
|
|
||||||
if (ch->scan_list_index == 0)
|
if (ch->scan_list_index == 0)
|
||||||
fprintf(out, "- ");
|
fprintf(out, "- ");
|
||||||
@ -748,7 +768,7 @@ static void print_digital_channels(FILE *out, int verbose)
|
|||||||
fprintf(out, "# 6) Scan list: - or index\n");
|
fprintf(out, "# 6) Scan list: - or index\n");
|
||||||
fprintf(out, "#\n");
|
fprintf(out, "#\n");
|
||||||
}
|
}
|
||||||
fprintf(out, "Digital Name Receive Transmit Power Scan Squelch Admit Color Slot Group Cntct InCall");
|
fprintf(out, "Digital Name Receive Transmit Power Scan Squelch Admit Color Slot Group Cntct InCall");
|
||||||
#if 1
|
#if 1
|
||||||
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX TA EmSys Privacy PN PCC EAA DCC CU");
|
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX TA EmSys Privacy PN PCC EAA DCC CU");
|
||||||
#endif
|
#endif
|
||||||
@ -827,7 +847,7 @@ static void print_analog_channels(FILE *out, int verbose)
|
|||||||
fprintf(out, "# 7) Scan list: - or index\n");
|
fprintf(out, "# 7) Scan list: - or index\n");
|
||||||
fprintf(out, "#\n");
|
fprintf(out, "#\n");
|
||||||
}
|
}
|
||||||
fprintf(out, "Analog Name Receive Transmit Power Scan Squelch Admit RxTone TxTone Width");
|
fprintf(out, "Analog Name Receive Transmit Power Scan Squelch Admit RxTone TxTone Width");
|
||||||
#if 1
|
#if 1
|
||||||
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX TA RxSign TxSign ID");
|
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX TA RxSign TxSign ID");
|
||||||
#endif
|
#endif
|
||||||
|
56
uv380.c
56
uv380.c
@ -496,10 +496,16 @@ static void print_freq(FILE *out, unsigned data)
|
|||||||
(data >> 20) & 15, (data >> 16) & 15,
|
(data >> 20) & 15, (data >> 16) & 15,
|
||||||
(data >> 12) & 15, (data >> 8) & 15);
|
(data >> 12) & 15, (data >> 8) & 15);
|
||||||
|
|
||||||
if ((data & 0xff) == 0)
|
if ((data & 0xff) == 0) {
|
||||||
putc(' ', out);
|
fputs(" ", out);
|
||||||
else
|
} else {
|
||||||
fprintf(out, "%d", (data >> 4) & 15);
|
fprintf(out, "%d", (data >> 4) & 15);
|
||||||
|
if ((data & 0x0f) == 0) {
|
||||||
|
fputs(" ", out);
|
||||||
|
} else {
|
||||||
|
fprintf(out, "%d", data & 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -570,6 +576,25 @@ static int freq_to_hz(uint32_t bcd)
|
|||||||
return (((((((a*10 + b) * 10 + c) * 10 + d) * 10 + e) * 10 + f) * 10 + g) * 10 + h) * 10;
|
return (((((((a*10 + b) * 10 + c) * 10 + d) * 10 + e) * 10 + f) * 10 + g) * 10 + h) * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print frequency as MHz.
|
||||||
|
//
|
||||||
|
static void print_mhz(FILE *out, uint32_t hz)
|
||||||
|
{
|
||||||
|
if (hz % 1000000 == 0)
|
||||||
|
fprintf(out, "%-8u", hz / 1000000);
|
||||||
|
else if (hz % 100000 == 0)
|
||||||
|
fprintf(out, "%-8.1f", hz / 1000000.0);
|
||||||
|
else if (hz % 10000 == 0)
|
||||||
|
fprintf(out, "%-8.2f", hz / 1000000.0);
|
||||||
|
else if (hz % 1000 == 0)
|
||||||
|
fprintf(out, "%-8.3f", hz / 1000000.0);
|
||||||
|
else if (hz % 100 == 0)
|
||||||
|
fprintf(out, "%-8.4f", hz / 1000000.0);
|
||||||
|
else
|
||||||
|
fprintf(out, "%-8.5f", hz / 1000000.0);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Print the transmit offset or frequency.
|
// Print the transmit offset or frequency.
|
||||||
//
|
//
|
||||||
@ -580,21 +605,16 @@ static void print_offset(FILE *out, uint32_t rx_bcd, uint32_t tx_bcd)
|
|||||||
int delta = tx_hz - rx_hz;
|
int delta = tx_hz - rx_hz;
|
||||||
|
|
||||||
if (delta == 0) {
|
if (delta == 0) {
|
||||||
fprintf(out, "+0 ");
|
fprintf(out, "+0 ");
|
||||||
} else if (delta > 0 && delta/50000 <= 255) {
|
} else if (delta > 0 && delta/50000 <= 255) {
|
||||||
if (delta % 1000000 == 0)
|
fprintf(out, "+");
|
||||||
fprintf(out, "+%-7u", delta / 1000000);
|
print_mhz(out, delta);
|
||||||
else
|
|
||||||
fprintf(out, "+%-7.3f", delta / 1000000.0);
|
|
||||||
} else if (delta < 0 && -delta/50000 <= 255) {
|
} else if (delta < 0 && -delta/50000 <= 255) {
|
||||||
delta = - delta;
|
fprintf(out, "-");
|
||||||
if (delta % 1000000 == 0)
|
print_mhz(out, -delta);
|
||||||
fprintf(out, "-%-7u", delta / 1000000);
|
|
||||||
else
|
|
||||||
fprintf(out, "-%-7.3f", delta / 1000000.0);
|
|
||||||
} else {
|
} else {
|
||||||
// Cross band mode.
|
fprintf(out, " ");
|
||||||
fprintf(out, " %-7.4f", tx_hz / 1000000.0);
|
print_mhz(out, tx_hz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +740,7 @@ static void print_chan_base(FILE *out, channel_t *ch, int cnum)
|
|||||||
fprintf(out, " ");
|
fprintf(out, " ");
|
||||||
print_offset(out, ch->rx_frequency, ch->tx_frequency);
|
print_offset(out, ch->rx_frequency, ch->tx_frequency);
|
||||||
|
|
||||||
fprintf(out, " %-4s ", POWER_NAME[ch->power]);
|
fprintf(out, "%-4s ", POWER_NAME[ch->power]);
|
||||||
|
|
||||||
if (ch->scan_list_index == 0)
|
if (ch->scan_list_index == 0)
|
||||||
fprintf(out, "- ");
|
fprintf(out, "- ");
|
||||||
@ -771,7 +791,7 @@ static void print_digital_channels(FILE *out, int verbose)
|
|||||||
fprintf(out, "# 6) Scan list: - or index\n");
|
fprintf(out, "# 6) Scan list: - or index\n");
|
||||||
fprintf(out, "#\n");
|
fprintf(out, "#\n");
|
||||||
}
|
}
|
||||||
fprintf(out, "Digital Name Receive Transmit Power Scan Sq Admit Color Slot Group Cntct InCall");
|
fprintf(out, "Digital Name Receive Transmit Power Scan Sq Admit Color Slot Group Cntct InCall");
|
||||||
#if 1
|
#if 1
|
||||||
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX EmSys Privacy PN PCC EAA DCC DCDM");
|
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX EmSys Privacy PN PCC EAA DCC DCDM");
|
||||||
#endif
|
#endif
|
||||||
@ -854,7 +874,7 @@ static void print_analog_channels(FILE *out, int verbose)
|
|||||||
fprintf(out, "# 7) Scan list: - or index\n");
|
fprintf(out, "# 7) Scan list: - or index\n");
|
||||||
fprintf(out, "#\n");
|
fprintf(out, "#\n");
|
||||||
}
|
}
|
||||||
fprintf(out, "Analog Name Receive Transmit Power Scan Sq Admit RxTone TxTone Width");
|
fprintf(out, "Analog Name Receive Transmit Power Scan Sq Admit RxTone TxTone Width");
|
||||||
#if 1
|
#if 1
|
||||||
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX RxSign TxSign ID TOFreq");
|
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX RxSign TxSign ID TOFreq");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user