0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +03:00

Code clean ups + first part of channel squelch (not yet implemented)

This commit is contained in:
OneOfEleven 2023-10-19 19:00:57 +01:00
parent 75aa98cc06
commit 3bae9b5cdb
16 changed files with 245 additions and 244 deletions

View File

@ -39,7 +39,7 @@ ENABLE_FREQ_SEARCH_TIMEOUT := 0
ENABLE_CODE_SEARCH_TIMEOUT := 0 ENABLE_CODE_SEARCH_TIMEOUT := 0
ENABLE_KILL_REVIVE := 0 ENABLE_KILL_REVIVE := 0
ENABLE_AM_FIX := 1 ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0 ENABLE_AM_FIX_SHOW_DATA := 1
ENABLE_SQUELCH_MORE_SENSITIVE := 1 ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1
ENABLE_FASTER_CHANNEL_SCAN := 1 ENABLE_FASTER_CHANNEL_SCAN := 1
@ -55,11 +55,12 @@ ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1
TARGET = firmware TARGET = firmware
GIT_HASH_TMP := $(shell git rev-parse --short HEAD) GIT_HASH_TMP := $(shell git rev-parse --short HEAD)
ifeq ($(GIT_HASH_TMP),) ifeq ($(GIT_HASH_TMP), )
GIT_HASH := "NOGIT" GIT_HASH := "NOGIT"
else else
GIT_HASH := $(GIT_HASH_TMP) GIT_HASH := $(GIT_HASH_TMP)
endif endif
$(info GIT_HASH = $(GIT_HASH)) $(info GIT_HASH = $(GIT_HASH))
ifeq ($(ENABLE_UART), 0) ifeq ($(ENABLE_UART), 0)
@ -190,6 +191,8 @@ else
TOP := $(shell pwd) TOP := $(shell pwd)
endif endif
$(info TOP = $(TOP))
AS = arm-none-eabi-gcc AS = arm-none-eabi-gcc
CC = CC =
@ -410,10 +413,21 @@ LIBS =
DEPS = $(OBJS:.o=.d) DEPS = $(OBJS:.o=.d)
ifeq ($(OS), Windows_NT)
PYTHON = $(shell where python 2>NUL || where python3 2>NUL)
else
PYTHON = $(shell which python || which python3)
endif
all: $(TARGET) all: $(TARGET)
$(OBJCOPY) -O binary $< $<.bin $(OBJCOPY) -O binary $< $<.bin
-python fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
-python3 fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin $(info PYTHON = $(PYTHON))
# -python fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
# -python3 fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
-$(PYTHON) fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
$(SIZE) $< $(SIZE) $<
debug: debug:

View File

@ -549,7 +549,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
data[2] = false; // remove it data[2] = false; // remove it
} }
EEPROM_WriteBuffer(eeprom_addr, data); // 8 bytes at a time EEPROM_WriteBuffer8(eeprom_addr, data); // 8 bytes at a time
data += write_size / sizeof(data[0]); data += write_size / sizeof(data[0]);
eeprom_addr += write_size; eeprom_addr += write_size;
} }

View File

@ -115,7 +115,7 @@ void FM_EraseChannels(void)
memset(Template, 0xFF, sizeof(Template)); memset(Template, 0xFF, sizeof(Template));
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
EEPROM_WriteBuffer(0x0E40 + (i * 8), Template); EEPROM_WriteBuffer8(0x0E40 + (i * 8), Template);
memset(g_fm_channels, 0xFF, sizeof(g_fm_channels)); memset(g_fm_channels, 0xFF, sizeof(g_fm_channels));
} }

View File

@ -71,7 +71,7 @@
// //
EEPROM_ReadBuffer(0x1F88, &misc, 8); EEPROM_ReadBuffer(0x1F88, &misc, 8);
misc.BK4819_XtalFreqLow = value; misc.BK4819_XtalFreqLow = value;
EEPROM_WriteBuffer(0x1F88, &misc); EEPROM_WriteBuffer8(0x1F88, &misc);
} }
} }
#endif #endif
@ -103,6 +103,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
switch (Cursor) switch (Cursor)
{ {
case MENU_SQL: case MENU_SQL:
case MENU_CHAN_SQL:
*pMin = 0; *pMin = 0;
*pMax = 9; *pMax = 9;
break; break;
@ -389,7 +390,12 @@ void MENU_AcceptSetting(void)
case MENU_SQL: case MENU_SQL:
g_eeprom.squelch_level = g_sub_menu_selection; g_eeprom.squelch_level = g_sub_menu_selection;
g_vfo_configure_mode = VFO_CONFIGURE; g_vfo_configure_mode = VFO_CONFIGURE;
break;
case MENU_CHAN_SQL:
g_tx_vfo->squelch_level = g_sub_menu_selection;
g_vfo_configure_mode = VFO_CONFIGURE;
break; break;
case MENU_STEP: case MENU_STEP:
@ -855,12 +861,12 @@ void MENU_AcceptSetting(void)
g_battery_calibration[3] = g_sub_menu_selection; // 7.6V, ~29%, 3 bars above this value g_battery_calibration[3] = g_sub_menu_selection; // 7.6V, ~29%, 3 bars above this value
g_battery_calibration[4] = (788ul * g_sub_menu_selection) / 760; // 7.88V, ~65%, 4 bars above this value g_battery_calibration[4] = (788ul * g_sub_menu_selection) / 760; // 7.88V, ~65%, 4 bars above this value
g_battery_calibration[5] = 2300; g_battery_calibration[5] = 2300;
EEPROM_WriteBuffer(0x1F40, g_battery_calibration); EEPROM_WriteBuffer8(0x1F40, g_battery_calibration);
EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf)); EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
buf[0] = g_battery_calibration[4]; buf[0] = g_battery_calibration[4];
buf[1] = g_battery_calibration[5]; buf[1] = g_battery_calibration[5];
EEPROM_WriteBuffer(0x1F48, buf); EEPROM_WriteBuffer8(0x1F48, buf);
break; break;
} }
@ -934,6 +940,10 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.squelch_level; g_sub_menu_selection = g_eeprom.squelch_level;
break; break;
case MENU_CHAN_SQL:
g_sub_menu_selection = g_tx_vfo->squelch_level;
break;
case MENU_STEP: case MENU_STEP:
g_sub_menu_selection = FREQUENCY_get_step_index(STEP_FREQ_TABLE[g_tx_vfo->step_setting]); g_sub_menu_selection = FREQUENCY_get_step_index(STEP_FREQ_TABLE[g_tx_vfo->step_setting]);
break; break;

View File

@ -359,11 +359,11 @@ static void cmd_051D(const uint8_t *pBuffer)
#ifdef ENABLE_PWRON_PASSWORD #ifdef ENABLE_PWRON_PASSWORD
if ((Offset < 0x0E98 || Offset >= 0x0E9C) || !g_password_locked || pCmd->allow_password) if ((Offset < 0x0E98 || Offset >= 0x0E9C) || !g_password_locked || pCmd->allow_password)
EEPROM_WriteBuffer(Offset, data); EEPROM_WriteBuffer8(Offset, data);
#else #else
if (Offset == 0x0E98) if (Offset == 0x0E98)
memset(data, 0xff, 4); // wipe the password memset(data, 0xff, 4); // wipe the password
EEPROM_WriteBuffer(Offset, data); EEPROM_WriteBuffer8(Offset, data);
#endif #endif
} }

View File

@ -782,7 +782,7 @@ void BOARD_EEPROM_load(void)
uint8_t *p_aes = (uint8_t*)&g_custom_aes_key; uint8_t *p_aes = (uint8_t*)&g_custom_aes_key;
memset(p_aes, 0xff, sizeof(g_custom_aes_key)); memset(p_aes, 0xff, sizeof(g_custom_aes_key));
for (i = 0; i < sizeof(g_custom_aes_key); i += 8) for (i = 0; i < sizeof(g_custom_aes_key); i += 8)
EEPROM_WriteBuffer(0x0F30 + i, &p_aes[i]); EEPROM_WriteBuffer8(0x0F30 + i, &p_aes[i]);
g_has_custom_aes_key = false; g_has_custom_aes_key = false;
} }
#endif #endif
@ -977,7 +977,7 @@ void BOARD_FactoryReset(bool bIsAll)
)) ))
) )
{ {
EEPROM_WriteBuffer(i, Template); EEPROM_WriteBuffer8(i, Template);
} }
} }

View File

@ -22,22 +22,23 @@
void EEPROM_ReadBuffer(const uint16_t address, void *p_buffer, const unsigned int size) void EEPROM_ReadBuffer(const uint16_t address, void *p_buffer, const unsigned int size)
{ {
if (p_buffer == NULL || address >= 0x2000 || size == 0) if (p_buffer == NULL || (address + size) > 0x2000 || size == 0)
return; return;
I2C_Start(); I2C_Start();
I2C_Write(0xA0); I2C_Write(0xA0);
I2C_Write((address >> 8) & 0xFF); I2C_Write((address >> 8) & 0xFF);
I2C_Write((address >> 0) & 0xFF); I2C_Write((address >> 0) & 0xFF);
I2C_Start(); I2C_Start();
I2C_Write(0xA1); I2C_Write(0xA1);
I2C_ReadBuffer(p_buffer, size); I2C_ReadBuffer(p_buffer, size);
I2C_Stop(); I2C_Stop();
} }
void EEPROM_WriteBuffer(const uint16_t address, const void *p_buffer) void EEPROM_WriteBuffer8(const uint16_t address, const void *p_buffer)
{ {
if (p_buffer == NULL || address >= 0x2000) if (p_buffer == NULL || (address + 8) > 0x2000)
return; return;
#if 0 #if 0
@ -50,9 +51,12 @@ void EEPROM_WriteBuffer(const uint16_t address, const void *p_buffer)
I2C_WriteBuffer(p_buffer, 8); I2C_WriteBuffer(p_buffer, 8);
I2C_Stop(); I2C_Stop();
// give the EEPROM time to burn the data in (apparently takes 1.5ms ~ 5ms)
SYSTEM_DelayMs(6);
#else #else
// eeprom wear reduction // eeprom wear reduction
// only write the data IF it's different to what's already in eeprom // only write the data if it's different to what's already there
uint8_t buffer[8]; uint8_t buffer[8];
EEPROM_ReadBuffer(address, buffer, 8); EEPROM_ReadBuffer(address, buffer, 8);
@ -64,10 +68,10 @@ void EEPROM_WriteBuffer(const uint16_t address, const void *p_buffer)
I2C_Write((address >> 0) & 0xFF); I2C_Write((address >> 0) & 0xFF);
I2C_WriteBuffer(p_buffer, 8); I2C_WriteBuffer(p_buffer, 8);
I2C_Stop(); I2C_Stop();
// give the EEPROM time to burn the data in (apparently takes 1.5ms ~ 5ms)
SYSTEM_DelayMs(6);
} }
#endif #endif
// give the EEPROM time to burn the data in (apparently takes 5ms)
SYSTEM_DelayMs(8);
} }

View File

@ -20,7 +20,7 @@
#include <stdint.h> #include <stdint.h>
void EEPROM_ReadBuffer(const uint16_t address, void *p_buffer, const unsigned int size); void EEPROM_ReadBuffer(const uint16_t address, void *p_buffer, const unsigned int size);
void EEPROM_WriteBuffer(const uint16_t address, const void *p_buffer); void EEPROM_WriteBuffer8(const uint16_t address, const void *p_buffer);
#endif #endif

Binary file not shown.

Binary file not shown.

240
radio.c
View File

@ -148,6 +148,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
uint8_t Band; uint8_t Band;
uint16_t Base; uint16_t Base;
uint32_t Frequency; uint32_t Frequency;
vfo_info_t *p_vfo = &g_eeprom.vfo_info[VFO];
if (!g_setting_350_enable) if (!g_setting_350_enable)
{ {
@ -160,14 +161,14 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
Channel = g_eeprom.screen_channel[VFO]; Channel = g_eeprom.screen_channel[VFO];
g_eeprom.vfo_info[VFO].frequency_channel = 0xff; p_vfo->frequency_channel = 0xff;
if (IS_VALID_CHANNEL(Channel)) if (IS_VALID_CHANNEL(Channel))
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (Channel >= NOAA_CHANNEL_FIRST) if (Channel >= NOAA_CHANNEL_FIRST)
{ {
RADIO_InitInfo(&g_eeprom.vfo_info[VFO], g_eeprom.screen_channel[VFO], NOAA_FREQUENCY_TABLE[Channel - NOAA_CHANNEL_FIRST]); RADIO_InitInfo(p_vfo, g_eeprom.screen_channel[VFO], NOAA_FREQUENCY_TABLE[Channel - NOAA_CHANNEL_FIRST]);
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF)
return; return;
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF; g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
@ -208,7 +209,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
Index = Channel - FREQ_CHANNEL_FIRST; Index = Channel - FREQ_CHANNEL_FIRST;
RADIO_InitInfo(&g_eeprom.vfo_info[VFO], Channel, FREQ_BAND_TABLE[Index].lower); RADIO_InitInfo(p_vfo, Channel, FREQ_BAND_TABLE[Index].lower);
return; return;
} }
@ -217,165 +218,99 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
Band = BAND6_400MHz; Band = BAND6_400MHz;
if (Channel <= USER_CHANNEL_LAST) if (Channel <= USER_CHANNEL_LAST)
{ // user channel { // USER channel
g_eeprom.vfo_info[VFO].band = Band; p_vfo->band = Band;
g_eeprom.vfo_info[VFO].scanlist_2_participation = (Attributes & USER_CH_SCANLIST2) ? 1 : 0; p_vfo->scanlist_2_participation = (Attributes & USER_CH_SCANLIST2) ? 1 : 0;
g_eeprom.vfo_info[VFO].scanlist_1_participation = (Attributes & USER_CH_SCANLIST1) ? 1 : 0; p_vfo->scanlist_1_participation = (Attributes & USER_CH_SCANLIST1) ? 1 : 0;
} }
else else
if (IS_FREQ_CHANNEL(Channel)) if (IS_FREQ_CHANNEL(Channel))
{ // VFO channel { // VFO channel
Band = Channel - FREQ_CHANNEL_FIRST; Band = Channel - FREQ_CHANNEL_FIRST;
g_eeprom.vfo_info[VFO].band = Band; // shouldn't this be "Band / 2" ? .. two VFO's per band g_eeprom.vfo_info[VFO].band = Band; // shouldn't this be "Band / 2" ? .. two VFO's per band
#if 0 #if 0
g_eeprom.vfo_info[VFO].scanlist_2_participation = 1; p_vfo->scanlist_2_participation = 1;
g_eeprom.vfo_info[VFO].scanlist_1_participation = 1; p_vfo->scanlist_1_participation = 1;
#else #else
// allowing the vfo's to be included in the scanning // allowing the vfo's to be included in the scanning
g_eeprom.vfo_info[VFO].scanlist_2_participation = (Attributes & USER_CH_SCANLIST2) ? 1 : 0; p_vfo->scanlist_2_participation = (Attributes & USER_CH_SCANLIST2) ? 1 : 0;
g_eeprom.vfo_info[VFO].scanlist_1_participation = (Attributes & USER_CH_SCANLIST1) ? 1 : 0; p_vfo->scanlist_1_participation = (Attributes & USER_CH_SCANLIST1) ? 1 : 0;
#endif #endif
} }
g_eeprom.vfo_info[VFO].channel_save = Channel; p_vfo->channel_save = Channel;
if (Channel <= USER_CHANNEL_LAST) if (Channel <= USER_CHANNEL_LAST)
Base = Channel * 16; Base = Channel * 16;
else else
Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16); Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 16 * 2) + (VFO * 16); // VFO channel
if (configure == VFO_CONFIGURE_RELOAD || Channel >= FREQ_CHANNEL_FIRST) if (configure == VFO_CONFIGURE_RELOAD || IS_FREQ_CHANNEL(Channel))
{ {
uint8_t Tmp; t_channel m_channel;
uint8_t Data[8];
// t_channel channel;
// EEPROM_ReadBuffer(Base, channel, sizeof(channel)); EEPROM_ReadBuffer(Base, &m_channel, sizeof(m_channel));
// *************** p_vfo->freq_config_rx.frequency = m_channel.frequency;
p_vfo->tx_offset_freq = (m_channel.offset <= 100000000) ? m_channel.offset : 1000000;
p_vfo->tx_offset_freq_dir = (m_channel.tx_offset_dir <= TX_OFFSET_FREQ_DIR_SUB) ? m_channel.tx_offset_dir : TX_OFFSET_FREQ_DIR_OFF;
p_vfo->am_mode = m_channel.am_mode;
p_vfo->step_setting = (m_channel.step_setting < ARRAY_SIZE(STEP_FREQ_TABLE)) ? m_channel.step_setting : STEP_12_5kHz;
p_vfo->step_freq = STEP_FREQ_TABLE[p_vfo->step_setting];
p_vfo->scrambling_type = (m_channel.scrambler < ARRAY_SIZE(g_sub_MENU_SCRAMBLERAMBLER)) ? m_channel.scrambler : 0;
EEPROM_ReadBuffer(Base + 8, Data, sizeof(Data)); p_vfo->freq_config_rx.code_type = m_channel.rx_ctcss_cdcss_type;
switch (m_channel.rx_ctcss_cdcss_type)
g_eeprom.vfo_info[VFO].freq_config_rx.code_type = (Data[2] >> 0) & 0x0F;
g_eeprom.vfo_info[VFO].freq_config_tx.code_type = (Data[2] >> 4) & 0x0F;
Tmp = Data[3] & 0x0F;
if (Tmp > TX_OFFSET_FREQ_DIR_SUB)
Tmp = 0;
g_eeprom.vfo_info[VFO].tx_offset_freq_dir = Tmp;
g_eeprom.vfo_info[VFO].am_mode = (Data[3] >> 4) & 1u;
Tmp = Data[6];
if (Tmp >= ARRAY_SIZE(STEP_FREQ_TABLE))
Tmp = STEP_12_5kHz;
g_eeprom.vfo_info[VFO].step_setting = Tmp;
g_eeprom.vfo_info[VFO].step_freq = STEP_FREQ_TABLE[Tmp];
Tmp = Data[7];
if (Tmp > (ARRAY_SIZE(g_sub_MENU_SCRAMBLERAMBLER) - 1))
Tmp = 0;
g_eeprom.vfo_info[VFO].scrambling_type = Tmp;
Tmp = Data[0];
switch (g_eeprom.vfo_info[VFO].freq_config_rx.code_type)
{ {
default: default:
case CODE_TYPE_NONE: case CODE_TYPE_NONE:
g_eeprom.vfo_info[VFO].freq_config_rx.code_type = CODE_TYPE_NONE; p_vfo->freq_config_rx.code_type = CODE_TYPE_NONE;
Tmp = 0; p_vfo->freq_config_rx.code = 0;
break; break;
case CODE_TYPE_CONTINUOUS_TONE: case CODE_TYPE_CONTINUOUS_TONE:
if (Tmp > (ARRAY_SIZE(CTCSS_OPTIONS) - 1)) p_vfo->freq_config_rx.code = (m_channel.rx_ctcss_cdcss_code < ARRAY_SIZE(CTCSS_OPTIONS)) ? m_channel.rx_ctcss_cdcss_code : 0;
Tmp = 0;
break; break;
case CODE_TYPE_DIGITAL: case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL: case CODE_TYPE_REVERSE_DIGITAL:
if (Tmp > (ARRAY_SIZE(DCS_OPTIONS) - 1)) p_vfo->freq_config_rx.code = (m_channel.rx_ctcss_cdcss_code < ARRAY_SIZE(DCS_OPTIONS)) ? m_channel.rx_ctcss_cdcss_code : 0;
Tmp = 0;
break; break;
} }
g_eeprom.vfo_info[VFO].freq_config_rx.code = Tmp;
Tmp = Data[1]; p_vfo->freq_config_tx.code_type = m_channel.tx_ctcss_cdcss_type;
switch (g_eeprom.vfo_info[VFO].freq_config_tx.code_type) switch (m_channel.tx_ctcss_cdcss_type)
{ {
default: default:
case CODE_TYPE_NONE: case CODE_TYPE_NONE:
g_eeprom.vfo_info[VFO].freq_config_tx.code_type = CODE_TYPE_NONE; p_vfo->freq_config_tx.code_type = CODE_TYPE_NONE;
Tmp = 0; p_vfo->freq_config_tx.code = 0;
break; break;
case CODE_TYPE_CONTINUOUS_TONE: case CODE_TYPE_CONTINUOUS_TONE:
if (Tmp > (ARRAY_SIZE(CTCSS_OPTIONS) - 1)) p_vfo->freq_config_tx.code = (m_channel.tx_ctcss_cdcss_code < ARRAY_SIZE(CTCSS_OPTIONS)) ? m_channel.tx_ctcss_cdcss_code : 0;
Tmp = 0;
break; break;
case CODE_TYPE_DIGITAL: case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL: case CODE_TYPE_REVERSE_DIGITAL:
if (Tmp > (ARRAY_SIZE(DCS_OPTIONS) - 1)) p_vfo->freq_config_tx.code = (m_channel.tx_ctcss_cdcss_code < ARRAY_SIZE(DCS_OPTIONS)) ? m_channel.tx_ctcss_cdcss_code : 0;
Tmp = 0;
break; break;
} }
g_eeprom.vfo_info[VFO].freq_config_tx.code = Tmp;
if (Data[4] == 0xFF) p_vfo->frequency_reverse = m_channel.frequency_reverse ? true : false;
{ p_vfo->channel_bandwidth = m_channel.channel_bandwidth ? true : false;
g_eeprom.vfo_info[VFO].frequency_reverse = false; p_vfo->output_power = m_channel.tx_power;
g_eeprom.vfo_info[VFO].channel_bandwidth = BK4819_FILTER_BW_WIDE; p_vfo->busy_channel_lock = m_channel.busy_channel_lock ? true : false;
g_eeprom.vfo_info[VFO].output_power = OUTPUT_POWER_LOW; p_vfo->compand = m_channel.compand;
g_eeprom.vfo_info[VFO].busy_channel_lock = false;
g_eeprom.vfo_info[VFO].compand = 0;
}
else
{
const uint8_t d4 = Data[4];
g_eeprom.vfo_info[VFO].frequency_reverse = ((d4 >> 0) & 1u) ? true : false;
g_eeprom.vfo_info[VFO].channel_bandwidth = ((d4 >> 1) & 1u) ? true : false;
g_eeprom.vfo_info[VFO].output_power = (d4 >> 2) & 3u;
g_eeprom.vfo_info[VFO].busy_channel_lock = ((d4 >> 4) & 1u) ? true : false;
g_eeprom.vfo_info[VFO].compand = (d4 >> 6) & 3u;
}
if (Data[5] == 0xFF) p_vfo->dtmf_decoding_enable = m_channel.dtmf_decoding_enable ? true : false;
{ p_vfo->dtmf_ptt_id_tx_mode = m_channel.dtmf_ptt_id_tx_mode;
g_eeprom.vfo_info[VFO].dtmf_decoding_enable = false;
g_eeprom.vfo_info[VFO].dtmf_ptt_id_tx_mode = PTT_ID_OFF;
}
else
{
g_eeprom.vfo_info[VFO].dtmf_decoding_enable = ((Data[5] >> 0) & 1u) ? true : false;
g_eeprom.vfo_info[VFO].dtmf_ptt_id_tx_mode = ((Data[5] >> 1) & 7u);
}
// *************** p_vfo->squelch_level = (m_channel.squelch_level < 10) ? m_channel.squelch_level : 0;
struct
{
uint32_t frequency;
uint32_t offset;
} __attribute__((packed)) info;
EEPROM_ReadBuffer(Base, &info, sizeof(info));
g_eeprom.vfo_info[VFO].freq_config_rx.frequency = info.frequency;
if (info.offset >= 100000000)
info.offset = 1000000;
g_eeprom.vfo_info[VFO].tx_offset_freq = info.offset;
// ***************
} }
Frequency = g_eeprom.vfo_info[VFO].freq_config_rx.frequency; Frequency = p_vfo->freq_config_rx.frequency;
#if 1 #if 1
// fix previously maybe incorrect set band // fix previously maybe incorrect set band
Band = FREQUENCY_GetBand(Frequency); Band = FREQUENCY_GetBand(Frequency);
g_eeprom.vfo_info[VFO].band = Band; p_vfo->band = Band;
#endif #endif
if (Frequency < FREQ_BAND_TABLE[Band].lower) if (Frequency < FREQ_BAND_TABLE[Band].lower)
@ -385,66 +320,79 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
Frequency = FREQ_BAND_TABLE[Band].upper; Frequency = FREQ_BAND_TABLE[Band].upper;
else else
if (Channel >= FREQ_CHANNEL_FIRST) if (Channel >= FREQ_CHANNEL_FIRST)
Frequency = FREQUENCY_FloorToStep(Frequency, g_eeprom.vfo_info[VFO].step_freq, FREQ_BAND_TABLE[Band].lower); Frequency = FREQUENCY_FloorToStep(Frequency, p_vfo->step_freq, FREQ_BAND_TABLE[Band].lower);
g_eeprom.vfo_info[VFO].freq_config_rx.frequency = Frequency; if (!g_setting_350_enable && Frequency >= 35000000 && Frequency < 40000000)
{ // 350~400Mhz not allowed
// hop onto the euro ham band
Frequency = 43350000;
p_vfo->freq_config_rx.frequency = Frequency;
p_vfo->freq_config_tx.frequency = Frequency;
Band = FREQUENCY_GetBand(Frequency);
p_vfo->band = Band;
p_vfo->frequency_reverse = 0;
p_vfo->tx_offset_freq_dir = TX_OFFSET_FREQ_DIR_OFF;
p_vfo->tx_offset_freq = 0;
}
p_vfo->freq_config_rx.frequency = Frequency;
if (Frequency >= 10800000 && Frequency < 13600000) if (Frequency >= 10800000 && Frequency < 13600000)
g_eeprom.vfo_info[VFO].tx_offset_freq_dir = TX_OFFSET_FREQ_DIR_OFF; // air band { // air band
p_vfo->tx_offset_freq_dir = TX_OFFSET_FREQ_DIR_OFF;
p_vfo->tx_offset_freq = 0;
}
else else
if (Channel > USER_CHANNEL_LAST) if (Channel > USER_CHANNEL_LAST)
g_eeprom.vfo_info[VFO].tx_offset_freq = FREQUENCY_FloorToStep(g_eeprom.vfo_info[VFO].tx_offset_freq, g_eeprom.vfo_info[VFO].step_freq, 0); {
p_vfo->tx_offset_freq = FREQUENCY_FloorToStep(p_vfo->tx_offset_freq, p_vfo->step_freq, 0);
if (IS_FREQ_CHANNEL(Channel))
g_eeprom.vfo_info[VFO].frequency_channel = BOARD_find_channel(Frequency); // remember if a channel has this frequency
RADIO_ApplyOffset(&g_eeprom.vfo_info[VFO]);
memset(g_eeprom.vfo_info[VFO].name, 0, sizeof(g_eeprom.vfo_info[VFO].name));
if (Channel <= USER_CHANNEL_LAST)
{ // only 10 bytes used
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), g_eeprom.vfo_info[VFO].name, 10);
} }
if (!g_eeprom.vfo_info[VFO].frequency_reverse) RADIO_ApplyOffset(p_vfo);
// channel name
memset(p_vfo->name, 0, sizeof(p_vfo->name));
if (Channel <= USER_CHANNEL_LAST)
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), p_vfo->name, 10); // only 10 bytes used
if (!p_vfo->frequency_reverse)
{ {
g_eeprom.vfo_info[VFO].p_rx = &g_eeprom.vfo_info[VFO].freq_config_rx; p_vfo->p_rx = &p_vfo->freq_config_rx;
g_eeprom.vfo_info[VFO].p_tx = &g_eeprom.vfo_info[VFO].freq_config_tx; p_vfo->p_tx = &p_vfo->freq_config_tx;
} }
else else
{ {
g_eeprom.vfo_info[VFO].p_rx = &g_eeprom.vfo_info[VFO].freq_config_tx; p_vfo->p_rx = &p_vfo->freq_config_tx;
g_eeprom.vfo_info[VFO].p_tx = &g_eeprom.vfo_info[VFO].freq_config_rx; p_vfo->p_tx = &p_vfo->freq_config_rx;
} }
if (!g_setting_350_enable) if (p_vfo->am_mode)
{
freq_config_t *pConfig = g_eeprom.vfo_info[VFO].p_rx;
if (pConfig->frequency >= 35000000 && pConfig->frequency < 40000000) // not allowed in this range
pConfig->frequency = 43300000; // hop onto the ham band
}
if (g_eeprom.vfo_info[VFO].am_mode)
{ // freq/chan is in AM mode { // freq/chan is in AM mode
g_eeprom.vfo_info[VFO].scrambling_type = 0; // disable stuff, even though it can all still be used with AM ???
// g_eeprom.vfo_info[VFO].dtmf_decoding_enable = false; // no reason to disable DTMF decoding, aircraft use it on SSB p_vfo->scrambling_type = 0;
g_eeprom.vfo_info[VFO].freq_config_rx.code_type = CODE_TYPE_NONE; // p_vfo->dtmf_decoding_enable = false;
g_eeprom.vfo_info[VFO].freq_config_tx.code_type = CODE_TYPE_NONE; p_vfo->freq_config_rx.code_type = CODE_TYPE_NONE;
p_vfo->freq_config_tx.code_type = CODE_TYPE_NONE;
} }
RADIO_ConfigureSquelchAndOutputPower(&g_eeprom.vfo_info[VFO]); RADIO_ConfigureSquelchAndOutputPower(p_vfo);
if (IS_FREQ_CHANNEL(Channel))
p_vfo->frequency_channel = BOARD_find_channel(Frequency); // remember if a channel has this frequency
} }
void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo) void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo)
{ {
uint8_t TX_power[3]; uint8_t TX_power[3];
uint16_t Base;
frequency_band_t Band; frequency_band_t Band;
// ******************************* // *******************************
// squelch // squelch
Band = FREQUENCY_GetBand(pInfo->p_rx->frequency); Band = FREQUENCY_GetBand(pInfo->p_rx->frequency);
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00; Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values // note that 'noise' and 'glitch' values are inverted compared to 'rssi' values

View File

@ -84,6 +84,8 @@ typedef struct vfo_info_t
uint8_t tx_offset_freq_dir; uint8_t tx_offset_freq_dir;
uint8_t squelch_level; // per channel squelch level
uint8_t squelch_open_rssi_thresh; uint8_t squelch_open_rssi_thresh;
uint8_t squelch_open_noise_thresh; uint8_t squelch_open_noise_thresh;
uint8_t squelch_close_glitch_thresh; uint8_t squelch_close_glitch_thresh;

View File

@ -44,10 +44,10 @@ eeprom_config_t g_eeprom;
state.frequency = g_eeprom.fm_selected_frequency; state.frequency = g_eeprom.fm_selected_frequency;
state.is_channel_selected = g_eeprom.fm_is_channel_mode; state.is_channel_selected = g_eeprom.fm_is_channel_mode;
EEPROM_WriteBuffer(0x0E88, &state); EEPROM_WriteBuffer8(0x0E88, &state);
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
EEPROM_WriteBuffer(0x0E40 + (i * 8), &g_fm_channels[i * 4]); EEPROM_WriteBuffer8(0x0E40 + (i * 8), &g_fm_channels[i * 4]);
} }
#endif #endif
@ -70,7 +70,7 @@ void SETTINGS_save_vfo_indices(void)
State[7] = g_eeprom.noaa_channel[1]; State[7] = g_eeprom.noaa_channel[1];
#endif #endif
EEPROM_WriteBuffer(0x0E80, State); EEPROM_WriteBuffer8(0x0E80, State);
} }
// ************************************************* // *************************************************
@ -178,8 +178,8 @@ void SETTINGS_restore_calibration(void)
while (index < sizeof(calib2)) while (index < sizeof(calib2))
{ {
const unsigned int addr = 0x1E00 + index; const unsigned int addr = 0x1E00 + index;
EEPROM_WriteBuffer(addr, &calib2[index]); EEPROM_WriteBuffer8(addr, &calib2[index]);
// EEPROM_WriteBuffer(addr, buf); // EEPROM_WriteBuffer8(addr, buf);
index += 8; index += 8;
} }
} }
@ -209,7 +209,7 @@ void SETTINGS_save(void)
State[6] = 0; State[6] = 0;
#endif #endif
State[7] = g_eeprom.mic_sensitivity; State[7] = g_eeprom.mic_sensitivity;
EEPROM_WriteBuffer(0x0E70, State); EEPROM_WriteBuffer8(0x0E70, State);
#ifdef ENABLE_CONTRAST #ifdef ENABLE_CONTRAST
State[0] = g_setting_contrast; State[0] = g_setting_contrast;
@ -223,7 +223,7 @@ void SETTINGS_save(void)
State[5] = g_eeprom.backlight; State[5] = g_eeprom.backlight;
State[6] = g_eeprom.tail_note_elimination; State[6] = g_eeprom.tail_note_elimination;
State[7] = g_eeprom.vfo_open; State[7] = g_eeprom.vfo_open;
EEPROM_WriteBuffer(0x0E78, State); EEPROM_WriteBuffer8(0x0E78, State);
State[0] = g_eeprom.beep_control; State[0] = g_eeprom.beep_control;
State[1] = g_eeprom.key1_short_press_action; State[1] = g_eeprom.key1_short_press_action;
@ -233,7 +233,7 @@ void SETTINGS_save(void)
State[5] = g_eeprom.scan_resume_mode; State[5] = g_eeprom.scan_resume_mode;
State[6] = g_eeprom.auto_keypad_lock; State[6] = g_eeprom.auto_keypad_lock;
State[7] = g_eeprom.pwr_on_display_mode; State[7] = g_eeprom.pwr_on_display_mode;
EEPROM_WriteBuffer(0x0E90, State); EEPROM_WriteBuffer8(0x0E90, State);
{ {
struct { struct {
@ -246,13 +246,13 @@ void SETTINGS_save(void)
array.password = g_eeprom.power_on_password; array.password = g_eeprom.power_on_password;
#endif #endif
EEPROM_WriteBuffer(0x0E98, &array); EEPROM_WriteBuffer8(0x0E98, &array);
} }
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
State[0] = g_eeprom.voice_prompt; State[0] = g_eeprom.voice_prompt;
EEPROM_WriteBuffer(0x0EA0, State); EEPROM_WriteBuffer8(0x0EA0, State);
#endif #endif
// ***************************** // *****************************
@ -281,7 +281,7 @@ void SETTINGS_save(void)
array.air_copy_freq = g_aircopy_freq; array.air_copy_freq = g_aircopy_freq;
#endif #endif
EEPROM_WriteBuffer(0x0EA8, &array); EEPROM_WriteBuffer8(0x0EA8, &array);
} }
State[0] = g_eeprom.dtmf_side_tone; State[0] = g_eeprom.dtmf_side_tone;
@ -292,13 +292,13 @@ void SETTINGS_save(void)
State[5] = g_eeprom.dtmf_preload_time / 10U; State[5] = g_eeprom.dtmf_preload_time / 10U;
State[6] = g_eeprom.dtmf_first_code_persist_time / 10U; State[6] = g_eeprom.dtmf_first_code_persist_time / 10U;
State[7] = g_eeprom.dtmf_hash_code_persist_time / 10U; State[7] = g_eeprom.dtmf_hash_code_persist_time / 10U;
EEPROM_WriteBuffer(0x0ED0, State); EEPROM_WriteBuffer8(0x0ED0, State);
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
State[0] = g_eeprom.dtmf_code_persist_time / 10U; State[0] = g_eeprom.dtmf_code_persist_time / 10U;
State[1] = g_eeprom.dtmf_code_interval_time / 10U; State[1] = g_eeprom.dtmf_code_interval_time / 10U;
State[2] = g_eeprom.permit_remote_kill; State[2] = g_eeprom.permit_remote_kill;
EEPROM_WriteBuffer(0x0ED8, State); EEPROM_WriteBuffer8(0x0ED8, State);
State[0] = g_eeprom.scan_list_default; State[0] = g_eeprom.scan_list_default;
State[1] = g_eeprom.scan_list_enabled[0]; State[1] = g_eeprom.scan_list_enabled[0];
@ -308,7 +308,7 @@ void SETTINGS_save(void)
State[5] = g_eeprom.scan_list_priority_ch1[1]; State[5] = g_eeprom.scan_list_priority_ch1[1];
State[6] = g_eeprom.scan_list_priority_ch2[1]; State[6] = g_eeprom.scan_list_priority_ch2[1];
State[7] = 0xFF; State[7] = 0xFF;
EEPROM_WriteBuffer(0x0F18, State); EEPROM_WriteBuffer8(0x0F18, State);
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
State[0] = g_setting_freq_lock; State[0] = g_setting_freq_lock;
@ -335,79 +335,85 @@ void SETTINGS_save(void)
if (!g_setting_am_fix) State[7] &= ~(1u << 5); if (!g_setting_am_fix) State[7] &= ~(1u << 5);
#endif #endif
State[7] = (State[7] & ~(3u << 6)) | ((g_setting_backlight_on_tx_rx & 3u) << 6); State[7] = (State[7] & ~(3u << 6)) | ((g_setting_backlight_on_tx_rx & 3u) << 6);
EEPROM_WriteBuffer(0x0F40, State); EEPROM_WriteBuffer8(0x0F40, State);
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
State[0] = g_eeprom.scan_hold_time_500ms; State[0] = g_eeprom.scan_hold_time_500ms;
EEPROM_WriteBuffer(0x0F48, State); EEPROM_WriteBuffer8(0x0F48, State);
} }
void SETTINGS_save_channel(const uint8_t channel, const uint8_t vfo, const vfo_info_t *p_vfo, const uint8_t mode) void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, const vfo_info_t *p_vfo, const unsigned int mode)
{ {
const uint16_t offset_mem = channel * 16; unsigned int eeprom_addr = channel * 16;
uint16_t offset_vfo = offset_mem; t_channel m_channel;
uint8_t state[16];
// t_channel channel_data;
if (p_vfo == NULL || IS_NOAA_CHANNEL(channel)) if (p_vfo == NULL || IS_NOAA_CHANNEL(channel))
return; return;
if (IS_FREQ_CHANNEL(channel))
{ // it's a VFO
offset_vfo = (vfo == 0) ? 0x0C80 : 0x0C90;
offset_vfo += (channel - FREQ_CHANNEL_FIRST) * 16 * 2;
}
if (mode < 2 && channel <= USER_CHANNEL_LAST) if (mode < 2 && channel <= USER_CHANNEL_LAST)
return; return;
if (IS_FREQ_CHANNEL(channel))
eeprom_addr = 0x0C80 + (16 * vfo) + ((channel - FREQ_CHANNEL_FIRST) * 16 * 2); // a VFO
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("sav_chan %u %u %u\r\n", channel, vfo, mode); // UART_printf("sav_chan %04X %3u %u %u\r\n", eeprom_addr, channel, vfo, mode);
#endif #endif
((uint32_t *)state)[0] = p_vfo->freq_config_rx.frequency; memset(&m_channel, 0, sizeof(m_channel));
((uint32_t *)state)[1] = p_vfo->tx_offset_freq; m_channel.frequency = p_vfo->freq_config_rx.frequency;
EEPROM_WriteBuffer(offset_vfo, state); m_channel.offset = p_vfo->tx_offset_freq;
m_channel.rx_ctcss_cdcss_code = p_vfo->freq_config_rx.code;
m_channel.tx_ctcss_cdcss_code = p_vfo->freq_config_tx.code;
m_channel.rx_ctcss_cdcss_type = p_vfo->freq_config_rx.code_type;
// m_channel.unused1:2
m_channel.tx_ctcss_cdcss_type = p_vfo->freq_config_tx.code_type;
// m_channel.unused2:2
m_channel.tx_offset_dir = p_vfo->tx_offset_freq_dir;
// m_channel.unused3:2
m_channel.am_mode = p_vfo->am_mode & 1u;
// m_channel.unused4:3
m_channel.frequency_reverse = p_vfo->frequency_reverse;
m_channel.channel_bandwidth = p_vfo->channel_bandwidth;
m_channel.tx_power = p_vfo->output_power;
m_channel.busy_channel_lock = p_vfo->busy_channel_lock;
// m_channel.unused5:1
m_channel.compand = p_vfo->compand;
m_channel.dtmf_decoding_enable = p_vfo->dtmf_decoding_enable;
m_channel.dtmf_ptt_id_tx_mode = p_vfo->dtmf_ptt_id_tx_mode;
// m_channel.unused6:4
m_channel.step_setting = p_vfo->step_setting;
m_channel.scrambler = p_vfo->scrambling_type;
m_channel.squelch_level = 0;
state[0] = p_vfo->freq_config_rx.code; EEPROM_WriteBuffer8(eeprom_addr + 0, (uint8_t *)(&m_channel) + 0);
state[1] = p_vfo->freq_config_tx.code; EEPROM_WriteBuffer8(eeprom_addr + 8, (uint8_t *)(&m_channel) + 8);
state[2] = (p_vfo->freq_config_tx.code_type << 4) | p_vfo->freq_config_rx.code_type;
state[3] = ((p_vfo->am_mode & 1u) << 4) | p_vfo->tx_offset_freq_dir;
state[4] =
((p_vfo->compand & 3u) << 6) |
((p_vfo->busy_channel_lock & 3u) << 4) |
((p_vfo->output_power & 1u) << 2) |
((p_vfo->channel_bandwidth & 1u) << 1) |
((p_vfo->frequency_reverse & 1u) << 0);
state[5] = ((p_vfo->dtmf_ptt_id_tx_mode & 7u) << 1) | ((p_vfo->dtmf_decoding_enable & 1u) << 0);
state[6] = p_vfo->step_setting;
state[7] = p_vfo->scrambling_type;
EEPROM_WriteBuffer(offset_vfo + 8, state);
SETTINGS_save_chan_attribs_name(channel, p_vfo); SETTINGS_save_chan_attribs_name(channel, p_vfo);
if (channel > USER_CHANNEL_LAST) if (channel <= USER_CHANNEL_LAST)
return; // it's not a user memory channel { // user channel, it has a channel name
const unsigned int eeprom_addr = 0x0F50 + (channel * 16);
uint8_t name[16];
#ifndef ENABLE_KEEP_MEM_NAME memset(name, 0, sizeof(name));
{ // clear/reset the channel name
memset(&state, 0, sizeof(state)); #ifndef ENABLE_KEEP_MEM_NAME
EEPROM_WriteBuffer(0x0F50 + 0 + offset_mem, state + 0); // clear/reset the channel name
EEPROM_WriteBuffer(0x0F50 + 8 + offset_mem, state + 8); EEPROM_WriteBuffer8(eeprom_addr + 0, name + 0);
EEPROM_WriteBuffer8(eeprom_addr + 8, name + 8);
#else
if (mode >= 3)
{ // save the channel name
memmove(name, p_vfo->name, 10);
EEPROM_WriteBuffer8(eeprom_addr + 0, name + 0);
EEPROM_WriteBuffer8(eeprom_addr + 8, name + 8);
}
#endif
} }
#else
if (mode >= 3)
{ // save the channel name
memset(state, 0, sizeof(state));
memmove(state, p_vfo->name, 10);
EEPROM_WriteBuffer(0x0F50 + 0 + offset_mem, state + 0);
EEPROM_WriteBuffer(0x0F50 + 8 + offset_mem, state + 8);
}
#endif
} }
void SETTINGS_save_chan_attribs_name(const uint8_t channel, const vfo_info_t *p_vfo) void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_t *p_vfo)
{ {
if (p_vfo == NULL || channel >= ARRAY_SIZE(g_user_channel_attributes)) if (p_vfo == NULL || channel >= ARRAY_SIZE(g_user_channel_attributes))
return; return;
@ -425,7 +431,7 @@ void SETTINGS_save_chan_attribs_name(const uint8_t channel, const vfo_info_t *p_
const unsigned int index = channel & ~7u; // eeprom writes are always 8 bytes in length const unsigned int index = channel & ~7u; // eeprom writes are always 8 bytes in length
g_user_channel_attributes[channel] = attribs; // remember new attributes g_user_channel_attributes[channel] = attribs; // remember new attributes
EEPROM_WriteBuffer(0x0D60 + index, g_user_channel_attributes + index); EEPROM_WriteBuffer8(0x0D60 + index, g_user_channel_attributes + index);
} }
if (channel <= USER_CHANNEL_LAST) if (channel <= USER_CHANNEL_LAST)
@ -436,7 +442,7 @@ void SETTINGS_save_chan_attribs_name(const uint8_t channel, const vfo_info_t *p_
memset(name, 0, sizeof(name)); memset(name, 0, sizeof(name));
memmove(name, p_vfo->name, 10); memmove(name, p_vfo->name, 10);
EEPROM_WriteBuffer(0x0F50 + 0 + index, name + 0); EEPROM_WriteBuffer8(0x0F50 + 0 + index, name + 0);
EEPROM_WriteBuffer(0x0F50 + 8 + index, name + 8); EEPROM_WriteBuffer8(0x0F50 + 8 + index, name + 8);
} }
} }

View File

@ -158,8 +158,10 @@ typedef struct {
uint8_t tx_power:2; // 0, 1 or 2 .. L, M or H uint8_t tx_power:2; // 0, 1 or 2 .. L, M or H
uint8_t busy_channel_lock:1; // uint8_t busy_channel_lock:1; //
#if 0 #if 0
// QS
uint8_t unused5:3; // uint8_t unused5:3; //
#else #else
// 1of11
uint8_t unused5:1; // uint8_t unused5:1; //
uint8_t compand:2; // 0 = off, 1 = TX, 2 = RX, 3 = TX/RX uint8_t compand:2; // 0 = off, 1 = TX, 2 = RX, 3 = TX/RX
#endif #endif
@ -168,11 +170,16 @@ typedef struct {
uint8_t dtmf_ptt_id_tx_mode:3; // uint8_t dtmf_ptt_id_tx_mode:3; //
uint8_t unused6:4; // uint8_t unused6:4; //
// [14] // [14]
uint8_t step_setting:3; // uint8_t step_setting; //
uint8_t unused7:5; //
// [15] // [15]
uint8_t scrambler:4; // uint8_t scrambler:4; //
uint8_t unused8:4; // #if 0
// QS
uint8_t unused7:4; //
#else
// 1of11
uint8_t squelch_level:4; // 0 ~ 9 per channel squelch, 0 = use main squelch level
#endif
} __attribute__((packed)) t_channel; // } __attribute__((packed)) t_channel; //
// 512 bytes // 512 bytes
@ -564,7 +571,7 @@ extern eeprom_config_t g_eeprom;
void SETTINGS_save_vfo_indices(void); void SETTINGS_save_vfo_indices(void);
//void SETTINGS_restore_calibration(void); //void SETTINGS_restore_calibration(void);
void SETTINGS_save(void); void SETTINGS_save(void);
void SETTINGS_save_channel(const uint8_t channel, const uint8_t vfo, const vfo_info_t *p_vfo, const uint8_t mode); void SETTINGS_save_channel(const unsigned int channel, const unsigned int vfo, const vfo_info_t *p_vfo, const unsigned int mode);
void SETTINGS_save_chan_attribs_name(const uint8_t channel, const vfo_info_t *p_vfo); void SETTINGS_save_chan_attribs_name(const unsigned int channel, const vfo_info_t *p_vfo);
#endif #endif

View File

@ -48,6 +48,7 @@ const t_menu_item g_menu_list[] =
// text, voice ID, menu ID // text, voice ID, menu ID
{"SQL", VOICE_ID_SQUELCH, MENU_SQL }, {"SQL", VOICE_ID_SQUELCH, MENU_SQL },
{"CH SQL", VOICE_ID_SQUELCH, MENU_CHAN_SQL },
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP }, {"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_BANDWIDTH }, {"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_BANDWIDTH },
{"Tx PWR", VOICE_ID_POWER, MENU_TX_POWER }, // was "TXP" {"Tx PWR", VOICE_ID_POWER, MENU_TX_POWER }, // was "TXP"
@ -538,7 +539,15 @@ void UI_DisplayMenu(void)
switch (g_menu_cursor) switch (g_menu_cursor)
{ {
case MENU_SQL: case MENU_SQL:
sprintf(String, "%d", g_sub_menu_selection); strcpy(String, "MAIN SQL\n");
sprintf(String + strlen(String), "%d\n ", g_sub_menu_selection);
break;
case MENU_CHAN_SQL:
if (g_sub_menu_selection == 0)
strcpy(String, "USE\nMAIN SQL");
else
sprintf(String, "%d\n ", g_sub_menu_selection);
break; break;
case MENU_MIC_GAIN: case MENU_MIC_GAIN:

View File

@ -41,6 +41,7 @@ enum
// ************************************ // ************************************
MENU_SQL = 0, MENU_SQL = 0,
MENU_CHAN_SQL,
MENU_STEP, MENU_STEP,
MENU_BANDWIDTH, MENU_BANDWIDTH,
MENU_TX_POWER, MENU_TX_POWER,