Channel frequency can be shown with name

This commit is contained in:
OneOfEleven 2023-09-10 05:49:39 +01:00
parent 5bc11d6674
commit 2d8c4787bf
16 changed files with 369 additions and 166 deletions

View File

@ -96,6 +96,7 @@ CFLAGS += -DDISABLE_VOICE
CFLAGS += -DDISABLE_AIRCOPY CFLAGS += -DDISABLE_AIRCOPY
CFLAGS += -DKEEP_MEM_NAME CFLAGS += -DKEEP_MEM_NAME
CFLAGS += -DDISABLE_ALARM CFLAGS += -DDISABLE_ALARM
CFLAGS += -DCHAN_NAME_FREQ
#CFLAGS += -DBAND_SCOPE #CFLAGS += -DBAND_SCOPE
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)

View File

@ -16,6 +16,7 @@ You can edit those changes by (currently) editing the MakeFile, look for these l
* CFLAGS += -DDISABLE_AIRCOPY .. remove AIRCOPY option * CFLAGS += -DDISABLE_AIRCOPY .. remove AIRCOPY option
* CFLAGS += -DKEEP_MEM_NAME .. maintain the memory channel's name when re-saving the memory channel * CFLAGS += -DKEEP_MEM_NAME .. maintain the memory channel's name when re-saving the memory channel
* CFLAGS += -DDISABLE_ALARM .. remove the ALARM transmit option from the firmware * CFLAGS += -DDISABLE_ALARM .. remove the ALARM transmit option from the firmware
* CFLAGS += -DCHAN_NAME_FREQ .. show the channel frequency (as well as channel number/name)
* #CFLAGS += -DBAND_SCOPE .. not yet implemented * #CFLAGS += -DBAND_SCOPE .. not yet implemented
To enable the custom option just uncomment the line by removing the starting '#'. To enable the custom option just uncomment the line by removing the starting '#'.
@ -25,6 +26,7 @@ To enable the custom option just uncomment the line by removing the starting '#'
* Battery voltage boot screen now includes the percentage (as well as voltage). * Battery voltage boot screen now includes the percentage (as well as voltage).
* Slightly less intense menu style. * Slightly less intense menu style.
* AM RX allowed everywhere. Although the radio really doesn't do AM, the adverts are a con ! * AM RX allowed everywhere. Although the radio really doesn't do AM, the adverts are a con !
* Finer RSSI bar steps
* "MEM-CH" and "DEL-CH" menus now include channel name * "MEM-CH" and "DEL-CH" menus now include channel name
* "STEP" menu, added 1.25kHz option, removed 5kHz option * "STEP" menu, added 1.25kHz option, removed 5kHz option

View File

@ -30,7 +30,9 @@ void ST7565_DrawLine(uint8_t Column, uint8_t Line, uint16_t Size, const uint8_t
uint16_t i; uint16_t i;
SPI_ToggleMasterMode(&SPI0->CR, false); SPI_ToggleMasterMode(&SPI0->CR, false);
ST7565_SelectColumnAndLine(Column + 4U, Line); ST7565_SelectColumnAndLine(Column + 4U, Line);
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0);
if (!bIsClearMode) if (!bIsClearMode)
@ -87,7 +89,8 @@ void ST7565_BlitFullScreen(void)
} }
void ST7565_BlitStatusLine(void) void ST7565_BlitStatusLine(void)
{ { // the top small text line on the display
unsigned int i; unsigned int i;
SPI_ToggleMasterMode(&SPI0->CR, false); SPI_ToggleMasterMode(&SPI0->CR, false);

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

105
font.c
View File

@ -142,3 +142,108 @@ const uint8_t gFontSmallDigits[11][7] = {
{ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00 }, { 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00 },
}; };
// ASCII 5x7 font
const uint8_t gFont5x7[5 * 16 * 6] =
{
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,
0x24, 0x2A, 0x7F, 0x2A, 0x12,
0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x08, 0x07, 0x03, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x80, 0x70, 0x30, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02,
0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x42, 0x7F, 0x40, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46,
0x21, 0x41, 0x49, 0x4D, 0x33,
0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39,
0x3C, 0x4A, 0x49, 0x49, 0x31,
0x41, 0x21, 0x11, 0x09, 0x07,
0x36, 0x49, 0x49, 0x49, 0x36,
0x46, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08,
0x02, 0x01, 0x59, 0x09, 0x06,
0x3E, 0x41, 0x5D, 0x59, 0x4E,
0x7C, 0x12, 0x11, 0x12, 0x7C, // #65 'A'
0x7F, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x49, 0x49, 0x49, 0x41,
0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x41, 0x51, 0x73,
0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01,
0x7F, 0x08, 0x14, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x1C, 0x02, 0x7F,
0x7F, 0x04, 0x08, 0x10, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x51, 0x21, 0x5E,
0x7F, 0x09, 0x19, 0x29, 0x46,
0x26, 0x49, 0x49, 0x49, 0x32,
0x03, 0x01, 0x7F, 0x01, 0x03,
0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F,
0x3F, 0x40, 0x38, 0x40, 0x3F,
0x63, 0x14, 0x08, 0x14, 0x63,
0x03, 0x04, 0x78, 0x04, 0x03,
0x61, 0x59, 0x49, 0x4D, 0x43,
0x00, 0x7F, 0x41, 0x41, 0x41,
0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x41, 0x41, 0x41, 0x7F,
0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x03, 0x07, 0x08, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40,
0x7F, 0x28, 0x44, 0x44, 0x38,
0x38, 0x44, 0x44, 0x44, 0x28,
0x38, 0x44, 0x44, 0x28, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18,
0x00, 0x08, 0x7E, 0x09, 0x02,
0x18, 0xA4, 0xA4, 0x9C, 0x78,
0x7F, 0x08, 0x04, 0x04, 0x78,
0x00, 0x44, 0x7D, 0x40, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78,
0x38, 0x44, 0x44, 0x44, 0x38,
0xFC, 0x18, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC,
0x7C, 0x08, 0x04, 0x04, 0x08,
0x48, 0x54, 0x54, 0x54, 0x24,
0x04, 0x04, 0x3F, 0x44, 0x24,
0x3C, 0x40, 0x40, 0x20, 0x7C,
0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C,
0x44, 0x28, 0x10, 0x28, 0x44,
0x4C, 0x90, 0x90, 0x90, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44,
0x00, 0x08, 0x36, 0x41, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02,
0x3C, 0x26, 0x23, 0x26, 0x3C
};

2
font.h
View File

@ -23,5 +23,7 @@ extern const uint8_t gFontBig[95][16];
extern const uint8_t gFontBigDigits[11][26]; extern const uint8_t gFontBigDigits[11][26];
extern const uint8_t gFontSmallDigits[11][7]; extern const uint8_t gFontSmallDigits[11][7];
extern const uint8_t gFont5x7[5 * 16 * 6];
#endif #endif

BIN
font5x7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

10
misc.c
View File

@ -170,9 +170,9 @@ uint8_t gIsLocked = 0xFF;
void NUMBER_Get(char *pDigits, uint32_t *pInteger) void NUMBER_Get(char *pDigits, uint32_t *pInteger)
{ {
uint8_t i; unsigned int i;
uint32_t Multiplier = 10000000; uint32_t Multiplier = 10000000;
uint32_t Value = 0; uint32_t Value = 0;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
if (pDigits[i] > 9) if (pDigits[i] > 9)
@ -185,14 +185,14 @@ void NUMBER_Get(char *pDigits, uint32_t *pInteger)
void NUMBER_ToDigits(uint32_t Value, char *pDigits) void NUMBER_ToDigits(uint32_t Value, char *pDigits)
{ {
uint8_t i; unsigned int i;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
const uint32_t Result = Value / 10U; const uint32_t Result = Value / 10U;
pDigits[7 - i] = Value - (Result * 10U); pDigits[7 - i] = Value - (Result * 10U);
Value = Result; Value = Result;
} }
pDigits[8] = 0;
} }
uint8_t NUMBER_AddWithWraparound(uint8_t Base, int8_t Add, uint8_t LowerLimit, uint8_t UpperLimit) uint8_t NUMBER_AddWithWraparound(uint8_t Base, int8_t Add, uint8_t LowerLimit, uint8_t UpperLimit)

View File

@ -15,6 +15,7 @@
*/ */
#include <string.h> #include <string.h>
#include "driver/st7565.h" #include "driver/st7565.h"
#include "external/printf/printf.h" #include "external/printf/printf.h"
#include "font.h" #include "font.h"
@ -77,47 +78,112 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
} }
} }
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, bool bCentered)
{
const size_t Length = strlen(pString);
size_t i;
if (bCentered)
Start += (((End - Start) - (Length * 8)) + 1) / 2;
for (i = 0; i < Length; i++)
{
if (pString[i] >= 32)
{
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);
}
}
}
}
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag) void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)
{ {
unsigned int i; const unsigned int char_width = 13;
uint8_t *pFb0 = gFrameBuffer[Y] + X;; uint8_t *pFb0 = gFrameBuffer[Y] + X;
uint8_t *pFb1 = pFb0 + 128; uint8_t *pFb1 = pFb0 + 128;
bool bCanDisplay = false; bool bCanDisplay = false;
unsigned int i = 0;
for (i = 0; i < 3; i++)
// MHz
while (i < 3)
{ {
const uint8_t Digit = pDigits[i]; const unsigned int Digit = pDigits[i++];
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
if (bDisplayLeadingZero || bCanDisplay || Digit)
{ {
bCanDisplay = true; bCanDisplay = true;
memcpy(pFb0 + (i * 13), gFontBigDigits[Digit] + 0, 13); memcpy(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1 + (i * 13), gFontBigDigits[Digit] + 13, 13); memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width);
} }
else else
if (bFlag) if (bFlag)
{ {
pFb1 -= 6;
pFb0 -= 6; pFb0 -= 6;
pFb1 -= 6;
}
pFb0 += char_width;
pFb1 += char_width;
}
// decimal point
*pFb1 = 0x60; pFb0++; pFb1++;
*pFb1 = 0x60; pFb0++; pFb1++;
*pFb1 = 0x60; pFb0++; pFb1++;
// kHz
while (i < 6)
{
const unsigned int Digit = pDigits[i++];
memcpy(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width);
pFb0 += char_width;
pFb1 += char_width;
}
}
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
{
const unsigned int char_width = 7;
uint8_t *pFb = gFrameBuffer[Y] + X;
bool bCanDisplay = false;
unsigned int i = 0;
// MHz
while (i < 3)
{
const unsigned int Digit = pDigits[i++];
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{
bCanDisplay = true;
memcpy(pFb, gFontSmallDigits[Digit], char_width);
pFb += char_width;
} }
} }
pFb1[0x27] = 0x60; // decimal point
pFb1[0x28] = 0x60; pFb++;
pFb1[0x29] = 0x60; pFb++;
*pFb++ = 0x60;
*pFb++ = 0x60;
pFb++;
for (i = 0; i < 3; i++) // kHz
while (i < 8)
{ {
const uint8_t Digit = pDigits[i + 3]; const unsigned int Digit = pDigits[i++];
memcpy(pFb0 + (i * 13) + 42, gFontBigDigits[Digit] + 0, 13); memcpy(pFb, gFontSmallDigits[Digit], char_width);
memcpy(pFb1 + (i * 13) + 42, gFontBigDigits[Digit] + 13, 13); pFb += char_width;
} }
} }
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y) void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y)
{ {
unsigned int i; const unsigned int char_width = 7;
for (i = 0; i < Size; i++) unsigned int x = X;
memcpy(gFrameBuffer[Y] + (i * 7) + X, gFontSmallDigits[(uint8_t)pString[i]], 7); unsigned int i;
for (i = 0; i < Size; i++, x += char_width)
memcpy(gFrameBuffer[Y] + x, gFontSmallDigits[(unsigned int)pString[i]], char_width);
} }

View File

@ -23,7 +23,9 @@
void UI_GenerateChannelString(char *pString, const uint8_t Channel); void UI_GenerateChannelString(char *pString, const uint8_t Channel);
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber); void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber);
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered); void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered);
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, bool bCentered);
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag); void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y); void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y);
#endif #endif

243
ui/main.c
View File

@ -30,8 +30,8 @@
void UI_DisplayMain(void) void UI_DisplayMain(void)
{ {
char String[16]; char String[16];
uint8_t i; unsigned int vfo_num;
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
@ -43,34 +43,19 @@ void UI_DisplayMain(void)
return; return;
} }
for (i = 0; i < 2; i++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
{ {
uint8_t *pLine0; uint8_t Channel = gEeprom.TX_CHANNEL;
uint8_t *pLine1; bool bIsSameVfo = !!(Channel == vfo_num);
uint8_t Line; uint8_t Line = (vfo_num == 0) ? 0 : 4;
uint8_t Channel; uint8_t *pLine0 = gFrameBuffer[Line + 0];
bool bIsSameVfo; uint8_t *pLine1 = gFrameBuffer[Line + 1];
uint32_t frequency_Hz = 0;
if (i == 0)
{
pLine0 = gFrameBuffer[0];
pLine1 = gFrameBuffer[1];
Line = 0;
}
else
{
pLine0 = gFrameBuffer[4];
pLine1 = gFrameBuffer[5];
Line = 4;
}
Channel = gEeprom.TX_CHANNEL;
bIsSameVfo = !!(Channel == i);
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
Channel = gEeprom.RX_CHANNEL; Channel = gEeprom.RX_CHANNEL;
if (Channel != i) if (Channel != vfo_num)
{ {
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode) if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
{ {
@ -105,7 +90,7 @@ void UI_DisplayMain(void)
else else
sprintf(String, ">%s", gDTMF_InputBox); sprintf(String, ">%s", gDTMF_InputBox);
UI_PrintString(String, 2, 127, i * 3, 8, false); UI_PrintString(String, 2, 127, vfo_num * 3, 8, false);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
memset(Contact, 0, sizeof(Contact)); memset(Contact, 0, sizeof(Contact));
@ -132,7 +117,7 @@ void UI_DisplayMain(void)
sprintf(String, ">%s", gDTMF_String); sprintf(String, ">%s", gDTMF_String);
} }
UI_PrintString(String, 2, 127, 2 + (i * 3), 8, false); UI_PrintString(String, 2, 127, 2 + (vfo_num * 3), 8, false);
continue; continue;
} }
@ -165,7 +150,7 @@ void UI_DisplayMain(void)
else else
Channel = gEeprom.TX_CHANNEL; Channel = gEeprom.TX_CHANNEL;
if (Channel == i) if (Channel == vfo_num)
{ {
SomeValue = 1; SomeValue = 1;
memcpy(pLine0 + 14, BITMAP_TX, sizeof(BITMAP_TX)); memcpy(pLine0 + 14, BITMAP_TX, sizeof(BITMAP_TX));
@ -176,34 +161,34 @@ void UI_DisplayMain(void)
{ {
SomeValue = 2; SomeValue = 2;
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == i) if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num)
memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX)); memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX));
} }
// 0x8F3C // 0x8F3C
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ {
memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M)); memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M));
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i) if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
NUMBER_ToDigits(gEeprom.ScreenChannel[i] + 1, String); NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String);
else else
memcpy(String + 5, gInputBox, 3); memcpy(String + 5, gInputBox, 3);
UI_DisplaySmallDigits(3, String + 5, 10, Line + 1); UI_DisplaySmallDigits(3, String + 5, 10, Line + 1);
} }
else else
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i])) if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ {
char c; char c;
memcpy(pLine1 + 14, BITMAP_F, sizeof(BITMAP_F)); memcpy(pLine1 + 14, BITMAP_F, sizeof(BITMAP_F));
c = (gEeprom.ScreenChannel[i] - FREQ_CHANNEL_FIRST) + 1; c = (gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST) + 1;
UI_DisplaySmallDigits(1, &c, 22, Line + 1); UI_DisplaySmallDigits(1, &c, 22, Line + 1);
} }
else else
{ {
memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand)); memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i) if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
{ {
NUMBER_ToDigits((gEeprom.ScreenChannel[i] - NOAA_CHANNEL_FIRST) + 1, String); NUMBER_ToDigits((gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST) + 1, String);
} }
else else
{ {
@ -215,7 +200,7 @@ void UI_DisplayMain(void)
// 0x8FEC // 0x8FEC
uint8_t State = VfoState[i]; uint8_t State = VfoState[vfo_num];
#ifndef DISABLE_ALARM #ifndef DISABLE_ALARM
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM) if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
@ -224,7 +209,7 @@ void UI_DisplayMain(void)
Channel = gEeprom.RX_CHANNEL; Channel = gEeprom.RX_CHANNEL;
else else
Channel = gEeprom.TX_CHANNEL; Channel = gEeprom.TX_CHANNEL;
if (Channel == i) if (Channel == vfo_num)
State = VFO_STATE_ALARM; State = VFO_STATE_ALARM;
} }
#endif #endif
@ -259,65 +244,86 @@ void UI_DisplayMain(void)
break; break;
} }
UI_PrintString(String, 31, 111, i * 4, Width, true); UI_PrintString(String, 31, 111, vfo_num * 4, Width, true);
} }
else else
{ {
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]) && gEeprom.TX_CHANNEL == i) if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
{ {
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false); UI_DisplayFrequency(gInputBox, 31, vfo_num * 4, true, false);
} }
else else
{ {
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ {
if (gCurrentFunction == FUNCTION_TRANSMIT)
{
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
Channel = gEeprom.RX_CHANNEL;
else
Channel = gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
frequency_Hz = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
else
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
}
else
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
switch (gEeprom.CHANNEL_DISPLAY_MODE) switch (gEeprom.CHANNEL_DISPLAY_MODE)
{ {
case MDF_FREQUENCY: case MDF_FREQUENCY:
if (gCurrentFunction == FUNCTION_TRANSMIT) NUMBER_ToDigits(frequency_Hz, String);
UI_DisplayFrequency(String, 31, vfo_num * 4, false, false);
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ {
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
Channel = gEeprom.RX_CHANNEL;
else
Channel = gEeprom.TX_CHANNEL;
if (Channel == i)
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
}
else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
UI_DisplayFrequency(String, 31, i * 4, false, false);
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
{
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
if (Attributes & MR_CH_SCANLIST1) if (Attributes & MR_CH_SCANLIST1)
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList)); memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
if (Attributes & MR_CH_SCANLIST2) if (Attributes & MR_CH_SCANLIST2)
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList)); memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
} }
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1); UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
frequency_Hz = 0;
break; break;
case MDF_CHANNEL: case MDF_CHANNEL:
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1); sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true); #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
break; break;
case MDF_NAME: case MDF_NAME:
if (gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF) #ifdef CHAN_NAME_FREQ
{ if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1); { // channel number
UI_PrintString(String, 31, 112, i * 4, 8, true); sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
} UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, (vfo_num * 4) + 1, false);
else }
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true); else
{ // channel name
memset(String, 0, sizeof(String));
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;
} }
} }
@ -329,20 +335,20 @@ void UI_DisplayMain(void)
Channel = gEeprom.RX_CHANNEL; Channel = gEeprom.RX_CHANNEL;
else else
Channel = gEeprom.TX_CHANNEL; Channel = gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
if (Channel == i) frequency_Hz = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
else else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String); frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
} }
else else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String); frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
UI_DisplayFrequency(String, 31, i * 4, false, false); NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequency(String, 31, vfo_num * 4, false, false);
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ {
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]]; const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (Attributes & MR_CH_SCANLIST1) if (Attributes & MR_CH_SCANLIST1)
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList)); memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
@ -352,6 +358,8 @@ void UI_DisplayMain(void)
} }
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1); UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
frequency_Hz = 0;
} }
} }
} }
@ -372,37 +380,29 @@ void UI_DisplayMain(void)
else else
if (SomeValue == 2) if (SomeValue == 2)
{ {
if (gVFO_RSSI_Level[i]) if (gVFO_RSSI_Level[vfo_num])
Level = gVFO_RSSI_Level[i]; Level = gVFO_RSSI_Level[vfo_num];
} }
// TODO: not quite how the original does it, but it's quite entangled in Ghidra // show TX power level
if (Level) if (Level >= 1)
{ {
memcpy(pLine1 + 128 + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); memcpy(pLine1 + 128 + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
memcpy(pLine1 + 128 + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); memcpy(pLine1 + 128 + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (Level >= 2) if (Level >= 2)
{ memcpy(pLine1 + 128 + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
memcpy(pLine1 + 128 + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); if (Level >= 3)
if (Level >= 3) memcpy(pLine1 + 128 + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
{ if (Level >= 4)
memcpy(pLine1 + 128 + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); memcpy(pLine1 + 128 + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (Level >= 4) if (Level >= 5)
{ memcpy(pLine1 + 128 + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
memcpy(pLine1 + 128 + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); if (Level >= 6)
if (Level >= 5) memcpy(pLine1 + 128 + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
{
memcpy(pLine1 + 128 + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (Level >= 6)
memcpy(pLine1 + 128 + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
}
}
}
}
} }
// 0x931E // 0x931E
if (gEeprom.VfoInfo[i].IsAM) if (gEeprom.VfoInfo[vfo_num].IsAM)
{ {
memcpy(pLine1 + 128 + 27, BITMAP_AM, sizeof(BITMAP_AM)); memcpy(pLine1 + 128 + 27, BITMAP_AM, sizeof(BITMAP_AM));
} }
@ -410,7 +410,7 @@ void UI_DisplayMain(void)
{ {
const FREQ_Config_t *pConfig; const FREQ_Config_t *pConfig;
pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[i].pTX : gEeprom.VfoInfo[i].pRX; pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
switch (pConfig->CodeType) switch (pConfig->CodeType)
{ {
@ -427,38 +427,51 @@ void UI_DisplayMain(void)
} }
// 0x936C // 0x936C
switch (gEeprom.VfoInfo[i].OUTPUT_POWER) switch (gEeprom.VfoInfo[vfo_num].OUTPUT_POWER)
{ {
case OUTPUT_POWER_LOW: case OUTPUT_POWER_LOW:
memcpy(pLine1 + 128 + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow)); memcpy(pLine1 + 128 + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow));
break; break;
case OUTPUT_POWER_MID: case OUTPUT_POWER_MID:
memcpy(pLine1 + 128 + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid)); memcpy(pLine1 + 128 + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid));
break; break;
case OUTPUT_POWER_HIGH: case OUTPUT_POWER_HIGH:
memcpy(pLine1 + 128 + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh)); memcpy(pLine1 + 128 + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh));
break; break;
} }
if (gEeprom.VfoInfo[i].ConfigRX.Frequency != gEeprom.VfoInfo[i].ConfigTX.Frequency) if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency)
{ {
if (gEeprom.VfoInfo[i].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_ADD) if (gEeprom.VfoInfo[vfo_num].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_ADD)
memcpy(pLine1 + 128 + 54, BITMAP_Add, sizeof(BITMAP_Add)); memcpy(pLine1 + 128 + 54, BITMAP_Add, sizeof(BITMAP_Add));
if (gEeprom.VfoInfo[i].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_SUB) if (gEeprom.VfoInfo[vfo_num].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_SUB)
memcpy(pLine1 + 128 + 54, BITMAP_Sub, sizeof(BITMAP_Sub)); memcpy(pLine1 + 128 + 54, BITMAP_Sub, sizeof(BITMAP_Sub));
} }
if (gEeprom.VfoInfo[i].FrequencyReverse) if (gEeprom.VfoInfo[vfo_num].FrequencyReverse)
memcpy(pLine1 + 128 + 64, BITMAP_ReverseMode, sizeof(BITMAP_ReverseMode)); memcpy(pLine1 + 128 + 64, BITMAP_ReverseMode, sizeof(BITMAP_ReverseMode));
if (gEeprom.VfoInfo[i].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW) if (gEeprom.VfoInfo[vfo_num].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
memcpy(pLine1 + 128 + 74, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand)); memcpy(pLine1 + 128 + 74, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
if (gEeprom.VfoInfo[i].DTMF_DECODING_ENABLE || gSetting_KILLED) if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
memcpy(pLine1 + 128 + 84, BITMAP_DTMF, sizeof(BITMAP_DTMF)); memcpy(pLine1 + 128 + 84, BITMAP_DTMF, sizeof(BITMAP_DTMF));
if (gEeprom.VfoInfo[i].SCRAMBLING_TYPE && gSetting_ScrambleEnable) if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE && gSetting_ScrambleEnable)
memcpy(pLine1 + 128 + 110, BITMAP_Scramble, sizeof(BITMAP_Scramble)); memcpy(pLine1 + 128 + 110, BITMAP_Scramble, sizeof(BITMAP_Scramble));
#ifdef CHAN_NAME_FREQ
if (frequency_Hz > 0)
{ // show the channel frequency above the channel number/name
#if 0
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequencySmall(String, 31 + 8, (vfo_num * 4) + 0, false);
#else
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
UI_PrintStringSmall(String, 31 + 8, 0, (vfo_num * 4) + 0, false);
#endif
}
#endif
} }
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();

View File

@ -27,7 +27,7 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
{ {
uint8_t *pLine; uint8_t *pLine;
uint8_t Line; uint8_t Line;
bool bIsClearMode; bool bIsClearMode = false;
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN) if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
return; return;
@ -52,20 +52,19 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
} }
else else
{ {
memcpy(pLine, BITMAP_Antenna, 5); memcpy(pLine, BITMAP_Antenna, 5);
memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); if (RssiLevel >= 2)
if (RssiLevel >= 2) // 2 memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (RssiLevel >= 3)
memcpy(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); memcpy(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (RssiLevel >= 3) // 3 if (RssiLevel >= 4)
memcpy(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); memcpy(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (RssiLevel >= 4) // 4 if (RssiLevel >= 5)
memcpy(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); memcpy(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (RssiLevel >= 5) // 5 if (RssiLevel >= 6)
memcpy(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); memcpy(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (RssiLevel >= 6) // 6 if (RssiLevel >= 7)
memcpy(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); memcpy(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
bIsClearMode = false;
} }
ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode); ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode);
@ -73,22 +72,32 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
void UI_UpdateRSSI(uint16_t RSSI) 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 uint16_t level01 = (level0 + level1) / 2;
const uint16_t level12 = (level1 + level2) / 2;
const uint16_t level23 = (level2 + level3) / 2;
uint8_t Level = 0; uint8_t Level = 0;
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][3]) if (RSSI >= level3) Level = 7;
Level = 6;
else else
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][2]) if (RSSI >= level23) Level = 6;
Level = 4;
else else
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][1]) if (RSSI >= level2) Level = 5;
Level = 2;
else else
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][0]) if (RSSI >= level12) Level = 4;
Level = 1; else
if (RSSI >= level1) Level = 3;
else
if (RSSI >= level01) Level = 2;
else
if (RSSI >= level0) Level = 1;
//const int16_t dB = (int16_t)(RSSI / 2) - 160;
if (gVFO_RSSI_Level[gEeprom.RX_CHANNEL] != Level) if (gVFO_RSSI_Level[gEeprom.RX_CHANNEL] != Level)
{ {
gVFO_RSSI_Level[gEeprom.RX_CHANNEL] = Level; gVFO_RSSI_Level[gEeprom.RX_CHANNEL] = Level;

View File

@ -2,5 +2,5 @@
#ifdef GIT_HASH #ifdef GIT_HASH
const char Version[] = "OEFW-" GIT_HASH; const char Version[] = "OEFW-" GIT_HASH;
#else #else
const char Version[] = "OEFW-230909"; const char Version[] = "OEFW-230910";
#endif #endif

View File

@ -13,7 +13,7 @@ del /S /Q *.o >nul 2>nul
del /S /Q *.d >nul 2>nul del /S /Q *.d >nul 2>nul
::python -m pip install --upgrade pip crcmod ::python -m pip install --upgrade pip crcmod
fw-pack.py firmware.bin 230909 firmware.packed.bin fw-pack.py firmware.bin 230910 firmware.packed.bin
::arm-none-eabi-size firmware ::arm-none-eabi-size firmware