Finish parsing d868uv channels.
This commit is contained in:
parent
5ce12ee6d6
commit
91287480df
9
d868uv.c
9
d868uv.c
@ -1456,20 +1456,17 @@ static void setup_channel(int i, int mode, char *name, double rx_mhz, double tx_
|
||||
memset(ch, 0, sizeof(channel_t));
|
||||
ascii_decode(ch->name, name, 16, 0);
|
||||
|
||||
//TODO
|
||||
#if 0
|
||||
ch->rx_frequency = freq_to_bcd(rx_mhz);
|
||||
ch->rx_frequency = mhz_to_ghefcdab(rx_mhz);
|
||||
if (tx_mhz > rx_mhz) {
|
||||
ch->repeater_mode = RM_TXPOS;
|
||||
ch->tx_offset = offset_to_bcd(tx_mhz - rx_mhz);
|
||||
ch->tx_offset = mhz_to_ghefcdab(tx_mhz - rx_mhz);
|
||||
} else if (tx_mhz < rx_mhz) {
|
||||
ch->repeater_mode = RM_TXNEG;
|
||||
ch->tx_offset = offset_to_bcd(rx_mhz - tx_mhz);
|
||||
ch->tx_offset = mhz_to_ghefcdab(rx_mhz - tx_mhz);
|
||||
} else {
|
||||
ch->repeater_mode = RM_SIMPLEX;
|
||||
ch->tx_offset = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
ch->channel_mode = mode;
|
||||
ch->power = power;
|
||||
|
4
gd77.c
4
gd77.c
@ -707,8 +707,8 @@ static void setup_channel(int i, int mode, char *name, double rx_mhz, double tx_
|
||||
ch->tot = tot;
|
||||
ch->scan_list_index = scanlist;
|
||||
ch->group_list_index = grouplist;
|
||||
ch->rx_frequency = mhz_to_bcd(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_bcd(tx_mhz);
|
||||
ch->rx_frequency = mhz_to_abcdefgh(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_abcdefgh(tx_mhz);
|
||||
ch->ctcss_dcs_receive = rxtone;
|
||||
ch->ctcss_dcs_transmit = txtone;
|
||||
|
||||
|
4
md380.c
4
md380.c
@ -592,8 +592,8 @@ static void setup_channel(int i, int mode, char *name, double rx_mhz, double tx_
|
||||
ch->tot = tot;
|
||||
ch->scan_list_index = scanlist;
|
||||
ch->group_list_index = grouplist;
|
||||
ch->rx_frequency = mhz_to_bcd(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_bcd(tx_mhz);
|
||||
ch->rx_frequency = mhz_to_abcdefgh(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_abcdefgh(tx_mhz);
|
||||
ch->ctcss_dcs_receive = rxtone;
|
||||
ch->ctcss_dcs_transmit = txtone;
|
||||
|
||||
|
4
rd5r.c
4
rd5r.c
@ -711,8 +711,8 @@ static void setup_channel(int i, int mode, char *name, double rx_mhz, double tx_
|
||||
ch->tot = tot;
|
||||
ch->scan_list_index = scanlist;
|
||||
ch->group_list_index = grouplist;
|
||||
ch->rx_frequency = mhz_to_bcd(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_bcd(tx_mhz);
|
||||
ch->rx_frequency = mhz_to_abcdefgh(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_abcdefgh(tx_mhz);
|
||||
ch->ctcss_dcs_receive = rxtone;
|
||||
ch->ctcss_dcs_transmit = txtone;
|
||||
|
||||
|
40
util.c
40
util.c
@ -483,19 +483,41 @@ void print_freq(FILE *out, unsigned data)
|
||||
//
|
||||
// Convert frequency in MHz from floating point to
|
||||
// a binary coded decimal format (8 digits).
|
||||
// Format: abcdefgh
|
||||
//
|
||||
unsigned mhz_to_bcd(double mhz)
|
||||
unsigned mhz_to_abcdefgh(double mhz)
|
||||
{
|
||||
unsigned hz = iround(mhz * 1000000.0);
|
||||
unsigned a = (hz / 100000000) % 10;
|
||||
unsigned b = (hz / 10000000) % 10;
|
||||
unsigned c = (hz / 1000000) % 10;
|
||||
unsigned d = (hz / 100000) % 10;
|
||||
unsigned e = (hz / 10000) % 10;
|
||||
unsigned f = (hz / 1000) % 10;
|
||||
unsigned g = (hz / 100) % 10;
|
||||
unsigned h = (hz / 10) % 10;
|
||||
|
||||
return ((hz / 100000000) % 10) << 28 |
|
||||
((hz / 10000000) % 10) << 24 |
|
||||
((hz / 1000000) % 10) << 20 |
|
||||
((hz / 100000) % 10) << 16 |
|
||||
((hz / 10000) % 10) << 12 |
|
||||
((hz / 1000) % 10) << 8 |
|
||||
((hz / 100) % 10) << 4 |
|
||||
((hz / 10) % 10);
|
||||
return a << 28 | b << 24 | c << 20 | d << 16 | e << 12 | f << 8 | g << 4 | h;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert frequency in MHz from floating point to
|
||||
// a binary coded decimal format (8 digits).
|
||||
// Format: ghefcdab
|
||||
//
|
||||
unsigned mhz_to_ghefcdab(double mhz)
|
||||
{
|
||||
unsigned hz = iround(mhz * 1000000.0);
|
||||
unsigned a = (hz / 100000000) % 10;
|
||||
unsigned b = (hz / 10000000) % 10;
|
||||
unsigned c = (hz / 1000000) % 10;
|
||||
unsigned d = (hz / 100000) % 10;
|
||||
unsigned e = (hz / 10000) % 10;
|
||||
unsigned f = (hz / 1000) % 10;
|
||||
unsigned g = (hz / 100) % 10;
|
||||
unsigned h = (hz / 10) % 10;
|
||||
|
||||
return g << 28 | h << 24 | e << 20 | f << 16 | c << 12 | d << 8 | a << 4 | b;
|
||||
}
|
||||
|
||||
//
|
||||
|
3
util.h
3
util.h
@ -87,7 +87,8 @@ int is_file(char *filename);
|
||||
// Convert frequency in MHz from floating point to
|
||||
// a binary coded decimal format (8 digits).
|
||||
//
|
||||
unsigned mhz_to_bcd(double mhz);
|
||||
unsigned mhz_to_abcdefgh(double mhz);
|
||||
unsigned mhz_to_ghefcdab(double mhz);
|
||||
|
||||
//
|
||||
// Get a binary value of the parameter: On/Off,
|
||||
|
4
uv380.c
4
uv380.c
@ -648,8 +648,8 @@ static void setup_channel(int i, int mode, char *name, double rx_mhz, double tx_
|
||||
ch->scan_list_index = scanlist;
|
||||
ch->group_list_index = grouplist;
|
||||
ch->squelch = squelch;
|
||||
ch->rx_frequency = mhz_to_bcd(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_bcd(tx_mhz);
|
||||
ch->rx_frequency = mhz_to_abcdefgh(rx_mhz);
|
||||
ch->tx_frequency = mhz_to_abcdefgh(tx_mhz);
|
||||
ch->ctcss_dcs_receive = rxtone;
|
||||
ch->ctcss_dcs_transmit = txtone;
|
||||
ch->power = power;
|
||||
|
Loading…
Reference in New Issue
Block a user