Skip to content

Commit

Permalink
Only small characters
Browse files Browse the repository at this point in the history
  • Loading branch information
manu committed Sep 22, 2023
1 parent 728882d commit 75011ab
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 79 deletions.
34 changes: 1 addition & 33 deletions font.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,7 @@
#include "font.h"

//stolen from https://github.com/dhepper/font8x8
const uint8_t gFontSmall[128][8] = {
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 0, 0, 0, 0, 0, 0,},
const uint8_t gFontSmall[128 - 32][8] = {
{0, 0, 0, 0, 0, 0, 0, 0,},
{0, 0, 6, 95, 95, 6, 0, 0,},
{0, 3, 3, 0, 3, 3, 0, 0,},
Expand Down
2 changes: 1 addition & 1 deletion font.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <stdint.h>

extern const uint8_t gFontSmall[128][8];
extern const uint8_t gFontSmall[128 - 32][8];
extern const uint8_t gFontBigDigits[11][26];

#endif
Expand Down
4 changes: 2 additions & 2 deletions ui/aircopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void UI_DisplayAircopy(void)
} else {
strcpy(String, "AIR COPY(CMP)");
}
UI_PrintString(String, 2, 127, 0, 8, true);
UI_PrintStringSmall(String, 2, 127, 0, 8, true);

if (gInputBoxIndex == 0) {
NUMBER_ToDigits(gRxVfo->ConfigRX.Frequency, String);
Expand All @@ -54,7 +54,7 @@ void UI_DisplayAircopy(void)
} else if (gAirCopyIsSendMode == 1) {
sprintf(String, "SND:%d", gAirCopyBlockNumber);
}
UI_PrintString(String, 2, 127, 4, 8, true);
UI_PrintStringSmall(String, 2, 127, 4, 8, true);
ST7565_BlitFullScreen();
}

6 changes: 3 additions & 3 deletions ui/fmradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void UI_DisplayFM(void)
memset(String, 0, sizeof(String));
strcpy(String, "FM");

UI_PrintString(String, 0, 127, 0, 12, true);
UI_PrintStringSmall(String, 0, 127, 0, 12, true);
memset(String, 0, sizeof(String));

if (gAskToSave) {
Expand Down Expand Up @@ -66,7 +66,7 @@ void UI_DisplayFM(void)
}
}

UI_PrintString(String, 0, 127, 2, 10, true);
UI_PrintStringSmall(String, 0, 127, 2, 10, true);
memset(String, 0, sizeof(String));

if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex)) {
Expand All @@ -84,7 +84,7 @@ void UI_DisplayFM(void)
sprintf(String, "CH-%02d", gEeprom.FM_SelectedChannel + 1);
}

UI_PrintString(String, 0, 127, 4, 10, true);
UI_PrintStringSmall(String, 0, 127, 4, 10, true);
ST7565_BlitFullScreen();
}

19 changes: 2 additions & 17 deletions ui/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
}
for (i = 0; i < Length; i++) {
if (pString[i] >= ' ' && pString[i] < 0x7F) {
uint8_t Index = pString[i];
uint8_t Index = pString[i] - ' ';
if(Line < 7)
memcpy(gFrameBuffer[Line + 0] + (i * Width) + Start, &gFontSmall[Index][0], 8);
else
Expand All @@ -91,21 +91,6 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
}
}

void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered)
{
uint32_t i, Length;

Length = strlen(pString);
if (bCentered) {
Start += (((End - Start) - (Length * Width)) + 1) / 2;
}
for (i = 0; i < Length; i++) {
if (pString[i] >= ' ' && pString[i] < 0x7F) {
memcpy(gFrameBuffer[Line + 0] + (i * Width) + Start, gFontSmall[(uint8_t)pString[i]], 8);
}
}
}

void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)
{
uint8_t *pFb0, *pFb1;
Expand Down Expand Up @@ -146,7 +131,7 @@ void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t
uint8_t i;

for (i = 0; i < Size; i++) {
memcpy(gFrameBuffer[Y] + (i * 7) + X, gFontSmall[pString[i] + '0'], 7);
memcpy(gFrameBuffer[Y] + (i * 7) + X, gFontSmall[pString[i] + '0' - ' '], 7);
}
}

1 change: 0 additions & 1 deletion ui/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
void UI_GenerateChannelString(char *pString, uint8_t Channel);
void UI_GenerateChannelStringEx(char *pString, bool bShowPrefix, uint8_t ChannelNumber);
void UI_PrintStringSmall(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_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y);

Expand Down
4 changes: 2 additions & 2 deletions ui/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void Render(void)
memset(gStatusLine, 0, sizeof(gStatusLine));
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
strcpy(String, "LOCK");
UI_PrintString(String, 0, 127, 1, 10, true);
UI_PrintStringSmall(String, 0, 127, 1, 10, true);
for (i = 0; i < 6; i++) {
if (gInputBox[i] == 10) {
String[i] = '-';
Expand All @@ -45,7 +45,7 @@ static void Render(void)
}
}
String[6] = 0;
UI_PrintString(String, 0, 127, 3, 12, true);
UI_PrintStringSmall(String, 0, 127, 3, 12, true);
ST7565_BlitStatusLine();
ST7565_BlitFullScreen();
}
Expand Down
21 changes: 11 additions & 10 deletions ui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "ui/helper.h"
#include "ui/inputbox.h"
#include "ui/main.h"
#include "font.h"

void UI_DisplayMain(void)
{
Expand All @@ -34,8 +35,8 @@ void UI_DisplayMain(void)

memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
if (gEeprom.KEY_LOCK && gKeypadLocked) {
UI_PrintString("Long Press #", 0, 127, 1, 8, true);
UI_PrintString("To Unlock", 0, 127, 3, 8, true);
UI_PrintStringSmall("Long Press #", 0, 127, 1, 8, true);
UI_PrintStringSmall("To Unlock", 0, 127, 3, 8, true);
ST7565_BlitFullScreen();
return;
}
Expand Down Expand Up @@ -91,7 +92,7 @@ void UI_DisplayMain(void)
} else {
sprintf(String, ">%s", gDTMF_InputBox);
}
UI_PrintString(String, 2, 127, i * 3, 8, false);
UI_PrintStringSmall(String, 2, 127, i * 3, 8, false);

memset(String, 0, sizeof(String));
memset(Contact, 0, sizeof(Contact));
Expand All @@ -113,7 +114,7 @@ void UI_DisplayMain(void)
sprintf(String, ">%s", gDTMF_String);
}
}
UI_PrintString(String, 2, 127, 2 + (i * 3), 8, false);
UI_PrintStringSmall(String, 2, 127, 2 + (i * 3), 8, false);
continue;
} else if (bIsSameVfo) {
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
Expand Down Expand Up @@ -225,7 +226,7 @@ void UI_DisplayMain(void)
Width = 8;
break;
}
UI_PrintString(String, 31, 111, i * 4, Width, true);
UI_PrintStringSmall(String, 31, 111, i * 4, Width, true);
} else {
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]) && gEeprom.TX_CHANNEL == i) {
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
Expand Down Expand Up @@ -261,14 +262,14 @@ void UI_DisplayMain(void)
break;
case MDF_CHANNEL:
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true);
UI_PrintStringSmall(String, 31, 112, i * 4, 8, true);
break;
case MDF_NAME:
if(gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF) {
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true);
UI_PrintStringSmall(String, 31, 112, i * 4, 8, true);
} else {
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
UI_PrintStringSmall(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
}
break;
}
Expand Down Expand Up @@ -379,10 +380,10 @@ void UI_DisplayMain(void)

if (gEeprom.VfoInfo[i].ConfigRX.Frequency != gEeprom.VfoInfo[i].ConfigTX.Frequency) {
if (gEeprom.VfoInfo[i].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_ADD) {
memcpy(pLine1 + 128 + 54, BITMAP_Add, sizeof(BITMAP_Add));
UI_PrintStringSmall("+", 80, 127, 2, 7, false);
}
if (gEeprom.VfoInfo[i].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_SUB) {
memcpy(pLine1 + 128 + 54, BITMAP_Sub, sizeof(BITMAP_Sub));
UI_PrintStringSmall("-", 80, 127, 2, 7, false);
}

}
Expand Down
8 changes: 4 additions & 4 deletions ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,16 +476,16 @@ void UI_DisplayMenu(void)
}

if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i]) {
UI_PrintString(String, 50, 127, 2, 8, 1);
UI_PrintStringSmall(String, 50, 127, 2, 8, 1);
} else {
UI_PrintString(String, 50, 127, 0, 8, 1);
UI_PrintStringSmall(String, 50, 127, 0, 8, 1);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
sprintf(String, "PRI1:%d", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
UI_PrintString(String, 50, 127, 2, 8, 1);
UI_PrintStringSmall(String, 50, 127, 2, 8, 1);
}
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
sprintf(String, "PRI2:%d", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
UI_PrintString(String, 50, 127, 4, 8, 1);
UI_PrintStringSmall(String, 50, 127, 4, 8, 1);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ui/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void UI_DisplayScanner(void)
} else {
sprintf(String, "FREQ:**.*****");
}
UI_PrintString(String, 2, 127, 1, 8, 0);
UI_PrintStringSmall(String, 2, 127, 1, 8, 0);
memset(String, 0, sizeof(String));

if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
Expand All @@ -48,7 +48,7 @@ void UI_DisplayScanner(void)
} else {
sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]);
}
UI_PrintString(String, 2, 127, 3, 8, 0);
UI_PrintStringSmall(String, 2, 127, 3, 8, 0);
memset(String, 0, sizeof(String));

if (gScannerEditState == 2) {
Expand All @@ -73,7 +73,7 @@ void UI_DisplayScanner(void)
bCentered = 0;
}

UI_PrintString(String, Start, 127, 5, 8, bCentered);
UI_PrintStringSmall(String, Start, 127, 5, 8, bCentered);
ST7565_BlitFullScreen();
}

6 changes: 3 additions & 3 deletions ui/welcome.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void UI_DisplayWelcome(void)
EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16);
EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);
}
UI_PrintString(WelcomeString0, 0, 127, 1, 10, true);
UI_PrintString(WelcomeString1, 0, 127, 3, 10, true);
UI_PrintString(Version, 0, 127, 5, 10, true);
UI_PrintStringSmall(WelcomeString0, 0, 127, 1, 10, true);
UI_PrintStringSmall(WelcomeString1, 0, 127, 3, 10, true);
UI_PrintStringSmall(Version, 0, 127, 5, 10, true);
ST7565_BlitStatusLine();
ST7565_BlitFullScreen();
}
Expand Down

0 comments on commit 75011ab

Please sign in to comment.