diff --git a/Makefile b/Makefile index 7ce3a44..21af1bd 100644 --- a/Makefile +++ b/Makefile @@ -37,8 +37,8 @@ ENABLE_AM_FIX_SHOW_DATA := 1 ENABLE_SQUELCH_MORE_SENSITIVE := 1 ENABLE_FASTER_CHANNEL_SCAN := 1 ENABLE_RSSI_BAR := 1 -ENABLE_SHOW_TX_TIMEOUT := 1 -ENABLE_AUDIO_BAR := 0 +ENABLE_SHOW_TX_TIMEOUT := 0 +ENABLE_AUDIO_BAR := 1 ENABLE_COPY_CHAN_TO_VFO := 1 #ENABLE_PANADAPTER := 0 #ENABLE_SINGLE_VFO_CHAN := 0 diff --git a/README.md b/README.md index e04acf0..f35c7df 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still t ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves ENABLE_FASTER_CHANNEL_SCAN := 1 increases the channel scan speed, but the squelch is also made more twitchy ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols -ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing -ENABLE_SHOW_TX_TIMEOUT := 1 show the TX time left when transmitting +ENABLE_SHOW_TX_TIMEOUT := 0 show the remainng TX time +ENABLE_AUDIO_BAR := 1 experimental, display an audo bar level when TX'ing, includes remaining TX time (in seconds) ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M') #ENABLE_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter #ENABLE_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible diff --git a/app/app.c b/app/app.c index 8d9bc3a..5ba324e 100644 --- a/app/app.c +++ b/app/app.c @@ -1529,7 +1529,7 @@ void APP_TimeSlice10ms(void) { // transmitting #ifdef ENABLE_AUDIO_BAR if (g_setting_mic_bar && (g_flash_light_blink_counter % (150 / 10)) == 0) // once every 150ms - UI_DisplayAudioBar(); + UI_DisplayAudioBar(true); #endif } diff --git a/app/fm.c b/app/fm.c index cbd67e6..9f667a8 100644 --- a/app/fm.c +++ b/app/fm.c @@ -24,6 +24,7 @@ #include "driver/bk1080.h" #include "driver/eeprom.h" #include "driver/gpio.h" +#include "driver/uart.h" #include "functions.h" #include "misc.h" #include "settings.h" @@ -458,7 +459,7 @@ static void FM_Key_MENU(bool key_pressed, bool key_held) g_key_input_count_down = key_input_timeout_500ms; if (key_held || key_pressed) - return; + return; // key still pressed // see if the frequency is already stored in a channel for (i = 0; i < ARRAY_SIZE(g_fm_channels) && channel < 0; i++) @@ -467,6 +468,10 @@ static void FM_Key_MENU(bool key_pressed, bool key_held) g_request_display_screen = DISPLAY_FM; + #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) + //UART_SendText("fm menu 1\r\n"); + #endif + if (g_fm_scan_state == FM_SCAN_OFF) { // not scanning @@ -501,25 +506,40 @@ static void FM_Key_MENU(bool key_pressed, bool key_held) else g_ask_to_delete = true; } + + return; } - else - { // scanning - if (g_fm_auto_scan || !g_fm_found_frequency) - { - g_input_box_index = 0; - return; - } - if (g_ask_to_save) - { - g_fm_channels[g_fm_channel_position] = g_eeprom.fm_frequency_playing; - g_ask_to_save = false; - g_request_save_fm = true; - } - else - if (channel < 0) - g_ask_to_save = true; + // scanning + + #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) + //UART_SendText("fm menu 2\r\n"); + #endif + + if (g_fm_auto_scan || !g_fm_found_frequency) + { + g_input_box_index = 0; + return; } + + #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) + //UART_SendText("fm menu 3\r\n"); + #endif + + if (g_ask_to_save) + { + g_fm_channels[g_fm_channel_position] = g_eeprom.fm_frequency_playing; + g_ask_to_save = false; + g_request_save_fm = true; + return; + } + + #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) + //UART_SendText("fm menu 4\r\n"); + #endif + + if (channel < 0) + g_ask_to_save = true; } static void FM_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Step) diff --git a/driver/bk4819.c b/driver/bk4819.c index 3bc33ef..d8a491a 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -976,7 +976,8 @@ void BK4819_EnableDTMF(void) // <3:0> 14 Max symbol number for SelCall detection // // const uint16_t threshold = 24; // default, but doesn't decode non-QS radios - const uint16_t threshold = 160; // but 128 ~ 247 does + const uint16_t threshold = 130; // but 128 ~ 247 does +// const uint16_t threshold = 8; // 0 ~ 63 ? .. doesn't work with A and B's :( BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110 (1u << BK4819_REG_24_SHIFT_UNKNOWN_15) | (threshold << BK4819_REG_24_SHIFT_THRESHOLD) | // 0 ~ 255 diff --git a/firmware.bin b/firmware.bin deleted file mode 100644 index 075167c..0000000 Binary files a/firmware.bin and /dev/null differ diff --git a/firmware.packed.bin b/firmware.packed.bin deleted file mode 100644 index d4fabd6..0000000 Binary files a/firmware.packed.bin and /dev/null differ diff --git a/ui/fmradio.c b/ui/fmradio.c index 6b90af5..fad2203 100644 --- a/ui/fmradio.c +++ b/ui/fmradio.c @@ -86,9 +86,9 @@ void UI_DisplayFM(void) } else if (!g_fm_auto_scan) - strcpy(String, "M-SCAN"); + strcpy(String, "FREQ SCAN"); else - sprintf(String, "A-SCAN %u", 1 + g_fm_channel_position); + sprintf(String, "A-SCAN %2u", 1 + g_fm_channel_position); } UI_PrintString(String, 0, 127, 2, 10); diff --git a/ui/main.c b/ui/main.c index d6dd4ed..70ef542 100644 --- a/ui/main.c +++ b/ui/main.c @@ -67,7 +67,7 @@ center_line_t center_line = CENTER_LINE_NONE; if (timeout_secs == 0 || g_tx_timer_count_down_500ms == 0) return false; - + { const unsigned int line = 3; const unsigned int txt_width = 7 * 6; // 6 text chars @@ -80,12 +80,12 @@ center_line_t center_line = CENTER_LINE_NONE; uint8_t *p_line = g_frame_buffer[line]; unsigned int i; char s[16]; - + if (now) memset(p_line, 0, LCD_WIDTH); sprintf(s, "TX %u", secs); - UI_PrintStringSmall(s, 2, 0, line); + UI_PrintStringSmallBold(s, 2, 0, line); #if 1 // solid bar @@ -100,7 +100,7 @@ center_line_t center_line = CENTER_LINE_NONE; if (now) ST7565_BlitFullScreen(); } - + return true; } #endif @@ -146,56 +146,53 @@ void UI_drawBars(uint8_t *p, const unsigned int level) return sqrti; } - void UI_DisplayAudioBar(void) + bool UI_DisplayAudioBar(const bool now) { + if (g_current_function != FUNCTION_TRANSMIT || g_screen_to_display != DISPLAY_MAIN) + return false; + + if (center_line != CENTER_LINE_NONE && center_line != CENTER_LINE_AUDIO_BAR) + return false; + + if (g_dtmf_call_state != DTMF_CALL_STATE_NONE) + return false; + + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) + if (g_alarm_state != ALARM_STATE_OFF) + return false; + #endif + if (g_setting_mic_bar) { const unsigned int line = 3; - const unsigned int bar_x = 2; - const unsigned int bar_width = LCD_WIDTH - 2 - bar_x; + const unsigned int txt_width = 7 * 3; // 3 text chars + const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph + const unsigned int bar_width = LCD_WIDTH - 1 - bar_x; + const unsigned int secs = g_tx_timer_count_down_500ms / 2; + uint8_t *p_line = g_frame_buffer[line]; unsigned int i; + char s[16]; - if (g_current_function != FUNCTION_TRANSMIT || - g_screen_to_display != DISPLAY_MAIN || - g_dtmf_call_state != DTMF_CALL_STATE_NONE) - { - return; // screen is in use - } - - #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) - if (g_alarm_state != ALARM_STATE_OFF) - return; - #endif - - { - #if 1 - // TX audio level - - const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0 - -// const unsigned int max = 65535; -// const unsigned int level = ((voice_amp * bar_width) + (max / 2)) / max; // with rounding -// const unsigned int len = (level <= bar_width) ? level : bar_width; - - // make non-linear to make more sensitive at low values - const unsigned int level = voice_amp * 8; - const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535); - const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width; - - #else - // TX/RX AF input level (dB) - - const uint8_t af_tx_rx = BK4819_GetAfTxRx(); // 6:0 - const unsigned int max = 63; - const unsigned int level = (((uint16_t)af_tx_rx * bar_width) + (max / 2)) / max; // with rounding - const unsigned int len = (level <= bar_width) ? level : bar_width; - - #endif - - uint8_t *p_line = g_frame_buffer[line]; - + if (now) memset(p_line, 0, LCD_WIDTH); + // TX timeout seconds + sprintf(s, "%3u", secs); + UI_PrintStringSmallBold(s, 2, 0, line); + + { // TX audio level + + const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0 + +// const unsigned int max = 65535; +// const unsigned int level = ((voice_amp * bar_width) + (max / 2)) / max; // with rounding +// const unsigned int len = (level <= bar_width) ? level : bar_width; + + // make non-linear to make more sensitive at low values + const unsigned int level = voice_amp * 8; + const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535); + const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width; + #if 1 // solid bar for (i = 0; i < bar_width; i++) @@ -206,10 +203,12 @@ void UI_drawBars(uint8_t *p, const unsigned int level) p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41; #endif - if (g_current_function == FUNCTION_TRANSMIT) + if (now) ST7565_BlitFullScreen(); } } + + return true; } #endif @@ -402,7 +401,7 @@ void UI_DisplayMain(void) ST7565_BlitFullScreen(); return; } - + if (g_eeprom.key_lock && g_keypad_locked > 0) { // tell user how to unlock the keyboard backlight_turn_on(); @@ -805,10 +804,9 @@ void UI_DisplayMain(void) #ifdef ENABLE_AUDIO_BAR // show the TX audio level - if (g_setting_mic_bar && g_current_function == FUNCTION_TRANSMIT) + if (UI_DisplayAudioBar(false)) { center_line = CENTER_LINE_AUDIO_BAR; - UI_DisplayAudioBar(); } else #endif diff --git a/ui/main.h b/ui/main.h index 494aef4..a32c855 100644 --- a/ui/main.h +++ b/ui/main.h @@ -35,7 +35,7 @@ extern center_line_t center_line; bool UI_DisplayTXCountdown(const bool now); #endif #ifdef ENABLE_AUDIO_BAR - void UI_DisplayAudioBar(void); + bool UI_DisplayAudioBar(const bool now); #endif void UI_UpdateRSSI(const int16_t rssi, const int vfo); void UI_DisplayMain(void);