Fixed WX/Cross-band display indicator, some menu renames

This commit is contained in:
OneOfEleven 2023-09-12 16:53:47 +01:00
parent 4dfa882770
commit f436a84bd5
12 changed files with 190 additions and 134 deletions

View File

@ -74,6 +74,7 @@ static void ACTION_Monitor(void)
RADIO_SetupRegisters(true);
APP_StartListening(FUNCTION_MONITOR);
return;
}
@ -207,6 +208,7 @@ void ACTION_FM(void)
if (gFmRadioMode)
{
FM_TurnOff();
gInputBoxIndex = 0;
gVoxResumeCountdown = 80;
gFlagReconfigureVfos = true;
@ -216,7 +218,9 @@ void ACTION_FM(void)
RADIO_SelectVfos();
RADIO_SetupRegisters(true);
FM_Start();
gInputBoxIndex = 0;
gRequestDisplayScreen = DISPLAY_FM;
}
@ -246,6 +250,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
#ifndef DISABLE_VOICE
gAnotherVoiceID = VOICE_ID_CANCEL;
#endif
gRequestDisplayScreen = DISPLAY_MAIN;
gDTMF_InputMode = false;
}
@ -286,6 +291,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
switch (Short)
{
default:
case ACTION_OPT_NONE:
break;
case ACTION_OPT_FLASHLIGHT:
ACTION_FlashLight();

View File

@ -421,7 +421,6 @@ void APP_StartListening(FUNCTION_Type_t Function)
#ifndef DISABLE_VOICE
if (gVoiceWriteIndex == 0)
// BK4819_SetAF(gRxVfo->IsAM ? BK4819_AF_AM : BK4819_AF_OPEN);
#endif
BK4819_SetAF(gRxVfo->IsAM ? BK4819_AF_AM : BK4819_AF_OPEN);
@ -685,7 +684,11 @@ static void APP_HandleVox(void)
gVoxPauseCountdown = 0;
}
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && !gFmRadioMode)
if (gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_MONITOR &&
gScanState == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF &&
!gFmRadioMode)
{
if (gVOX_NoiseDetected)
{
@ -704,6 +707,7 @@ static void APP_HandleVox(void)
else
{
APP_EndTransmission();
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
FUNCTION_Select(FUNCTION_FOREGROUND);
else
@ -727,7 +731,9 @@ static void APP_HandleVox(void)
if (gCurrentFunction != FUNCTION_TRANSMIT)
{
gDTMF_ReplyState = DTMF_REPLY_NONE;
RADIO_PrepareTX();
gUpdateDisplay = true;
}
}
@ -749,9 +755,13 @@ void APP_Update(void)
{
gTxTimeoutReached = false;
gFlagEndTransmission = true;
APP_EndTransmission();
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP);
RADIO_SetVfoState(VFO_STATE_TIMEOUT);
GUI_DisplayScreen();
}
@ -809,6 +819,7 @@ void APP_Update(void)
{
NOAA_IncreaseChannel();
RADIO_SetupRegisters(false);
gScheduleNOAA = false;
gNOAA_Countdown = 7;
}
@ -840,7 +851,11 @@ void APP_Update(void)
}
}
if (gFM_ScanState != FM_SCAN_OFF && gScheduleFM && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_TRANSMIT)
if (gFM_ScanState != FM_SCAN_OFF &&
gScheduleFM &&
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_TRANSMIT)
{
FM_Play();
gScheduleFM = false;
@ -852,7 +867,14 @@ void APP_Update(void)
if (gSchedulePowerSave)
{
#ifndef DISABLE_NOAA
if (gEeprom.BATTERY_SAVE == 0 || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_STATE_NONE)
if (gEeprom.BATTERY_SAVE == 0 ||
gScanState != SCAN_OFF ||
gCssScanMode != CSS_SCAN_MODE_OFF ||
gFmRadioMode ||
gPttIsPressed ||
gScreenToDisplay != DISPLAY_MAIN ||
gKeyBeingHeld ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
gBatterySaveCountdown = 1000;
else
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
@ -860,7 +882,14 @@ void APP_Update(void)
else
gBatterySaveCountdown = 1000;
#else
if (gEeprom.BATTERY_SAVE == 0 || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_STATE_NONE)
if (gEeprom.BATTERY_SAVE == 0 ||
gScanState != SCAN_OFF ||
gCssScanMode != CSS_SCAN_MODE_OFF ||
gFmRadioMode ||
gPttIsPressed ||
gScreenToDisplay != DISPLAY_MAIN ||
gKeyBeingHeld ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
gBatterySaveCountdown = 1000;
else
FUNCTION_Select(FUNCTION_POWER_SAVE);
@ -889,6 +918,7 @@ void APP_Update(void)
}
FUNCTION_Init();
gBatterySave = 10;
gRxIdleMode = false;
}
@ -923,7 +953,7 @@ void APP_Update(void)
// called every 10ms
void APP_CheckKeys(void)
{
const uint16_t key_repeat_delay = 70; // 700ms
const uint16_t key_repeat_delay = 60; // 600ms
KEY_Code_t Key;
#ifndef DISABLE_AIRCOPY

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,12 +42,7 @@ void FUNCTION_Init(void)
{
gCurrentCodeType = gSelectedCodeType;
if (gCssScanMode == CSS_SCAN_MODE_OFF)
{
if (gRxVfo->IsAM)
gCurrentCodeType = CODE_TYPE_OFF;
else
gCurrentCodeType = gRxVfo->pRX->CodeType;
}
gCurrentCodeType = gRxVfo->IsAM ? CODE_TYPE_OFF : gRxVfo->pRX->CodeType;
}
#ifndef DISABLE_NOAA
else
@ -84,30 +79,37 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
bWasPowerSave = (PreviousFunction == FUNCTION_POWER_SAVE);
gCurrentFunction = Function;
if (bWasPowerSave) {
if (Function != FUNCTION_POWER_SAVE) {
if (bWasPowerSave)
{
if (Function != FUNCTION_POWER_SAVE)
{
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
gRxIdleMode = false;
UI_DisplayStatus();
}
}
switch (Function) {
switch (Function)
{
case FUNCTION_FOREGROUND:
if (gDTMF_ReplyState != DTMF_REPLY_NONE) {
if (gDTMF_ReplyState != DTMF_REPLY_NONE)
RADIO_PrepareCssTX();
}
if (PreviousFunction == FUNCTION_TRANSMIT) {
if (PreviousFunction == FUNCTION_TRANSMIT)
{
gVFO_RSSI_Level[0] = 0;
gVFO_RSSI_Level[1] = 0;
} else if (PreviousFunction == FUNCTION_RECEIVE) {
if (gFmRadioMode) {
Countdown = 500;
}
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED) {
else
if (PreviousFunction == FUNCTION_RECEIVE)
{
if (gFmRadioMode)
Countdown = 500;
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2);
}
}
return;
case FUNCTION_MONITOR:
@ -118,11 +120,14 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
case FUNCTION_POWER_SAVE:
gBatterySave = gEeprom.BATTERY_SAVE * 10;
gRxIdleMode = true;
BK4819_DisableVox();
BK4819_Sleep();
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
gBatterySaveCountdownExpired = false;
gUpdateStatus = true;
GUI_SelectNextDisplay(DISPLAY_MAIN);
return;
@ -149,7 +154,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
#endif
GUI_DisplayScreen();
RADIO_SetTxParameters();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
DTMF_Reply();
@ -157,13 +164,12 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
#ifndef DISABLE_ALARM
if (gAlarmState != ALARM_STATE_OFF)
{
if (gAlarmState == ALARM_STATE_TX1750)
BK4819_TransmitTone(true, 1750);
else
BK4819_TransmitTone(true, 500);
BK4819_TransmitTone(true, (gAlarmState == ALARM_STATE_TX1750) ? 1750 : 500);
SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gAlarmToneCounter = 0;
gEnableSpeaker = true;
break;
@ -177,8 +183,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
break;
}
gBatterySaveCountdown = 1000;
gSchedulePowerSave = false;
gFM_RestoreCountdown = Countdown;
}

View File

@ -74,6 +74,9 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
#ifdef DISABLE_VOICE
gMenuListCount--;
#endif
#ifdef DISABLE_ALARM
gMenuListCount--;
#endif
#ifdef DISABLE_NOAA
gMenuListCount--;
#endif

View File

@ -46,7 +46,7 @@ void UI_DisplayAircopy(void)
{
NUMBER_ToDigits(gRxVfo->ConfigRX.Frequency, String);
UI_DisplayFrequency(String, 16, 2, 0, 0);
UI_DisplaySmallDigits(2, String + 6, 97, 3);
UI_DisplaySmallDigits(2, String + 6, 97, 3, true);
}
else
UI_DisplayFrequency(gInputBox, 16, 2, 1, 0);

View File

@ -217,11 +217,21 @@ void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bD
}
}
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y)
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros)
{
const unsigned int char_width = 7;
unsigned int x = X;
bool display = display_leading_zeros;
unsigned int xx;
unsigned int i;
for (i = 0; i < Size; i++, x += char_width)
memcpy(gFrameBuffer[Y] + x, gFontSmallDigits[(unsigned int)pString[i]], char_width);
for (i = 0, xx = x; i < size; i++)
{
const unsigned int c = (unsigned int)str[i];
if (c > 0)
display = true;
if (display && c < ARRAY_SIZE(gFontSmallDigits))
{
memcpy(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width);
xx += char_width;
}
}
}

View File

@ -26,7 +26,7 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y);
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);
#endif

View File

@ -116,8 +116,9 @@ void UI_DisplayMain(void)
// highlight the selected/used VFO with a marker
if (!single_vfo && bIsSameVfo)
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
//else
// memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
else
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
}
else
if (!single_vfo)
@ -169,7 +170,7 @@ void UI_DisplayMain(void)
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String);
else
memcpy(String + 5, gInputBox, 3);
UI_DisplaySmallDigits(3, String + 5, x + sizeof(BITMAP_M), Line + 1);
UI_DisplaySmallDigits(3, String + 5, x + sizeof(BITMAP_M), Line + 1, false);
}
else
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
@ -179,7 +180,7 @@ void UI_DisplayMain(void)
char c;
memcpy(pLine1 + x, BITMAP_FB, sizeof(BITMAP_FB));
c = (gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST) + 1;
UI_DisplaySmallDigits(1, &c, x + sizeof(BITMAP_FB), Line + 1);
UI_DisplaySmallDigits(1, &c, x + sizeof(BITMAP_FB), Line + 1, false);
}
else
{
@ -195,7 +196,7 @@ void UI_DisplayMain(void)
String[6] = gInputBox[0];
String[7] = gInputBox[1];
}
UI_DisplaySmallDigits(2, String + 6, 15, Line + 1);
UI_DisplaySmallDigits(2, String + 6, 15, Line + 1, true);
}
// ************
@ -285,7 +286,7 @@ void UI_DisplayMain(void)
// show the main large frequency digits
UI_DisplayFrequency(String, 31, Line, false, false);
// show the remaining 2 small frequency digits
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1, true);
#else
// show the frequency in the main font
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
@ -346,7 +347,7 @@ void UI_DisplayMain(void)
// show the main large frequency digits
UI_DisplayFrequency(String, 31, Line, false, false);
// show the remaining 2 small frequency digits
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1, true);
#else
// show the frequency in the main font
sprintf(String, "%9.5f", frequency_Hz * 0.00001);

View File

@ -34,22 +34,22 @@ static const char MenuList[][7] =
{
"SQL",
"STEP",
"TX-PWR",
"R_DCS",
"R_CTCS",
"T_DCS",
"T_CTCS",
"TX-PWR", // was "TXP"
"R-DCS", // was "R_DCS"
"R-CTCS", // was "R_CTCS"
"T-DCS", // was "T_DCS"
"T-CTCS", // was "T_CTCS"
"SFT-D",
"OFFSET",
"W/N",
"SCRAM",
"SCRAM", // was "SCR"
"BCL",
"MEM-CH",
"B-SAVE",
"B-SAVE", // was "SAVE"
"VOX",
"BAK-LT",
"TDR",
"CROS-B",
"BAK-LT", // was "ABR"
"DUAL-W", // was "TDR"
"CROS-B", // was "WX"
"BEEP",
"TOT",
#ifndef DISABLE_VOICE
@ -82,8 +82,8 @@ static const char MenuList[][7] =
"D-LIST",
"PONMSG",
"ROGER",
"BATVOL",
"MODE",
"BATVOL", // was "VOL"
"MODE", // was "AM"
#ifndef DISABLE_NOAA
"NOAA_S",
#endif
@ -93,12 +93,12 @@ static const char MenuList[][7] =
// normally hidden menu items from here on.
// enabled if pressing PTT and side button below PTT at power-on.
"350TX",
"350-TX", // was "350TX"
"F-LOCK",
"200TX",
"500TX",
"350EN",
"SCREN"
"200-TX", // was "200TX"
"500-TX", // was "500TX"
"350-EN", // was "350EN"
"SCR-EN" // was "SCREN"
};
#if 0
@ -293,7 +293,7 @@ void UI_DisplayMenu(void)
#endif
NUMBER_ToDigits(gMenuCursor + 1, String);
UI_DisplaySmallDigits(2, String + 6, 33, 6);
UI_DisplaySmallDigits(2, String + 6, 33, 6, false);
if (gIsInSubMenu)
memcpy(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
@ -628,10 +628,10 @@ void UI_DisplayMenu(void)
gMenuCursor == MENU_T_DCS ||
gMenuCursor == MENU_D_LIST)
{
uint8_t Offset;
unsigned int Offset;
NUMBER_ToDigits((uint8_t)gSubMenuSelection, String);
Offset = (gMenuCursor == MENU_D_LIST) ? 2 : 3;
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0);
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0, false);
}
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)