diff --git a/firmware.bin b/firmware.bin index 1c87907..2d54e17 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 889f00f..d453faa 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/settings.c b/settings.c index e9f5e29..27cba20 100644 --- a/settings.c +++ b/settings.c @@ -86,7 +86,7 @@ void SETTINGS_save_vfo_indices(void) void SETTINGS_save_attributes(void) { unsigned int i; - unsigned int index = (unsigned int )(((uint8_t *)&g_eeprom.config.channel_attributes) - ((uint8_t *)&g_eeprom)); + unsigned int index = (unsigned int)(((uint8_t *)&g_eeprom.config.channel_attributes) - ((uint8_t *)&g_eeprom)); index &= ~7u; for (i = 0; i < sizeof(g_eeprom.config.channel_attributes); i += 8) EEPROM_WriteBuffer8(index + i, ((uint8_t *)&g_eeprom) + index + i); @@ -105,7 +105,7 @@ void SETTINGS_read_eeprom(void) { unsigned int index; - // read the entire EEPROM contents into memory as a whole + // read the entire EEPROM contents into memory for (index = 0; index < sizeof(g_eeprom); index += 128) EEPROM_ReadBuffer(index, (uint8_t *)(&g_eeprom) + index, 128); diff --git a/ui/main.c b/ui/main.c index 14271ca..d26f78d 100644 --- a/ui/main.c +++ b/ui/main.c @@ -215,7 +215,7 @@ void draw_bar(uint8_t *line, const int len, const int max_width) const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB; #ifdef ENABLE_SINGLE_VFO_CHAN - const unsigned int line = (single_vfo >= 0 && !pan_enabled) ? 7 : 3; + const unsigned int line = (single_vfo >= 0 && !pan_enabled) ? 6 : 3; #else const unsigned int line = 3; #endif @@ -281,6 +281,11 @@ void UI_update_rssi(const int rssi, const unsigned int glitch, const unsigned in (void)noise; #endif + #ifdef ENABLE_SINGLE_VFO_CHAN + if (single_vfo >= 0 && !pan_enabled) + return; + #endif + { // original little RSSI bars #ifdef ENABLE_SINGLE_VFO_CHAN @@ -507,6 +512,123 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int } #endif +void UI_DisplayCenterLine(void) +{ +// const bool rx = (g_current_function == FUNCTION_RECEIVE && g_squelch_open) ? true : false; + const bool rx = (g_current_function == FUNCTION_RECEIVE) ? true : false; + + if (g_center_line != CENTER_LINE_NONE || + g_current_display_screen != DISPLAY_MAIN || + g_dtmf_call_state != DTMF_CALL_STATE_NONE) + { + return; + } + + // we're free to use the middle line + + #ifdef ENABLE_TX_AUDIO_BAR + // show the TX audio level + if (UI_DisplayAudioBar(false)) + { + g_center_line = CENTER_LINE_AUDIO_BAR; + } + else + #endif + + #ifdef ENABLE_MDC1200 + if (mdc1200_rx_ready_tick_500ms > 0) + { + g_center_line = CENTER_LINE_MDC1200; + #ifdef ENABLE_MDC1200_SHOW_OP_ARG + sprintf(str, "MDC1200 %02X %02X %04X", mdc1200_op, mdc1200_arg, mdc1200_unit_id); + #else + sprintf(str, "MDC1200 ID %04X", mdc1200_unit_id); + #endif + #ifdef ENABLE_SMALL_BOLD + UI_PrintStringSmallBold(str, 2, 0, 3); + #else + UI_PrintStringSmall(str, 2, 0, 3); + #endif + } + else + #endif + + #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) + // show the AM-FIX debug data + if (rx && g_vfo_info[g_rx_vfo_num].mod_mode != MOD_MODE_FM && g_eeprom.config.setting.am_fix) + { + g_center_line = CENTER_LINE_AM_FIX_DATA; + AM_fix_print_data(g_rx_vfo_num, str); + UI_PrintStringSmall(str, 2, 0, 3); + } + else + #endif + + #ifdef ENABLE_RX_SIGNAL_BAR + // show the RX RSSI dBm, S-point and signal strength bar graph + if (rx && g_eeprom.config.setting.enable_rssi_bar) + { + const int rssi_level = (g_tx_vfo->channel_attributes.band < 3) ? g_current_rssi[g_rx_vfo_num] + rssi_offset_band_123 : g_current_rssi[g_rx_vfo_num] + rssi_offset_band_4567; + g_center_line = CENTER_LINE_RSSI; + UI_DisplayRSSIBar(rssi_level, g_current_glitch[g_rx_vfo_num], g_current_noise[g_rx_vfo_num], false); + } + else + #endif + + if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE) + { + #ifdef ENABLE_DTMF_LIVE_DECODER + #if 1 + if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_live[0] != 0) + { // show live DTMF decode + const unsigned int len = strlen(g_dtmf_rx_live); + const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars + + if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) + return; + + g_center_line = CENTER_LINE_DTMF_DEC; + + strcpy(str, "DTMF "); + strcat(str, g_dtmf_rx_live + idx); + UI_PrintStringSmall(str, 2, 0, 3); + } + #else + if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0) + { // show live DTMF decode + const unsigned int len = g_dtmf_rx_index; + const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars + + if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) + return; + + g_center_line = CENTER_LINE_DTMF_DEC; + + strcpy(str, "DTMF "); + strcat(str, g_dtmf_rx + idx); + UI_PrintStringSmall(str, 2, 0, 3); + } + #endif + #endif + + #ifdef ENABLE_SHOW_CHARGE_LEVEL + else + if (g_charging_with_type_c) + { // show the battery charge state + if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) + return; + + g_center_line = CENTER_LINE_CHARGE_DATA; + + sprintf(str, "Charge %u.%02uV %u%%", + g_battery_voltage_average / 100, g_battery_voltage_average % 100, + BATTERY_VoltsToPercent(g_battery_voltage_average)); + UI_PrintStringSmall(str, 2, 0, 3); + } + #endif + } +} + const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"}; #ifdef ENABLE_SINGLE_VFO_CHAN @@ -849,6 +971,8 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA #endif } + UI_DisplayCenterLine(); + ST7565_BlitFullScreen(); } #endif @@ -916,18 +1040,15 @@ void UI_DisplayMain(void) #if ENABLE_SINGLE_VFO_CHAN #ifdef ENABLE_PANADAPTER - if (single_vfo >= 0 && !pan_enabled) - { - UI_DisplayMainSingle(); - return; - } - #else - if (single_vfo >= 0) - { - UI_DisplayMainSingle(); - return; - } + if (!pan_enabled) #endif + { + if (single_vfo >= 0) + { + UI_DisplayMainSingle(); + return; + } + } #endif for (vfo_num = 0; vfo_num < 2; vfo_num++) @@ -1415,116 +1536,7 @@ void UI_DisplayMain(void) // ************************************************* - if (g_center_line == CENTER_LINE_NONE && - g_current_display_screen == DISPLAY_MAIN && - g_dtmf_call_state == DTMF_CALL_STATE_NONE) - { // we're free to use the middle line - -// const bool rx = (g_current_function == FUNCTION_RECEIVE && g_squelch_open) ? true : false; - const bool rx = (g_current_function == FUNCTION_RECEIVE) ? true : false; - - #ifdef ENABLE_TX_AUDIO_BAR - // show the TX audio level - if (UI_DisplayAudioBar(false)) - { - g_center_line = CENTER_LINE_AUDIO_BAR; - } - else - #endif - - #ifdef ENABLE_MDC1200 - if (mdc1200_rx_ready_tick_500ms > 0) - { - g_center_line = CENTER_LINE_MDC1200; - #ifdef ENABLE_MDC1200_SHOW_OP_ARG - sprintf(str, "MDC1200 %02X %02X %04X", mdc1200_op, mdc1200_arg, mdc1200_unit_id); - #else - sprintf(str, "MDC1200 ID %04X", mdc1200_unit_id); - #endif - #ifdef ENABLE_SMALL_BOLD - UI_PrintStringSmallBold(str, 2, 0, 3); - #else - UI_PrintStringSmall(str, 2, 0, 3); - #endif - } - else - #endif - - #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) - // show the AM-FIX debug data - if (rx && g_vfo_info[g_rx_vfo_num].mod_mode != MOD_MODE_FM && g_eeprom.config.setting.am_fix) - { - g_center_line = CENTER_LINE_AM_FIX_DATA; - AM_fix_print_data(g_rx_vfo_num, str); - UI_PrintStringSmall(str, 2, 0, 3); - } - else - #endif - - #ifdef ENABLE_RX_SIGNAL_BAR - // show the RX RSSI dBm, S-point and signal strength bar graph - if (rx && g_eeprom.config.setting.enable_rssi_bar) - { - const int rssi_level = (g_tx_vfo->channel_attributes.band < 3) ? g_current_rssi[g_rx_vfo_num] + rssi_offset_band_123 : g_current_rssi[g_rx_vfo_num] + rssi_offset_band_4567; - g_center_line = CENTER_LINE_RSSI; - UI_DisplayRSSIBar(rssi_level, g_current_glitch[g_rx_vfo_num], g_current_noise[g_rx_vfo_num], false); - } - else - #endif - - if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE) - { - #ifdef ENABLE_DTMF_LIVE_DECODER - #if 1 - if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_live[0] != 0) - { // show live DTMF decode - const unsigned int len = strlen(g_dtmf_rx_live); - const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars - - if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) - return; - - g_center_line = CENTER_LINE_DTMF_DEC; - - strcpy(str, "DTMF "); - strcat(str, g_dtmf_rx_live + idx); - UI_PrintStringSmall(str, 2, 0, 3); - } - #else - if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0) - { // show live DTMF decode - const unsigned int len = g_dtmf_rx_index; - const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars - - if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) - return; - - g_center_line = CENTER_LINE_DTMF_DEC; - - strcpy(str, "DTMF "); - strcat(str, g_dtmf_rx + idx); - UI_PrintStringSmall(str, 2, 0, 3); - } - #endif - #endif - - #ifdef ENABLE_SHOW_CHARGE_LEVEL - else - if (g_charging_with_type_c) - { // show the battery charge state - if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) - return; - - g_center_line = CENTER_LINE_CHARGE_DATA; - - sprintf(str, "Charge %u.%02uV %u%%", - g_battery_voltage_average / 100, g_battery_voltage_average % 100, - BATTERY_VoltsToPercent(g_battery_voltage_average)); - UI_PrintStringSmall(str, 2, 0, 3); - } - #endif - } - } + UI_DisplayCenterLine(); #ifdef ENABLE_PANADAPTER UI_DisplayMain_pan(false);