Use pointers to avoid some string copying

Size: 60664 -> 60464
This commit is contained in:
Juan Antonio 2023-12-23 18:18:23 +01:00 committed by egzumer
parent 1281bbf033
commit f8ef687026
8 changed files with 138 additions and 182 deletions

View File

@ -138,13 +138,14 @@ bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
bool DTMF_GetContact(const int Index, char *pContact) bool DTMF_GetContact(const int Index, char *pContact)
{ {
int i = -1; if (Index < 0 || Index >= MAX_DTMF_CONTACTS || pContact == NULL) {
if (Index >= 0 && Index < MAX_DTMF_CONTACTS && pContact != NULL) return false;
{
EEPROM_ReadBuffer(0x1C00 + (Index * 16), pContact, 16);
i = (int)pContact[0] - ' ';
} }
return (i >= 0 && i < 95);
EEPROM_ReadBuffer(0x1C00 + (Index * 16), pContact, 16);
// check whether the first character is printable or not
return (pContact[0] >= ' ' && pContact[0] < 127);
} }
bool DTMF_FindContact(const char *pContact, char *pResult) bool DTMF_FindContact(const char *pContact, char *pResult)
@ -331,13 +332,12 @@ void DTMF_HandleRequest(void)
if (gDTMF_RX_index >= 2) if (gDTMF_RX_index >= 2)
{ // look for ACK reply { // look for ACK reply
char *pPrintStr = "AB";
strcpy(String, "AB"); Offset = gDTMF_RX_index - strlen(pPrintStr);
Offset = gDTMF_RX_index - strlen(String); if (CompareMessage(gDTMF_RX + Offset, pPrintStr, strlen(pPrintStr), true)) {
// ends with "AB"
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
{ // ends with "AB"
if (gDTMF_ReplyState != DTMF_REPLY_NONE) // 1of11 if (gDTMF_ReplyState != DTMF_REPLY_NONE) // 1of11
// if (gDTMF_CallState != DTMF_CALL_STATE_NONE) // 1of11 // if (gDTMF_CallState != DTMF_CALL_STATE_NONE) // 1of11

View File

@ -29,18 +29,18 @@
void UI_DisplayAircopy(void) void UI_DisplayAircopy(void)
{ {
char String[16]; char String[16] = {0};
char *pPrintStr = { 0 };
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); if (gAircopyState == AIRCOPY_READY) {
pPrintStr = "AIR COPY(RDY)";
} else if (gAircopyState == AIRCOPY_TRANSFER) {
pPrintStr = "AIR COPY";
} else {
pPrintStr = "AIR COPY(CMP)";
}
if (gAircopyState == AIRCOPY_READY) UI_PrintString(pPrintStr, 2, 127, 0, 8);
strcpy(String, "AIR COPY(RDY)");
else
if (gAircopyState == AIRCOPY_TRANSFER)
strcpy(String, "AIR COPY");
else
strcpy(String, "AIR COPY(CMP)");
UI_PrintString(String, 2, 127, 0, 8);
if (gInputBoxIndex == 0) if (gInputBoxIndex == 0)
{ {

View File

@ -30,82 +30,57 @@
void UI_DisplayFM(void) void UI_DisplayFM(void)
{ {
unsigned int i; char String[16] = {0};
char String[16]; char *pPrintStr = String;
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
memset(String, 0, sizeof(String)); UI_PrintString("FM", 0, 127, 0, 12);
strcpy(String, "FM");
UI_PrintString(String, 0, 127, 0, 12);
memset(String, 0, sizeof(String)); if (gAskToSave) {
if (gAskToSave) pPrintStr = "SAVE?";
{ } else if (gAskToDelete) {
strcpy(String, "SAVE?"); pPrintStr = "DEL?";
} } else if (gFM_ScanState == FM_SCAN_OFF) {
else if (gEeprom.FM_IsMrMode) {
if (gAskToDelete) sprintf(String, "MR(CH%02u)", gEeprom.FM_SelectedChannel + 1);
{ pPrintStr = String;
strcpy(String, "DEL?"); } else {
} pPrintStr = "VFO";
else for (unsigned int i = 0; i < 20; i++) {
{ if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
if (gFM_ScanState == FM_SCAN_OFF) sprintf(String, "VFO(CH%02u)", i + 1);
{ pPrintStr = String;
if (!gEeprom.FM_IsMrMode) break;
{
for (i = 0; i < 20; i++)
{
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i])
{
sprintf(String, "VFO(CH%02u)", i + 1);
break;
}
} }
if (i == 20)
strcpy(String, "VFO");
} }
else
sprintf(String, "MR(CH%02u)", gEeprom.FM_SelectedChannel + 1);
}
else
{
if (!gFM_AutoScan)
strcpy(String, "M-SCAN");
else
sprintf(String, "A-SCAN(%u)", gFM_ChannelPosition + 1);
} }
} else if (gFM_AutoScan) {
sprintf(String, "A-SCAN(%u)", gFM_ChannelPosition + 1);
pPrintStr = String;
} else {
pPrintStr = "M-SCAN";
} }
UI_PrintString(String, 0, 127, 2, 10);
UI_PrintString(pPrintStr, 0, 127, 2, 10);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) {
{
UI_GenerateChannelString(String, gFM_ChannelPosition); UI_GenerateChannelString(String, gFM_ChannelPosition);
} } else if (gAskToDelete) {
else sprintf(String, "CH-%02u", gEeprom.FM_SelectedChannel + 1);
if (!gAskToDelete) } else {
{ if (gInputBoxIndex == 0) {
if (gInputBoxIndex == 0)
{
sprintf(String, "%3d.%d", gEeprom.FM_FrequencyPlaying / 10, gEeprom.FM_FrequencyPlaying % 10); sprintf(String, "%3d.%d", gEeprom.FM_FrequencyPlaying / 10, gEeprom.FM_FrequencyPlaying % 10);
UI_DisplayFrequency(String, 32, 4, true); } else {
}
else {
const char * ascii = INPUTBOX_GetAscii(); const char * ascii = INPUTBOX_GetAscii();
sprintf(String, "%.3s.%.1s",ascii, ascii + 3); sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
UI_DisplayFrequency(String, 32, 4, false);
} }
UI_DisplayFrequency(String, 32, 4, gInputBoxIndex == 0);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
return; return;
} }
else
{
sprintf(String, "CH-%02u", gEeprom.FM_SelectedChannel + 1);
}
UI_PrintString(String, 0, 127, 4, 10); UI_PrintString(String, 0, 127, 4, 10);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();

View File

@ -46,21 +46,23 @@ 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)
{ {
if (gInputBoxIndex > 0) if (gInputBoxIndex > 0) {
{ for (unsigned int i = 0; i < 3; i++) {
unsigned int i;
for (i = 0; i < 3; i++)
pString[i] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0'; pString[i] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
}
pString[3] = 0;
return; return;
} }
if (bShowPrefix) if (bShowPrefix) {
// BUG here? Prefixed NULLs are allowed
sprintf(pString, "CH-%03u", ChannelNumber + 1); sprintf(pString, "CH-%03u", ChannelNumber + 1);
else } else if (ChannelNumber == 0xFF) {
if (ChannelNumber == 0xFF)
strcpy(pString, "NULL"); strcpy(pString, "NULL");
else } else {
sprintf(pString, "%03u", ChannelNumber + 1); sprintf(pString, "%03u", ChannelNumber + 1);
}
} }
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width) void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width)
@ -112,10 +114,10 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
{ {
const size_t Length = strlen(pString); const size_t Length = strlen(pString);
size_t i; size_t i;
if (End > Start) if (End > Start)
Start += (((End - Start) - (Length * 8)) + 1) / 2; Start += (((End - Start) - (Length * 8)) + 1) / 2;
const unsigned int char_width = ARRAY_SIZE(gFontSmallBold[0]); const unsigned int char_width = ARRAY_SIZE(gFontSmallBold[0]);
const unsigned int char_spacing = char_width + 1; const unsigned int char_spacing = char_width + 1;
uint8_t *pFb = gFrameBuffer[Line] + Start; uint8_t *pFb = gFrameBuffer[Line] + Start;
@ -171,7 +173,7 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
*pFb1 = 0x60; pFb0++; pFb1++; *pFb1 = 0x60; pFb0++; pFb1++;
continue; continue;
} }
} }
else if (center) { else if (center) {
pFb0 -= 6; pFb0 -= 6;
@ -182,7 +184,7 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
} }
} }
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black) void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black)
{ {
const uint8_t pattern = 1 << (y % 8); const uint8_t pattern = 1 << (y % 8);
if(black) if(black)
@ -228,7 +230,7 @@ void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int1
UI_DrawLineBuffer(buffer, x1,y2, x2,y2, black); UI_DrawLineBuffer(buffer, x1,y2, x2,y2, black);
} }
void UI_DisplayPopup(const char *string) void UI_DisplayPopup(const char *string)
{ {
for(uint8_t i = 0; i < 7; i++) { for(uint8_t i = 0; i < 7; i++) {
memset(gFrameBuffer[i], 0x00, 128); memset(gFrameBuffer[i], 0x00, 128);

View File

@ -37,8 +37,7 @@ static void Render(void)
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
strcpy(String, "LOCK"); UI_PrintString("LOCK", 0, 127, 1, 10);
UI_PrintString(String, 0, 127, 1, 10);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
String[i] = (gInputBox[i] == 10) ? '-' : '*'; String[i] = (gInputBox[i] == 10) ? '-' : '*';
String[6] = 0; String[6] = 0;

View File

@ -773,8 +773,7 @@ void UI_DisplayMain(void)
center_line = CENTER_LINE_DTMF_DEC; center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF "); sprintf(String, "DTMF %s", gDTMF_RX_live + idx);
strcat(String, gDTMF_RX_live + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
} }
#else #else
@ -789,8 +788,7 @@ void UI_DisplayMain(void)
center_line = CENTER_LINE_DTMF_DEC; center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF "); sprintf(String, "DTMF %s", gDTMF_RX_live + idx);
strcat(String, gDTMF_RX + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
} }
#endif #endif

View File

@ -475,9 +475,8 @@ void UI_DisplayMenu(void)
else else
if (menu_index >= 0 && menu_index < (int)gMenuListCount) if (menu_index >= 0 && menu_index < (int)gMenuListCount)
{ // current menu item { // current menu item
strcpy(String, MenuList[menu_index].name);
// strcat(String, ":"); // strcat(String, ":");
UI_PrintString(String, 0, 0, 0, 8); UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8);
// UI_PrintStringSmall(String, 0, 0, 0); // UI_PrintStringSmall(String, 0, 0, 0);
} }
} }
@ -675,24 +674,20 @@ void UI_DisplayMenu(void)
if (!gIsInSubMenu || edit_index < 0) if (!gIsInSubMenu || edit_index < 0)
{ // show the channel name { // show the channel name
SETTINGS_FetchChannelName(String, gSubMenuSelection); SETTINGS_FetchChannelName(String, gSubMenuSelection);
if (String[0] == 0) char *pPrintStr = String[0] ? String : "--";
strcpy(String, "--"); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
} }
else else
{ // show the channel name being edited { // show the channel name being edited
UI_PrintString(edit, menu_item_x1, 0, 2, 8); UI_PrintString(edit, menu_item_x1, 0, 2, 8);
if (edit_index < 10) if (edit_index < 10)
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
} }
if (!gAskForConfirmation) if (!gAskForConfirmation)
{ // show the frequency so that the user knows the channels frequency { // show the frequency so that the user knows the channels frequency
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000); sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
if (!gIsInSubMenu || edit_index < 0) UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0), 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
else
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
} }
} }
@ -908,45 +903,34 @@ void UI_DisplayMenu(void)
if (UI_MENU_GetCurrentMenuId() == MENU_SLIST1 || UI_MENU_GetCurrentMenuId() == MENU_SLIST2) if (UI_MENU_GetCurrentMenuId() == MENU_SLIST1 || UI_MENU_GetCurrentMenuId() == MENU_SLIST2)
{ {
i = (UI_MENU_GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1; i = (UI_MENU_GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1;
char *pPrintStr = String;
// if (gSubMenuSelection == 0xFF) if (gSubMenuSelection < 0) {
if (gSubMenuSelection < 0) pPrintStr = "NULL";
strcpy(String, "NULL"); } else {
else
UI_GenerateChannelStringEx(String, true, gSubMenuSelection); UI_GenerateChannelStringEx(String, true, gSubMenuSelection);
pPrintStr = String;
// if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i])
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i])
{
// channel number
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
// channel name
SETTINGS_FetchChannelName(String, gSubMenuSelection);
if (String[0] == 0)
strcpy(String, "--");
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
} }
else
{
// channel number
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
// channel name // channel number
SETTINGS_FetchChannelName(String, gSubMenuSelection); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0, 8);
if (String[0] == 0)
strcpy(String, "--");
UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 2);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) SETTINGS_FetchChannelName(String, gSubMenuSelection);
{ pPrintStr = String[0] ? String : "--";
sprintf(String, "PRI1:%u", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
// channel name and scan-list
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
} else {
UI_PrintStringSmall(pPrintStr, menu_item_x1, menu_item_x2, 2);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
} }
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
{ sprintf(String, "PRI%d:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
sprintf(String, "PRI2:%u", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
} }
} }
@ -958,20 +942,18 @@ void UI_DisplayMenu(void)
{ // display the channel name { // display the channel name
char s[11]; char s[11];
SETTINGS_FetchChannelName(s, gSubMenuSelection); SETTINGS_FetchChannelName(s, gSubMenuSelection);
if (s[0] == 0) char *pPrintStr = s[0] ? s : "--";
strcpy(s, "--"); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
} }
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan) if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8); UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
{
Contact[11] = 0; Contact[11] = 0;
memcpy(&gDTMF_ID, Contact + 8, 4); memcpy(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%s", Contact + 8); sprintf(String, "ID:%4s", gDTMF_ID);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
} }
#endif #endif
@ -983,9 +965,7 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
|| UI_MENU_GetCurrentMenuId() == MENU_D_LIST || UI_MENU_GetCurrentMenuId() == MENU_D_LIST
#endif #endif
) ) {
{
sprintf(String, "%2d", gSubMenuSelection); sprintf(String, "%2d", gSubMenuSelection);
UI_PrintStringSmall(String, 105, 0, 0); UI_PrintStringSmall(String, 105, 0, 0);
} }
@ -995,8 +975,8 @@ void UI_DisplayMenu(void)
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME || UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation)
{ // display confirmation { // display confirmation
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!"); char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!";
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5, 8);
} }
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();

View File

@ -26,56 +26,58 @@
void UI_DisplayScanner(void) void UI_DisplayScanner(void)
{ {
char String[16]; char String[16] = {0};
bool bCentered; char *pPrintStr = String;
bool bCentered;
uint8_t Start; uint8_t Start;
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
memset(String, 0, sizeof(String)); if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) {
if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED))
sprintf(String, "FREQ:%u.%05u", gScanFrequency / 100000, gScanFrequency % 100000); sprintf(String, "FREQ:%u.%05u", gScanFrequency / 100000, gScanFrequency % 100000);
else pPrintStr = String;
strcpy(String, "FREQ:**.*****"); } else {
UI_PrintString(String, 2, 0, 1, 8); pPrintStr = "FREQ:**.*****";
}
memset(String, 0, sizeof(String)); UI_PrintString(pPrintStr, 2, 0, 1, 8);
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult)
strcpy(String, "CTC:******"); if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
else pPrintStr = "CTC:******";
if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) } else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
sprintf(String, "CTC:%u.%uHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10); sprintf(String, "CTC:%u.%uHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10);
else pPrintStr = String;
} else {
sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]); sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]);
UI_PrintString(String, 2, 0, 3, 8); pPrintStr = String;
}
UI_PrintString(pPrintStr, 2, 0, 3, 8);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gScannerSaveState == SCAN_SAVE_CHANNEL) if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
{ pPrintStr = "SAVE?";
strcpy(String, "SAVE?");
Start = 0; Start = 0;
bCentered = 1; bCentered = 1;
} } else {
else Start = 2;
{ bCentered = 0;
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) { if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
strcpy(String, "SAVE:"); strcpy(String, "SAVE:");
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel); UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
} pPrintStr = String;
else if (gScanCssState < SCAN_CSS_STATE_FOUND) { } else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
strcpy(String, "SCAN"); strcpy(String, "SCAN");
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1); memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
pPrintStr = String;
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
pPrintStr = "SCAN CMP.";
} else {
pPrintStr = "SCAN FAIL.";
} }
else if (gScanCssState == SCAN_CSS_STATE_FOUND)
strcpy(String, "SCAN CMP.");
else
strcpy(String, "SCAN FAIL.");
Start = 2;
bCentered = 0;
} }
UI_PrintString(String, Start, bCentered ? 127 : 0, 5, 8);
UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5, 8);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }