mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-22 01:32:43 +00:00
DTMF decoder tidy up
This commit is contained in:
parent
079236f4aa
commit
d1bbe69b91
2
Makefile
2
Makefile
@ -17,8 +17,8 @@ ENABLE_TX_WHEN_AM := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
ENABLE_MAIN_KEY_HOLD := 1
|
||||
ENABLE_BOOT_BEEPS := 1
|
||||
ENABLE_COMPANDER := 1
|
||||
ENABLE_DTMF_DECODER := 1
|
||||
ENABLE_COMPANDER := 1
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||
#ENABLE_BAND_SCOPE := 1
|
||||
|
||||
|
11
README.md
11
README.md
@ -25,11 +25,11 @@ ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving m
|
||||
ENABLE_CHAN_NAME_FREQ := 1 show channel frequency below channel name/number
|
||||
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though frontend not tuned over full range)
|
||||
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9
|
||||
ENABLE_BOOT_BEEPS := 1 give user audio feedback on volume knob position at boot-up
|
||||
ENABLE_DTMF_DECODER := 1 live on-screen DTMF decoder
|
||||
ENABLE_COMPANDER := 1 compander option - setting not yet saved
|
||||
ENABLE_DTMF_DECODER := 1 enable real time on-screen DTMF decoder
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
||||
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
||||
```
|
||||
@ -40,7 +40,7 @@ ENABLE_DTMF_DECODER := 1 enable real time on-screen DTMF decoder
|
||||
* Added new bugs
|
||||
* Finer RSSI bar steps
|
||||
* Mic menu includes max gain possible
|
||||
* AM RX everywhere (not that AM really works)
|
||||
* AM RX everywhere
|
||||
* Better backlight times (inc always on)
|
||||
* Nicer/cleaner big numeric font than original Quansheng big numeric font
|
||||
* Various menu re-wordings (trying to reduce 'WTH does that mean ?')
|
||||
@ -86,6 +86,7 @@ Many thanks to various people on Telegram for putting up with me during this eff
|
||||
* @Davide
|
||||
* @Ismo OH2FTG
|
||||
* [OneOfEleven](https://github.com/OneOfEleven)
|
||||
* @d1ced95
|
||||
* and others I forget
|
||||
|
||||
# License
|
||||
@ -109,6 +110,6 @@ You may obtain a copy of the License at
|
||||
|
||||
<p float="left">
|
||||
<img src="/image1.png" width="300" />
|
||||
<img src="/image2.png" width="300" />
|
||||
<img src="/image3.png" width="300" />
|
||||
<img src="/image2.png" width="300" />
|
||||
<img src="/image3.png" width="300" />
|
||||
</p>
|
||||
|
47
app/app.c
47
app/app.c
@ -646,31 +646,29 @@ void APP_CheckRadioInterrupts(void)
|
||||
// g_CTCSS_Lost = true;
|
||||
|
||||
if (interrupt_status_bits & BK4819_REG_02_DTMF_5TONE_FOUND)
|
||||
{
|
||||
{ // save the new DTMF RX'ed character
|
||||
|
||||
// fetch the RX'ed char
|
||||
const char c = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code());
|
||||
|
||||
gDTMF_RequestPending = true;
|
||||
gDTMF_RecvTimeout = DTMF_RX_timeout_500ms;
|
||||
|
||||
if (gDTMF_WriteIndex >= ARRAY_SIZE(gDTMF_Received))
|
||||
{ // shift the RX buffer down one
|
||||
unsigned int i;
|
||||
for (i = 0; i < (ARRAY_SIZE(gDTMF_Received) - 1); i++)
|
||||
gDTMF_Received[i] = gDTMF_Received[i + 1];
|
||||
gDTMF_WriteIndex--;
|
||||
}
|
||||
|
||||
// save new RX'ed character
|
||||
gDTMF_Received[gDTMF_WriteIndex++] = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code());
|
||||
// shift the RX buffer down one - if need be
|
||||
if (gDTMF_WriteIndex >= sizeof(gDTMF_Received))
|
||||
memmove(gDTMF_Received, &gDTMF_Received[1], gDTMF_WriteIndex-- - 1);
|
||||
gDTMF_Received[gDTMF_WriteIndex++] = c;
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE)
|
||||
{
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
if (gDTMF_WriteIndex > 0)
|
||||
{
|
||||
memcpy(gDTMF_ReceivedSaved, gDTMF_Received, sizeof(gDTMF_ReceivedSaved));
|
||||
gDTMF_WriteIndexSaved = gDTMF_WriteIndex;
|
||||
gDTMF_RecvTimeoutSaved = DTMF_RX_timeout_saved_500ms;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
gDTMF_RecvTimeoutSaved = DTMF_RX_timeout_saved_500ms;
|
||||
size_t len = strlen(gDTMF_ReceivedSaved);
|
||||
// shift the RX buffer down one
|
||||
if (len >= (sizeof(gDTMF_ReceivedSaved) - 1))
|
||||
memmove(gDTMF_ReceivedSaved, &gDTMF_ReceivedSaved[1], len--);
|
||||
gDTMF_ReceivedSaved[len++] = c;
|
||||
gDTMF_ReceivedSaved[len] = '\0';
|
||||
gUpdateDisplay = true;
|
||||
#endif
|
||||
|
||||
DTMF_HandleRequest();
|
||||
@ -1718,8 +1716,7 @@ void APP_TimeSlice500ms(void)
|
||||
{
|
||||
if (--gDTMF_RecvTimeoutSaved == 0)
|
||||
{
|
||||
gDTMF_WriteIndexSaved = 0;
|
||||
memset(gDTMF_ReceivedSaved, 0, sizeof(gDTMF_ReceivedSaved));
|
||||
gDTMF_ReceivedSaved[0] = '\0';
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
@ -1789,6 +1786,14 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK)
|
||||
gKeyLockCountdown = 30; // 15 seconds
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld)
|
||||
{ // clear the DTMF RX display buffer
|
||||
gDTMF_RecvTimeoutSaved = 0;
|
||||
gDTMF_ReceivedSaved[0] = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!bKeyPressed)
|
||||
{
|
||||
if (gFlagSaveVfo)
|
||||
|
@ -40,8 +40,7 @@ uint8_t gDTMF_PreviousIndex = 0;
|
||||
uint8_t gDTMF_RecvTimeout = 0;
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
char gDTMF_ReceivedSaved[16];
|
||||
uint8_t gDTMF_WriteIndexSaved = 0;
|
||||
char gDTMF_ReceivedSaved[17];
|
||||
uint8_t gDTMF_RecvTimeoutSaved = 0;
|
||||
#endif
|
||||
|
||||
|
@ -62,8 +62,7 @@ extern uint8_t gDTMF_PreviousIndex;
|
||||
extern uint8_t gDTMF_RecvTimeout;
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
extern char gDTMF_ReceivedSaved[16];
|
||||
extern uint8_t gDTMF_WriteIndexSaved;
|
||||
extern char gDTMF_ReceivedSaved[17];
|
||||
extern uint8_t gDTMF_RecvTimeoutSaved;
|
||||
#endif
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -60,9 +60,8 @@ void FUNCTION_Init(void)
|
||||
memset(gDTMF_Received, 0, sizeof(gDTMF_Received));
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
// gDTMF_RecvTimeoutSaved = 0;
|
||||
// gDTMF_WriteIndexSaved = 0;
|
||||
// memset(gDTMF_ReceivedSaved, 0, sizeof(gDTMF_ReceivedSaved));
|
||||
// gDTMF_RecvTimeoutSaved = 0;
|
||||
// gDTMF_ReceivedSaved[0] = '\0';
|
||||
#endif
|
||||
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
|
22
ui/main.c
22
ui/main.c
@ -262,30 +262,32 @@ void UI_DisplayMain(void)
|
||||
break;
|
||||
|
||||
case MDF_NAME: // show the channel name
|
||||
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
|
||||
if (gEeprom.VfoInfo[vfo_num].Name[0] <= 32 ||
|
||||
gEeprom.VfoInfo[vfo_num].Name[0] >= 127)
|
||||
{ // no channel name, show the channel number instead
|
||||
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||
}
|
||||
else
|
||||
{ // channel name
|
||||
strcpy(String, gEeprom.VfoInfo[vfo_num].Name);
|
||||
memset(String, 0, sizeof(String));
|
||||
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 10);
|
||||
}
|
||||
UI_PrintString(String, 31, 112, Line, 8);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_CHAN_NAME_FREQ
|
||||
case MDF_NAME_FREQ: // show the channel name and frequency
|
||||
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
|
||||
if (gEeprom.VfoInfo[vfo_num].Name[0] <= 32 ||
|
||||
gEeprom.VfoInfo[vfo_num].Name[0] >= 127)
|
||||
{ // no channel name, show channel number instead
|
||||
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, Line);
|
||||
}
|
||||
else
|
||||
{ // channel name
|
||||
memset(String, 0, sizeof(String));
|
||||
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 8);
|
||||
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, Line);
|
||||
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 10);
|
||||
}
|
||||
UI_PrintStringSmall(String, 31 + 8, 0, Line);
|
||||
|
||||
// show the channel frequency below the channel number/name
|
||||
sprintf(String, "%03u.%05u", frequency_Hz / 100000, frequency_Hz % 100000);
|
||||
@ -402,13 +404,9 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
if (gDTMF_WriteIndexSaved > 0)
|
||||
if (gDTMF_ReceivedSaved[0] >= 32)
|
||||
{ // show the incoming DTMF live on-screen
|
||||
const unsigned int len = (gDTMF_WriteIndexSaved < ARRAY_SIZE(String)) ? gDTMF_WriteIndexSaved : ARRAY_SIZE(String) - 1;
|
||||
memset(String, 0, sizeof(String));
|
||||
memcpy(String, gDTMF_ReceivedSaved, len);
|
||||
UI_PrintStringSmall("D:", 2, 0, 3);
|
||||
UI_PrintStringSmall(String, 2 + (7 * 2), 0, 3);
|
||||
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#ifdef GIT_HASH
|
||||
#define VER GIT_HASH
|
||||
#else
|
||||
#define VER "230916"
|
||||
#define VER "230917"
|
||||
#endif
|
||||
|
||||
const char Version[] = "OEFW-"VER;
|
||||
|
@ -13,7 +13,7 @@ del /S /Q *.o >nul 2>nul
|
||||
del /S /Q *.d >nul 2>nul
|
||||
|
||||
::python -m pip install --upgrade pip crcmod
|
||||
fw-pack.py firmware.bin 230916 firmware.packed.bin
|
||||
fw-pack.py firmware.bin 230917 firmware.packed.bin
|
||||
|
||||
::arm-none-eabi-size firmware
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user