0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-18 22:29:50 +03:00

fix missing display details

This commit is contained in:
OneOfEleven
2023-11-02 21:44:53 +00:00
parent 3681674b09
commit 98a4cd9483
20 changed files with 401 additions and 444 deletions

View File

@ -84,7 +84,8 @@ void UI_PrintString(const char *str, unsigned int x, const unsigned int end, con
x += ofs;
}
for (i = 0; i < length && (x + width) <= LCD_WIDTH; i++, x += width)
// for (i = 0; i < length && (x + width) <= LCD_WIDTH; i++, x += width)
for (i = 0; i < length; i++, x += width)
{
const int c = (int)str[i] - ' ';
if (c >= 0 && c < (int)font_size)
@ -117,6 +118,7 @@ static void UI_print_string(
}
for (i = 0; i < length && (x + char_width) <= LCD_WIDTH; i++, x += char_pitch)
// for (i = 0; i < length; i++, x += char_pitch)
{
const int c = (int)str[i] - ' ';
if (c >= 0 && c < (int)font_size)

View File

@ -262,7 +262,7 @@ void UI_update_rssi(const int16_t rssi, const int vfo)
// TODO: sort out all 8 values from the eeprom
#if 1
const unsigned int band = g_rx_vfo->band;
const unsigned int band = g_rx_vfo->channel_attributes.band;
const int16_t level0 = g_eeprom_rssi_calib[band][0];
const int16_t level1 = g_eeprom_rssi_calib[band][1];
const int16_t level2 = g_eeprom_rssi_calib[band][2];
@ -730,7 +730,7 @@ void UI_DisplayMain(void)
}
x += smallest_char_spacing * 4;
if (g_vfo_info[vfo_num].compand)
if (g_vfo_info[vfo_num].channel.compand)
UI_PrintStringSmallest("C", x, (line + 0) * 8, false, true);
//x += smallest_char_spacing * 1;
}
@ -740,14 +740,14 @@ void UI_DisplayMain(void)
const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel;
// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // currently way to slow
if (g_vfo_info[vfo_num].compand)
if (g_vfo_info[vfo_num].channel.compand)
{
strcpy(str, " ");
if (is_freq_chan && freq_in_channel <= USER_CHANNEL_LAST)
str[0] = 'F'; // channel number that contains this VFO frequency
if (g_vfo_info[vfo_num].compand)
if (g_vfo_info[vfo_num].channel.compand)
str[1] = 'C'; // compander is enabled
UI_PrintStringSmall(str, LCD_WIDTH - (7 * 2), 0, line + 1);
@ -771,7 +771,7 @@ void UI_DisplayMain(void)
if (mode == 1)
{ // TX power level
switch (g_rx_vfo->output_power)
switch (g_rx_vfo->channel.tx_power)
{
case OUTPUT_POWER_LOW: Level = 2; break;
case OUTPUT_POWER_MID: Level = 4; break;
@ -791,10 +791,10 @@ void UI_DisplayMain(void)
// ************
str[0] = '\0';
if (g_vfo_info[vfo_num].am_mode > 0)
if (g_vfo_info[vfo_num].channel.am_mode > 0)
{
//strcpy(str, g_sub_menu_mod_mode[g_vfo_info[vfo_num].am_mode]);
switch (g_vfo_info[vfo_num].am_mode)
//strcpy(str, g_sub_menu_mod_mode[g_vfo_info[vfo_num].channel.am_mode]);
switch (g_vfo_info[vfo_num].channel.am_mode)
{
default:
case 0: strcpy(str, "FM"); break;
@ -810,62 +810,62 @@ void UI_DisplayMain(void)
if (code_type < ARRAY_SIZE(code_list))
strcpy(str, code_list[code_type]);
}
UI_PrintStringSmall(str, LCD_WIDTH + 24, 0, line + 1);
UI_PrintStringSmall(str, 24, 0, line + 2);
#ifdef ENABLE_TX_WHEN_AM
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM)
#else
if ((state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) && g_vfo_info[vfo_num].am_mode == 0) // not allowed to TX if not in FM mode
if ((state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) && g_vfo_info[vfo_num].channel.am_mode == 0) // TX allowed only when FM
#endif
{
if (FREQUENCY_tx_freq_check(g_vfo_info[vfo_num].p_tx->frequency) == 0)
{
// show the TX power
const char pwr_list[] = "LMH";
const unsigned int i = g_vfo_info[vfo_num].output_power;
const unsigned int i = g_vfo_info[vfo_num].channel.tx_power;
str[0] = (i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
str[1] = '\0';
UI_PrintStringSmall(str, LCD_WIDTH + 46, 0, line + 1);
UI_PrintStringSmall(str, 46, 0, line + 2);
if (g_vfo_info[vfo_num].freq_config_rx.frequency != g_vfo_info[vfo_num].freq_config_tx.frequency)
{ // show the TX offset symbol
const char dir_list[] = "\0+-";
const unsigned int i = g_vfo_info[vfo_num].tx_offset_freq_dir;
const unsigned int i = g_vfo_info[vfo_num].channel.tx_offset_dir;
str[0] = (i < sizeof(dir_list)) ? dir_list[i] : '?';
str[1] = '\0';
UI_PrintStringSmall(str, LCD_WIDTH + 54, 0, line + 1);
UI_PrintStringSmall(str, 54, 0, line + 2);
}
}
}
// show the TX/RX reverse symbol
if (g_vfo_info[vfo_num].frequency_reverse)
UI_PrintStringSmall("R", LCD_WIDTH + 62, 0, line + 1);
if (g_vfo_info[vfo_num].channel.frequency_reverse)
UI_PrintStringSmall("R", 62, 0, line + 2);
{ // show the narrow band symbol
str[0] = '\0';
if (g_vfo_info[vfo_num].channel_bandwidth == BANDWIDTH_NARROW)
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_NARROW)
{
str[0] = 'N';
str[1] = '\0';
}
UI_PrintStringSmall(str, LCD_WIDTH + 70, 0, line + 1);
UI_PrintStringSmall(str, 70, 0, line + 2);
}
// show the DTMF decoding symbol
#ifdef ENABLE_KILL_REVIVE
if (g_vfo_info[vfo_num].dtmf_decoding_enable || g_eeprom.config.setting.radio_disabled)
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable || g_eeprom.config.setting.radio_disabled)
UI_PrintStringSmall("DTMF", 78, 0, line + 2);
#else
if (g_vfo_info[vfo_num].dtmf_decoding_enable)
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
//UI_PrintStringSmall4x5("DTMF", LCD_WIDTH + 78, 0, line + 1); // font table is currently wrong
//UI_PrintStringSmallest("DTMF", LCD_WIDTH + 78, (line + 1) * 8, false, true);
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable)
UI_PrintStringSmall("DTMF", 78, 0, line + 2);
//UI_PrintStringSmall4x5("DTMF", 78, 0, line + 2); // font table is currently wrong
//UI_PrintStringSmallest("DTMF", 78, (line + 2) * 8, false, true);
#endif
// show the audio scramble symbol
if (g_vfo_info[vfo_num].scrambling_type > 0 && g_eeprom.config.setting.enable_scrambler)
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
if (g_vfo_info[vfo_num].channel.scrambler > 0 && g_eeprom.config.setting.enable_scrambler)
UI_PrintStringSmall("SCR", 106, 0, line + 2);
}
if (g_center_line == CENTER_LINE_NONE &&

View File

@ -30,6 +30,7 @@
#include "frequencies.h"
#include "helper/battery.h"
#include "misc.h"
#include "radio.h"
#include "settings.h"
#include "ui/helper.h"
#include "ui/inputbox.h"
@ -469,10 +470,10 @@ void UI_SortMenu(const bool hide_hidden)
void UI_DisplayMenu(void)
{
const unsigned int menu_list_width = 6; // max no. of characters on the menu list (left side)
const unsigned int sub_menu_x1 = (8 * menu_list_width) + 0; // start x corrd
const unsigned int sub_menu_x2 = LCD_WIDTH - 1; // end x coord
bool channel_setting = false; // set if the setting is a channel setting
const unsigned int menu_list_width = 6; // max no. of characters on the menu list (left side)
const unsigned int sub_menu_x1 = 8 * menu_list_width; // start x corrd
const unsigned int sub_menu_x2 = LCD_WIDTH - 1; // end x coord
bool channel_setting = false; // set if the setting is a channel setting
unsigned int i;
char str[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
@ -736,7 +737,6 @@ void UI_DisplayMenu(void)
break;
case MENU_MOD_MODE:
// strcpy(str, (g_sub_menu_selection == 0) ? "FM" : "AM");
strcpy(str, g_sub_menu_mod_mode[g_sub_menu_selection]);
channel_setting = true;
break;
@ -793,6 +793,10 @@ void UI_DisplayMenu(void)
break;
case MENU_DTMF_DCD:
channel_setting = true;
// Fallthrough
case MENU_DTMF_LIVE_DEC:
strcpy(str, "DTMF\nDECODE\n");
strcat(str, g_sub_menu_off_on[g_sub_menu_selection]);
@ -989,16 +993,19 @@ void UI_DisplayMenu(void)
case MENU_UP_CODE:
strcpy(str, "DTMF BOT\n");
strcat(str, g_eeprom.config.setting.dtmf.key_up_code);
channel_setting = true;
break;
case MENU_DN_CODE:
strcpy(str, "DTMF EOT\n");
strcat(str, g_eeprom.config.setting.dtmf.key_down_code);
channel_setting = true;
break;
case MENU_DTMF_RSP:
strcpy(str, "DTMF\nRESPONSE\n");
strcat(str, g_sub_menu_dtmf_rsp[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_DTMF_HOLD: