mirror of
https://github.com/silenty4ng/uv-k5-firmware-chinese-lts
synced 2025-01-15 14:54:40 +00:00
95 lines
2.7 KiB
C
95 lines
2.7 KiB
C
/* 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)
|
|
{
|
|
char String[16];
|
|
bool bCentered;
|
|
uint8_t Start;
|
|
|
|
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
|
|
|
memset(String, 0, sizeof(String));
|
|
if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED))
|
|
|
|
//频率
|
|
sprintf(String, "\x03\x04:%u.%05u", gScanFrequency / 100000, gScanFrequency % 100000);
|
|
else
|
|
strcpy(String, "\x03\x04:**.*****");
|
|
UI_PrintStringSmall(String, 2, 0, 1);
|
|
|
|
memset(String, 0, sizeof(String));
|
|
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult)
|
|
//模拟亚音
|
|
strcpy(String, "\x0C\x0D\x09\x0B:******");
|
|
|
|
else
|
|
if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE)
|
|
//模拟亚音
|
|
sprintf(String, "\x0C\x0D\x09\x0B:%u.%uHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10);
|
|
else
|
|
//数字亚音
|
|
sprintf(String, "\x07\x08\x09\x0B:D%03oN", DCS_Options[gScanCssResultCode]);
|
|
UI_PrintStringSmall(String, 2, 0, 3);
|
|
|
|
memset(String, 0, sizeof(String));
|
|
if (gScannerSaveState == SCAN_SAVE_CHANNEL)
|
|
{
|
|
//存置
|
|
strcpy(String, 存置问);
|
|
Start = 0;
|
|
bCentered = 1;
|
|
}
|
|
else
|
|
{
|
|
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
|
|
|
//存置
|
|
strcpy(String, 存置了);
|
|
|
|
UI_GenerateChannelStringEx(String + 3, gShowChPrefix, gScanChannel);
|
|
}
|
|
else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
|
|
|
//扫描
|
|
strcpy(String, 扫描);
|
|
memset(String + 2, '.', (gScanProgressIndicator & 7) + 1);
|
|
}
|
|
else if (gScanCssState == SCAN_CSS_STATE_FOUND)
|
|
//扫描ok
|
|
strcpy(String, "\x81\x82 OK.");
|
|
|
|
|
|
else
|
|
//扫描fail
|
|
strcpy(String, "\x81\x82 FAIL.");
|
|
Start = 2;
|
|
bCentered = 0;
|
|
}
|
|
UI_PrintStringSmall(String, Start, bCentered ? 127 : 0, 5);
|
|
|
|
ST7565_BlitFullScreen();
|
|
}
|