0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

Added extra MENU-MDF option (NAM+FRE)

This commit is contained in:
OneOfEleven
2023-09-10 09:57:49 +01:00
parent 1e3368ac2e
commit b1399c8073
13 changed files with 341 additions and 45 deletions

View File

@ -22,6 +22,10 @@
#include "ui/helper.h"
#include "ui/inputbox.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0]))
#endif
void UI_GenerateChannelString(char *pString, const uint8_t Channel)
{
unsigned int i;
@ -86,18 +90,53 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
if (bCentered)
Start += (((End - Start) - (Length * 8)) + 1) / 2;
for (i = 0; i < Length; i++)
{
if (pString[i] >= 32)
#if 0
{ // 5x7 font
for (i = 0; i < Length; i++)
{
const unsigned int Index = ((unsigned int)pString[i] - 32) * 5;
if (Index < sizeof(gFont5x7))
if (pString[i] >= 32)
{
const unsigned int ofs = (unsigned int)Start + (i * 8);
memcpy(gFrameBuffer[Line] + ofs, &gFont5x7[Index], 5);
const unsigned int Index = ((unsigned int)pString[i] - 32) * 5;
if (Index < sizeof(gFont5x7))
{
const unsigned int ofs = (unsigned int)Start + (i * 8);
memcpy(gFrameBuffer[Line] + ofs, &gFont5x7[Index], 5);
}
}
}
}
#else
{ // 6x8 font
for (i = 0; i < Length; i++)
{
if (pString[i] >= 32)
{
const unsigned int Index = (unsigned int)pString[i] - 32;
if (Index < ARRAY_SIZE(gFont6x8))
{
const unsigned int ofs = (unsigned int)Start + (i * 8);
memcpy(gFrameBuffer[Line] + ofs, &gFont6x8[Index], 6);
}
}
}
}
/*
{ // 8x8 font
for (i = 0; i < Length; i++)
{
if (pString[i] >= 32)
{
const unsigned int Index = (unsigned int)pString[i] - 32;
if (Index < ARRAY_SIZE(gFont8x8))
{
const unsigned int ofs = (unsigned int)Start + (i * 8);
memcpy(gFrameBuffer[Line] + ofs, &gFont8x8[Index], 8);
}
}
}
}
*/
#endif
}
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)

View File

@ -288,20 +288,28 @@ void UI_DisplayMain(void)
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
frequency_Hz = 0;
break;
case MDF_CHANNEL:
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
#ifdef CHAN_NAME_FREQ
UI_PrintStringSmall(String, 31 + 8, 0, (vfo_num * 4) + 1, false);
#else
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
#endif
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
frequency_Hz = 0;
break;
case MDF_NAME:
#ifdef CHAN_NAME_FREQ
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
}
else
{ // channel name
UI_PrintString(gEeprom.VfoInfo[vfo_num].Name, 31, 112, vfo_num * 4, 8, true);
}
frequency_Hz = 0;
break;
#ifdef CHAN_NAME_FREQ
case MDF_NAME_FREQ:
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
@ -313,18 +321,8 @@ void UI_DisplayMain(void)
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 8);
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, (vfo_num * 4) + 1, false);
}
#else
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
}
else
{ // channel name
UI_PrintString(gEeprom.VfoInfo[vfo_num].Name, 31, 112, vfo_num * 4, 8, true);
}
#endif
break;
break;
#endif
}
}
else

View File

@ -183,12 +183,22 @@ static const char gSubMenu_SC_REV[3][3] =
"SE",
};
static const char gSubMenu_MDF[3][5] =
{
"FREQ",
"CHAN",
"NAME",
};
#ifndef CHAN_NAME_FREQ
static const char gSubMenu_MDF[3][5] =
{
"FREQ",
"CHAN",
"NAME"
};
#else
static const char gSubMenu_MDF[4][8] =
{
"FREQ",
"CHAN",
"NAME",
"NAM+FRE"
};
#endif
#ifndef DISABLE_ALARM
static const char gSubMenu_AL_MOD[2][5] =

View File

@ -74,10 +74,13 @@ void UI_UpdateRSSI(uint16_t RSSI)
{
//const int16_t dB = (int16_t)(RSSI / 2) - 160;
const uint16_t level0 = gEEPROM_RSSI_CALIB[gRxVfo->Band][0];
const uint16_t level1 = gEEPROM_RSSI_CALIB[gRxVfo->Band][1];
const uint16_t level2 = gEEPROM_RSSI_CALIB[gRxVfo->Band][2];
const uint16_t level3 = gEEPROM_RSSI_CALIB[gRxVfo->Band][3];
// const unsigned int band = gRxVfo->Band;
const unsigned int band = 0;
const uint16_t level0 = gEEPROM_RSSI_CALIB[band][0];
const uint16_t level1 = gEEPROM_RSSI_CALIB[band][1];
const uint16_t level2 = gEEPROM_RSSI_CALIB[band][2];
const uint16_t level3 = gEEPROM_RSSI_CALIB[band][3];
const uint16_t level01 = (level0 + level1) / 2;
const uint16_t level12 = (level1 + level2) / 2;
const uint16_t level23 = (level2 + level3) / 2;