2023-12-07 03:39:09 +00:00
|
|
|
/* Copyright 2023 Dual Tachyon
|
|
|
|
* https://github.com/DualTachyon
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
#include "chinese.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "app/scanner.h"
|
|
|
|
#include "dcs.h"
|
|
|
|
#include "driver/st7565.h"
|
|
|
|
#include "external/printf/printf.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "ui/helper.h"
|
|
|
|
#include "ui/scanner.h"
|
|
|
|
|
|
|
|
void UI_DisplayScanner(void)
|
|
|
|
{
|
2024-01-05 09:04:33 +00:00
|
|
|
char String[16] = {0};
|
|
|
|
char *pPrintStr = String;
|
|
|
|
bool bCentered;
|
2023-12-07 03:39:09 +00:00
|
|
|
uint8_t Start;
|
|
|
|
|
2024-01-05 09:04:33 +00:00
|
|
|
UI_DisplayClear();
|
|
|
|
if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) {
|
2023-12-07 03:39:09 +00:00
|
|
|
//频率
|
2023-12-09 03:25:53 +00:00
|
|
|
sprintf(String, 频率":%u.%05u", gScanFrequency / 100000, gScanFrequency % 100000);
|
2023-12-07 03:39:09 +00:00
|
|
|
|
2024-01-05 09:04:33 +00:00
|
|
|
pPrintStr = String;
|
|
|
|
} else {
|
|
|
|
pPrintStr = 频率":**.*****";
|
|
|
|
}
|
2023-12-07 03:39:09 +00:00
|
|
|
|
2024-01-05 09:04:33 +00:00
|
|
|
|
|
|
|
UI_PrintStringSmall(pPrintStr, 2, 0, 1);
|
|
|
|
|
|
|
|
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
|
|
|
|
pPrintStr = 模拟亚音":******";
|
|
|
|
} else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
|
2023-12-07 03:39:09 +00:00
|
|
|
//模拟亚音
|
2023-12-07 09:34:07 +00:00
|
|
|
#ifdef TEST_UNDE_CTCSS
|
|
|
|
|
2023-12-09 03:25:53 +00:00
|
|
|
sprintf(String, 模拟亚音":%u.%uHz", gScanCssResultCode_all/10, gScanCssResultCode_all% 10);
|
2023-12-07 09:34:07 +00:00
|
|
|
#else
|
2023-12-09 03:25:53 +00:00
|
|
|
sprintf(String, 模拟亚音":%u.%uHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10);
|
2023-12-07 09:34:07 +00:00
|
|
|
#endif
|
2024-01-05 09:04:33 +00:00
|
|
|
pPrintStr = String;
|
|
|
|
} else {
|
2023-12-07 03:39:09 +00:00
|
|
|
//数字亚音
|
2023-12-09 03:25:53 +00:00
|
|
|
sprintf(String, 数字亚音":D%03oN", DCS_Options[gScanCssResultCode]);
|
2024-01-05 09:04:33 +00:00
|
|
|
pPrintStr = String;
|
|
|
|
}
|
|
|
|
UI_PrintStringSmall(pPrintStr, 2, 0, 3);
|
2023-12-07 03:39:09 +00:00
|
|
|
memset(String, 0, sizeof(String));
|
2024-01-05 09:04:33 +00:00
|
|
|
|
|
|
|
if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
|
|
|
|
pPrintStr = 存置问;
|
2023-12-07 03:39:09 +00:00
|
|
|
Start = 0;
|
|
|
|
bCentered = 1;
|
2024-01-05 09:04:33 +00:00
|
|
|
} else {
|
|
|
|
Start = 2;
|
|
|
|
bCentered = 0;
|
2023-12-07 03:39:09 +00:00
|
|
|
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
|
|
|
|
|
|
|
//存置
|
|
|
|
strcpy(String, 存置了);
|
2023-12-20 15:20:23 +00:00
|
|
|
#if ENABLE_CHINESE_FULL!=4
|
2023-12-07 03:39:09 +00:00
|
|
|
|
|
|
|
UI_GenerateChannelStringEx(String + 3, gShowChPrefix, gScanChannel);
|
2023-12-20 15:20:23 +00:00
|
|
|
#else
|
|
|
|
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2024-01-05 09:04:33 +00:00
|
|
|
pPrintStr = String;
|
|
|
|
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
2023-12-07 03:39:09 +00:00
|
|
|
|
|
|
|
//扫描
|
|
|
|
strcpy(String, 扫描);
|
2023-12-20 15:20:23 +00:00
|
|
|
#if ENABLE_CHINESE_FULL!=4
|
2023-12-07 03:39:09 +00:00
|
|
|
memset(String + 2, '.', (gScanProgressIndicator & 7) + 1);
|
2024-01-05 09:04:33 +00:00
|
|
|
|
2023-12-20 15:20:23 +00:00
|
|
|
#else
|
|
|
|
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
|
|
|
|
|
|
|
|
#endif
|
2024-01-05 09:04:33 +00:00
|
|
|
pPrintStr = String;
|
|
|
|
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
|
|
|
|
pPrintStr = 扫描" OK.";
|
|
|
|
} else {
|
|
|
|
pPrintStr = 扫描" FAIL.";
|
2023-12-07 03:39:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-05 09:04:33 +00:00
|
|
|
|
|
|
|
|
2023-12-07 03:39:09 +00:00
|
|
|
}
|
2024-01-05 09:04:33 +00:00
|
|
|
UI_PrintStringSmall(pPrintStr, Start, bCentered ? 127 : 0, 5);
|
2023-12-07 03:39:09 +00:00
|
|
|
ST7565_BlitFullScreen();
|
|
|
|
}
|