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

MDC100 update

This commit is contained in:
OneOfEleven 2023-10-25 13:07:12 +01:00
parent 216cc027cf
commit 2d5730f578
13 changed files with 95 additions and 26 deletions

View File

@ -44,7 +44,7 @@ ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0
ENABLE_F_CAL_MENU := 0
ENABLE_TX_UNLOCK := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
ENABLE_CONTRAST := 0
ENABLE_BOOT_BEEPS := 0
ENABLE_DTMF_CALL_FLASH_LIGHT := 1
@ -57,7 +57,7 @@ ENABLE_KILL_REVIVE := 0
# AM Fix 0.8 kB
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_SQUELCH_MORE_SENSITIVE := 0
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1
ENABLE_FASTER_CHANNEL_SCAN := 1
ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1
@ -70,7 +70,7 @@ ENABLE_TX_AUDIO_BAR := 0
# Side Button Menu 0.3 kB
ENABLE_SIDE_BUTT_MENU := 1
# Key Lock 0.4 kB
ENABLE_KEYLOCK := 1
ENABLE_KEYLOCK := 0
#ENABLE_PANADAPTER := 0
#ENABLE_SINGLE_VFO_CHAN := 0

View File

@ -329,6 +329,13 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
*pMax = ARRAY_SIZE(g_sub_menu_dtmf_rsp) - 1;
break;
#ifdef ENABLE_MDC1200
case MENU_MDC1200_ID:
*pMin = 0;
*pMax = 0xffff;
break;
#endif
case MENU_PTT_ID:
*pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_ptt_id) - 1;
@ -703,6 +710,12 @@ void MENU_AcceptSetting(void)
g_eeprom.dtmf_preload_time = g_sub_menu_selection * 10;
break;
#ifdef ENABLE_MDC1200
case MENU_MDC1200_ID:
g_eeprom.mdc1200_id = g_sub_menu_selection;
break;
#endif
case MENU_PTT_ID:
g_tx_vfo->dtmf_ptt_id_tx_mode = g_sub_menu_selection;
if (g_tx_vfo->dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN ||
@ -1199,6 +1212,12 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.dtmf_preload_time / 10;
break;
#ifdef ENABLE_MDC1200
case MENU_MDC1200_ID:
g_sub_menu_selection = g_eeprom.mdc1200_id;
break;
#endif
case MENU_PTT_ID:
g_sub_menu_selection = g_tx_vfo->dtmf_ptt_id_tx_mode;
break;

View File

@ -605,7 +605,10 @@ void BOARD_EEPROM_load(void)
// 0E98..0E9F
EEPROM_ReadBuffer(0x0E98, Data, 8);
memcpy(&g_eeprom.power_on_password, Data, sizeof(g_eeprom.power_on_password));
memcpy(&g_eeprom.power_on_password, &Data[0], sizeof(g_eeprom.power_on_password));
#ifdef ENABLE_MDC1200
memcpy(&g_eeprom.mdc1200_id, &Data[4], sizeof(g_eeprom.mdc1200_id));
#endif
// 0EA0..0EA7
#ifdef ENABLE_VOICE

View File

@ -268,7 +268,7 @@ void BK4819_DisableAGC(void)
// 000=Bypass DC filter;
//
BK4819_WriteRegister(0x7E,
(1u << 15) | // 0 AGC fix mode
(0u << 15) | // 0 AGC fix mode
(3u << 12) | // 3 AGC fix index
(5u << 3) | // 5 DC Filter band width for Tx (MIC In)
(6u << 0)); // 6 DC Filter band width for Rx (I.F In)
@ -345,7 +345,7 @@ void BK4819_EnableAGC(void)
//BK4819_WriteRegister(0x7E, (1u << 15) | (4u << 12) | (5u << 3) | (6u << 0));
BK4819_WriteRegister(0x7E,
(0u << 15) | // 0 AGC fix mode
(1u << 15) | // 0 AGC fix mode
(3u << 12) | // 3 AGC fix index
(5u << 3) | // 5 DC Filter band width for Tx (MIC In)
(6u << 0)); // 6 DC Filter band width for Rx (I.F In)
@ -1174,7 +1174,8 @@ void BK4819_TxOn_Beep(void)
{
BK4819_WriteRegister(0x37, 0x1D0F);
BK4819_WriteRegister(0x52, 0x028F);
BK4819_WriteRegister(0x30, 0x0000);
BK4819_WriteRegister(0x30, 0);
BK4819_WriteRegister(0x30, 0xC1FE);
}
@ -1217,7 +1218,7 @@ void BK4819_ExitSubAu(void)
// 0 = min
// 127 = max
//
BK4819_WriteRegister(0x51, 0x0000);
BK4819_WriteRegister(0x51, 0);
}
void BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable(void)
@ -1969,14 +1970,21 @@ void BK4819_start_fsk_rx(const unsigned int packet_size)
#ifdef ENABLE_MDC1200
void BK4819_PlayRogerMDC1200(void)
void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
{
uint16_t fsk_reg59;
uint8_t packet[42];
const uint8_t op = MDC1200_OP_CODE_POST_ID;
const uint8_t arg = 0x80;
const uint16_t id = 0xB183;
// REG_51
//
// <15> 1 = Enable TxCTCSS/CDCSS
// 0 = Disable
//
if (BK4819_ReadRegister(0x51) & (1u << 15))
{ // need to turn oss the CRCSS/CDCSS
BK4819_ExitSubAu();
SYSTEM_DelayMs(10);
}
// create the MDC1200 packet
const unsigned int size = MDC1200_encode_single_packet(packet, op, arg, id);
@ -2116,7 +2124,7 @@ void BK4819_PlayRogerMDC1200(void)
(0u << 9) | // 0 ~ 1 1 = invert data when TX
(0u << 8) | // 0 ~ 1 ???
(0u << 4) | // 0 ~ 15 preamble length
(0u << 3) | // 0 ~ 1 sync length
(1u << 3) | // 0 ~ 1 sync length
(0u << 0); // 0 ~ 7 ???
// Set entire packet length (not including the pre-amble and sync bytes we can't seem to disable)
@ -2137,7 +2145,7 @@ void BK4819_PlayRogerMDC1200(void)
// <15:8> 0x55 FSK Sync Byte 2 (Sync Byte 0 first, then 1,2,3)
// <7:0> 0xAA FSK Sync Byte 3
//
BK4819_WriteRegister(0x5B, 0x0000); // bytes 2 & 3 (not used)
BK4819_WriteRegister(0x5B, 0x0000); // bytes 2 & 3
// CRC setting (plus other stuff we don't know what)
//

View File

@ -156,8 +156,9 @@ uint8_t BK4819_GetCTCType(void);
void BK4819_start_fsk_rx(const unsigned int packet_size);
void BK4819_PlayRoger(void);
#ifdef ENABLE_MDC1200
void BK4819_PlayRogerMDC1200(void);
void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id);
#endif
void BK4819_Enable_AfDac_DiscMode_TxDsp(void);

Binary file not shown.

Binary file not shown.

View File

@ -11,8 +11,8 @@
// >= 24-bit pre-amble
// 40-bit sync
//
static const uint8_t pre_amble[] = {0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x0A};
static const uint8_t sync[] = {0x07, 0x09, 0x2a, 0x44, 0x6f};
static const uint8_t pre_amble[] = {0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t sync[] = {0xCC, 0x07, 0x09, 0x2a, 0x44, 0x6f};
uint8_t bit_reverse_8(uint8_t n)
{

15
radio.c
View File

@ -32,6 +32,9 @@
#include "frequencies.h"
#include "functions.h"
#include "helper/battery.h"
#ifdef ENABLE_MDC1200
#include "mdc1200.h"
#endif
#include "misc.h"
#include "radio.h"
#include "settings.h"
@ -843,11 +846,11 @@ void RADIO_enableTX(const bool fsk_tx)
{
BK4819_filter_bandwidth_t Bandwidth = g_current_vfo->channel_bandwidth;
// disable the speaker
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = false;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false); // ???
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
@ -1118,15 +1121,21 @@ void RADIO_tx_eot(void)
}
else
if (g_eeprom.roger_mode == ROGER_MODE_ROGER)
{
BK4819_PlayRoger();
}
else
#ifdef ENABLE_MDC1200
if (g_eeprom.roger_mode == ROGER_MODE_MDC)
BK4819_PlayRogerMDC1200();
{
BK4819_send_MDC1200(MDC1200_OP_CODE_POST_ID, 0x80, g_eeprom.mdc1200_id);
}
else
#endif
if (g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
{
BK4819_PlayTone(APOLLO_TONE2_HZ, APOLLO_TONE_MS, 28);
}
BK4819_ExitDTMF_TX(true);
}

View File

@ -243,13 +243,21 @@ void SETTINGS_save(void)
{
struct {
uint32_t password;
uint32_t spare;
#ifdef ENABLE_MDC1200
uint16_t mdc1200_id; // 1of11
uint8_t spare[2];
#else
uint8_t spare[4];
#endif
} __attribute__((packed)) array;
memset(&array, 0xff, sizeof(array));
#ifdef ENABLE_PWRON_PASSWORD
array.password = g_eeprom.power_on_password;
#endif
#ifdef ENABLE_MDC1200
array.mdc1200_id = g_eeprom.mdc1200_id;
#endif
EEPROM_WriteBuffer8(0x0E98, &array);
}

View File

@ -334,7 +334,12 @@ typedef struct {
uint8_t auto_key_lock; //
uint8_t display_mode; //
uint32_t power_on_password; //
#ifdef ENABLE_MDC1200
uint16_t mdc1200_id; // 1of11
uint8_t unused6[2]; // 0xff's
#else
uint8_t unused6[4]; // 0xff's
#endif
// 0x0EA0
uint8_t voice_prompt; //
@ -500,6 +505,10 @@ typedef struct {
uint8_t scan_list_priority_ch1[2];
uint8_t scan_list_priority_ch2[2];
#ifdef ENABLE_MDC1200
uint16_t mdc1200_id;
#endif
bool auto_keypad_lock;
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)

View File

@ -107,6 +107,9 @@ const t_menu_item g_menu_list[] =
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UpCODE", VOICE_ID_INVALID, MENU_UP_CODE },
{"DnCODE", VOICE_ID_INVALID, MENU_DN_CODE }, // was "DWCODE"
#ifdef ENABLE_MDC1200
{"MDC ID", VOICE_ID_INVALID, MENU_MDC1200_ID },
#endif
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D ST", VOICE_ID_INVALID, MENU_DTMF_ST },
{"D RSP", VOICE_ID_INVALID, MENU_DTMF_RSP },
@ -294,7 +297,7 @@ const char g_sub_menu_roger_mode[3][16] =
{
"OFF",
"TX END\nROGER",
"TX END\nMDC\n1200"
"TX END\nMDC1200"
};
const char g_sub_menu_reset[2][4] =
@ -992,6 +995,12 @@ void UI_DisplayMenu(void)
sprintf(str + strlen(str), "%dms", 10 * g_sub_menu_selection);
break;
#ifdef ENABLE_MDC1200
case MENU_MDC1200_ID:
sprintf(str, "MDC1200\nID\n%04X", g_sub_menu_selection);
break;
#endif
case MENU_PTT_ID:
strcpy(str, (g_sub_menu_selection > 0) ? "TX ID\n" : "");
strcat(str, g_sub_menu_ptt_id[g_sub_menu_selection]);

View File

@ -100,6 +100,9 @@ enum
MENU_DTMF_DCD,
MENU_DTMF_LIST,
MENU_DTMF_LIVE_DEC,
#ifdef ENABLE_MDC1200
MENU_MDC1200_ID,
#endif
MENU_PTT_ID,
MENU_ROGER_MODE,
#ifdef ENABLE_ALARM