0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

551 lines
17 KiB
C
Raw Normal View History

2023-09-09 08:03:56 +01: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 <string.h>
#include "app/dtmf.h"
#ifdef ENABLE_AM_FIX_SHOW_DATA
#include "am_fix.h"
#endif
2023-09-09 08:03:56 +01:00
#include "bitmaps.h"
#include "board.h"
#include "driver/bk4819.h"
2023-09-09 08:03:56 +01:00
#include "driver/st7565.h"
#include "external/printf/printf.h"
#include "functions.h"
2023-09-18 14:31:14 +01:00
#include "helper/battery.h"
2023-09-09 08:03:56 +01:00
#include "misc.h"
#include "radio.h"
#include "settings.h"
#include "ui/helper.h"
#include "ui/inputbox.h"
#include "ui/main.h"
2023-09-23 12:25:06 +01:00
#include "ui/ui.h"
2023-09-09 08:03:56 +01:00
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
2023-09-14 09:56:30 +01:00
#ifdef ENABLE_AUDIO_BAR
void UI_DisplayAudioBar(void)
{
if (gSetting_mic_bar)
{
const unsigned int line = 3;
const unsigned int lcd_width = sizeof(gFrameBuffer[line]) - 2;
#if 1
// TX audio level
2023-09-22 13:52:17 +01:00
2023-09-25 13:27:52 +01:00
if (gCurrentFunction != FUNCTION_TRANSMIT)
return;
2023-09-22 13:52:17 +01:00
// TODO: logify this to make the bar visible with the mostly small value
const uint16_t voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
const unsigned int max = 32767;
const unsigned int level = (((uint32_t)voice_amp * lcd_width) + (max / 2)) / max; // with rounding
#else
// TX/RX AF input level (dB)
const uint8_t af_tx_rx = BK4819_GetAfTxRx(); // 6:0
const unsigned int max = 63;
const unsigned int level = (((uint16_t)af_tx_rx * lcd_width) + (max / 2)) / max; // with rounding
#endif
const unsigned int len = (level <= lcd_width) ? level : lcd_width;
uint8_t *pLine = gFrameBuffer[line];
memset(pLine, 0, lcd_width);
#if 0
// solid bar
memset(pLine, 0x3e, len);
#else
for (unsigned int i = 0; i < len; i += 2)
pLine[i] = 0x3e;
#endif
2023-09-25 13:27:52 +01:00
if (gCurrentFunction == FUNCTION_TRANSMIT)
ST7565_BlitFullScreen();
}
}
#endif
2023-09-09 08:03:56 +01:00
void UI_DisplayMain(void)
{
2023-09-12 15:31:37 +01:00
char String[16];
unsigned int vfo_num;
2023-09-09 08:03:56 +01:00
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
2023-09-13 18:45:52 +01:00
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
{ // tell user how to unlock the keyboard
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
2023-09-09 08:03:56 +01:00
ST7565_BlitFullScreen();
return;
}
2023-09-10 13:52:41 +01:00
// #ifdef SINGLE_VFO_CHAN
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
// #else
const bool single_vfo = false;
// #endif
bool center_line_is_free = true;
2023-09-17 15:36:23 +01:00
for (vfo_num = 0; vfo_num < 2; vfo_num++)
2023-09-09 08:03:56 +01:00
{
2023-09-12 15:31:37 +01:00
uint8_t Channel = gEeprom.TX_CHANNEL;
bool bIsSameVfo = !!(Channel == vfo_num);
uint8_t Line = (vfo_num == 0) ? 0 : 4;
uint8_t *pLine0 = gFrameBuffer[Line + 0];
uint8_t *pLine1 = gFrameBuffer[Line + 1];
2023-09-10 13:52:41 +01:00
if (single_vfo)
2023-09-12 15:31:37 +01:00
{ // we're in single VFO mode - screen is dedicated to just one VFO
2023-09-11 00:02:57 +01:00
2023-09-10 13:52:41 +01:00
if (!bIsSameVfo)
2023-09-12 15:31:37 +01:00
continue; // skip the unused vfo
2023-09-09 08:03:56 +01:00
2023-09-16 17:16:36 +01:00
2023-09-10 13:52:41 +01:00
}
2023-09-09 08:03:56 +01:00
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
Channel = gEeprom.RX_CHANNEL; // we're currently monitoring the other VFO
2023-09-09 08:03:56 +01:00
if (Channel != vfo_num)
2023-09-09 08:03:56 +01:00
{
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
2023-09-11 00:02:57 +01:00
{ // show DTMF stuff
2023-09-09 08:03:56 +01:00
char Contact[16];
if (!gDTMF_InputMode)
{
2023-09-10 13:52:41 +01:00
memset(Contact, 0, sizeof(Contact));
2023-09-09 08:03:56 +01:00
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
2023-09-10 13:52:41 +01:00
strcpy(String, (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT");
2023-09-09 08:03:56 +01:00
else
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
2023-09-10 13:52:41 +01:00
sprintf(String, "CALL:%s", (DTMF_FindContact(gDTMF_Caller, Contact)) ? Contact : gDTMF_Caller);
2023-09-09 08:03:56 +01:00
else
if (gDTMF_IsTx)
2023-09-10 13:52:41 +01:00
strcpy(String, (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX");
2023-09-09 08:03:56 +01:00
}
else
{
2023-09-09 08:03:56 +01:00
sprintf(String, ">%s", gDTMF_InputBox);
center_line_is_free = false;
}
2023-09-12 15:31:37 +01:00
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
2023-09-09 08:03:56 +01:00
memset(String, 0, sizeof(String));
if (!gDTMF_InputMode)
{
2023-09-10 13:52:41 +01:00
memset(Contact, 0, sizeof(Contact));
2023-09-09 08:03:56 +01:00
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
2023-09-10 13:52:41 +01:00
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_String, Contact)) ? Contact : gDTMF_String);
2023-09-09 08:03:56 +01:00
else
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
2023-09-10 13:52:41 +01:00
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_Callee, Contact)) ? Contact : gDTMF_Callee);
2023-09-09 08:03:56 +01:00
else
if (gDTMF_IsTx)
sprintf(String, ">%s", gDTMF_String);
}
else
{
center_line_is_free = false;
}
2023-09-12 15:31:37 +01:00
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
2023-09-10 13:52:41 +01:00
center_line_is_free = false;
2023-09-09 08:03:56 +01:00
continue;
}
2023-09-09 13:58:21 +01:00
2023-09-10 13:52:41 +01:00
// highlight the selected/used VFO with a marker
if (!single_vfo && bIsSameVfo)
memmove(pLine0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memmove(pLine0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
2023-09-09 08:03:56 +01:00
}
else
2023-09-10 13:52:41 +01:00
if (!single_vfo)
{ // highlight the selected/used VFO with a marker
2023-09-09 08:03:56 +01:00
if (bIsSameVfo)
memmove(pLine0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
2023-09-12 15:31:37 +01:00
else
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memmove(pLine0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
2023-09-09 08:03:56 +01:00
}
2023-09-19 14:48:09 +01:00
uint32_t duff_beer = 0;
2023-09-09 08:03:56 +01:00
if (gCurrentFunction == FUNCTION_TRANSMIT)
2023-09-11 00:02:57 +01:00
{ // transmitting
2023-09-14 09:56:30 +01:00
#ifdef ENABLE_ALARM
2023-09-09 09:01:52 +01:00
if (gAlarmState == ALARM_STATE_ALARM)
2023-09-19 14:48:09 +01:00
duff_beer = 2;
2023-09-09 09:01:52 +01:00
else
#endif
2023-09-09 08:03:56 +01:00
{
2023-09-10 13:52:41 +01:00
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
2023-09-10 13:52:41 +01:00
{ // show the TX symbol
2023-09-19 14:48:09 +01:00
duff_beer = 1;
2023-09-16 17:16:36 +01:00
UI_PrintStringSmall("TX", 14, 0, Line);
2023-09-09 08:03:56 +01:00
}
}
}
else
2023-09-12 15:31:37 +01:00
{ // receiving .. show the RX symbol
2023-09-19 14:48:09 +01:00
duff_beer = 2;
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num)
2023-09-16 17:16:36 +01:00
UI_PrintStringSmall("RX", 14, 0, Line);
2023-09-09 08:03:56 +01:00
}
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
2023-09-11 00:02:57 +01:00
{ // channel mode
2023-09-12 15:31:37 +01:00
const unsigned int x = 2;
const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) ? false : true;
if (!inputting)
2023-09-14 19:38:28 +01:00
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
2023-09-09 08:03:56 +01:00
else
2023-09-17 09:54:24 +01:00
memmove(String + 5, gInputBox, 3); // show the input text
UI_PrintStringSmall("M", x, 0, Line + 1);
UI_DisplaySmallDigits(3, String + 5, x + 7, Line + 1, inputting);
2023-09-09 08:03:56 +01:00
}
else
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ // frequency mode
2023-09-11 00:02:57 +01:00
// show the frequency band number
const unsigned int x = 2; // was 14
// sprintf(String, "FB%u", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST);
sprintf(String, "VFO%u", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST);
2023-09-16 17:16:36 +01:00
UI_PrintStringSmall(String, x, 0, Line + 1);
2023-09-09 08:03:56 +01:00
}
#ifdef ENABLE_NOAA
2023-09-09 08:03:56 +01:00
else
{
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
{ // channel number
sprintf(String, "N%u", 1 + gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST);
}
else
{ // user entering channel number
sprintf(String, "N%u%u", '0' + gInputBox[0], '0' + gInputBox[1]);
}
UI_PrintStringSmall(String, 7, 0, Line + 1);
2023-09-09 08:03:56 +01:00
}
#endif
2023-09-09 08:03:56 +01:00
2023-09-12 15:31:37 +01:00
// ************
uint8_t State = VfoState[vfo_num];
2023-09-09 08:03:56 +01:00
2023-09-14 09:56:30 +01:00
#ifdef ENABLE_ALARM
2023-09-09 09:01:52 +01:00
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
{
2023-09-10 13:52:41 +01:00
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
2023-09-09 09:01:52 +01:00
State = VFO_STATE_ALARM;
}
#endif
2023-09-09 13:58:21 +01:00
2023-09-10 13:52:41 +01:00
if (State != VFO_STATE_NORMAL)
2023-09-09 08:03:56 +01:00
{
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
if (State >= 0 && State < ARRAY_SIZE(state_list))
UI_PrintString(state_list[State], 31, 0, Line, 8);
2023-09-09 08:03:56 +01:00
}
else
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
{ // user entering a frequency
UI_DisplayFrequency(gInputBox, 32, Line, true, false);
center_line_is_free = false;
}
else
{
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
2023-09-09 08:03:56 +01:00
}
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ // channel mode
// show the channel symbols
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (attributes & MR_CH_SCANLIST1)
memmove(pLine0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
if (attributes & MR_CH_SCANLIST2)
memmove(pLine0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
#ifndef ENABLE_BIG_FREQ
#ifdef ENABLE_COMPANDER
if ((attributes & MR_CH_COMPAND) > 0)
memmove(pLine0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
#endif
#endif
switch (gEeprom.CHANNEL_DISPLAY_MODE)
{
case MDF_FREQUENCY: // show the channel frequency
#ifdef ENABLE_BIG_FREQ
NUMBER_ToDigits(frequency, String);
// show the main large frequency digits
UI_DisplayFrequency(String, 32, Line, false, false);
// show the remaining 2 small frequency digits
UI_DisplaySmallDigits(2, String + 6, 113, Line + 1, true);
#else
// show the frequency in the main font
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, 32, 0, Line, 8);
#endif
break;
2023-09-09 13:58:21 +01:00
case MDF_CHANNEL: // show the channel number
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 32, 0, Line, 8);
break;
case MDF_NAME: // show the channel name
case MDF_NAME_FREQ: // show the channel name and frequency
2023-09-22 13:52:17 +01:00
BOARD_fetchChannelName(String, gEeprom.ScreenChannel[vfo_num]);
if (String[0] == 0)
{ // no channel name, show the channel number instead
2023-09-13 02:01:35 +01:00
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
}
2023-09-22 13:52:17 +01:00
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME)
{
UI_PrintString(String, 32, 0, Line, 8);
}
else
{
2023-09-24 01:36:43 +01:00
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold(String, 32 + 4, 0, Line);
#else
UI_PrintStringSmall(String, 32 + 4, 0, Line);
#endif
// show the channel frequency below the channel number/name
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
UI_PrintStringSmall(String, 32 + 4, 0, Line + 1);
}
2023-09-22 13:52:17 +01:00
break;
2023-09-09 08:03:56 +01:00
}
}
else
{ // frequency mode
#ifdef ENABLE_BIG_FREQ
NUMBER_ToDigits(frequency, String); // 8 digits
// show the main large frequency digits
UI_DisplayFrequency(String, 32, Line, false, false);
// show the remaining 2 small frequency digits
UI_DisplaySmallDigits(2, String + 6, 113, Line + 1, true);
#else
// show the frequency in the main font
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, 32, 0, Line, 8);
#endif
#ifdef ENABLE_COMPANDER
// show the channel symbols
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if ((attributes & MR_CH_COMPAND) > 0)
#ifdef ENABLE_BIG_FREQ
memmove(pLine0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
#else
memmove(pLine0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
#endif
#endif
}
2023-09-09 08:03:56 +01:00
}
2023-09-12 15:31:37 +01:00
// ************
2023-09-10 13:52:41 +01:00
{ // show the TX/RX level
uint8_t Level = 0;
2023-09-09 08:03:56 +01:00
2023-09-19 14:48:09 +01:00
if (duff_beer == 1)
2023-09-10 13:52:41 +01:00
{ // TX power level
switch (gRxVfo->OUTPUT_POWER)
{
case OUTPUT_POWER_LOW: Level = 2; break;
case OUTPUT_POWER_MID: Level = 4; break;
case OUTPUT_POWER_HIGH: Level = 6; break;
2023-09-10 13:52:41 +01:00
}
}
else
2023-09-19 14:48:09 +01:00
if (duff_beer == 2)
2023-09-10 13:52:41 +01:00
{ // RX signal level
2023-09-17 15:36:23 +01:00
#ifdef ENABLE_DBM
// dBm
//
// this doesn't yet quite fit into the available screen space
const int16_t rssi = gVFO_RSSI[vfo_num];
2023-09-17 15:36:23 +01:00
if (rssi > 0)
{
const int16_t dBm = (rssi / 2) - 160;
2023-09-17 15:36:23 +01:00
sprintf(String, "%-3d", dBm);
UI_PrintStringSmall(String, 2, 0, Line + 2);
}
#else
// bar graph
if (gVFO_RSSI_bar_level[vfo_num] > 0)
Level = gVFO_RSSI_bar_level[vfo_num];
2023-09-17 15:36:23 +01:00
#endif
2023-09-10 13:52:41 +01:00
}
2023-09-10 13:52:41 +01:00
if (Level >= 1)
{
uint8_t *pLine = pLine1 + LCD_WIDTH;
2023-09-17 15:36:23 +01:00
memmove(pLine + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
2023-09-10 13:52:41 +01:00
if (Level >= 2)
2023-09-17 15:36:23 +01:00
memmove(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
2023-09-10 13:52:41 +01:00
if (Level >= 3)
2023-09-17 15:36:23 +01:00
memmove(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
2023-09-10 13:52:41 +01:00
if (Level >= 4)
2023-09-17 15:36:23 +01:00
memmove(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
2023-09-10 13:52:41 +01:00
if (Level >= 5)
2023-09-17 15:36:23 +01:00
memmove(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
2023-09-10 13:52:41 +01:00
if (Level >= 6)
2023-09-17 15:36:23 +01:00
memmove(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (Level >= 7)
memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
2023-09-10 13:52:41 +01:00
}
2023-09-09 08:03:56 +01:00
}
2023-09-12 15:31:37 +01:00
// ************
2023-09-17 15:36:23 +01:00
String[0] = '\0';
if (gEeprom.VfoInfo[vfo_num].IsAM)
2023-09-10 13:52:41 +01:00
{ // show the AM symbol
2023-09-17 15:36:23 +01:00
strcpy(String, "AM");
2023-09-09 08:03:56 +01:00
}
else
{ // or show the CTCSS/DCS symbol
2023-09-19 14:48:09 +01:00
const FREQ_Config_t *pConfig = (duff_beer == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
const unsigned int code_type = pConfig->CodeType;
const char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
2023-09-17 15:36:23 +01:00
strcpy(String, code_list[code_type]);
2023-09-09 08:03:56 +01:00
}
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, Line + 1);
2023-09-09 08:03:56 +01:00
if (State != VFO_STATE_TX_DISABLE)
{ // show the TX power
const char pwr_list[] = "LMH";
const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER;
String[0] = (i >= 0 && i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
String[1] = '\0';
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, Line + 1);
2023-09-09 08:03:56 +01:00
}
if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency)
2023-09-10 13:52:41 +01:00
{ // show the TX offset symbol
const char dir_list[] = "\0+-";
const unsigned int i = gEeprom.VfoInfo[vfo_num].TX_OFFSET_FREQUENCY_DIRECTION;
String[0] = (i < sizeof(dir_list)) ? dir_list[i] : '?';
2023-09-16 17:16:36 +01:00
String[1] = '\0';
UI_PrintStringSmall(String, LCD_WIDTH + 54, 0, Line + 1);
2023-09-09 08:03:56 +01:00
}
2023-09-10 13:52:41 +01:00
// show the TX/RX reverse symbol
if (gEeprom.VfoInfo[vfo_num].FrequencyReverse)
UI_PrintStringSmall("R", LCD_WIDTH + 62, 0, Line + 1);
2023-09-09 08:03:56 +01:00
2023-09-18 00:48:40 +01:00
{ // show the narrow band symbol
String[0] = '\0';
if (gEeprom.VfoInfo[vfo_num].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
2023-09-18 00:48:40 +01:00
{
String[0] = 'N';
String[1] = '\0';
2023-09-18 00:48:40 +01:00
}
UI_PrintStringSmall(String, LCD_WIDTH + 70, 0, Line + 1);
2023-09-18 00:48:40 +01:00
}
// show the DTMF decoding symbol(
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, Line + 1);
2023-09-09 08:03:56 +01:00
2023-09-10 13:52:41 +01:00
// show the audio scramble symbol
2023-09-17 15:36:23 +01:00
if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, Line + 1);
2023-09-09 08:03:56 +01:00
}
if (center_line_is_free)
2023-09-22 13:52:17 +01:00
{ // we're free to use the middle empty line for something
2023-09-24 00:06:10 +01:00
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
2023-09-24 01:58:03 +01:00
if (gSetting_AM_fix && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].IsAM)
2023-09-23 12:25:06 +01:00
{
switch (gCurrentFunction)
{
case FUNCTION_TRANSMIT:
case FUNCTION_BAND_SCOPE:
case FUNCTION_POWER_SAVE:
break;
2023-09-23 12:25:06 +01:00
case FUNCTION_FOREGROUND:
break;
2023-09-23 12:25:06 +01:00
case FUNCTION_RECEIVE:
case FUNCTION_MONITOR:
case FUNCTION_INCOMING:
2023-09-24 20:59:28 +01:00
AM_fix_print_data(gEeprom.RX_CHANNEL, String);
2023-09-23 17:23:21 +01:00
UI_PrintStringSmall(String, 0, 0, 3);
2023-09-23 12:25:06 +01:00
break;
}
}
2023-09-24 01:58:03 +01:00
else
#endif
{
#ifdef ENABLE_AUDIO_BAR
UI_DisplayAudioBar();
if (!gSetting_mic_bar)
#endif
{
if (gSetting_live_DTMF_decoder && gDTMF_ReceivedSaved[0] >= 32)
{ // show live DTMF decode
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
}
else
if (gChargingWithTypeC)
{ // charging .. show the battery state
#ifdef ENABLE_SHOW_CHARGE_LEVEL
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
sprintf(String, "Charge %u.%02uV %u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, percent);
UI_PrintStringSmall(String, 2, 0, 3);
#endif
}
2023-09-22 13:52:17 +01:00
}
2023-09-24 01:58:03 +01:00
}
}
2023-09-17 15:36:23 +01:00
2023-09-09 08:03:56 +01:00
ST7565_BlitFullScreen();
}