mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 14:48:03 +03:00
Radio kill/revive code compile option added
This commit is contained in:
@ -543,6 +543,11 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
data[3] = 0xffff;
|
||||
//#endif
|
||||
}
|
||||
else
|
||||
if (eeprom_addr == 0x0F40)
|
||||
{ // killed flag is here
|
||||
data[2] = false; // remove it
|
||||
}
|
||||
|
||||
EEPROM_WriteBuffer(eeprom_addr, data); // 8 bytes at a time
|
||||
data += write_size / sizeof(data[0]);
|
||||
|
73
app/app.c
73
app/app.c
@ -225,7 +225,11 @@ static void APP_process_incoming_rx(void)
|
||||
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && g_css_scan_mode == CSS_SCAN_MODE_OFF)
|
||||
{ // not scanning
|
||||
|
||||
if (g_rx_vfo->dtmf_decoding_enable || g_setting_radio_disabled)
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (g_rx_vfo->dtmf_decoding_enable || g_setting_radio_disabled)
|
||||
#else
|
||||
if (g_rx_vfo->dtmf_decoding_enable)
|
||||
#endif
|
||||
{ // DTMF DCD is enabled
|
||||
|
||||
DTMF_HandleRequest();
|
||||
@ -479,8 +483,10 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
|
||||
const unsigned int chan = g_eeprom.rx_vfo;
|
||||
// const unsigned int chan = g_rx_vfo->channel_save;
|
||||
|
||||
if (g_setting_radio_disabled)
|
||||
return;
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (g_setting_radio_disabled)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
@ -888,7 +894,11 @@ void APP_process_radio_interrupts(void)
|
||||
g_update_display = true;
|
||||
}
|
||||
|
||||
if (g_rx_vfo->dtmf_decoding_enable || g_setting_radio_disabled)
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (g_rx_vfo->dtmf_decoding_enable || g_setting_radio_disabled)
|
||||
#else
|
||||
if (g_rx_vfo->dtmf_decoding_enable)
|
||||
#endif
|
||||
{
|
||||
if (g_dtmf_rx_index >= (sizeof(g_dtmf_rx) - 1))
|
||||
{ // make room
|
||||
@ -999,8 +1009,10 @@ void APP_end_tx(void)
|
||||
#ifdef ENABLE_VOX
|
||||
static void APP_process_vox(void)
|
||||
{
|
||||
if (g_setting_radio_disabled)
|
||||
return;
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (g_setting_radio_disabled)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (g_vox_resume_count_down == 0)
|
||||
{
|
||||
@ -1350,37 +1362,44 @@ void APP_check_keys(void)
|
||||
|
||||
key_code_t key;
|
||||
|
||||
if (g_setting_radio_disabled)
|
||||
return;
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (g_setting_radio_disabled)
|
||||
return;
|
||||
#endif
|
||||
|
||||
// *****************
|
||||
// PTT is treated completely separately from all the other buttons
|
||||
|
||||
if (ptt_pressed)
|
||||
{ // PTT pressed
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (!g_setting_radio_disabled && !g_ptt_is_pressed && g_screen_to_display != DISPLAY_AIRCOPY)
|
||||
#else
|
||||
if (!g_setting_radio_disabled && !g_ptt_is_pressed)
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (!g_setting_radio_disabled)
|
||||
#endif
|
||||
{
|
||||
if (++g_ptt_debounce >= 3) // 30ms
|
||||
{ // start TX'ing
|
||||
|
||||
g_boot_counter_10ms = 0; // cancel the boot-up screen
|
||||
g_ptt_is_pressed = true;
|
||||
g_ptt_was_released = false;
|
||||
g_ptt_debounce = 0;
|
||||
|
||||
APP_process_key(KEY_PTT, true, false);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
// UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
|
||||
#endif
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (!g_ptt_is_pressed && g_screen_to_display != DISPLAY_AIRCOPY)
|
||||
#else
|
||||
if (!g_ptt_is_pressed)
|
||||
#endif
|
||||
{
|
||||
if (++g_ptt_debounce >= 3) // 30ms
|
||||
{ // start TX'ing
|
||||
|
||||
g_boot_counter_10ms = 0; // cancel the boot-up screen
|
||||
g_ptt_is_pressed = true;
|
||||
g_ptt_was_released = false;
|
||||
g_ptt_debounce = 0;
|
||||
|
||||
APP_process_key(KEY_PTT, true, false);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
// UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
g_ptt_debounce = 0;
|
||||
}
|
||||
else
|
||||
g_ptt_debounce = 0;
|
||||
}
|
||||
else
|
||||
{ // PTT released
|
||||
|
137
app/dtmf.c
137
app/dtmf.c
@ -215,79 +215,85 @@ void DTMF_HandleRequest(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_rx_vfo->dtmf_decoding_enable && !g_setting_radio_disabled)
|
||||
{ // D-DCD is disabled or we're alive
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (!g_rx_vfo->dtmf_decoding_enable && !g_setting_radio_disabled)
|
||||
#else
|
||||
if (!g_rx_vfo->dtmf_decoding_enable)
|
||||
#endif
|
||||
{ // D-DCD is disabled or we're enabled
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
}
|
||||
|
||||
g_dtmf_rx_pending = false;
|
||||
|
||||
if (g_dtmf_rx_index >= 9)
|
||||
{ // look for the KILL code
|
||||
|
||||
sprintf(String, "%s%c%s", g_eeprom.ani_dtmf_id, g_eeprom.dtmf_separate_code, g_eeprom.kill_code);
|
||||
|
||||
Offset = g_dtmf_rx_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
|
||||
{ // bugger
|
||||
|
||||
if (g_eeprom.permit_remote_kill)
|
||||
{
|
||||
g_setting_radio_disabled = true; // oooerr !
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (g_dtmf_rx_index >= 9)
|
||||
{ // look for the RADIO DISABLE code
|
||||
|
||||
sprintf(String, "%s%c%s", g_eeprom.ani_dtmf_id, g_eeprom.dtmf_separate_code, g_eeprom.kill_code);
|
||||
|
||||
Offset = g_dtmf_rx_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
|
||||
{ // bugger
|
||||
|
||||
if (g_eeprom.permit_remote_kill)
|
||||
{
|
||||
g_setting_radio_disabled = true; // :(
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
SETTINGS_SaveSettings();
|
||||
|
||||
g_dtmf_reply_state = DTMF_REPLY_AB;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
{
|
||||
FM_TurnOff();
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dtmf_reply_state = DTMF_REPLY_NONE;
|
||||
}
|
||||
|
||||
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
|
||||
|
||||
g_update_display = true;
|
||||
g_update_status = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_dtmf_rx_index >= 9)
|
||||
{ // look for the REVIVE code
|
||||
|
||||
sprintf(String, "%s%c%s", g_eeprom.ani_dtmf_id, g_eeprom.dtmf_separate_code, g_eeprom.revive_code);
|
||||
|
||||
Offset = g_dtmf_rx_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
|
||||
{ // shit, we're back !
|
||||
|
||||
g_setting_radio_disabled = false;
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
|
||||
SETTINGS_SaveSettings();
|
||||
|
||||
|
||||
g_dtmf_reply_state = DTMF_REPLY_AB;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
{
|
||||
FM_TurnOff();
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
#endif
|
||||
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
|
||||
|
||||
g_update_display = true;
|
||||
g_update_status = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dtmf_reply_state = DTMF_REPLY_NONE;
|
||||
}
|
||||
|
||||
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
|
||||
|
||||
g_update_display = true;
|
||||
g_update_status = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_dtmf_rx_index >= 9)
|
||||
{ // look for the REVIVE code
|
||||
|
||||
sprintf(String, "%s%c%s", g_eeprom.ani_dtmf_id, g_eeprom.dtmf_separate_code, g_eeprom.revive_code);
|
||||
|
||||
Offset = g_dtmf_rx_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
|
||||
{ // shit, we're back !
|
||||
|
||||
g_setting_radio_disabled = false;
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
SETTINGS_SaveSettings();
|
||||
|
||||
g_dtmf_reply_state = DTMF_REPLY_AB;
|
||||
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
|
||||
|
||||
g_update_display = true;
|
||||
g_update_status = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_dtmf_rx_index >= 2)
|
||||
{ // look for ACK reply
|
||||
@ -300,7 +306,6 @@ void DTMF_HandleRequest(void)
|
||||
{ // ends with "AB"
|
||||
|
||||
if (g_dtmf_reply_state != DTMF_REPLY_NONE) // 1of11
|
||||
// if (g_dtmf_call_state != DTMF_CALL_STATE_NONE) // 1of11
|
||||
// if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT) // 1of11
|
||||
{
|
||||
g_dtmf_state = DTMF_STATE_TX_SUCC;
|
||||
@ -328,10 +333,10 @@ void DTMF_HandleRequest(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_setting_radio_disabled || g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT)
|
||||
{ // we've been disabled, or expecting a reply
|
||||
return;
|
||||
}
|
||||
#ifdef ENABLE_KILL_REVIVE
|
||||
if (g_setting_radio_disabled)
|
||||
return; // we've been disabled
|
||||
#endif
|
||||
|
||||
if (g_dtmf_rx_index >= 7)
|
||||
{ // see if we're being called
|
||||
|
@ -350,6 +350,13 @@ static void cmd_051D(const uint8_t *pBuffer)
|
||||
memset(data, 0xff, 8); // wipe the AES key
|
||||
#endif
|
||||
|
||||
//#ifndef ENABLE_KILL_REVIVE
|
||||
if (Offset == 0x0F40)
|
||||
{ // killed flag is here
|
||||
data[2] = false; // remove it
|
||||
}
|
||||
//#endif
|
||||
|
||||
#ifdef ENABLE_PWRON_PASSWORD
|
||||
if ((Offset < 0x0E98 || Offset >= 0x0E9C) || !g_password_locked || pCmd->allow_password)
|
||||
EEPROM_WriteBuffer(Offset, data);
|
||||
|
Reference in New Issue
Block a user