Skip to content

Commit

Permalink
Updated DTMF to full char range
Browse files Browse the repository at this point in the history
  • Loading branch information
OneOfEleven authored and OneOfEleven committed Oct 11, 2023
1 parent 6374160 commit 04f9262
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 17 deletions.
20 changes: 19 additions & 1 deletion app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,10 +1814,28 @@ void APP_TimeSlice10ms(void)

void cancelUserInputModes(void)
{
if (g_ask_to_save)
{
g_ask_to_save = false;
g_update_display = true;
}
if (g_ask_to_delete)
{
g_ask_to_delete = false;
g_update_display = true;
}

if (g_dtmf_input_mode || g_dtmf_input_box_index > 0)
{
DTMF_clear_input_box();
g_request_display_screen = DISPLAY_MAIN;
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
g_request_display_screen = DISPLAY_FM;
else
g_request_display_screen = DISPLAY_MAIN;
#else
g_request_display_screen = DISPLAY_MAIN;
#endif
g_update_display = true;
}

Expand Down
8 changes: 8 additions & 0 deletions app/fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)

static void FM_Key_STAR(bool key_pressed, bool key_held)
{
g_key_input_count_down = key_input_timeout_500ms;

if (key_held && !key_pressed)
return;

Expand All @@ -392,6 +394,8 @@ static void FM_Key_STAR(bool key_pressed, bool key_held)

static void FM_Key_EXIT(bool key_pressed, bool key_held)
{
g_key_input_count_down = key_input_timeout_500ms;

if (key_held || key_pressed)
return;

Expand Down Expand Up @@ -451,6 +455,8 @@ static void FM_Key_MENU(bool key_pressed, bool key_held)
unsigned int i;
int channel = -1;

g_key_input_count_down = key_input_timeout_500ms;

if (key_held || key_pressed)
return;

Expand Down Expand Up @@ -518,6 +524,8 @@ static void FM_Key_MENU(bool key_pressed, bool key_held)

static void FM_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Step)
{
g_key_input_count_down = key_input_timeout_500ms;

if (key_held || !key_pressed)
{
if (g_input_box_index > 0)
Expand Down
3 changes: 2 additions & 1 deletion driver/bk4819.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,8 @@ void BK4819_EnableDTMF(void)
(1u << BK4819_REG_24_SHIFT_UNKNOWN_6) |
BK4819_REG_24_ENABLE |
BK4819_REG_24_SELECT_DTMF |
(14u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
// (14u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
(15u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
}

void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch)
Expand Down
Binary file modified firmware.bin
Binary file not shown.
Binary file modified firmware.packed.bin
Binary file not shown.
44 changes: 29 additions & 15 deletions ui/fmradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ void UI_DisplayFM(void)

memset(g_frame_buffer, 0, sizeof(g_frame_buffer));

// *************************************

if (g_eeprom.key_lock && g_keypad_locked > 0)
{ // tell user how to unlock the keyboard
backlight_turn_on();
Expand All @@ -46,19 +44,22 @@ void UI_DisplayFM(void)
}

// *************************************

// upper text line

UI_PrintString("FM", 0, 127, 0, 12);

// *************************************

// middle text line

if (g_ask_to_save)
{
strcpy(String, "SAVE ?");
const unsigned int freq = g_eeprom.fm_frequency_playing;
sprintf(String, "SAVE %u.%u ?", freq / 10, freq % 10);
}
else
if (g_ask_to_delete)
{
strcpy(String, "DEL ?");
strcpy(String, "DELETE ?");
}
else
{
Expand All @@ -72,7 +73,7 @@ void UI_DisplayFM(void)
{
if (g_eeprom.fm_frequency_playing == g_fm_channels[i])
{
sprintf(String, "VFO (CH %u)", i + 1);
sprintf(String, "VFO (CH %u)", 1 + i);
break;
}
}
Expand All @@ -81,31 +82,42 @@ void UI_DisplayFM(void)
strcpy(String, "VFO");
}
else
sprintf(String, "CH %u", g_eeprom.fm_selected_channel + 1);
sprintf(String, "CH %u", 1 + g_eeprom.fm_selected_channel);
}
else
if (!g_fm_auto_scan)
strcpy(String, "M-SCAN");
else
sprintf(String, "A-SCAN %u", g_fm_channel_position + 1);
sprintf(String, "A-SCAN %u", 1 + g_fm_channel_position);
}

UI_PrintString(String, 0, 127, 2, 10);

// *************************************
// lower text line

memset(String, 0, sizeof(String));

if (g_ask_to_save || (g_eeprom.fm_is_channel_mode && g_input_box_index > 0))
if (g_ask_to_save)
{ // channel mode
const unsigned int chan = g_fm_channel_position;
const uint32_t freq = g_fm_channels[chan];
UI_GenerateChannelString(String, chan, ' ');
if (FM_CheckValidChannel(chan))
sprintf(String + strlen(String), " (%u.%u)", freq / 10, freq % 10);
}
else
if (g_eeprom.fm_is_channel_mode && g_input_box_index > 0)
{ // user is entering a channel number
UI_GenerateChannelString(String, g_fm_channel_position, ' ');
}
else
if (!g_ask_to_delete)
{
if (g_input_box_index == 0)
{
NUMBER_ToDigits(g_eeprom.fm_frequency_playing * 10000, String);
{ // frequency mode
const uint32_t freq = g_eeprom.fm_frequency_playing;
NUMBER_ToDigits(freq * 10000, String);
UI_DisplayFrequency(String, 23, 4, false, true);
}
else
Expand All @@ -114,11 +126,13 @@ void UI_DisplayFM(void)
}
}
else
{
sprintf(String, "CH %u", g_eeprom.fm_selected_channel + 1);
{ // delete channel
const uint32_t chan = g_eeprom.fm_selected_channel;
const uint32_t freq = g_fm_channels[chan];
sprintf(String, "CH %u (%u.%u)", 1 + chan, freq / 10, freq % 10);
}

UI_PrintString(String, 0, 127, 4, 10);
UI_PrintString(String, 0, 127, 4, (strlen(String) >= 8) ? 8 : 10);

// *************************************

Expand Down

0 comments on commit 04f9262

Please sign in to comment.