diff --git a/Makefile b/Makefile index 1fdd29c59..4599ba2ff 100644 --- a/Makefile +++ b/Makefile @@ -225,7 +225,7 @@ endif CFLAGS = ifeq ($(ENABLE_CLANG),0) # Highest optimization settings (possible breaking changes): - CFLAGS += -Oz -mcpu=cortex-m0 -fno-delete-null-pointer-checks -std=c11 -MMD + CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-delete-null-pointer-checks -std=c11 -MMD # Standard settings: #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD diff --git a/app/app.c b/app/app.c index 70ddb3855..2dfc01bf3 100644 --- a/app/app.c +++ b/app/app.c @@ -65,6 +65,9 @@ #ifdef ENABLE_MESSENGER #include "app/messenger.h" #endif +#ifdef ENABLE_ENCRYPTION + #include "helper/crypto.h" +#endif #ifdef ENABLE_MESSENGER_NOTIFICATION bool gPlayMSGRing = false; @@ -786,14 +789,7 @@ void APP_EndTransmission(bool playRoger) else { APP_EndTransmission(true); - - if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) - { - //if (gCurrentFunction != FUNCTION_FOREGROUND) - FUNCTION_Select(FUNCTION_FOREGROUND); - } - else - gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; + FUNCTION_Select(FUNCTION_FOREGROUND); } gUpdateStatus = true; @@ -1239,19 +1235,6 @@ void APP_TimeSlice10ms(void) } } #endif - - // repeater tail tone elimination - if (gRTTECountdown > 0) - { - if (--gRTTECountdown == 0) - { - //if (gCurrentFunction != FUNCTION_FOREGROUND) - FUNCTION_Select(FUNCTION_FOREGROUND); - - gUpdateStatus = true; - gUpdateDisplay = true; - } - } } #ifdef ENABLE_FMRADIO @@ -1329,6 +1312,13 @@ void APP_TimeSlice500ms(void) } else if (hasNewMessage == 2) { hasNewMessage = 1; } + } + #endif + + #ifdef ENABLE_ENCRYPTION + if(gRecalculateEncKey){ + CRYPTO_Generate256BitKey(gEeprom.ENC_KEY, gEncryptionKey, sizeof(gEeprom.ENC_KEY)); + gRecalculateEncKey = false; } #endif @@ -1865,10 +1855,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { ALARM_Off(); - if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) - FUNCTION_Select(FUNCTION_FOREGROUND); - else - gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; + FUNCTION_Select(FUNCTION_FOREGROUND); if (Key == KEY_PTT) gPttWasPressed = true; diff --git a/app/generic.c b/app/generic.c index c68e369ad..d32ff7a6c 100644 --- a/app/generic.c +++ b/app/generic.c @@ -108,11 +108,7 @@ void GENERIC_Key_PTT(bool bKeyPressed) else { APP_EndTransmission(true); - - if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) - FUNCTION_Select(FUNCTION_FOREGROUND); - else - gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; + FUNCTION_Select(FUNCTION_FOREGROUND); } gFlagEndTransmission = false; @@ -165,7 +161,7 @@ void GENERIC_Key_PTT(bool bKeyPressed) goto start_tx; // listening to the FM radio .. start TX'ing #endif - if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0) + if (gCurrentFunction == FUNCTION_TRANSMIT) { // already transmitting gInputBoxIndex = 0; return; diff --git a/app/menu.c b/app/menu.c index 521f69ca6..7355c51d7 100644 --- a/app/menu.c +++ b/app/menu.c @@ -273,11 +273,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_VOX: case MENU_VOX_DELAY: #endif - case MENU_RP_STE: - *pMin = 0; - *pMax = 10; - break; - case MENU_MEM_CH: case MENU_1_CALL: case MENU_DEL_CH: @@ -630,10 +625,6 @@ void MENU_AcceptSetting(void) gFlagResetVfos = true; return; - case MENU_RP_STE: - gEeprom.REPEATER_TAIL_TONE_ELIMINATION = gSubMenuSelection; - break; - case MENU_MIC: gEeprom.MIC_SENSITIVITY = gSubMenuSelection; BOARD_EEPROM_LoadCalibration(); @@ -1019,10 +1010,6 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gTxVfo->SCANLIST2_PARTICIPATION; break; - case MENU_RP_STE: - gSubMenuSelection = gEeprom.REPEATER_TAIL_TONE_ELIMINATION; - break; - case MENU_MIC: gSubMenuSelection = gEeprom.MIC_SENSITIVITY; break; diff --git a/app/messenger.c b/app/messenger.c index 733d98b2e..b17416c13 100644 --- a/app/messenger.c +++ b/app/messenger.c @@ -75,20 +75,17 @@ void MSG_FSKSendData() { // set the FM deviation level const uint16_t dev_val = BK4819_ReadRegister(BK4819_REG_40); - // mute the mic - const uint16_t reg30 = BK4819_ReadRegister(BK4819_REG_30); - BK4819_WriteRegister(BK4819_REG_30, reg30 & ~(1u << 2)); - //UART_printf("\n BANDWIDTH : 0x%.4X", dev_val); { - uint16_t deviation = 850; + uint16_t deviation; switch (gEeprom.VfoInfo[gEeprom.TX_VFO].CHANNEL_BANDWIDTH) { case BK4819_FILTER_BW_WIDE: deviation = 1350; break; // 20k // measurements by kamilsss655 case BK4819_FILTER_BW_NARROW: deviation = 1200; break; // 10k - case BK4819_FILTER_BW_NARROWAVIATION: deviation = 850; break; // 5k - case BK4819_FILTER_BW_NARROWER: deviation = 850; break; // 5k - case BK4819_FILTER_BW_NARROWEST: deviation = 850; break; // 5k + // case BK4819_FILTER_BW_NARROWAVIATION: deviation = 850; break; // 5k + // case BK4819_FILTER_BW_NARROWER: deviation = 850; break; // 5k + // case BK4819_FILTER_BW_NARROWEST: deviation = 850; break; // 5k + default: deviation = 850; break; // 5k } //BK4819_WriteRegister(0x40, (3u << 12) | (deviation & 0xfff)); BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0xfff)); @@ -276,9 +273,6 @@ void MSG_FSKSendData() { } } - // clear dataPacket - memset(dataPacket.serializedArray, 0, sizeof(dataPacket.serializedArray));; - // enable FSK TX BK4819_WriteRegister(BK4819_REG_59, (1u << 11) | fsk_reg59); @@ -308,9 +302,6 @@ void MSG_FSKSendData() { // restore FM deviation level BK4819_WriteRegister(BK4819_REG_40, dev_val); - //restore mic mute - BK4819_WriteRegister(BK4819_REG_30, reg30); - // restore TX/RX filtering BK4819_WriteRegister(BK4819_REG_2B, filt_val); @@ -548,11 +539,11 @@ void moveUP(char (*rxMessages)[PAYLOAD_LENGTH + 2]) { memset(rxMessages[3], 0, sizeof(rxMessages[3])); } -void MSG_SendPacket(union DataPacket packet) { +void MSG_SendPacket() { if ( msgStatus != READY ) return; - if ( strlen(packet.data.payload) > 0 && (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0) ) { + if ( strlen((char *)dataPacket.data.payload) > 0 && (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0) ) { msgStatus = SENDING; @@ -560,45 +551,46 @@ void MSG_SendPacket(union DataPacket packet) { BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true); - memset(dataPacket.serializedArray, 0, sizeof(dataPacket.serializedArray)); + // display sent message (before encryption) + if (dataPacket.data.header != ACK_PACKET) { + moveUP(rxMessage); + sprintf(rxMessage[3], "> %s", dataPacket.data.payload); + memset(lastcMessage, 0, sizeof(lastcMessage)); + memcpy(lastcMessage, dataPacket.data.payload, PAYLOAD_LENGTH); + cIndex = 0; + prevKey = 0; + prevLetter = 0; + memset(cMessage, 0, sizeof(cMessage)); + } - // later refactor to not use global state but pass dataPacket type everywhere - dataPacket = packet; #ifdef ENABLE_ENCRYPTION - if(packet.data.header == ENCRYPTED_MESSAGE_PACKET){ - char nonce[NONCE_LENGTH]; + if(dataPacket.data.header == ENCRYPTED_MESSAGE_PACKET){ - CRYPTO_Random(nonce, NONCE_LENGTH); - // this is wat happens when we have global state - memcpy(packet.data.nonce, nonce, NONCE_LENGTH); + CRYPTO_Random(dataPacket.data.nonce, NONCE_LENGTH); CRYPTO_Crypt( - packet.data.payload, + dataPacket.data.payload, PAYLOAD_LENGTH, dataPacket.data.payload, - &packet.data.nonce, + &dataPacket.data.nonce, gEncryptionKey, 256 ); - - memcpy(dataPacket.data.nonce, nonce, sizeof(dataPacket.data.nonce)); } #endif BK4819_DisableDTMF(); - RADIO_SetTxParameters(); + // mute the mic during TX + gMuteMic = true; + FUNCTION_Select(FUNCTION_TRANSMIT); - SYSTEM_DelayMs(500); - // BK4819_PlayRogerNormal(98); - // BK4819_PlayRogerMDC(); - SYSTEM_DelayMs(100); - BK4819_ExitTxMute(); + SYSTEM_DelayMs(50); MSG_FSKSendData(); - SYSTEM_DelayMs(100); + SYSTEM_DelayMs(50); APP_EndTransmission(false); // this must be run after end of TX, otherwise radio will still TX transmit without even RED LED on @@ -606,19 +598,16 @@ void MSG_SendPacket(union DataPacket packet) { RADIO_SetVfoState(VFO_STATE_NORMAL); + // disable mic mute after TX + gMuteMic = false; + BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false); MSG_EnableRX(true); - if (packet.data.header != ACK_PACKET) { - moveUP(rxMessage); - sprintf(rxMessage[3], "> %s", packet.data.payload); - memset(lastcMessage, 0, sizeof(lastcMessage)); - memcpy(lastcMessage, packet.data.payload, PAYLOAD_LENGTH); - cIndex = 0; - prevKey = 0; - prevLetter = 0; - memset(cMessage, 0, sizeof(cMessage)); - } + + // clear packet buffer + MSG_ClearPacketBuffer(); + msgStatus = READY; } else { @@ -635,6 +624,9 @@ uint8_t validate_char( uint8_t rchar ) { void MSG_StorePacket(const uint16_t interrupt_bits) { + // prevent listening to fsk data and squelch (kamilsss655) + AUDIO_AudioPathOff(); + //const uint16_t rx_sync_flags = BK4819_ReadRegister(BK4819_REG_0B); const bool rx_sync = (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC) ? true : false; @@ -645,7 +637,7 @@ void MSG_StorePacket(const uint16_t interrupt_bits) { if (rx_sync) { gFSKWriteIndex = 0; - memset(dataPacket.serializedArray, 0, sizeof(dataPacket.serializedArray)); + MSG_ClearPacketBuffer(); msgStatus = RECEIVING; } @@ -665,6 +657,8 @@ void MSG_StorePacket(const uint16_t interrupt_bits) { } if (rx_finished) { + // turn off green LED + BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, 0); const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11)); @@ -673,63 +667,9 @@ void MSG_StorePacket(const uint16_t interrupt_bits) { msgStatus = READY; if (gFSKWriteIndex > 2) { - - if (dataPacket.data.header == ACK_PACKET) { - #ifdef ENABLE_MESSENGER_DELIVERY_NOTIFICATION - #ifdef ENABLE_MESSENGER_UART - UART_printf("SVC= INVALID_PACKET) { - snprintf(rxMessage[3], PAYLOAD_LENGTH + 2, "ERROR: INVALID PACKET."); - } - else - { - #ifdef ENABLE_ENCRYPTION - if(dataPacket.data.header == ENCRYPTED_MESSAGE_PACKET) - { - CRYPTO_Crypt(dataPacket.data.payload, - PAYLOAD_LENGTH, - dataPacket.data.payload, - &dataPacket.data.nonce, - gEncryptionKey, - 256); - } - snprintf(rxMessage[3], PAYLOAD_LENGTH + 2, "< %s", dataPacket.data.payload); - #else - snprintf(rxMessage[3], PAYLOAD_LENGTH + 2, "< %s", dataPacket.data.payload); - #endif - } - - #ifdef ENABLE_MESSENGER_UART - UART_printf("SMS<%s\r\n", dencryptedTxMessage); - #endif - - if ( gScreenToDisplay != DISPLAY_MSG ) { - hasNewMessage = 1; - gUpdateStatus = true; - gUpdateDisplay = true; - #ifdef ENABLE_MESSENGER_NOTIFICATION - gPlayMSGRing = true; - #endif - } - else { - gUpdateDisplay = true; - } - } + MSG_HandleReceive(); } - gFSKWriteIndex = 0; - // Transmit a message to the sender that we have received the message (Unless it's a service message) - if (dataPacket.data.header!=ACK_PACKET) { - dataPacket.data.header=ACK_PACKET; - MSG_SendPacket(dataPacket); - } } } @@ -742,6 +682,79 @@ void MSG_Init() { prevKey = 0; prevLetter = 0; cIndex = 0; + #ifdef ENABLE_ENCRYPTION + gRecalculateEncKey = true; + #endif +} + +void MSG_SendAck() { + // in the future we might reply with received payload and then the sending radio + // could compare it and determine if the messegage was read correctly (kamilsss655) + MSG_ClearPacketBuffer(); + dataPacket.data.header = ACK_PACKET; + // sending only empty header seems to not work, so set few bytes of payload to increase reliability (kamilsss655) + memset(dataPacket.data.payload, 255, 5); + MSG_SendPacket(); +} + +void MSG_HandleReceive(){ + if (dataPacket.data.header == ACK_PACKET) { + #ifdef ENABLE_MESSENGER_DELIVERY_NOTIFICATION + #ifdef ENABLE_MESSENGER_UART + UART_printf("SVC= INVALID_PACKET) { + snprintf(rxMessage[3], PAYLOAD_LENGTH + 2, "ERROR: INVALID PACKET."); + } + else + { + #ifdef ENABLE_ENCRYPTION + if(dataPacket.data.header == ENCRYPTED_MESSAGE_PACKET) + { + CRYPTO_Crypt(dataPacket.data.payload, + PAYLOAD_LENGTH, + dataPacket.data.payload, + &dataPacket.data.nonce, + gEncryptionKey, + 256); + } + snprintf(rxMessage[3], PAYLOAD_LENGTH + 2, "< %s", dataPacket.data.payload); + #else + snprintf(rxMessage[3], PAYLOAD_LENGTH + 2, "< %s", dataPacket.data.payload); + #endif + } + + #ifdef ENABLE_MESSENGER_UART + UART_printf("SMS<%s\r\n", dencryptedTxMessage); + #endif + + if ( gScreenToDisplay != DISPLAY_MSG ) { + hasNewMessage = 1; + gUpdateStatus = true; + gUpdateDisplay = true; + #ifdef ENABLE_MESSENGER_NOTIFICATION + gPlayMSGRing = true; + #endif + } + else { + gUpdateDisplay = true; + } + } + + // Transmit a message to the sender that we have received the message + if (dataPacket.data.header == MESSAGE_PACKET || + dataPacket.data.header == ENCRYPTED_MESSAGE_PACKET) + { + // wait so the correspondent radio can properly receive it + SYSTEM_DelayMs(700); + MSG_SendAck(); + } } // --------------------------------------------------------------------------------- @@ -843,14 +856,14 @@ void MSG_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { break;*/ case KEY_MENU: // Send message - memset(dataPacket.serializedArray,0,sizeof(dataPacket.serializedArray)); + MSG_ClearPacketBuffer(); #ifdef ENABLE_ENCRYPTION dataPacket.data.header=ENCRYPTED_MESSAGE_PACKET; #else dataPacket.data.header=MESSAGE_PACKET; #endif memcpy(dataPacket.data.payload, cMessage, sizeof(dataPacket.data.payload)); - MSG_SendPacket(dataPacket); + MSG_SendPacket(); break; case KEY_EXIT: gRequestDisplayScreen = DISPLAY_MAIN; @@ -876,5 +889,10 @@ void MSG_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { } +void MSG_ClearPacketBuffer() +{ + memset(dataPacket.serializedArray, 0, sizeof(dataPacket.serializedArray)); +} + #endif \ No newline at end of file diff --git a/app/messenger.h b/app/messenger.h index bc496e1f5..08e0c1b82 100644 --- a/app/messenger.h +++ b/app/messenger.h @@ -58,8 +58,11 @@ void MSG_EnableRX(const bool enable); void MSG_StorePacket(const uint16_t interrupt_bits); void MSG_Init(); void MSG_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); -void MSG_SendPacket(union DataPacket packet); +void MSG_SendPacket(); void MSG_FSKSendData(); +void MSG_ClearPacketBuffer(); +void MSG_SendAck(); +void MSG_HandleReceive(); #endif diff --git a/app/spectrum.c b/app/spectrum.c index 7ca5123b7..3de7017e6 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -1481,8 +1481,6 @@ void APP_RunSpectrum() { BackupRegisters(); - AutoAdjustFreqChangeStep(); - ResetInterrupts(); // turn of GREEN LED if spectrum was started during active RX @@ -1504,6 +1502,8 @@ void APP_RunSpectrum() { BK4819_SetFilterBandwidth(settings.listenBw = BK4819_FILTER_BW_WIDE, false); #endif + AutoAdjustFreqChangeStep(); + RelaunchScan(); for (int i = 0; i < 128; ++i) { diff --git a/board.c b/board.c index 572aa26c2..1037dfa2b 100644 --- a/board.c +++ b/board.c @@ -600,7 +600,7 @@ void BOARD_EEPROM_Init(void) gEeprom.ALARM_MODE = (Data[0] < 2) ? Data[0] : true; #endif gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF; - gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0; + // Data[2] empty slot gEeprom.TX_VFO = (Data[3] < 2) ? Data[3] : 0; gEeprom.BATTERY_TYPE = (Data[4] < BATTERY_TYPE_UNKNOWN) ? Data[4] : BATTERY_TYPE_1600_MAH; gEeprom.SQL_TONE = (Data[5] < ARRAY_SIZE(CTCSS_Options)) ? Data[5] : 50; diff --git a/docs/UV K5 EEPROM.xlsx b/docs/UV K5 EEPROM.xlsx index 9e1ecf34e..6d6b5dac2 100644 Binary files a/docs/UV K5 EEPROM.xlsx and b/docs/UV K5 EEPROM.xlsx differ diff --git a/driver/bk4819.c b/driver/bk4819.c index dc11f7045..d6b3708c1 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -1058,11 +1058,22 @@ void BK4819_ExitBypass(void) ); } -void BK4819_PrepareTransmit(void) +void BK4819_PrepareTransmit(bool muteMic) { BK4819_ExitBypass(); BK4819_ExitTxMute(); BK4819_TxOn_Beep(); + + if(muteMic) + { + BK4819_MuteMic(); + } +} + +void BK4819_MuteMic(void) +{ + const uint16_t reg30 = BK4819_ReadRegister(BK4819_REG_30); + BK4819_WriteRegister(BK4819_REG_30, reg30 & ~(1u << 2)); } void BK4819_TxOn_Beep(void) diff --git a/driver/bk4819.h b/driver/bk4819.h index a596ee2a0..ebb888556 100644 --- a/driver/bk4819.h +++ b/driver/bk4819.h @@ -120,7 +120,8 @@ void BK4819_TurnsOffTones_TurnsOnRX(void); void BK4819_ResetFSK(void); void BK4819_Idle(void); void BK4819_ExitBypass(void); -void BK4819_PrepareTransmit(void); +void BK4819_PrepareTransmit(bool muteMic); +void BK4819_MuteMic(void); void BK4819_TxOn_Beep(void); void BK4819_ExitSubAu(void); diff --git a/helper/crypto.c b/helper/crypto.c index ddf905798..3eeea30fa 100644 --- a/helper/crypto.c +++ b/helper/crypto.c @@ -19,6 +19,8 @@ #include "driver/bk4819.h" #include "driver/systick.h" +bool gRecalculateEncKey; + u_int8_t gEncryptionKey[32]; // salt used for hashing encryption key from eeprom used for sending packets diff --git a/helper/crypto.h b/helper/crypto.h index 55f8d6c82..c7de28174 100644 --- a/helper/crypto.h +++ b/helper/crypto.h @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#include #include - -extern uint8_t gEncryptionKey[32]; +extern bool gRecalculateEncKey; +extern uint8_t gEncryptionKey[32]; static const uint8_t encryptionSalt[4][8]; static const uint8_t displaySalt[32]; diff --git a/misc.c b/misc.c index 2972d5eba..0f7fff95b 100644 --- a/misc.c +++ b/misc.c @@ -140,7 +140,6 @@ volatile uint8_t gVFOStateResumeCountdown_500ms; bool gEnableSpeaker; uint8_t gKeyInputCountdown = 0; uint8_t gKeyLockCountdown; -uint8_t gRTTECountdown; bool bIsInLockScreen; uint8_t gUpdateStatus; uint8_t gFoundCTCSS; diff --git a/misc.h b/misc.h index 99014cd1b..97283292a 100644 --- a/misc.h +++ b/misc.h @@ -241,7 +241,6 @@ extern volatile uint16_t gTailNoteEliminationCountdown_10ms; extern bool gEnableSpeaker; extern uint8_t gKeyInputCountdown; extern uint8_t gKeyLockCountdown; -extern uint8_t gRTTECountdown; extern bool bIsInLockScreen; extern uint8_t gUpdateStatus; extern uint8_t gFoundCTCSS; diff --git a/radio.c b/radio.c index 955383b0f..40936b90f 100644 --- a/radio.c +++ b/radio.c @@ -44,6 +44,7 @@ VFO_Info_t *gRxVfo; VFO_Info_t *gCurrentVfo; DCS_CodeType_t gCurrentCodeType; VfoState_t VfoState[2]; +bool gMuteMic; const char gModulationStr[][4] = { @@ -820,7 +821,7 @@ void RADIO_SetTxParameters(void) // TX compressor BK4819_SetCompander((gRxVfo->Modulation == MODULATION_FM && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0); - BK4819_PrepareTransmit(); + BK4819_PrepareTransmit(gMuteMic); SYSTEM_DelayMs(10); @@ -1032,7 +1033,6 @@ void RADIO_PrepareTX(void) gTxTimeoutReached = false; gFlagEndTransmission = false; - gRTTECountdown = 0; #ifdef ENABLE_DTMF_CALLING gDTMF_ReplyState = DTMF_REPLY_NONE; diff --git a/radio.h b/radio.h index 27663351f..4bf096099 100644 --- a/radio.h +++ b/radio.h @@ -152,6 +152,9 @@ extern DCS_CodeType_t gCurrentCodeType; extern VfoState_t VfoState[2]; +// determines whether mic should be muted during TX (i.e during FSK modem TX) +extern bool gMuteMic; + bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum); uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum); void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency); diff --git a/settings.c b/settings.c index 43f6cb039..6ffca7354 100644 --- a/settings.c +++ b/settings.c @@ -121,7 +121,7 @@ void SETTINGS_SaveSettings(void) State[0] = false; #endif State[1] = gEeprom.ROGER; - State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION; + // State[2] = empty slot State[3] = gEeprom.TX_VFO; State[4] = gEeprom.BATTERY_TYPE; State[5] = gEeprom.SQL_TONE; @@ -277,8 +277,7 @@ void SETTINGS_SaveEncryptionKey() { EEPROM_WriteBuffer(0x0F30, gEeprom.ENC_KEY, true); EEPROM_WriteBuffer(0x0F38, gEeprom.ENC_KEY + 8, true); - - CRYPTO_Generate256BitKey(gEeprom.ENC_KEY, gEncryptionKey, sizeof(gEeprom.ENC_KEY)); + gRecalculateEncKey = true; } #endif diff --git a/settings.h b/settings.h index 0b5e526f7..eb605f331 100644 --- a/settings.h +++ b/settings.h @@ -191,7 +191,6 @@ typedef struct { #endif POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE; ROGER_Mode_t ROGER; - uint8_t REPEATER_TAIL_TONE_ELIMINATION; uint8_t KEY_1_SHORT_PRESS_ACTION; uint8_t KEY_1_LONG_PRESS_ACTION; uint8_t KEY_2_SHORT_PRESS_ACTION; diff --git a/ui/menu.c b/ui/menu.c index fb5c8e9c5..c18f1a083 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -87,7 +87,6 @@ const t_menu_item MenuList[] = {"Voice", VOICE_ID_VOICE_PROMPT, MENU_VOICE }, #endif {"Roger", VOICE_ID_INVALID, MENU_ROGER }, - {"RP STE", VOICE_ID_INVALID, MENU_RP_STE }, {"SqTone", VOICE_ID_INVALID, MENU_SQL_TONE }, // squelch tail tone used for RX/TX {"1 Call", VOICE_ID_INVALID, MENU_1_CALL }, #ifdef ENABLE_ALARM @@ -621,7 +620,6 @@ void UI_DisplayMenu(void) case MENU_ABR: strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]); - BACKLIGHT_SetBrightness(-1); break; case MENU_ABR_MIN: @@ -629,8 +627,6 @@ void UI_DisplayMenu(void) sprintf(String, "%d", gSubMenuSelection); if(gIsInSubMenu) BACKLIGHT_SetBrightness(gSubMenuSelection); - else - BACKLIGHT_SetBrightness(-1); break; case MENU_AM: @@ -785,13 +781,6 @@ void UI_DisplayMenu(void) strcpy(String, gSubMenu_MDF[gSubMenuSelection]); break; - case MENU_RP_STE: - if (gSubMenuSelection == 0) - strcpy(String, "OFF"); - else - sprintf(String, "%d*100ms", gSubMenuSelection); - break; - #ifdef ENABLE_ALARM case MENU_AL_MOD: sprintf(String, gSubMenu_AL_MOD[gSubMenuSelection]); diff --git a/ui/menu.h b/ui/menu.h index f40cace2b..a4df3d6c5 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -73,7 +73,6 @@ enum MENU_AUTOLK, MENU_S_ADD1, MENU_S_ADD2, - MENU_RP_STE, MENU_SQL_TONE, MENU_MIC, MENU_COMPAND,