Merge branch 'batcal'
This commit is contained in:
17
Makefile
17
Makefile
@@ -11,7 +11,8 @@ ENABLE_AIRCOPY := 0
|
||||
ENABLE_FMRADIO := 1
|
||||
ENABLE_NOAA := 0
|
||||
ENABLE_VOICE := 0
|
||||
ENABLE_ALARM := 1
|
||||
ENABLE_VOX := 1
|
||||
ENABLE_ALARM := 0
|
||||
ENABLE_TX1750 := 0
|
||||
ENABLE_BIG_FREQ := 1
|
||||
ENABLE_SMALL_BOLD := 1
|
||||
@@ -22,7 +23,6 @@ ENABLE_F_CAL_MENU := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
ENABLE_MAIN_KEY_HOLD := 1
|
||||
ENABLE_BOOT_BEEPS := 0
|
||||
ENABLE_COMPANDER := 1
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||
@@ -32,9 +32,9 @@ ENABLE_SQUELCH_LOWER := 0
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||
ENABLE_RSSI_BAR := 1
|
||||
ENABLE_AUDIO_BAR := 1
|
||||
ENABLE_SPECTRUM := 1
|
||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||
ENABLE_SPECTRUM := 1
|
||||
#ENABLE_BAND_SCOPE := 1
|
||||
|
||||
#############################################################
|
||||
@@ -209,6 +209,9 @@ endif
|
||||
ifeq ($(ENABLE_VOICE),1)
|
||||
CFLAGS += -DENABLE_VOICE
|
||||
endif
|
||||
ifeq ($(ENABLE_VOX),1)
|
||||
CFLAGS += -DENABLE_VOX
|
||||
endif
|
||||
ifeq ($(ENABLE_ALARM),1)
|
||||
CFLAGS += -DENABLE_ALARM
|
||||
endif
|
||||
@@ -236,9 +239,6 @@ endif
|
||||
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
||||
CFLAGS += -DENABLE_BOOT_BEEPS
|
||||
endif
|
||||
ifeq ($(ENABLE_COMPANDER),1)
|
||||
CFLAGS += -DENABLE_COMPANDER
|
||||
endif
|
||||
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
||||
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
||||
endif
|
||||
@@ -284,6 +284,9 @@ endif
|
||||
|
||||
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
||||
|
||||
# Use newlib-nano instead of newlib
|
||||
LDFLAGS += --specs=nano.specs
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
ASFLAGS += -g
|
||||
CFLAGS += -g
|
||||
|
@@ -55,9 +55,10 @@ ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
|
||||
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (overlay will be disabled if you enable this)
|
||||
ENABLE_UART := 1 without this you can't configure radio via PC !
|
||||
ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
|
||||
ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver
|
||||
ENABLE_FMRADIO := 0 WBFM VHF broadcast band receiver
|
||||
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
|
||||
ENABLE_VOICE := 0 want to hear voices ?
|
||||
ENABLE_VOX := 0
|
||||
ENABLE_ALARM := 0 TX alarms
|
||||
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
|
||||
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
|
||||
@@ -69,17 +70,16 @@ ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden freque
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead just hold down keys 0-9 to access the secondary butt functions
|
||||
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
||||
ENABLE_COMPANDER := 0 this is broken, don't bother with it for now .. compander option (per channel)
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
|
||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
||||
#ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the current channel into the VFO
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M')
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
||||
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
||||
```
|
||||
|
282
am_fix.c
282
am_fix.c
@@ -34,20 +34,9 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if 1
|
||||
// bitfields take up less flash bytes
|
||||
uint8_t lna_short:2; // 0 ~ 3
|
||||
uint8_t lna:3; // 0 ~ 7
|
||||
uint8_t mixer:2; // 0 ~ 3
|
||||
uint8_t pga:3; // 0 ~ 7
|
||||
#else
|
||||
uint8_t lna_short; // 0 ~ 3
|
||||
uint8_t lna; // 0 ~ 7
|
||||
uint8_t mixer; // 0 ~ 3
|
||||
uint8_t pga; // 0 ~ 7
|
||||
#endif
|
||||
} t_gain_table;
|
||||
//} __attribute__((packed)) t_gain_table;
|
||||
uint16_t reg_val;
|
||||
int8_t gain_dB;
|
||||
} __attribute__((packed)) t_gain_table;
|
||||
|
||||
// REG_10 AGC gain table
|
||||
//
|
||||
@@ -97,141 +86,140 @@
|
||||
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
||||
//
|
||||
//
|
||||
// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||
static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||
static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
||||
static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
||||
static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
||||
//// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||
// static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||
// static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
||||
// static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
||||
// static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
||||
|
||||
// lookup table is hugely easier than writing code to do the same
|
||||
//
|
||||
static const t_gain_table gain_table[] =
|
||||
{
|
||||
{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original
|
||||
{0x035E, -17}, // 0 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
|
||||
// test table that lets me manually set the lna-short register
|
||||
// to measure it's actual dB change using an RF signal generator
|
||||
|
||||
{0, 2, 3, 6}, // 1 .. -33dB -14dB 0dB -3dB .. -50dB
|
||||
{1, 2, 3, 6}, // 2 .. -30dB -14dB 0dB -3dB .. -47dB
|
||||
{2, 2, 3, 6}, // 3 .. -24dB -14dB 0dB -3dB .. -41dB
|
||||
{3, 2, 3, 6} // 4 .. 0dB -14dB 0dB -3dB .. -17dB
|
||||
{0x005E, -50}, // 1 .. 0 2 3 6 .. -33dB -14dB 0dB -3dB .. -50dB
|
||||
{0x015E, -47}, // 2 .. 1 2 3 6 .. -30dB -14dB 0dB -3dB .. -47dB
|
||||
{0x025E, -41}, // 3 .. 2 2 3 6 .. -24dB -14dB 0dB -3dB .. -41dB
|
||||
{0x035E, -17} // 4 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||
};
|
||||
|
||||
const unsigned int original_index = 1;
|
||||
static const unsigned int original_index = 1;
|
||||
|
||||
#else
|
||||
|
||||
{0, 0, 0, 0}, // 1 .. -33dB -24dB -8dB -33dB .. -98dB
|
||||
{0, 0, 1, 0}, // 2 .. -33dB -24dB -6dB -33dB .. -96dB
|
||||
{1, 0, 0, 0}, // 3 .. -30dB -24dB -8dB -33dB .. -95dB
|
||||
{0, 1, 0, 0}, // 4 .. -33dB -19dB -8dB -33dB .. -93dB
|
||||
{0, 0, 0, 1}, // 5 .. -33dB -24dB -8dB -27dB .. -92dB
|
||||
{0, 1, 1, 0}, // 6 .. -33dB -19dB -6dB -33dB .. -91dB
|
||||
{0, 0, 1, 1}, // 7 .. -33dB -24dB -6dB -27dB .. -90dB
|
||||
{1, 0, 0, 1}, // 8 .. -30dB -24dB -8dB -27dB .. -89dB
|
||||
{0, 1, 2, 0}, // 9 .. -33dB -19dB -3dB -33dB .. -88dB
|
||||
{1, 0, 3, 0}, // 10 .. -30dB -24dB 0dB -33dB .. -87dB
|
||||
{0, 0, 0, 2}, // 11 .. -33dB -24dB -8dB -21dB .. -86dB
|
||||
{1, 1, 2, 0}, // 12 .. -30dB -19dB -3dB -33dB .. -85dB
|
||||
{0, 0, 3, 1}, // 13 .. -33dB -24dB 0dB -27dB .. -84dB
|
||||
{0, 3, 0, 0}, // 14 .. -33dB -9dB -8dB -33dB .. -83dB
|
||||
{1, 1, 3, 0}, // 15 .. -30dB -19dB 0dB -33dB .. -82dB
|
||||
{1, 0, 3, 1}, // 16 .. -30dB -24dB 0dB -27dB .. -81dB
|
||||
{0, 2, 3, 0}, // 17 .. -33dB -14dB 0dB -33dB .. -80dB
|
||||
{1, 2, 0, 1}, // 18 .. -30dB -14dB -8dB -27dB .. -79dB
|
||||
{0, 3, 2, 0}, // 19 .. -33dB -9dB -3dB -33dB .. -78dB
|
||||
{1, 4, 0, 0}, // 20 .. -30dB -6dB -8dB -33dB .. -77dB
|
||||
{1, 1, 3, 1}, // 21 .. -30dB -19dB 0dB -27dB .. -76dB
|
||||
{0, 0, 2, 3}, // 22 .. -33dB -24dB -3dB -15dB .. -75dB
|
||||
{1, 3, 0, 1}, // 23 .. -30dB -9dB -8dB -27dB .. -74dB
|
||||
{1, 6, 0, 0}, // 24 .. -30dB -2dB -8dB -33dB .. -73dB
|
||||
{0, 7, 1, 0}, // 25 .. -33dB 0dB -6dB -33dB .. -72dB
|
||||
{0, 6, 2, 0}, // 26 .. -33dB -2dB -3dB -33dB .. -71dB
|
||||
{2, 1, 3, 1}, // 27 .. -24dB -19dB 0dB -27dB .. -70dB
|
||||
{0, 3, 1, 2}, // 28 .. -33dB -9dB -6dB -21dB .. -69dB
|
||||
{0, 0, 0, 6}, // 29 .. -33dB -24dB -8dB -3dB .. -68dB
|
||||
{0, 5, 2, 1}, // 30 .. -33dB -4dB -3dB -27dB .. -67dB
|
||||
{0, 0, 1, 6}, // 31 .. -33dB -24dB -6dB -3dB .. -66dB
|
||||
{1, 2, 3, 2}, // 32 .. -30dB -14dB 0dB -21dB .. -65dB
|
||||
{2, 1, 1, 3}, // 33 .. -24dB -19dB -6dB -15dB .. -64dB
|
||||
{1, 7, 3, 0}, // 34 .. -30dB 0dB 0dB -33dB .. -63dB
|
||||
{1, 3, 0, 3}, // 35 .. -30dB -9dB -8dB -15dB .. -62dB
|
||||
{0, 1, 2, 5}, // 36 .. -33dB -19dB -3dB -6dB .. -61dB
|
||||
{2, 0, 2, 4}, // 37 .. -24dB -24dB -3dB -9dB .. -60dB
|
||||
{1, 6, 3, 1}, // 38 .. -30dB -2dB 0dB -27dB .. -59dB
|
||||
{1, 2, 0, 5}, // 39 .. -30dB -14dB -8dB -6dB .. -58dB
|
||||
{2, 5, 0, 2}, // 40 .. -24dB -4dB -8dB -21dB .. -57dB
|
||||
{2, 6, 2, 1}, // 41 .. -24dB -2dB -3dB -27dB .. -56dB
|
||||
{0, 5, 2, 3}, // 42 .. -33dB -4dB -3dB -15dB .. -55dB
|
||||
{2, 0, 2, 6}, // 43 .. -24dB -24dB -3dB -3dB .. -54dB
|
||||
{0, 3, 0, 6}, // 44 .. -33dB -9dB -8dB -3dB .. -53dB
|
||||
{0, 6, 0, 4}, // 45 .. -33dB -2dB -8dB -9dB .. -52dB
|
||||
{0, 3, 1, 6}, // 46 .. -33dB -9dB -6dB -3dB .. -51dB
|
||||
{1, 2, 3, 5}, // 47 .. -30dB -14dB 0dB -6dB .. -50dB
|
||||
{0, 5, 1, 5}, // 48 .. -33dB -4dB -6dB -6dB .. -49dB
|
||||
{0, 3, 3, 5}, // 49 .. -33dB -9dB 0dB -6dB .. -48dB
|
||||
{0, 6, 2, 4}, // 50 .. -33dB -2dB -3dB -9dB .. -47dB
|
||||
{1, 5, 2, 4}, // 51 .. -30dB -4dB -3dB -9dB .. -46dB
|
||||
{3, 0, 1, 3}, // 52 .. 0dB -24dB -6dB -15dB .. -45dB
|
||||
{0, 6, 1, 6}, // 53 .. -33dB -2dB -6dB -3dB .. -44dB
|
||||
{1, 5, 2, 5}, // 54 .. -30dB -4dB -3dB -6dB .. -43dB
|
||||
{0, 4, 2, 7}, // 55 .. -33dB -6dB -3dB 0dB .. -42dB
|
||||
{2, 2, 2, 7}, // 56 .. -24dB -14dB -3dB 0dB .. -41dB
|
||||
{2, 5, 2, 4}, // 57 .. -24dB -4dB -3dB -9dB .. -40dB
|
||||
{2, 3, 3, 5}, // 58 .. -24dB -9dB 0dB -6dB .. -39dB
|
||||
{1, 6, 3, 5}, // 59 .. -30dB -2dB 0dB -6dB .. -38dB
|
||||
{2, 5, 1, 6}, // 60 .. -24dB -4dB -6dB -3dB .. -37dB
|
||||
{3, 3, 3, 1}, // 61 .. 0dB -9dB 0dB -27dB .. -36dB
|
||||
{3, 2, 3, 2}, // 62 .. 0dB -14dB 0dB -21dB .. -35dB
|
||||
{2, 5, 2, 6}, // 63 .. -24dB -4dB -3dB -3dB .. -34dB
|
||||
{3, 0, 1, 6}, // 64 .. 0dB -24dB -6dB -3dB .. -33dB
|
||||
{3, 0, 0, 7}, // 65 .. 0dB -24dB -8dB 0dB .. -32dB
|
||||
{2, 5, 3, 6}, // 66 .. -24dB -4dB 0dB -3dB .. -31dB
|
||||
{3, 3, 3, 2}, // 67 .. 0dB -9dB 0dB -21dB .. -30dB
|
||||
{2, 6, 3, 6}, // 68 .. -24dB -2dB 0dB -3dB .. -29dB
|
||||
{3, 2, 0, 5}, // 69 .. 0dB -14dB -8dB -6dB .. -28dB
|
||||
{3, 5, 0, 3}, // 70 .. 0dB -4dB -8dB -15dB .. -27dB
|
||||
{3, 3, 0, 4}, // 71 .. 0dB -9dB -8dB -9dB .. -26dB
|
||||
{3, 1, 1, 7}, // 72 .. 0dB -19dB -6dB 0dB .. -25dB
|
||||
{3, 4, 2, 3}, // 73 .. 0dB -6dB -3dB -15dB .. -24dB
|
||||
{3, 4, 0, 4}, // 74 .. 0dB -6dB -8dB -9dB .. -23dB
|
||||
{3, 2, 0, 7}, // 75 .. 0dB -14dB -8dB 0dB .. -22dB
|
||||
{3, 7, 1, 3}, // 76 .. 0dB 0dB -6dB -15dB .. -21dB
|
||||
{3, 6, 2, 3}, // 77 .. 0dB -2dB -3dB -15dB .. -20dB
|
||||
{3, 5, 3, 3}, // 78 .. 0dB -4dB 0dB -15dB .. -19dB
|
||||
{3, 3, 3, 4}, // 79 .. 0dB -9dB 0dB -9dB .. -18dB
|
||||
{3, 2, 3, 6}, // 80 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||
{3, 6, 0, 5}, // 81 .. 0dB -2dB -8dB -6dB .. -16dB
|
||||
{3, 7, 1, 4}, // 82 .. 0dB 0dB -6dB -9dB .. -15dB
|
||||
{3, 2, 3, 7}, // 83 .. 0dB -14dB 0dB 0dB .. -14dB
|
||||
{3, 6, 0, 6}, // 84 .. 0dB -2dB -8dB -3dB .. -13dB
|
||||
{3, 3, 2, 7}, // 85 .. 0dB -9dB -3dB 0dB .. -12dB
|
||||
{3, 7, 0, 6}, // 86 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||
{3, 5, 3, 5}, // 87 .. 0dB -4dB 0dB -6dB .. -10dB
|
||||
{3, 7, 2, 5}, // 88 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||
{3, 6, 3, 5}, // 89 .. 0dB -2dB 0dB -6dB .. -8dB
|
||||
{3, 5, 2, 7}, // 90 .. 0dB -4dB -3dB 0dB .. -7dB
|
||||
{3, 7, 2, 6}, // 91 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||
{3, 6, 2, 7}, // 92 .. 0dB -2dB -3dB 0dB .. -5dB
|
||||
{3, 5, 3, 7}, // 93 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||
{3, 7, 2, 7}, // 94 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||
{3, 6, 3, 7}, // 95 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||
{3, 7, 3, 7} // 96 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||
{0x0000, -98}, // 1 .. 0 0 0 0 .. -33dB -24dB -8dB -33dB .. -98dB
|
||||
{0x0008, -96}, // 2 .. 0 0 1 0 .. -33dB -24dB -6dB -33dB .. -96dB
|
||||
{0x0100, -95}, // 3 .. 1 0 0 0 .. -30dB -24dB -8dB -33dB .. -95dB
|
||||
{0x0020, -93}, // 4 .. 0 1 0 0 .. -33dB -19dB -8dB -33dB .. -93dB
|
||||
{0x0001, -92}, // 5 .. 0 0 0 1 .. -33dB -24dB -8dB -27dB .. -92dB
|
||||
{0x0028, -91}, // 6 .. 0 1 1 0 .. -33dB -19dB -6dB -33dB .. -91dB
|
||||
{0x0009, -90}, // 7 .. 0 0 1 1 .. -33dB -24dB -6dB -27dB .. -90dB
|
||||
{0x0101, -89}, // 8 .. 1 0 0 1 .. -30dB -24dB -8dB -27dB .. -89dB
|
||||
{0x0030, -88}, // 9 .. 0 1 2 0 .. -33dB -19dB -3dB -33dB .. -88dB
|
||||
{0x0118, -87}, // 10 .. 1 0 3 0 .. -30dB -24dB 0dB -33dB .. -87dB
|
||||
{0x0002, -86}, // 11 .. 0 0 0 2 .. -33dB -24dB -8dB -21dB .. -86dB
|
||||
{0x0130, -85}, // 12 .. 1 1 2 0 .. -30dB -19dB -3dB -33dB .. -85dB
|
||||
{0x0019, -84}, // 13 .. 0 0 3 1 .. -33dB -24dB 0dB -27dB .. -84dB
|
||||
{0x0060, -83}, // 14 .. 0 3 0 0 .. -33dB -9dB -8dB -33dB .. -83dB
|
||||
{0x0138, -82}, // 15 .. 1 1 3 0 .. -30dB -19dB 0dB -33dB .. -82dB
|
||||
{0x0119, -81}, // 16 .. 1 0 3 1 .. -30dB -24dB 0dB -27dB .. -81dB
|
||||
{0x0058, -80}, // 17 .. 0 2 3 0 .. -33dB -14dB 0dB -33dB .. -80dB
|
||||
{0x0141, -79}, // 18 .. 1 2 0 1 .. -30dB -14dB -8dB -27dB .. -79dB
|
||||
{0x0070, -78}, // 19 .. 0 3 2 0 .. -33dB -9dB -3dB -33dB .. -78dB
|
||||
{0x0180, -77}, // 20 .. 1 4 0 0 .. -30dB -6dB -8dB -33dB .. -77dB
|
||||
{0x0139, -76}, // 21 .. 1 1 3 1 .. -30dB -19dB 0dB -27dB .. -76dB
|
||||
{0x0013, -75}, // 22 .. 0 0 2 3 .. -33dB -24dB -3dB -15dB .. -75dB
|
||||
{0x0161, -74}, // 23 .. 1 3 0 1 .. -30dB -9dB -8dB -27dB .. -74dB
|
||||
{0x01C0, -73}, // 24 .. 1 6 0 0 .. -30dB -2dB -8dB -33dB .. -73dB
|
||||
{0x00E8, -72}, // 25 .. 0 7 1 0 .. -33dB 0dB -6dB -33dB .. -72dB
|
||||
{0x00D0, -71}, // 26 .. 0 6 2 0 .. -33dB -2dB -3dB -33dB .. -71dB
|
||||
{0x0239, -70}, // 27 .. 2 1 3 1 .. -24dB -19dB 0dB -27dB .. -70dB
|
||||
{0x006A, -69}, // 28 .. 0 3 1 2 .. -33dB -9dB -6dB -21dB .. -69dB
|
||||
{0x0006, -68}, // 29 .. 0 0 0 6 .. -33dB -24dB -8dB -3dB .. -68dB
|
||||
{0x00B1, -67}, // 30 .. 0 5 2 1 .. -33dB -4dB -3dB -27dB .. -67dB
|
||||
{0x000E, -66}, // 31 .. 0 0 1 6 .. -33dB -24dB -6dB -3dB .. -66dB
|
||||
{0x015A, -65}, // 32 .. 1 2 3 2 .. -30dB -14dB 0dB -21dB .. -65dB
|
||||
{0x022B, -64}, // 33 .. 2 1 1 3 .. -24dB -19dB -6dB -15dB .. -64dB
|
||||
{0x01F8, -63}, // 34 .. 1 7 3 0 .. -30dB 0dB 0dB -33dB .. -63dB
|
||||
{0x0163, -62}, // 35 .. 1 3 0 3 .. -30dB -9dB -8dB -15dB .. -62dB
|
||||
{0x0035, -61}, // 36 .. 0 1 2 5 .. -33dB -19dB -3dB -6dB .. -61dB
|
||||
{0x0214, -60}, // 37 .. 2 0 2 4 .. -24dB -24dB -3dB -9dB .. -60dB
|
||||
{0x01D9, -59}, // 38 .. 1 6 3 1 .. -30dB -2dB 0dB -27dB .. -59dB
|
||||
{0x0145, -58}, // 39 .. 1 2 0 5 .. -30dB -14dB -8dB -6dB .. -58dB
|
||||
{0x02A2, -57}, // 40 .. 2 5 0 2 .. -24dB -4dB -8dB -21dB .. -57dB
|
||||
{0x02D1, -56}, // 41 .. 2 6 2 1 .. -24dB -2dB -3dB -27dB .. -56dB
|
||||
{0x00B3, -55}, // 42 .. 0 5 2 3 .. -33dB -4dB -3dB -15dB .. -55dB
|
||||
{0x0216, -54}, // 43 .. 2 0 2 6 .. -24dB -24dB -3dB -3dB .. -54dB
|
||||
{0x0066, -53}, // 44 .. 0 3 0 6 .. -33dB -9dB -8dB -3dB .. -53dB
|
||||
{0x00C4, -52}, // 45 .. 0 6 0 4 .. -33dB -2dB -8dB -9dB .. -52dB
|
||||
{0x006E, -51}, // 46 .. 0 3 1 6 .. -33dB -9dB -6dB -3dB .. -51dB
|
||||
{0x015D, -50}, // 47 .. 1 2 3 5 .. -30dB -14dB 0dB -6dB .. -50dB
|
||||
{0x00AD, -49}, // 48 .. 0 5 1 5 .. -33dB -4dB -6dB -6dB .. -49dB
|
||||
{0x007D, -48}, // 49 .. 0 3 3 5 .. -33dB -9dB 0dB -6dB .. -48dB
|
||||
{0x00D4, -47}, // 50 .. 0 6 2 4 .. -33dB -2dB -3dB -9dB .. -47dB
|
||||
{0x01B4, -46}, // 51 .. 1 5 2 4 .. -30dB -4dB -3dB -9dB .. -46dB
|
||||
{0x030B, -45}, // 52 .. 3 0 1 3 .. 0dB -24dB -6dB -15dB .. -45dB
|
||||
{0x00CE, -44}, // 53 .. 0 6 1 6 .. -33dB -2dB -6dB -3dB .. -44dB
|
||||
{0x01B5, -43}, // 54 .. 1 5 2 5 .. -30dB -4dB -3dB -6dB .. -43dB
|
||||
{0x0097, -42}, // 55 .. 0 4 2 7 .. -33dB -6dB -3dB 0dB .. -42dB
|
||||
{0x0257, -41}, // 56 .. 2 2 2 7 .. -24dB -14dB -3dB 0dB .. -41dB
|
||||
{0x02B4, -40}, // 57 .. 2 5 2 4 .. -24dB -4dB -3dB -9dB .. -40dB
|
||||
{0x027D, -39}, // 58 .. 2 3 3 5 .. -24dB -9dB 0dB -6dB .. -39dB
|
||||
{0x01DD, -38}, // 59 .. 1 6 3 5 .. -30dB -2dB 0dB -6dB .. -38dB
|
||||
{0x02AE, -37}, // 60 .. 2 5 1 6 .. -24dB -4dB -6dB -3dB .. -37dB
|
||||
{0x0379, -36}, // 61 .. 3 3 3 1 .. 0dB -9dB 0dB -27dB .. -36dB
|
||||
{0x035A, -35}, // 62 .. 3 2 3 2 .. 0dB -14dB 0dB -21dB .. -35dB
|
||||
{0x02B6, -34}, // 63 .. 2 5 2 6 .. -24dB -4dB -3dB -3dB .. -34dB
|
||||
{0x030E, -33}, // 64 .. 3 0 1 6 .. 0dB -24dB -6dB -3dB .. -33dB
|
||||
{0x0307, -32}, // 65 .. 3 0 0 7 .. 0dB -24dB -8dB 0dB .. -32dB
|
||||
{0x02BE, -31}, // 66 .. 2 5 3 6 .. -24dB -4dB 0dB -3dB .. -31dB
|
||||
{0x037A, -30}, // 67 .. 3 3 3 2 .. 0dB -9dB 0dB -21dB .. -30dB
|
||||
{0x02DE, -29}, // 68 .. 2 6 3 6 .. -24dB -2dB 0dB -3dB .. -29dB
|
||||
{0x0345, -28}, // 69 .. 3 2 0 5 .. 0dB -14dB -8dB -6dB .. -28dB
|
||||
{0x03A3, -27}, // 70 .. 3 5 0 3 .. 0dB -4dB -8dB -15dB .. -27dB
|
||||
{0x0364, -26}, // 71 .. 3 3 0 4 .. 0dB -9dB -8dB -9dB .. -26dB
|
||||
{0x032F, -25}, // 72 .. 3 1 1 7 .. 0dB -19dB -6dB 0dB .. -25dB
|
||||
{0x0393, -24}, // 73 .. 3 4 2 3 .. 0dB -6dB -3dB -15dB .. -24dB
|
||||
{0x0384, -23}, // 74 .. 3 4 0 4 .. 0dB -6dB -8dB -9dB .. -23dB
|
||||
{0x0347, -22}, // 75 .. 3 2 0 7 .. 0dB -14dB -8dB 0dB .. -22dB
|
||||
{0x03EB, -21}, // 76 .. 3 7 1 3 .. 0dB 0dB -6dB -15dB .. -21dB
|
||||
{0x03D3, -20}, // 77 .. 3 6 2 3 .. 0dB -2dB -3dB -15dB .. -20dB
|
||||
{0x03BB, -19}, // 78 .. 3 5 3 3 .. 0dB -4dB 0dB -15dB .. -19dB
|
||||
{0x037C, -18}, // 79 .. 3 3 3 4 .. 0dB -9dB 0dB -9dB .. -18dB
|
||||
{0x035E, -17}, // 80 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||
{0x03C5, -16}, // 81 .. 3 6 0 5 .. 0dB -2dB -8dB -6dB .. -16dB
|
||||
{0x03EC, -15}, // 82 .. 3 7 1 4 .. 0dB 0dB -6dB -9dB .. -15dB
|
||||
{0x035F, -14}, // 83 .. 3 2 3 7 .. 0dB -14dB 0dB 0dB .. -14dB
|
||||
{0x03C6, -13}, // 84 .. 3 6 0 6 .. 0dB -2dB -8dB -3dB .. -13dB
|
||||
{0x0377, -12}, // 85 .. 3 3 2 7 .. 0dB -9dB -3dB 0dB .. -12dB
|
||||
{0x03E6, -11}, // 86 .. 3 7 0 6 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||
{0x03BD, -10}, // 87 .. 3 5 3 5 .. 0dB -4dB 0dB -6dB .. -10dB
|
||||
{0x03F5, -9}, // 88 .. 3 7 2 5 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||
{0x03DD, -8}, // 89 .. 3 6 3 5 .. 0dB -2dB 0dB -6dB .. -8dB
|
||||
{0x03B7, -7}, // 90 .. 3 5 2 7 .. 0dB -4dB -3dB 0dB .. -7dB
|
||||
{0x03F6, -6}, // 91 .. 3 7 2 6 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||
{0x03D7, -5}, // 92 .. 3 6 2 7 .. 0dB -2dB -3dB 0dB .. -5dB
|
||||
{0x03BF, -4}, // 93 .. 3 5 3 7 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||
{0x03F7, -3}, // 94 .. 3 7 2 7 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||
{0x03DF, -2}, // 95 .. 3 6 3 7 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||
{0x03FF, 0} // 96 .. 3 7 3 7 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||
};
|
||||
|
||||
const unsigned int original_index = 80;
|
||||
static const unsigned int original_index = 80;
|
||||
|
||||
#endif
|
||||
|
||||
// total RF gain for each table index
|
||||
int8_t gain_dB[ARRAY_SIZE(gain_table)] = {0};
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
// display update rate
|
||||
const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||
static const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||
unsigned int counter = 0;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
// user manually sets the table index .. used to calibrate the desired dB gain table
|
||||
@@ -274,13 +262,6 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
// pre-compute the total gain for each table index .. saves doing it in real time
|
||||
for (i = 0; i < ARRAY_SIZE(gain_table); i++)
|
||||
{
|
||||
const t_gain_table gains = gain_table[i];
|
||||
gain_dB[i] = lna_short_dB[gains.lna_short] + lna_dB[gains.lna] + mixer_dB[gains.mixer] + pga_dB[gains.pga];
|
||||
}
|
||||
|
||||
#if 0
|
||||
{ // set a maximum gain to use
|
||||
// const int16_t max_gain_dB = gain_dB[original_index];
|
||||
@@ -288,7 +269,8 @@
|
||||
|
||||
max_index = ARRAY_SIZE(gain_table);
|
||||
while (--max_index > 1)
|
||||
if (gain_dB[max_index] <= max_gain_dB)
|
||||
// if (gain_dB[max_index] <= max_gain_dB)
|
||||
if (gain_table[max_index].gain_dB <= max_gain_dB)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
@@ -300,7 +282,9 @@
|
||||
void AM_fix_reset(const int vfo)
|
||||
{ // reset the AM fixer upper
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
counter = 0;
|
||||
#endif
|
||||
|
||||
prev_rssi[vfo] = 0;
|
||||
|
||||
@@ -334,7 +318,9 @@
|
||||
case FUNCTION_TRANSMIT:
|
||||
case FUNCTION_BAND_SCOPE:
|
||||
case FUNCTION_POWER_SAVE:
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
||||
#endif
|
||||
return;
|
||||
|
||||
// only adjust stuff if we're in one of these modes
|
||||
@@ -345,6 +331,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
if (counter > 0)
|
||||
{
|
||||
if (++counter >= display_update_rate)
|
||||
@@ -353,6 +340,7 @@
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // sample the current RSSI level
|
||||
// average it with the previous rssi (a bit of noise/spike immunity)
|
||||
@@ -361,11 +349,14 @@
|
||||
prev_rssi[vfo] = new_rssi;
|
||||
}
|
||||
|
||||
{ // save the corrected RSSI level
|
||||
// save the corrected RSSI level
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
{
|
||||
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
||||
if (gCurrentRSSI[vfo] != new_rssi)
|
||||
{
|
||||
gCurrentRSSI[vfo] = new_rssi;
|
||||
|
||||
if (counter == 0)
|
||||
{ // trigger a display update
|
||||
counter = 1;
|
||||
@@ -373,6 +364,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
// user is manually adjusting a gain register - don't do anything automatically
|
||||
@@ -405,10 +399,12 @@
|
||||
if (diff_dB >= 10)
|
||||
{ // jump immediately to a new gain setting
|
||||
// this greatly speeds up initial gain reduction (but reduces noise/spike immunity)
|
||||
const int16_t desired_gain_dB = (int16_t)gain_dB[index] - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
||||
|
||||
const int16_t desired_gain_dB = (int16_t)gain_table[index].gain_dB - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
||||
|
||||
// scan the table to see what index to jump straight too
|
||||
while (index > 1)
|
||||
if (gain_dB[--index] <= desired_gain_dB)
|
||||
if (gain_table[--index].gain_dB <= desired_gain_dB)
|
||||
break;
|
||||
|
||||
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
||||
@@ -455,33 +451,35 @@
|
||||
// remember the new table index
|
||||
gain_table_index_prev[vfo] = index;
|
||||
|
||||
const t_gain_table gains = gain_table[index];
|
||||
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
||||
BK4819_WriteRegister(BK4819_REG_13, gain_table[index].reg_val);
|
||||
|
||||
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
||||
|
||||
// RF gain difference from original QS setting
|
||||
rssi_gain_diff[vfo] = ((int16_t)gain_dB[index] - gain_dB[original_index]) * 2;
|
||||
rssi_gain_diff[vfo] = ((int16_t)gain_table[index].gain_dB - gain_table[original_index].gain_dB) * 2;
|
||||
}
|
||||
|
||||
// save the corrected RSSI level
|
||||
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
if (counter == 0)
|
||||
{
|
||||
counter = 1;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
|
||||
void AM_fix_print_data(const int vfo, char *s)
|
||||
{
|
||||
if (s != NULL)
|
||||
if (s != NULL && vfo >= 0 && vfo < ARRAY_SIZE(gain_table_index))
|
||||
{
|
||||
const unsigned int index = gain_table_index[vfo];
|
||||
sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_dB[index], prev_rssi[vfo]);
|
||||
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||
sprintf(s, "%2u %4ddB %3u", index, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
|
10
app/action.c
10
app/action.c
@@ -224,6 +224,7 @@ void ACTION_Scan(bool bRestart)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
void ACTION_Vox(void)
|
||||
{
|
||||
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||
@@ -234,9 +235,10 @@ void ACTION_Vox(void)
|
||||
#endif
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
static void ACTION_AlarmOr1750(bool b1750)
|
||||
static void ACTION_AlarmOr1750(const bool b1750)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
@@ -252,7 +254,7 @@ void ACTION_Vox(void)
|
||||
|
||||
gFlagPrepareTX = true;
|
||||
|
||||
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
#endif
|
||||
@@ -268,7 +270,9 @@ void ACTION_Vox(void)
|
||||
FM_TurnOff();
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
gFlagReconfigureVfos = true;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
@@ -369,7 +373,9 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
ACTION_Scan(true);
|
||||
break;
|
||||
case ACTION_OPT_VOX:
|
||||
#ifdef ENABLE_VOX
|
||||
ACTION_Vox();
|
||||
#endif
|
||||
break;
|
||||
case ACTION_OPT_ALARM:
|
||||
#ifdef ENABLE_ALARM
|
||||
|
@@ -23,7 +23,9 @@
|
||||
void ACTION_Power(void);
|
||||
void ACTION_Monitor(void);
|
||||
void ACTION_Scan(bool bFlag);
|
||||
#ifdef ENABLE_VOX
|
||||
void ACTION_Vox(void);
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
//static void ACTION_AlarmOr1750(bool b1750)
|
||||
#endif
|
||||
|
77
app/app.c
77
app/app.c
@@ -486,7 +486,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
|
||||
gEnableSpeaker = true;
|
||||
|
||||
if (gSetting_backlight_on_rx)
|
||||
if (gSetting_backlight_on_tx_rx >= 2)
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
if (gScanState != SCAN_OFF)
|
||||
@@ -519,6 +519,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gEeprom.ScreenChannel[chan] = gRxVfo->CHANNEL_SAVE;
|
||||
|
||||
gNOAA_Countdown_10ms = 500; // 5 sec
|
||||
gScheduleNOAA = false;
|
||||
}
|
||||
@@ -574,9 +575,9 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
// if (gVoiceWriteIndex == 0)
|
||||
if (gVoiceWriteIndex == 0) // AM/FM RX mode will be set when the voice has finished
|
||||
#endif
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM); // no need, set it now
|
||||
|
||||
FUNCTION_Select(Function);
|
||||
|
||||
@@ -630,7 +631,7 @@ static void FREQ_NextChannel(void)
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
// ScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
ScanPauseDelayIn_10ms = 10; // 100ms
|
||||
ScanPauseDelayIn_10ms = 10; // 100ms .. it don't like any faster :(
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
gUpdateDisplay = true;
|
||||
@@ -671,9 +672,7 @@ static void MR_NextChannel(void)
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
// chan = (gEeprom.RX_CHANNEL + 1) & 1u;
|
||||
// chan = gEeprom.MrChannel[chan];
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// chan = gEeprom.VfoInfo[chan].CHANNEL_SAVE;
|
||||
// chan = 14;
|
||||
// if (RADIO_CheckValidChannel(chan, false, 0))
|
||||
// {
|
||||
@@ -851,6 +850,7 @@ void APP_CheckRadioInterrupts(void)
|
||||
if (interrupt_status_bits & BK4819_REG_02_CTCSS_FOUND)
|
||||
g_CTCSS_Lost = false;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (interrupt_status_bits & BK4819_REG_02_VOX_LOST)
|
||||
{
|
||||
g_VOX_Lost = true;
|
||||
@@ -881,6 +881,7 @@ void APP_CheckRadioInterrupts(void)
|
||||
g_VOX_Lost = false;
|
||||
gVoxPauseCountdown = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (interrupt_status_bits & BK4819_REG_02_SQUELCH_LOST)
|
||||
{
|
||||
@@ -935,6 +936,7 @@ void APP_EndTransmission(void)
|
||||
RADIO_SetupRegisters(false);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
static void APP_HandleVox(void)
|
||||
{
|
||||
if (gSetting_KILLED)
|
||||
@@ -1012,6 +1014,7 @@ static void APP_HandleVox(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void APP_Update(void)
|
||||
{
|
||||
@@ -1145,8 +1148,10 @@ void APP_Update(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
APP_HandleVox();
|
||||
#endif
|
||||
|
||||
if (gSchedulePowerSave)
|
||||
{
|
||||
@@ -1211,10 +1216,14 @@ void APP_Update(void)
|
||||
{
|
||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||
#endif
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF &&
|
||||
gScanState == SCAN_OFF &&
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{ // dual watch mode, toggle between the two VFO's
|
||||
DUALWATCH_Alternate();
|
||||
|
||||
@@ -1390,7 +1399,8 @@ void APP_TimeSlice10ms(void)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
|
||||
// if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
|
||||
if (gRxVfo->AM_mode && gSetting_AM_fix)
|
||||
AM_fix_10ms(gEeprom.RX_CHANNEL);
|
||||
#endif
|
||||
|
||||
@@ -1445,11 +1455,13 @@ void APP_TimeSlice10ms(void)
|
||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gVoxResumeCountdown > 0)
|
||||
gVoxResumeCountdown--;
|
||||
|
||||
if (gVoxPauseCountdown > 0)
|
||||
gVoxPauseCountdown--;
|
||||
#endif
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
@@ -1985,6 +1997,7 @@ void APP_TimeSlice500ms(void)
|
||||
static void ALARM_Off(void)
|
||||
{
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gEnableSpeaker = false;
|
||||
|
||||
@@ -1994,13 +2007,15 @@ void APP_TimeSlice500ms(void)
|
||||
RADIO_EnableCxCSS();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
#endif
|
||||
@@ -2054,17 +2069,6 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK)
|
||||
gKeyLockCountdown = 30; // 15 seconds
|
||||
|
||||
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld && gDTMF_RX_live[0] != 0)
|
||||
{ // clear the live DTMF decoder if the EXIT key is held
|
||||
if (gDTMF_RX_live[0] != 0)
|
||||
{
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bKeyPressed)
|
||||
{
|
||||
if (gFlagSaveVfo)
|
||||
@@ -2100,11 +2104,24 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Key != KEY_PTT)
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
if (Key == KEY_EXIT && bKeyHeld)
|
||||
{ // exit key held pressed
|
||||
|
||||
// clear the live DTMF decoder
|
||||
if (gDTMF_RX_live[0] != 0)
|
||||
{
|
||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
||||
gMenuCountdown = menu_timeout_500ms;
|
||||
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
||||
{ // cancel the ringing
|
||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||
@@ -2161,14 +2178,16 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
Key != KEY_MENU)
|
||||
{
|
||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
{ // frequency or CTCSS/DCS scanning
|
||||
{ // FREQ/CTCSS/DCS scanning
|
||||
if (bKeyPressed && !bKeyHeld)
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gPttWasPressed && Key == KEY_PTT)
|
||||
if (Key == KEY_PTT)
|
||||
{
|
||||
if (gPttWasPressed)
|
||||
{
|
||||
bFlag = bKeyHeld;
|
||||
if (!bKeyPressed)
|
||||
@@ -2177,8 +2196,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gPttWasPressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (gPttWasReleased && Key != KEY_PTT)
|
||||
}
|
||||
else
|
||||
if (gPttWasReleased)
|
||||
{
|
||||
if (bKeyHeld)
|
||||
bFlag = true;
|
||||
@@ -2260,10 +2280,12 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
else
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
if ((!bKeyHeld && bKeyPressed) || (gAlarmState == ALARM_STATE_TX1750 && bKeyHeld && !bKeyPressed))
|
||||
{
|
||||
ALARM_Off();
|
||||
|
||||
// TODO: fix side key 1750, you have to press it twice to restart the tone :(
|
||||
|
||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||
{
|
||||
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
||||
@@ -2275,6 +2297,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (Key == KEY_PTT)
|
||||
gPttWasPressed = true;
|
||||
else
|
||||
if (!bKeyHeld)
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
#endif
|
||||
|
@@ -127,7 +127,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
}
|
||||
|
||||
gFlagEndTransmission = false;
|
||||
#ifdef ENABLE_VOX
|
||||
gVOX_NoiseDetected = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||
|
78
app/main.c
78
app/main.c
@@ -28,6 +28,7 @@
|
||||
#include "app/spectrum.h"
|
||||
#endif
|
||||
#include "audio.h"
|
||||
#include "board.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "dtmf.h"
|
||||
#include "frequencies.h"
|
||||
@@ -101,7 +102,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
||||
else
|
||||
gEeprom.TX_CHANNEL = (Vfo == 0);
|
||||
gEeprom.TX_CHANNEL = (Vfo + 1) & 1u;
|
||||
|
||||
gRequestSaveSettings = 1;
|
||||
gFlagReconfigureVfos = true;
|
||||
@@ -123,7 +124,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
uint8_t Channel;
|
||||
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
{ // swap to frequency mode
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
@@ -135,7 +136,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 0);
|
||||
if (Channel != 0xFF)
|
||||
{
|
||||
{ // swap to channel mode
|
||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
@@ -217,7 +218,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_7:
|
||||
#ifdef ENABLE_VOX
|
||||
ACTION_Vox();
|
||||
#else
|
||||
|
||||
|
||||
// TODO: make use of the function key press
|
||||
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
case KEY_8:
|
||||
@@ -532,7 +541,8 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
{ // menu key held down (long press)
|
||||
|
||||
if (bKeyPressed)
|
||||
{
|
||||
{ // long press MENU key
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||
{
|
||||
if (gInputBoxIndex > 0)
|
||||
@@ -544,34 +554,28 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
|
||||
|
||||
// TODO: long press M-key
|
||||
|
||||
|
||||
|
||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||
if (gEeprom.VFO_OPEN &&
|
||||
gEeprom.DUAL_WATCH == DUAL_WATCH_OFF &&
|
||||
gScanState == SCAN_OFF &&
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{ // copy channel to VFO
|
||||
|
||||
int channel = -1;
|
||||
int vfo = -1;
|
||||
//int selected = -1;
|
||||
|
||||
if (IS_FREQ_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
{ // VFO mode
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // other VFO is in channel mode
|
||||
channel = gTxVfo->CHANNEL_SAVE;
|
||||
vfo = gRxVfo->CHANNEL_SAVE;
|
||||
}
|
||||
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) &&
|
||||
IS_MR_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||
{
|
||||
channel = gEeprom.ScreenChannel[1];
|
||||
vfo = 0;
|
||||
}
|
||||
else
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // VFO mode
|
||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
{ // other VFO is in channel mode
|
||||
channel = gRxVfo->CHANNEL_SAVE;
|
||||
vfo = gTxVfo->CHANNEL_SAVE;
|
||||
}
|
||||
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1]) &&
|
||||
IS_MR_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||
{
|
||||
channel = gEeprom.ScreenChannel[0];
|
||||
vfo = 1;
|
||||
}
|
||||
|
||||
if (channel >= 0 && vfo >= 0)
|
||||
@@ -579,15 +583,29 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
gEeprom.MrChannel[vfo] = channel;
|
||||
gEeprom.ScreenChannel[vfo] = channel;
|
||||
RADIO_ConfigureChannel(vfo, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
// TODO: finish this
|
||||
channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
||||
gEeprom.MrChannel[vfo] = channel;
|
||||
gEeprom.ScreenChannel[vfo] = channel;
|
||||
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
|
||||
|
||||
//gEeprom.RX_CHANNEL = () & 1; // swap to the VFO
|
||||
// swap to the VFO
|
||||
gEeprom.TX_CHANNEL = vfo;
|
||||
gEeprom.RX_CHANNEL = vfo;
|
||||
RADIO_SelectVfos();
|
||||
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
|
||||
// gRequestSaveVFO = true;
|
||||
// gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
// gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
// SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
||||
|
||||
gUpdateStatus = true;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
72
app/menu.c
72
app/menu.c
@@ -47,7 +47,12 @@
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
void writeXtalFreqCal(const int32_t value)
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||
{
|
||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + value);
|
||||
|
||||
if (update_eeprom)
|
||||
{
|
||||
struct
|
||||
{
|
||||
@@ -56,17 +61,19 @@ void writeXtalFreqCal(const int32_t value)
|
||||
uint16_t EEPROM_1F8C;
|
||||
uint8_t VOLUME_GAIN;
|
||||
uint8_t DAC_GAIN;
|
||||
} __attribute__((packed)) Misc;
|
||||
} __attribute__((packed)) misc;
|
||||
|
||||
gEeprom.BK4819_XTAL_FREQ_LOW = value;
|
||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
|
||||
|
||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
||||
Misc.BK4819_XtalFreqLow = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
EEPROM_WriteBuffer(0x1F88, &Misc);
|
||||
//
|
||||
EEPROM_ReadBuffer(0x1F88, &misc, 8);
|
||||
misc.BK4819_XtalFreqLow = value;
|
||||
EEPROM_WriteBuffer(0x1F88, &misc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void MENU_StartCssScan(int8_t Direction)
|
||||
{
|
||||
@@ -192,12 +199,11 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_Compand) - 1;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RX_TX) - 1;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
@@ -212,7 +218,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
case MENU_MIC_BAR:
|
||||
#endif
|
||||
case MENU_ABR_ON_RX:
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_AUTOLK:
|
||||
@@ -246,7 +251,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
#endif
|
||||
case MENU_RP_STE:
|
||||
*pMin = 0;
|
||||
*pMax = 10;
|
||||
@@ -291,11 +298,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
*pMin = 0;
|
||||
*pMax = 2300;
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||
@@ -497,6 +499,7 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
@@ -505,13 +508,14 @@ void MENU_AcceptSetting(void)
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
gEeprom.BACKLIGHT = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_ABR_ON_RX:
|
||||
gSetting_backlight_on_rx = gSubMenuSelection;
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
gSetting_backlight_on_tx_rx = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
@@ -595,7 +599,6 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
gTxVfo->Compander = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
@@ -603,7 +606,6 @@ void MENU_AcceptSetting(void)
|
||||
gFlagResetVfos = true;
|
||||
// gRequestSaveChannel = 1;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case MENU_1_CALL:
|
||||
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
||||
@@ -640,12 +642,6 @@ void MENU_AcceptSetting(void)
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_VOL:
|
||||
if(gF_LOCK) {
|
||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
gSetting_battery_text = gSubMenuSelection;
|
||||
break;
|
||||
@@ -757,13 +753,23 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
writeXtalFreqCal(gSubMenuSelection);
|
||||
writeXtalFreqCal(gSubMenuSelection, true);
|
||||
return;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL:
|
||||
gBatteryCalibration[3] = gSubMenuSelection;
|
||||
gBatteryCalibration[0] = 520*gSubMenuSelection/760; //5.2V empty, blinking above this value, reduced functionality below
|
||||
gBatteryCalibration[1] = 700*gSubMenuSelection/760; // 7V, ~5%, 1 bars above this value
|
||||
gBatteryCalibration[2] = 745*gSubMenuSelection/760; // 7.45V, ~17%, 2 bars above this value
|
||||
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value
|
||||
gBatteryCalibration[4] = 788*gSubMenuSelection/760; // 7.88V, ~65% 4 bars above this value
|
||||
gBatteryCalibration[5] = 2300;
|
||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
||||
uint16_t buf[4];
|
||||
EEPROM_ReadBuffer(0x1F48, buf, sizeof(buf));
|
||||
buf[0] = gBatteryCalibration[4];
|
||||
buf[1] = gBatteryCalibration[5];
|
||||
EEPROM_WriteBuffer(0x1F48, buf);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -921,9 +927,11 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
gSubMenuSelection = gEeprom.BACKLIGHT;
|
||||
@@ -932,8 +940,8 @@ void MENU_ShowCurrentSetting(void)
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
||||
break;
|
||||
|
||||
case MENU_ABR_ON_RX:
|
||||
gSubMenuSelection = gSetting_backlight_on_rx;
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
gSubMenuSelection = gSetting_backlight_on_tx_rx;
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
@@ -996,11 +1004,9 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
gSubMenuSelection = gTxVfo->Compander;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case MENU_1_CALL:
|
||||
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
||||
@@ -1044,10 +1050,6 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
gSubMenuSelection = gBatteryCalibration[3];
|
||||
return;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
gSubMenuSelection = gSetting_battery_text;
|
||||
return;
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
|
||||
#endif
|
||||
|
||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
||||
void MENU_AcceptSetting(void);
|
||||
void MENU_SelectNextCode(void);
|
||||
|
@@ -412,7 +412,9 @@ void SCANNER_Start(void)
|
||||
g_CDCSS_Lost = false;
|
||||
gCDCSSCodeType = 0;
|
||||
g_CTCSS_Lost = false;
|
||||
#ifdef ENABLE_VOX
|
||||
g_VOX_Lost = false;
|
||||
#endif
|
||||
g_SquelchLost = false;
|
||||
gScannerEditState = 0;
|
||||
gScanProgressIndicator = 0;
|
||||
|
32
audio.c
32
audio.c
@@ -187,7 +187,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
BK4819_TurnsOffTones_TurnsOnRX();
|
||||
@@ -258,7 +260,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
VoiceID += VOICE_ID_ENG_BASE;
|
||||
}
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -267,7 +271,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
#endif
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 2000;
|
||||
#endif
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
AUDIO_PlayVoice(VoiceID);
|
||||
|
||||
@@ -278,8 +286,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
{
|
||||
SYSTEM_DelayMs(Delay * 10);
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
@@ -291,7 +301,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
gVoiceWriteIndex = 0;
|
||||
gVoiceReadIndex = 0;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -404,14 +418,19 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
gCountdownToPlayNextVoice_10ms = Delay;
|
||||
gFlagPlayQueuedVoice = false;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 2000;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
gCurrentFunction == FUNCTION_MONITOR ||
|
||||
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
@@ -421,7 +440,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
if (!gEnableSpeaker)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
gVoxResumeCountdown = 80;
|
||||
#endif
|
||||
|
||||
gVoiceWriteIndex = 0;
|
||||
gVoiceReadIndex = 0;
|
||||
}
|
||||
|
@@ -138,6 +138,7 @@ const uint8_t BITMAP_F_Key[6] =
|
||||
0b01000001
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
const uint8_t BITMAP_VOX[18] =
|
||||
{ // "VOX"
|
||||
0b00000000,
|
||||
@@ -159,6 +160,7 @@ const uint8_t BITMAP_VOX[18] =
|
||||
0b00010100,
|
||||
0b01100011
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
const uint8_t BITMAP_WX[12] =
|
||||
@@ -414,7 +416,6 @@ const uint8_t BITMAP_ScanList2[6] =
|
||||
0b01000010
|
||||
};
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
const uint8_t BITMAP_compand[6] =
|
||||
{
|
||||
0b00000000,
|
||||
@@ -424,4 +425,3 @@ const uint8_t BITMAP_ScanList2[6] =
|
||||
0b01000010,
|
||||
0b00100100
|
||||
};
|
||||
#endif
|
||||
|
@@ -21,7 +21,9 @@ extern const uint8_t BITMAP_KeyLock[6];
|
||||
|
||||
extern const uint8_t BITMAP_F_Key[6];
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
extern const uint8_t BITMAP_VOX[18];
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
extern const uint8_t BITMAP_WX[12];
|
||||
@@ -63,9 +65,7 @@ extern const uint8_t BITMAP_VFO_NotDefault[8];
|
||||
extern const uint8_t BITMAP_ScanList1[6];
|
||||
extern const uint8_t BITMAP_ScanList2[6];
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const uint8_t BITMAP_compand[6];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
6
board.c
6
board.c
@@ -532,8 +532,10 @@ void BOARD_EEPROM_Init(void)
|
||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||
#endif
|
||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
||||
#ifdef ENABLE_VOX
|
||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
||||
#endif
|
||||
gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4;
|
||||
|
||||
// 0E78..0E7F
|
||||
@@ -712,7 +714,7 @@ void BOARD_EEPROM_Init(void)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
||||
#endif
|
||||
gSetting_backlight_on_rx = (Data[7] & (1u << 6)) ? true : false;
|
||||
gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u;
|
||||
|
||||
if (!gEeprom.VFO_OPEN)
|
||||
{
|
||||
@@ -757,8 +759,10 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
}
|
||||
gBatteryCalibration[5] = 2300;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
||||
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
||||
#endif
|
||||
|
||||
//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
|
||||
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
||||
|
@@ -835,13 +835,10 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
|
||||
if (mode == 0)
|
||||
{ // disable
|
||||
BK4819_WriteRegister(BK4819_REG_31, r31 & ~(1u < 3));
|
||||
BK4819_WriteRegister(BK4819_REG_31, r31 & ~(1u << 3));
|
||||
return;
|
||||
}
|
||||
|
||||
// enable
|
||||
BK4819_WriteRegister(BK4819_REG_31, r31 | (1u < 3));
|
||||
|
||||
// set the compressor ratio
|
||||
//
|
||||
// REG_29 <15:14> 10 Compress (AF Tx) Ratio
|
||||
@@ -854,13 +851,14 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
//
|
||||
// REG_29 <6:0> 64 Compress (AF Tx) noise point (dB)
|
||||
//
|
||||
// const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 2 : 0; // 2:1
|
||||
// const uint16_t compress_0dB = 86;
|
||||
// const uint16_t compress_noise_dB = 64;
|
||||
// BK4819_WriteRegister(BK4819_REG_29, // (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14));
|
||||
// (compress_ratio < 14)
|
||||
// | (compress_0dB < 7)
|
||||
// | (compress_noise_dB < 0));
|
||||
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 2 : 0; // 2:1
|
||||
const uint16_t compress_0dB = 86;
|
||||
const uint16_t compress_noise_dB = 64;
|
||||
// AB40 10 1010110 1000000
|
||||
BK4819_WriteRegister(BK4819_REG_29, // (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14));
|
||||
(compress_ratio << 14)
|
||||
| (compress_0dB << 7)
|
||||
| (compress_noise_dB << 0));
|
||||
|
||||
// set the expander ratio
|
||||
//
|
||||
@@ -874,13 +872,17 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
//
|
||||
// REG_28 <6:0> 56 Expander (AF Rx) noise point (dB)
|
||||
//
|
||||
// const uint16_t expand_ratio = (mode >= 2) ? 1 : 0; // 1:2
|
||||
// const uint16_t expand_0dB = 86;
|
||||
// const uint16_t expand_noise_dB = 56;
|
||||
// BK4819_WriteRegister(BK4819_REG_28, // (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14));
|
||||
// (expand_ratio < 14)
|
||||
// | (expand_0dB < 7)
|
||||
// | (expand_noise_dB < 0));
|
||||
const uint16_t expand_ratio = (mode >= 2) ? 1 : 0; // 1:2
|
||||
const uint16_t expand_0dB = 86;
|
||||
const uint16_t expand_noise_dB = 56;
|
||||
// 6B38 01 1010110 0111000
|
||||
BK4819_WriteRegister(BK4819_REG_28, // (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14));
|
||||
(expand_ratio << 14)
|
||||
| (expand_0dB << 7)
|
||||
| (expand_noise_dB << 0));
|
||||
|
||||
// enable
|
||||
BK4819_WriteRegister(BK4819_REG_31, r31 | (1u << 3));
|
||||
}
|
||||
|
||||
void BK4819_DisableVox(void)
|
||||
|
@@ -24,22 +24,22 @@
|
||||
|
||||
enum BK4819_AF_Type_t
|
||||
{
|
||||
BK4819_AF_MUTE = 0u,
|
||||
BK4819_AF_OPEN = 1u,
|
||||
BK4819_AF_ALAM = 2u,
|
||||
BK4819_AF_BEEP = 3u,
|
||||
BK4819_AF_UNKNOWN1 = 4u,
|
||||
BK4819_AF_UNKNOWN2 = 5u,
|
||||
BK4819_AF_CTCO = 6u,
|
||||
BK4819_AF_AM = 7u,
|
||||
BK4819_AF_FSKO = 8u,
|
||||
BK4819_AF_UNKNOWN3 = 9u,
|
||||
BK4819_AF_UNKNOWN4 = 10u,
|
||||
BK4819_AF_UNKNOWN5 = 11u,
|
||||
BK4819_AF_UNKNOWN6 = 12u,
|
||||
BK4819_AF_UNKNOWN7 = 13u,
|
||||
BK4819_AF_UNKNOWN8 = 14u,
|
||||
BK4819_AF_UNKNOWN9 = 15u
|
||||
BK4819_AF_MUTE = 0u, //
|
||||
BK4819_AF_FM = 1u, // FM
|
||||
BK4819_AF_ALAM = 2u, //
|
||||
BK4819_AF_BEEP = 3u, //
|
||||
BK4819_AF_BASEBAND1 = 4u, // SSB
|
||||
BK4819_AF_BASEBAND2 = 5u, // SSB
|
||||
BK4819_AF_CTCO = 6u, // strange LF audio .. maybe the CTCSS LF line ?
|
||||
BK4819_AF_AM = 7u, // AM
|
||||
BK4819_AF_FSKO = 8u, // nothing
|
||||
BK4819_AF_UNKNOWN3 = 9u, // distorted
|
||||
BK4819_AF_UNKNOWN4 = 10u, // nothing at all
|
||||
BK4819_AF_UNKNOWN5 = 11u, // distorted
|
||||
BK4819_AF_UNKNOWN6 = 12u, // distorted
|
||||
BK4819_AF_UNKNOWN7 = 13u, // interesting
|
||||
BK4819_AF_UNKNOWN8 = 14u, // interesting
|
||||
BK4819_AF_UNKNOWN9 = 15u // not a lot
|
||||
};
|
||||
|
||||
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#endif
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "dcs.h"
|
||||
#include "driver/backlight.h"
|
||||
#if defined(ENABLE_FMRADIO)
|
||||
#include "driver/bk1080.h"
|
||||
#endif
|
||||
@@ -60,7 +61,10 @@ void FUNCTION_Init(void)
|
||||
g_CDCSS_Lost = false;
|
||||
g_CTCSS_Lost = false;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
g_VOX_Lost = false;
|
||||
#endif
|
||||
|
||||
g_SquelchLost = false;
|
||||
|
||||
gFlagTailNoteEliminationComplete = false;
|
||||
@@ -226,6 +230,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
|
||||
if (gSetting_backlight_on_tx_rx == 1 || gSetting_backlight_on_tx_rx == 3)
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
break;
|
||||
|
||||
case FUNCTION_BAND_SCOPE:
|
||||
|
@@ -75,7 +75,9 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
{
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||
gEeprom.BATTERY_SAVE = 0;
|
||||
#ifdef ENABLE_VOX
|
||||
gEeprom.VOX_SWITCH = false;
|
||||
#endif
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
|
14
misc.c
14
misc.c
@@ -45,7 +45,9 @@ const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec afte
|
||||
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
||||
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
||||
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
||||
#ifdef ENABLE_VOX
|
||||
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
||||
#endif
|
||||
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
||||
|
||||
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||
@@ -61,7 +63,9 @@ const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
||||
#endif
|
||||
|
||||
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
||||
@@ -83,7 +87,7 @@ bool gSetting_TX_EN;
|
||||
uint8_t gSetting_F_LOCK;
|
||||
bool gSetting_ScrambleEnable;
|
||||
|
||||
bool gSetting_backlight_on_rx;
|
||||
uint8_t gSetting_backlight_on_tx_rx;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
bool gSetting_AM_fix;
|
||||
@@ -188,12 +192,14 @@ bool g_CDCSS_Lost;
|
||||
uint8_t gCDCSSCodeType;
|
||||
bool g_CTCSS_Lost;
|
||||
bool g_CxCSS_TAIL_Found;
|
||||
#ifdef ENABLE_VOX
|
||||
bool g_VOX_Lost;
|
||||
bool g_SquelchLost;
|
||||
uint8_t gFlashLightState;
|
||||
bool gVOX_NoiseDetected;
|
||||
uint16_t gVoxResumeCountdown;
|
||||
uint16_t gVoxPauseCountdown;
|
||||
#endif
|
||||
bool g_SquelchLost;
|
||||
uint8_t gFlashLightState;
|
||||
volatile uint16_t gFlashLightBlinkCounter;
|
||||
bool gFlagEndTransmission;
|
||||
uint16_t gLowBatteryCountdown;
|
||||
@@ -234,7 +240,9 @@ uint8_t gShowChPrefix;
|
||||
volatile bool gNextTimeslice;
|
||||
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||
#ifdef ENABLE_VOX
|
||||
volatile uint16_t gVoxStopCountdown_10ms;
|
||||
#endif
|
||||
volatile bool gNextTimeslice40ms;
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAACountdown_10ms = 0;
|
||||
|
14
misc.h
14
misc.h
@@ -116,7 +116,9 @@ extern const uint16_t battery_save_count_10ms;
|
||||
extern const uint16_t power_save1_10ms;
|
||||
extern const uint16_t power_save2_10ms;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
extern const uint16_t vox_stop_count_down_10ms;
|
||||
#endif
|
||||
|
||||
extern const uint16_t NOAA_countdown_10ms;
|
||||
extern const uint16_t NOAA_countdown_2_10ms;
|
||||
@@ -128,7 +130,9 @@ extern const uint16_t dual_watch_count_after_1_10ms;
|
||||
extern const uint16_t dual_watch_count_after_2_10ms;
|
||||
extern const uint16_t dual_watch_count_toggle_10ms;
|
||||
extern const uint16_t dual_watch_count_noaa_10ms;
|
||||
#ifdef ENABLE_VOX
|
||||
extern const uint16_t dual_watch_count_after_vox_10ms;
|
||||
#endif
|
||||
|
||||
extern const uint16_t scan_pause_delay_in_1_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_2_10ms;
|
||||
@@ -152,7 +156,7 @@ extern bool gSetting_TX_EN;
|
||||
extern uint8_t gSetting_F_LOCK;
|
||||
extern bool gSetting_ScrambleEnable;
|
||||
|
||||
extern bool gSetting_backlight_on_rx;
|
||||
extern uint8_t gSetting_backlight_on_tx_rx;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
extern bool gSetting_AM_fix;
|
||||
@@ -258,12 +262,14 @@ extern bool g_CDCSS_Lost;
|
||||
extern uint8_t gCDCSSCodeType;
|
||||
extern bool g_CTCSS_Lost;
|
||||
extern bool g_CxCSS_TAIL_Found;
|
||||
#ifdef ENABLE_VOX
|
||||
extern bool g_VOX_Lost;
|
||||
extern bool g_SquelchLost;
|
||||
extern uint8_t gFlashLightState;
|
||||
extern bool gVOX_NoiseDetected;
|
||||
extern uint16_t gVoxResumeCountdown;
|
||||
extern uint16_t gVoxPauseCountdown;
|
||||
#endif
|
||||
extern bool g_SquelchLost;
|
||||
extern uint8_t gFlashLightState;
|
||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||
extern bool gFlagEndTransmission;
|
||||
extern uint16_t gLowBatteryCountdown;
|
||||
@@ -300,7 +306,9 @@ extern bool gF_LOCK;
|
||||
extern uint8_t gShowChPrefix;
|
||||
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||
#ifdef ENABLE_VOX
|
||||
extern volatile uint16_t gVoxStopCountdown_10ms;
|
||||
#endif
|
||||
extern volatile bool gNextTimeslice40ms;
|
||||
#ifdef ENABLE_NOAA
|
||||
extern volatile uint16_t gNOAACountdown_10ms;
|
||||
|
24
radio.c
24
radio.c
@@ -130,9 +130,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
pInfo->pRX = &pInfo->freq_config_RX;
|
||||
pInfo->pTX = &pInfo->freq_config_TX;
|
||||
#ifdef ENABLE_COMPANDER
|
||||
pInfo->Compander = 0; // off
|
||||
#endif
|
||||
|
||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||
pInfo->AM_mode = 1;
|
||||
@@ -420,9 +418,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
||||
#endif
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
||||
}
|
||||
@@ -461,16 +457,16 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
//
|
||||
// getting the best setting here is still experimental, bare with me
|
||||
//
|
||||
// note that 'noise' and 'glitch' value are inverted compared to 'rssi' values
|
||||
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||
|
||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
|
||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 10) / 11;
|
||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
|
||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
|
||||
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 11) / 10;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 11) / 10;
|
||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 11) / 10;
|
||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||
#endif
|
||||
|
||||
if (pInfo->SquelchOpenNoiseThresh > 127)
|
||||
@@ -698,6 +694,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||
@@ -716,12 +713,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
BK4819_DisableVox();
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
// RX expander
|
||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||
@@ -826,10 +822,8 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
// TX compressor
|
||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
||||
#endif
|
||||
|
||||
BK4819_PrepareTransmit();
|
||||
|
||||
|
4
radio.h
4
radio.h
@@ -25,9 +25,7 @@
|
||||
|
||||
enum {
|
||||
MR_CH_BAND_MASK = 0x0F << 0,
|
||||
#ifdef ENABLE_COMPANDER
|
||||
MR_CH_COMPAND = 3u << 4, // new
|
||||
#endif
|
||||
MR_CH_SCANLIST2 = 1u << 6,
|
||||
MR_CH_SCANLIST1 = 1u << 7
|
||||
};
|
||||
@@ -111,9 +109,7 @@ typedef struct VFO_Info_t
|
||||
|
||||
uint8_t AM_mode;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
uint8_t Compander;
|
||||
#endif
|
||||
|
||||
char Name[16];
|
||||
} VFO_Info_t;
|
||||
|
@@ -104,7 +104,9 @@ void SystickHandler(void)
|
||||
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
DECREMENT(gVoxStopCountdown_10ms);
|
||||
#endif
|
||||
|
||||
DECREMENT(boot_counter_10ms);
|
||||
}
|
||||
|
16
settings.c
16
settings.c
@@ -86,8 +86,13 @@ void SETTINGS_SaveSettings(void)
|
||||
State[3] = false;
|
||||
#endif
|
||||
State[4] = gEeprom.KEY_LOCK;
|
||||
#ifdef ENABLE_VOX
|
||||
State[5] = gEeprom.VOX_SWITCH;
|
||||
State[6] = gEeprom.VOX_LEVEL;
|
||||
#else
|
||||
State[5] = false;
|
||||
State[6] = 0;
|
||||
#endif
|
||||
State[7] = gEeprom.MIC_SENSITIVITY;
|
||||
EEPROM_WriteBuffer(0x0E70, State);
|
||||
|
||||
@@ -174,7 +179,7 @@ void SETTINGS_SaveSettings(void)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
||||
#endif
|
||||
if (!gSetting_backlight_on_rx) State[7] &= ~(1u << 6);
|
||||
State[7] = (State[7] & ~(3u << 6)) | ((gSetting_backlight_on_tx_rx & 3u) << 6);
|
||||
|
||||
EEPROM_WriteBuffer(0x0F40, State);
|
||||
}
|
||||
@@ -255,20 +260,15 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
||||
{
|
||||
uint8_t State[8];
|
||||
uint8_t Attributes = 0xFF; // default attributes
|
||||
#ifdef ENABLE_COMPANDER
|
||||
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled
|
||||
#endif
|
||||
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
||||
|
||||
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled
|
||||
|
||||
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
||||
|
||||
if (keep)
|
||||
{
|
||||
#ifdef ENABLE_COMPANDER
|
||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
||||
#else
|
||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Band << 0);
|
||||
#endif
|
||||
if (State[Channel & 7u] == Attributes)
|
||||
return; // no change in the attributes
|
||||
}
|
||||
|
70
ui/main.c
70
ui/main.c
@@ -51,6 +51,22 @@ center_line_t center_line = CENTER_LINE_NONE;
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
default:
|
||||
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
case 0: break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
|
||||
unsigned int sqrt16(unsigned int value)
|
||||
@@ -89,6 +105,11 @@ center_line_t center_line = CENTER_LINE_NONE;
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (gAlarmState != ALARM_STATE_OFF)
|
||||
return;
|
||||
#endif
|
||||
|
||||
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
||||
|
||||
// const unsigned int max = 65535;
|
||||
@@ -275,25 +296,12 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
|
||||
memset(p_line, 0, 23);
|
||||
|
||||
if (rssi_level > 0)
|
||||
{
|
||||
//if (rssi_level >= 1)
|
||||
memmove(p_line, BITMAP_Antenna, 5);
|
||||
if (rssi_level >= 2)
|
||||
memmove(p_line + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
if (rssi_level >= 3)
|
||||
memmove(p_line + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
if (rssi_level >= 4)
|
||||
memmove(p_line + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
if (rssi_level >= 5)
|
||||
memmove(p_line + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
if (rssi_level >= 6)
|
||||
memmove(p_line + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
if (rssi_level >= 7)
|
||||
memmove(p_line + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
}
|
||||
else
|
||||
// untested !!!
|
||||
|
||||
if (rssi_level == 0)
|
||||
p_line = NULL;
|
||||
else
|
||||
UI_drawBars(p_line, rssi_level);
|
||||
|
||||
ST7565_DrawLine(0, Line, 23, p_line);
|
||||
#endif
|
||||
@@ -535,10 +543,12 @@ void UI_DisplayMain(void)
|
||||
if (attributes & MR_CH_SCANLIST2)
|
||||
memmove(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
||||
#ifndef ENABLE_BIG_FREQ
|
||||
#ifdef ENABLE_COMPANDER
|
||||
if ((attributes & MR_CH_COMPAND) > 0)
|
||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
#endif
|
||||
#else
|
||||
|
||||
// TODO: // find somewhere else to put the symbol
|
||||
|
||||
#endif
|
||||
|
||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||
@@ -605,7 +615,6 @@ void UI_DisplayMain(void)
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
// show the channel symbols
|
||||
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||
if ((attributes & MR_CH_COMPAND) > 0)
|
||||
@@ -614,7 +623,6 @@ void UI_DisplayMain(void)
|
||||
#else
|
||||
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,23 +650,7 @@ void UI_DisplayMain(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (Level >= 1)
|
||||
{
|
||||
uint8_t *p_line = p_line1 + LCD_WIDTH;
|
||||
memmove(p_line + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
if (Level >= 2)
|
||||
memmove(p_line + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
if (Level >= 3)
|
||||
memmove(p_line + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
if (Level >= 4)
|
||||
memmove(p_line + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
if (Level >= 5)
|
||||
memmove(p_line + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
if (Level >= 6)
|
||||
memmove(p_line + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
if (Level >= 7)
|
||||
memmove(p_line + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
}
|
||||
UI_drawBars(p_line1 + LCD_WIDTH, Level);
|
||||
}
|
||||
|
||||
// ************
|
||||
|
22
ui/menu.c
22
ui/menu.c
@@ -18,6 +18,7 @@
|
||||
#include <stdlib.h> // abs()
|
||||
|
||||
#include "app/dtmf.h"
|
||||
#include "app/menu.h"
|
||||
#include "bitmaps.h"
|
||||
#include "board.h"
|
||||
#include "dcs.h"
|
||||
@@ -61,9 +62,11 @@ const t_menu_item MenuList[] =
|
||||
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||
#ifdef ENABLE_VOX
|
||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||
#endif
|
||||
{"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||
{"BLT RX", VOICE_ID_INVALID, MENU_ABR_ON_RX },
|
||||
{"BLTTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
|
||||
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -79,9 +82,7 @@ const t_menu_item MenuList[] =
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||
#endif
|
||||
#ifdef ENABLE_COMPANDER
|
||||
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
||||
#endif
|
||||
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
||||
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||
@@ -290,15 +291,13 @@ const char gSubMenu_BACKLIGHT[8][7] =
|
||||
"ON"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
const char gSubMenu_Compand[4][6] =
|
||||
const char gSubMenu_RX_TX[4][6] =
|
||||
{
|
||||
"OFF",
|
||||
"TX",
|
||||
"RX",
|
||||
"TX/RX"
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
const char gSubMenu_AM_fix_test1[4][8] =
|
||||
@@ -557,12 +556,14 @@ void UI_DisplayMenu(void)
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
||||
@@ -583,16 +584,14 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
strcpy(String, gSubMenu_Compand[gSubMenuSelection]);
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
strcpy(String, gSubMenu_RX_TX[gSubMenuSelection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
#endif
|
||||
case MENU_ABR_ON_RX:
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_S_ADD1:
|
||||
@@ -787,8 +786,7 @@ void UI_DisplayMenu(void)
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
|
||||
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
|
||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
||||
writeXtalFreqCal(gSubMenuSelection, false);
|
||||
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
gSubMenuSelection,
|
||||
|
10
ui/menu.h
10
ui/menu.h
@@ -49,9 +49,11 @@ enum
|
||||
MENU_MEM_NAME,
|
||||
MENU_MDF,
|
||||
MENU_SAVE,
|
||||
#ifdef ENABLE_VOX
|
||||
MENU_VOX,
|
||||
#endif
|
||||
MENU_ABR,
|
||||
MENU_ABR_ON_RX,
|
||||
MENU_ABR_ON_TX_RX,
|
||||
MENU_TDR,
|
||||
MENU_BEEP,
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -67,9 +69,7 @@ enum
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
MENU_MIC_BAR,
|
||||
#endif
|
||||
#ifdef ENABLE_COMPANDER
|
||||
MENU_COMPAND,
|
||||
#endif
|
||||
MENU_1_CALL,
|
||||
MENU_S_LIST,
|
||||
MENU_SLIST1,
|
||||
@@ -145,9 +145,7 @@ extern const char gSubMenu_ROGER[3][9];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const char gSubMenu_Compand[4][6];
|
||||
#endif
|
||||
extern const char gSubMenu_RX_TX[4][6];
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
extern const char gSubMenu_AM_fix_test1[4][8];
|
||||
#endif
|
||||
|
@@ -131,6 +131,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
}
|
||||
x += sizeof(BITMAP_XB);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
// VOX indicator
|
||||
if (gEeprom.VOX_SWITCH || test_display)
|
||||
{
|
||||
@@ -138,6 +139,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x1 = x + sizeof(BITMAP_VOX);
|
||||
}
|
||||
x += sizeof(BITMAP_VOX);
|
||||
#endif
|
||||
|
||||
// KEY-LOCK indicator
|
||||
if (gEeprom.KEY_LOCK || test_display)
|
||||
|
@@ -93,6 +93,8 @@ void create_gain_table(const char *filename)
|
||||
mixer_dB[orig_mixer] +
|
||||
pga_dB[orig_pga];
|
||||
|
||||
#if 1
|
||||
// full table
|
||||
const uint8_t lna_short_min = 0; // 0
|
||||
const uint8_t lna_min = 0; // 0
|
||||
const uint8_t mixer_min = 0; // 0
|
||||
@@ -102,6 +104,18 @@ void create_gain_table(const char *filename)
|
||||
const uint8_t lna_max = 7; // 5
|
||||
const uint8_t mixer_max = 3; // 3
|
||||
const uint8_t pga_max = 7; // 7
|
||||
#else
|
||||
// just one register changes
|
||||
const uint8_t lna_short_min = 0;
|
||||
const uint8_t lna_min = 2;
|
||||
const uint8_t mixer_min = 3;
|
||||
const uint8_t pga_min = 6;
|
||||
|
||||
const uint8_t lna_short_max = 3;
|
||||
const uint8_t lna_max = 2;
|
||||
const uint8_t mixer_max = 3;
|
||||
const uint8_t pga_max = 6;
|
||||
#endif
|
||||
|
||||
uint8_t lna_short = lna_short_min;
|
||||
uint8_t lna = lna_min;
|
||||
@@ -244,8 +258,10 @@ void create_gain_table(const char *filename)
|
||||
return;
|
||||
|
||||
fprintf(file, "\n");
|
||||
fprintf(file, "\tconst t_am_fix_gain_table am_fix_gain_table[] =\n");
|
||||
fprintf(file, "\tstatic const t_am_fix_gain_table am_fix_gain_table[] =\n");
|
||||
fprintf(file, "\t{\n");
|
||||
|
||||
#if 0
|
||||
fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n");
|
||||
|
||||
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||
@@ -271,10 +287,61 @@ void create_gain_table(const char *filename)
|
||||
|
||||
fprintf(file, "%s\n", s);
|
||||
}
|
||||
#else
|
||||
{
|
||||
//BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
||||
|
||||
uint16_t reg_val;
|
||||
int16_t sum_dB;
|
||||
|
||||
reg_val = ((uint16_t)orig_lna_short << 8) | ((uint16_t)orig_lna << 5) | ((uint16_t)orig_mixer << 3) | ((uint16_t)orig_pga << 0);
|
||||
sum_dB = lna_short_dB[orig_lna_short] + lna_dB[orig_lna] + mixer_dB[orig_mixer] + pga_dB[orig_pga];
|
||||
fprintf(file, "\t\t{0x%04X, %-3d}, // 0 .. %u %u %u %u .. 0dB -14dB 0dB -3dB .. -17dB original\n\n",
|
||||
reg_val,
|
||||
sum_dB,
|
||||
orig_lna_short,
|
||||
orig_lna,
|
||||
orig_mixer,
|
||||
orig_pga);
|
||||
|
||||
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||
{
|
||||
char s[1024];
|
||||
|
||||
const t_gain_table entry = gain_table[i];
|
||||
|
||||
reg_val = ((uint16_t)entry.lna_short << 8) | ((uint16_t)entry.lna << 5) | ((uint16_t)entry.mixer << 3) | ((uint16_t)entry.pga << 0);
|
||||
sum_dB = lna_short_dB[entry.lna_short] + lna_dB[entry.lna] + mixer_dB[entry.mixer] + pga_dB[entry.pga];
|
||||
|
||||
sprintf(s, "\t\t{0x%04X, %-3d}, // %3u .. %u %u %u %u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
||||
reg_val,
|
||||
sum_dB,
|
||||
|
||||
1 + i,
|
||||
|
||||
entry.lna_short,
|
||||
entry.lna,
|
||||
entry.mixer,
|
||||
entry.pga,
|
||||
|
||||
entry.lna_short_dB,
|
||||
entry.lna_dB,
|
||||
entry.mixer_dB,
|
||||
entry.pga_dB,
|
||||
|
||||
entry.sum_dB);
|
||||
|
||||
if (i == original_index)
|
||||
strcat(s, " original");
|
||||
|
||||
fprintf(file, "%s\n", s);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
fprintf(file, "\t};\n\n");
|
||||
|
||||
fprintf(file, "\tconst unsigned int original_index = %u;\n", 1 + original_index);
|
||||
fprintf(file, "\tstatic const unsigned int original_index = %u;\n", 1 + original_index);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
BIN
utils/misc.exe
BIN
utils/misc.exe
Binary file not shown.
Reference in New Issue
Block a user