diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4c75cb3..3ac06dd 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -20,25 +20,23 @@ - - - + - + - - - + + + + + - - - - + + + - @@ -323,6 +328,7 @@ - \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 717986f..3420dff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -816,4 +816,4 @@ add_executable(uv_k5_firmware_custom_0_17 sram-overlay.c sram-overlay.h version.c - version.h chinese.h app/mdc1200.c app/mdc1200.c) + version.h chinese.h app/mdc1200.c app/mdc1200.c app/mdc1200.c) diff --git a/Makefile b/Makefile index 1a761df..79d8a93 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ ENABLE_TX_WHEN_AM := 0 ENABLE_F_CAL_MENU := 0 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0 ENABLE_BOOT_BEEPS := 0 -ENABLE_SHOW_CHARGE_LEVEL := 1 +ENABLE_SHOW_CHARGE_LEVEL := 0 ENABLE_REVERSE_BAT_SYMBOL := 0 ENABLE_NO_CODE_SCAN_TIMEOUT := 1 ENABLE_AM_FIX := 1 diff --git a/app/action.c b/app/action.c index 5f49aad..75b4406 100644 --- a/app/action.c +++ b/app/action.c @@ -396,6 +396,9 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) default: case ACTION_OPT_WIDTH: gTxVfo->CHANNEL_BANDWIDTH=!gTxVfo->CHANNEL_BANDWIDTH; + gRequestSaveChannel = 1; + // gRequestSaveSettings = 1; + break; case ACTION_OPT_NONE: break; diff --git a/app/app.c b/app/app.c index 2797584..26eca4a 100644 --- a/app/app.c +++ b/app/app.c @@ -15,7 +15,7 @@ */ #include - +#include "mdc1200.h" #include "app/action.h" #ifdef ENABLE_AIRCOPY #include "app/aircopy.h" @@ -743,6 +743,9 @@ static void CheckRadioInterrupts(void) g_FSK_Buffer[gFSKWriteIndex++] = BK4819_ReadRegister(BK4819_REG_5F); AIRCOPY_StorePacket(); } +#endif +#ifdef ENABLE_MDC1200 + MDC1200_process_rx(interrupt_status_bits); #endif } } diff --git a/app/dtmf.c b/app/dtmf.c index 91bd215..96ae9cd 100644 --- a/app/dtmf.c +++ b/app/dtmf.c @@ -393,7 +393,7 @@ void DTMF_HandleRequest(void) } #endif -void DTMF_Reply(void) +bool DTMF_Reply() { uint16_t Delay; #ifdef ENABLE_DTMF_CALLING @@ -438,7 +438,7 @@ gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN) { gDTMF_ReplyState = DTMF_REPLY_NONE; - return; + return false; } // send TX-UP DTMF @@ -449,7 +449,7 @@ gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN) gDTMF_ReplyState = DTMF_REPLY_NONE; if (pString == NULL) - return; + return false; Delay = (gEeprom.DTMF_PRELOAD_TIME < 200) ? 200 : gEeprom.DTMF_PRELOAD_TIME; @@ -476,4 +476,6 @@ gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN) gEnableSpeaker = false; BK4819_ExitDTMF_TX(false); + return true; + } \ No newline at end of file diff --git a/app/dtmf.h b/app/dtmf.h index f72f038..cbcf9e9 100644 --- a/app/dtmf.h +++ b/app/dtmf.h @@ -104,7 +104,7 @@ bool DTMF_ValidateCodes(char *pCode, const unsigned int size); char DTMF_GetCharacter(const unsigned int code); void DTMF_clear_input_box(void); void DTMF_Append(const char vode); -void DTMF_Reply(void); +bool DTMF_Reply(); #ifdef ENABLE_DTMF_CALLING void DTMF_clear_RX(void); diff --git a/app/main.c b/app/main.c index f53368c..4e7a219 100644 --- a/app/main.c +++ b/app/main.c @@ -544,6 +544,8 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) { { gWasFKeyPressed=false; gEeprom.BEEP_CONTROL=!gEeprom.BEEP_CONTROL; + gRequestSaveSettings = 1; + return; } const bool bFlag = (gInputBoxIndex == 0); diff --git a/app/mdc1200.c b/app/mdc1200.c index e76754a..2eb5758 100644 --- a/app/mdc1200.c +++ b/app/mdc1200.c @@ -5,7 +5,7 @@ #include "mdc1200.h" #include "misc.h" #include - +uint16_t MDC_ID=0X542B; const uint8_t mdc1200_pre_amble[] = {0x00, 0x00, 0x00}; const uint8_t mdc1200_sync[5] = {0x07, 0x09, 0x2a, 0x44, 0x6f}; diff --git a/app/mdc1200.h b/app/mdc1200.h index 3f9d5e8..b19bf05 100644 --- a/app/mdc1200.h +++ b/app/mdc1200.h @@ -102,5 +102,6 @@ unsigned int MDC1200_encode_single_packet(void *data, const uint8_t op, const void MDC1200_reset_rx(void); void MDC1200_process_rx(const uint16_t interrupt_bits); void MDC1200_init(void); +extern uint16_t MDC_ID; #endif diff --git a/driver/bk4819.c b/driver/bk4819.c index d52ec01..44eea8d 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -31,7 +31,6 @@ #endif BK4819_FilterBandwidth_t m_bandwidth = BK4819_FILTER_BW_NARROW; -static const uint16_t FSK_RogerTable[7] = {0xF1A2, 0x7446, 0x61A4, 0x6544, 0x4E8A, 0xE044, 0xEA84}; static const uint8_t DTMF_TONE1_GAIN = 65; static const uint8_t DTMF_TONE2_GAIN = 93; @@ -1703,43 +1702,6 @@ void BK4819_PlayRoger(void) BK4819_WriteRegister(BK4819_REG_30, 0xC1FE); // 1 1 0000 0 1 1111 1 1 1 0 } -void BK4819_PlayRogerMDC(void) -{ - unsigned int i; - - BK4819_SetAF(BK4819_AF_MUTE); - - BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable, - // RX Bandwidth FFSK 1200/1800 - // 0xAA or 0x55 Preamble - // 11 RX Gain, - // 101 RX Mode - // TX FFSK 1200/1800 - BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone-2 to 1200Hz - BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone-2 and Set Tone2 Gain - BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes - BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO - BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done) - BK4819_WriteRegister(BK4819_REG_5A, 0x5555); // First two sync bytes - BK4819_WriteRegister(BK4819_REG_5B, 0x55AA); // End of sync bytes. Total 4 bytes: 555555aa - BK4819_WriteRegister(BK4819_REG_5C, 0xAA30); // Disable CRC - - // Send the data from the roger table - for (i = 0; i < 7; i++) - BK4819_WriteRegister(BK4819_REG_5F, FSK_RogerTable[i]); - - SYSTEM_DelayMs(20); - - // 4 sync bytes, 6 byte preamble, Enable FSK TX - BK4819_WriteRegister(BK4819_REG_59, 0x0868); - - SYSTEM_DelayMs(180); - - // Stop FSK TX, reset Tone-2, disable FSK - BK4819_WriteRegister(BK4819_REG_59, 0x0068); - BK4819_WriteRegister(BK4819_REG_70, 0x0000); - BK4819_WriteRegister(BK4819_REG_58, 0x0000); -} void BK4819_Enable_AfDac_DiscMode_TxDsp(void) { diff --git a/driver/bk4819.h b/driver/bk4819.h index 8787246..59bddfd 100644 --- a/driver/bk4819.h +++ b/driver/bk4819.h @@ -173,6 +173,7 @@ void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id, void BK4819_stop_tones(const bool tx); void BK4819_start_tone(const uint16_t frequency, const unsigned int level, const bool tx, const bool tx_mute); +void BK4819_enable_mdc1200_rx(const bool enable); #endif diff --git a/functions.c b/functions.c index afa81f8..bef0a01 100644 --- a/functions.c +++ b/functions.c @@ -15,7 +15,7 @@ */ #include - +#include "app/mdc1200.h" #include "app/dtmf.h" #if defined(ENABLE_FMRADIO) #include "app/fm.h" @@ -160,7 +160,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function) return; case FUNCTION_TRANSMIT: - +#ifdef ENABLE_MDC1200 + BK4819_enable_mdc1200_rx(false); +#endif // if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11 BK4819_DisableDTMF(); @@ -213,11 +215,27 @@ void FUNCTION_Select(FUNCTION_Type_t Function) // turn the RED LED on BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true); - DTMF_Reply(); + if(!DTMF_Reply()) { +#ifdef ENABLE_MDC1200 + // if (g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_BOT || g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_BOTH) + if(1) + { - if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO) - BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE); + SYSTEM_DelayMs(30); + BK4819_send_MDC1200(1, 0x80, MDC_ID, true); + +#ifdef ENABLE_MDC1200_SIDE_BEEP + BK4819_start_tone(880, 10, true, true); + SYSTEM_DelayMs(120); + BK4819_stop_tones(true); +#endif + } + else +#endif + if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO) + BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE); + } #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) if (gAlarmState != ALARM_STATE_OFF) { diff --git a/radio.c b/radio.c index 7591dfb..4a030c8 100644 --- a/radio.c +++ b/radio.c @@ -1124,7 +1124,7 @@ void RADIO_SendEndOfTransmission(void) BK4819_PlayRoger(); else if (gEeprom.ROGER == ROGER_MODE_MDC) { - BK4819_send_MDC1200(MDC1200_OP_CODE_POST_ID, 0x00, 12, false); + BK4819_send_MDC1200(MDC1200_OP_CODE_POST_ID, 0x00, MDC_ID, false); #ifdef ENABLE_MDC1200_SIDE_BEEP BK4819_start_tone(880, 10, true, true); diff --git a/settings.c b/settings.c index ce906a9..ea7cfdc 100644 --- a/settings.c +++ b/settings.c @@ -125,7 +125,7 @@ void SETTINGS_InitEEPROM(void) gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; - gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE; + gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_MESSAGE; // 0E98..0E9F EEPROM_ReadBuffer(0x0E98, Data, 8); diff --git a/settings.h b/settings.h index 0f89db3..d7d6198 100644 --- a/settings.h +++ b/settings.h @@ -26,10 +26,9 @@ #include enum POWER_OnDisplayMode_t { - POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0, - POWER_ON_DISPLAY_MODE_MESSAGE, - POWER_ON_DISPLAY_MODE_VOLTAGE, POWER_ON_DISPLAY_MODE_NONE +, + POWER_ON_DISPLAY_MODE_MESSAGE, }; typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t; diff --git a/ui/main.c b/ui/main.c index 89d4c04..c453d6e 100644 --- a/ui/main.c +++ b/ui/main.c @@ -795,6 +795,9 @@ void UI_DisplayMain(void) UI_PrintStringSmall(String, 2, 0, 3); } #endif + + + } } diff --git a/版本说明.txt b/版本说明.txt index 5770a64..9e65456 100644 --- a/版本说明.txt +++ b/版本说明.txt @@ -1,6 +1,7 @@ #0.10.4 + 修复“按键音开机后失效“ 修复开机显示问题 - 修复宽窄带开机后失效问题 + 修复“宽窄带开机后失效“ 频谱图增加AM-FIX 增加MDC1200信令 #0.10.3