Merge remote-tracking branch 'remotes/OneOfEleven/main'

This commit is contained in:
Krzysiek Egzmont
2023-10-02 23:15:34 +02:00
28 changed files with 584 additions and 576 deletions

View File

@@ -18,6 +18,7 @@ ENABLE_SMALL_BOLD := 1
ENABLE_KEEP_MEM_NAME := 1 ENABLE_KEEP_MEM_NAME := 1
ENABLE_WIDE_RX := 1 ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0 ENABLE_TX_WHEN_AM := 0
ENABLE_F_CAL_MENU := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
ENABLE_MAIN_KEY_HOLD := 1 ENABLE_MAIN_KEY_HOLD := 1
ENABLE_BOOT_BEEPS := 0 ENABLE_BOOT_BEEPS := 0
@@ -219,6 +220,9 @@ endif
ifeq ($(ENABLE_TX_WHEN_AM),1) ifeq ($(ENABLE_TX_WHEN_AM),1)
CFLAGS += -DENABLE_TX_WHEN_AM CFLAGS += -DENABLE_TX_WHEN_AM
endif endif
ifeq ($(ENABLE_F_CAL_MENU),1)
CFLAGS += -DENABLE_F_CAL_MENU
endif
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1) ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
endif endif

View File

@@ -36,9 +36,11 @@ Anyway, have fun.
Please note that the Quansheng uv-k radios are not professional quality transceivers, their Please note that the Quansheng uv-k radios are not professional quality transceivers, their
performance is strictly limited, somewhat below that of a decent transceiver. The RX front performance is strictly limited, somewhat below that of a decent transceiver. The RX front
end has no track-tuned band pass filtering at all, and so are wide band/wide open to any end has no track-tuned band pass filtering at all, and so are wide band/wide open to any
and all signals over a wide frequency range. Using the radio in high intensity RF environments and all signals over a wide frequency range.
will nearly always destroy your reception, the receiver simply doesn't have a great dynamic Using the radio in high intensity RF environments will nearly always destroy your reception,
range, though are quite sensitive (weak signal wise). the receiver simply doesn't have a great dynamic range, which means distorted AM audio with
strong received signals, there is nothing more anyone can do in firmware/software to stop that
happening once the RX gain adjustment I do (AM fix) reaches the hardwares limit.
Saying that, they are nice toys for the price, fun to play with. Saying that, they are nice toys for the price, fun to play with.
@@ -63,6 +65,7 @@ ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though frontend not tuned over full range) ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though frontend not tuned over full range)
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions
ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up

View File

@@ -447,8 +447,10 @@ const uint8_t orig_pga = 6; // -3dB
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index
} }
if (gain_table_index[vfo] == gain_table_index_prev[vfo]) #if 0
return; // no gain change if (gain_table_index[vfo] == gain_table_index_prev[vfo])
return; // no gain change
#endif
#endif #endif

View File

@@ -134,9 +134,9 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
NUMBER_Get(gInputBox, &Frequency); NUMBER_Get(gInputBox, &Frequency);
for (i = 0; i < 7; i++) for (i = 0; i < ARRAY_SIZE(frequencyBandTable); i++)
{ {
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i]) if (Frequency >= frequencyBandTable[i].lower && Frequency < frequencyBandTable[i].upper)
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;

295
app/app.c
View File

@@ -95,7 +95,7 @@ static void APP_CheckForIncoming(void)
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE) if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
{ // CTCSS/DTS scanning { // CTCSS/DTS scanning
ScanPauseDelayIn_10ms = 100; // 1 second ScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
gRxReceptionMode = RX_MODE_DETECTED; gRxReceptionMode = RX_MODE_DETECTED;
} }
@@ -160,7 +160,7 @@ static void APP_CheckForIncoming(void)
return; return;
} }
ScanPauseDelayIn_10ms = 20; // 200ms ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
} }
@@ -401,7 +401,7 @@ Skip:
break; break;
case SCAN_RESUME_CO: case SCAN_RESUME_CO:
ScanPauseDelayIn_10ms = 360; ScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
break; break;
@@ -490,7 +490,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
case SCAN_RESUME_TO: case SCAN_RESUME_TO:
if (!gScanPauseMode) if (!gScanPauseMode)
{ {
ScanPauseDelayIn_10ms = 500; ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
gScanPauseMode = true; gScanPauseMode = true;
} }
@@ -613,7 +613,7 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
if (pInfo->StepFrequency == 833) if (pInfo->StepFrequency == 833)
{ {
const uint32_t Lower = LowerLimitFrequencyBandTable[pInfo->Band]; const uint32_t Lower = frequencyBandTable[pInfo->Band].lower;
const uint32_t Delta = Frequency - Lower; const uint32_t Delta = Frequency - Lower;
uint32_t Base = (Delta / 2500) * 2500; uint32_t Base = (Delta / 2500) * 2500;
const uint32_t Index = ((Delta - Base) % 2500) / 833; const uint32_t Index = ((Delta - Base) % 2500) / 833;
@@ -624,11 +624,11 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
Frequency = Lower + Base + (Index * 833); Frequency = Lower + Base + (Index * 833);
} }
if (Frequency > UpperLimitFrequencyBandTable[pInfo->Band]) if (Frequency >= frequencyBandTable[pInfo->Band].upper)
Frequency = LowerLimitFrequencyBandTable[pInfo->Band]; Frequency = frequencyBandTable[pInfo->Band].lower;
else else
if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band]) if (Frequency < frequencyBandTable[pInfo->Band].lower)
Frequency = FREQUENCY_FloorToStep(UpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, LowerLimitFrequencyBandTable[pInfo->Band]); Frequency = FREQUENCY_FloorToStep(frequencyBandTable[pInfo->Band].upper, pInfo->StepFrequency, frequencyBandTable[pInfo->Band].lower);
return Frequency; return Frequency;
} }
@@ -641,58 +641,79 @@ static void FREQ_NextChannel(void)
RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
gUpdateDisplay = true; // ScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
ScanPauseDelayIn_10ms = 10; ScanPauseDelayIn_10ms = 10; // 100ms
bScanKeepFrequency = false;
bScanKeepFrequency = false;
gUpdateDisplay = true;
} }
static void MR_NextChannel(void) static void MR_NextChannel(void)
{ {
const uint8_t Ch1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT]; static unsigned int prev_mr_chan = 0;
const uint8_t Ch2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT]; const bool enabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
const bool bEnabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT]; const unsigned int chan1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
uint8_t PreviousCh = gNextMrChannel; const unsigned int chan2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
uint8_t Ch; const unsigned int prev_chan = gNextMrChannel;
unsigned int chan = 0;
if (bEnabled) if (enabled)
{ {
if (gCurrentScanList == 0) switch (gCurrentScanList)
{ {
gPreviousMrChannel = gNextMrChannel; case SCAN_NEXT_CHAN_SCANLIST1:
if (RADIO_CheckValidChannel(Ch1, false, 0)) prev_mr_chan = gNextMrChannel;
gNextMrChannel = Ch1; if (RADIO_CheckValidChannel(chan1, false, 0))
else {
gCurrentScanList = 1; //gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
} gNextMrChannel = chan1;
break;
}
if (gCurrentScanList == 1) case SCAN_NEXT_CHAN_SCANLIST2:
{ if (RADIO_CheckValidChannel(chan2, false, 0))
if (RADIO_CheckValidChannel(Ch2, false, 0)) {
gNextMrChannel = Ch2; gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
else gNextMrChannel = chan2;
gCurrentScanList = 2; break;
} }
if (gCurrentScanList == 2) // this bit doesn't work at all :(
{ case SCAN_NEXT_CHAN_DUAL_WATCH:
gNextMrChannel = gPreviousMrChannel; // if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT); {
if (Ch == 0xFF) // chan = (gEeprom.RX_CHANNEL + 1) & 1u;
return; // chan = gEeprom.MrChannel[chan];
// chan = gEeprom.ScreenChannel[chan];
// chan = gEeprom.VfoInfo[chan].CHANNEL_SAVE;
// chan = 14;
// if (RADIO_CheckValidChannel(chan, false, 0))
// {
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
// gNextMrChannel = chan;
// break;
// }
}
gNextMrChannel = Ch; default:
case SCAN_NEXT_CHAN_MR:
gCurrentScanList = SCAN_NEXT_CHAN_MR;
gNextMrChannel = prev_mr_chan;
chan = 0xffffffff;
break;
} }
} }
else
if (!enabled || chan == 0xffffffff)
{ {
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT); chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
if (Ch == 0xFF) if (chan == 0xFF)
return; return;
gNextMrChannel = Ch; gNextMrChannel = chan;
} }
if (PreviousCh != gNextMrChannel) if (prev_chan != gNextMrChannel)
{ {
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel; gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel; gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
@@ -703,12 +724,14 @@ static void MR_NextChannel(void)
gUpdateDisplay = true; gUpdateDisplay = true;
} }
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms; // ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
bScanKeepFrequency = false; ScanPauseDelayIn_10ms = 8; // 80ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
if (bEnabled) bScanKeepFrequency = false;
if (++gCurrentScanList > 2)
gCurrentScanList = 0; if (enabled)
if (++gCurrentScanList >= SCAN_NEXT_NUM)
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@@ -1258,47 +1281,21 @@ void APP_CheckKeys(void)
if (gPttIsPressed) if (gPttIsPressed)
{ {
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || gSerialConfigCountDown_500ms > 0)
{ // PTT released { // PTT released or serial comms config in progress
#if 0 if (++gPttDebounceCounter >= 3 || gSerialConfigCountDown_500ms > 0) // 30ms
// denoise the PTT { // stop transmitting
unsigned int i = 6; // test the PTT button for 6ms APP_ProcessKey(KEY_PTT, false, false);
unsigned int count = 0; gPttIsPressed = false;
while (i-- > 0) if (gKeyReading1 != KEY_INVALID)
{ gPttWasReleased = true;
SYSTEM_DelayMs(1); }
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
{ // PTT pressed
if (count > 0)
count--;
continue;
}
if (++count < 3)
continue;
// stop transmitting
APP_ProcessKey(KEY_PTT, false, false);
gPttIsPressed = false;
if (gKeyReading1 != KEY_INVALID)
gPttWasReleased = true;
break;
}
#else
if (++gPttDebounceCounter >= 3) // 30ms
{ // stop transmitting
APP_ProcessKey(KEY_PTT, false, false);
gPttIsPressed = false;
if (gKeyReading1 != KEY_INVALID)
gPttWasReleased = true;
}
#endif
} }
else else
gPttDebounceCounter = 0; gPttDebounceCounter = 0;
} }
else else
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
{ // PTT pressed { // PTT pressed
if (++gPttDebounceCounter >= 3) // 30ms if (++gPttDebounceCounter >= 3) // 30ms
{ // start transmitting { // start transmitting
@@ -1450,7 +1447,6 @@ void APP_TimeSlice10ms(void)
// Skipping authentic device checks // Skipping authentic device checks
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
// if (gFmRadioCountdown_500ms > 0)
if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11 if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11
return; return;
#endif #endif
@@ -1561,6 +1557,9 @@ void APP_TimeSlice10ms(void)
switch (gScanCssState) switch (gScanCssState)
{ {
case SCAN_CSS_STATE_OFF: case SCAN_CSS_STATE_OFF:
// must be RF frequency scanning if we're here ?
if (!BK4819_GetFrequencyScanResult(&Result)) if (!BK4819_GetFrequencyScanResult(&Result))
break; break;
@@ -1593,8 +1592,8 @@ void APP_TimeSlice10ms(void)
gUpdateStatus = true; gUpdateStatus = true;
} }
//gScanDelay_10ms = scan_delay_10ms; gScanDelay_10ms = scan_delay_10ms;
gScanDelay_10ms = 20 / 10; // 20ms //gScanDelay_10ms = 1; // 10ms
break; break;
case SCAN_CSS_STATE_SCANNING: case SCAN_CSS_STATE_SCANNING:
@@ -1714,6 +1713,16 @@ void APP_TimeSlice500ms(void)
if (--gDTMF_RX_timeout == 0) if (--gDTMF_RX_timeout == 0)
DTMF_clear_RX(); DTMF_clear_RX();
if (gSerialConfigCountDown_500ms > 0)
{
gReducedService = true; // a serial config upload/download is in progress
// if (gCurrentFunction == FUNCTION_TRANSMIT)
// { // stop transmitting
//
// }
}
// Skipped authentic device check // Skipped authentic device check
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@@ -1757,11 +1766,18 @@ void APP_TimeSlice500ms(void)
BATTERY_GetReadings(true); BATTERY_GetReadings(true);
} }
// regular statusbar updates (once every 2 sec) if need be // regular display updates (once every 2 sec) - if need be
if ((gBatteryCheckCounter & 3) == 0) if ((gBatteryCheckCounter & 3) == 0)
{
if (gChargingWithTypeC || gSetting_battery_text > 0) if (gChargingWithTypeC || gSetting_battery_text > 0)
gUpdateStatus = true; gUpdateStatus = true;
#ifdef ENABLE_SHOW_CHARGE_LEVEL
if (gChargingWithTypeC)
gUpdateDisplay = true;
#endif
}
if (gCurrentFunction != FUNCTION_POWER_SAVE) if (gCurrentFunction != FUNCTION_POWER_SAVE)
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_CHANNEL);
@@ -1783,6 +1799,8 @@ void APP_TimeSlice500ms(void)
if (gScanState == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) if (gScanState == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
#endif #endif
{ {
bool exit_menu = false;
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode) if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
{ {
if (--gKeyLockCountdown == 0) if (--gKeyLockCountdown == 0)
@@ -1791,52 +1809,55 @@ void APP_TimeSlice500ms(void)
gUpdateStatus = true; // lock symbol needs showing gUpdateStatus = true; // lock symbol needs showing
} }
if (gVoltageMenuCountdown > 0) if (gMenuCountdown > 0)
if (--gMenuCountdown == 0)
exit_menu = true; // exit menu mode
if (exit_menu)
{ {
if (--gVoltageMenuCountdown == 0) gMenuCountdown = 0;
if (gEeprom.BACKLIGHT == 0 && gScreenToDisplay == DISPLAY_MENU)
{ {
if (gEeprom.BACKLIGHT == 0 && gScreenToDisplay == DISPLAY_MENU) gBacklightCountdown = 0;
{ GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
gBacklightCountdown = 0;
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
}
if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
if (gScreenToDisplay == DISPLAY_SCANNER)
{
BK4819_StopScan();
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
RADIO_SetupRegisters(true);
}
gWasFKeyPressed = false;
gUpdateStatus = true;
gInputBoxIndex = 0;
gDTMF_InputMode = false;
gDTMF_InputIndex = 0;
gAskToSave = false;
gAskToDelete = false;
#ifdef ENABLE_FMRADIO
if (gFmRadioMode &&
gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT)
{
GUI_SelectNextDisplay(DISPLAY_FM);
}
else
#endif
#ifndef ENABLE_CODE_SCAN_TIMEOUT
if (gScreenToDisplay != DISPLAY_SCANNER)
#endif
GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
if (gScreenToDisplay == DISPLAY_SCANNER)
{
BK4819_StopScan();
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
RADIO_SetupRegisters(true);
}
gWasFKeyPressed = false;
gUpdateStatus = true;
gInputBoxIndex = 0;
gDTMF_InputMode = false;
gDTMF_InputIndex = 0;
gAskToSave = false;
gAskToDelete = false;
#ifdef ENABLE_FMRADIO
if (gFmRadioMode &&
gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT)
{
GUI_SelectNextDisplay(DISPLAY_FM);
}
else
#endif
#ifndef ENABLE_CODE_SCAN_TIMEOUT
if (gScreenToDisplay != DISPLAY_SCANNER)
#endif
GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
} }
} }
@@ -1996,7 +2017,7 @@ void CHANNEL_Next(bool bFlag, int8_t Direction)
RADIO_SelectVfos(); RADIO_SelectVfos();
gNextMrChannel = gRxVfo->CHANNEL_SAVE; gNextMrChannel = gRxVfo->CHANNEL_SAVE;
gCurrentScanList = 0; gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gScanState = Direction; gScanState = Direction;
if (IS_MR_CHANNEL(gNextMrChannel)) if (IS_MR_CHANNEL(gNextMrChannel))
@@ -2085,7 +2106,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
else else
{ {
if (Key != KEY_PTT) if (Key != KEY_PTT)
gVoltageMenuCountdown = menu_timeout_500ms; {
gMenuCountdown = menu_timeout_500ms;
}
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
@@ -2328,6 +2351,8 @@ Skip:
if (gFlagAcceptSetting) if (gFlagAcceptSetting)
{ {
gMenuCountdown = menu_timeout_500ms;
MENU_AcceptSetting(); MENU_AcceptSetting();
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
@@ -2435,6 +2460,8 @@ Skip:
if (gFlagRefreshSetting) if (gFlagRefreshSetting)
{ {
gFlagRefreshSetting = false; gFlagRefreshSetting = false;
gMenuCountdown = menu_timeout_500ms;
MENU_ShowCurrentSetting(); MENU_ShowCurrentSetting();
} }

View File

@@ -20,6 +20,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "functions.h" #include "functions.h"
#include "frequencies.h"
#include "radio.h" #include "radio.h"
void APP_EndTransmission(void); void APP_EndTransmission(void);

View File

@@ -387,11 +387,13 @@ void DTMF_Reply(void)
case DTMF_REPLY_NONE: case DTMF_REPLY_NONE:
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOT) gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
{ {
gDTMF_ReplyState = DTMF_REPLY_NONE; gDTMF_ReplyState = DTMF_REPLY_NONE;
return; return;
} }
// send TX-UP DTMF
pString = gEeprom.DTMF_UP_CODE; pString = gEeprom.DTMF_UP_CODE;
break; break;
} }

View File

@@ -358,20 +358,20 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
NUMBER_Get(gInputBox, &Frequency); NUMBER_Get(gInputBox, &Frequency);
// clamp the frequency entered to some valid value // clamp the frequency entered to some valid value
if (Frequency < LowerLimitFrequencyBandTable[0]) if (Frequency < frequencyBandTable[0].lower)
{ {
Frequency = LowerLimitFrequencyBandTable[0]; Frequency = frequencyBandTable[0].lower;
} }
else else
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz) if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
{ {
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2; const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
Frequency = (Frequency < center) ? bx_stop1_Hz : bx_start2_Hz; Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower;
} }
else else
if (Frequency > UpperLimitFrequencyBandTable[6]) if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
{ {
Frequency = UpperLimitFrequencyBandTable[6]; Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
} }
{ {
@@ -395,12 +395,12 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// Frequency += 75; // is this meant to be rounding ? // Frequency += 75; // is this meant to be rounding ?
Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]); Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, frequencyBandTable[gTxVfo->Band].lower);
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz) if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
{ // clamp the frequency to the limit { // clamp the frequency to the limit
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2; const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
Frequency = (Frequency < center) ? bx_stop1_Hz - gTxVfo->StepFrequency : bx_start2_Hz; Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower;
} }
gTxVfo->freq_config_RX.Frequency = Frequency; gTxVfo->freq_config_RX.Frequency = Frequency;
@@ -603,7 +603,6 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
if (bFlag) if (bFlag)
{ {
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
gFlagBackupSetting = true;
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;

View File

@@ -315,14 +315,16 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
*pMax = 16; *pMax = 16;
break; break;
case MENU_F_CALI: #ifdef ENABLE_F_CAL_MENU
*pMin = -50; case MENU_F_CALI:
*pMax = +50; *pMin = -50;
break; *pMax = +50;
break;
#endif
case MENU_BATCAL: case MENU_BATCAL:
*pMin = 1760; // 0 *pMin = 1600; // 0
*pMax = 2000; // 2300 *pMax = 2200; // 2300
break; break;
default: default:
@@ -736,10 +738,11 @@ void MENU_AcceptSetting(void)
gSetting_TX_EN = gSubMenuSelection; gSetting_TX_EN = gSubMenuSelection;
break; break;
case MENU_F_CALI: #ifdef ENABLE_F_CAL_MENU
//if (gF_LOCK) case MENU_F_CALI:
writeXtalFreqCal(gSubMenuSelection); writeXtalFreqCal(gSubMenuSelection);
return; return;
#endif
case MENU_BATCAL: case MENU_BATCAL:
gBatteryCalibration[3] = gSubMenuSelection; gBatteryCalibration[3] = gSubMenuSelection;
@@ -1106,9 +1109,11 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_TX_EN; gSubMenuSelection = gSetting_TX_EN;
break; break;
case MENU_F_CALI: #ifdef ENABLE_F_CAL_MENU
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW; case MENU_F_CALI:
break; gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
break;
#endif
case MENU_BATCAL: case MENU_BATCAL:
gSubMenuSelection = gBatteryCalibration[3]; gSubMenuSelection = gBatteryCalibration[3];
@@ -1117,12 +1122,6 @@ void MENU_ShowCurrentSetting(void)
default: default:
return; return;
} }
// if (gFlagBackupSetting)
{ // save a copy incase the user wants to back out
// gFlagBackupSetting = false;
gSubMenuSelection_original = gSubMenuSelection;
}
} }
static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
@@ -1176,7 +1175,6 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{ {
gMenuCursor = Value - 1; gMenuCursor = Value - 1;
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
gFlagBackupSetting = true;
return; return;
} }
@@ -1192,7 +1190,6 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{ {
gMenuCursor = Value - 1; gMenuCursor = Value - 1;
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
gFlagBackupSetting = true;
return; return;
} }
break; break;
@@ -1301,17 +1298,6 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
{ {
if (gIsInSubMenu) if (gIsInSubMenu)
{ {
// ***********************
// restore original value
if (gMenuCursor == MENU_F_CALI)
{
// if (gF_LOCK)
// writeXtalFreqCal(gSubMenuSelection_original);
}
// ***********************
if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET) if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET)
{ {
gAskForConfirmation = 0; gAskForConfirmation = 0;
@@ -1616,7 +1602,6 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1); gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
gFlagBackupSetting = true;
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;
@@ -1736,6 +1721,19 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
break; break;
} }
if (gScreenToDisplay == DISPLAY_MENU && gMenuCursor == MENU_VOL) if (gScreenToDisplay == DISPLAY_MENU)
gVoltageMenuCountdown = menu_timeout_500ms; {
if (gMenuCursor == MENU_VOL ||
#ifdef ENABLE_F_CAL_MENU
gMenuCursor == MENU_F_CALI ||
#endif
gMenuCursor == MENU_BATCAL)
{
gMenuCountdown = menu_timeout_long_500ms;
}
else
{
gMenuCountdown = menu_timeout_500ms;
}
}
} }

View File

@@ -225,10 +225,17 @@ static void CMD_0514(const uint8_t *pBuffer)
const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer; const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer;
Timestamp = pCmd->Timestamp; Timestamp = pCmd->Timestamp;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown_500ms = fm_radio_countdown_500ms; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif #endif
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
// turn the LCD backlight off
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
SendVersion(); SendVersion();
} }
@@ -241,9 +248,13 @@ static void CMD_051B(const uint8_t *pBuffer)
if (pCmd->Timestamp != Timestamp) if (pCmd->Timestamp != Timestamp)
return; return;
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown_500ms = fm_radio_countdown_500ms; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif #endif
memset(&Reply, 0, sizeof(Reply)); memset(&Reply, 0, sizeof(Reply));
Reply.Header.ID = 0x051C; Reply.Header.ID = 0x051C;
Reply.Header.Size = pCmd->Size + 4; Reply.Header.Size = pCmd->Size + 4;
@@ -269,11 +280,15 @@ static void CMD_051D(const uint8_t *pBuffer)
if (pCmd->Timestamp != Timestamp) if (pCmd->Timestamp != Timestamp)
return; return;
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
bReloadEeprom = false; bReloadEeprom = false;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown_500ms = fm_radio_countdown_500ms; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif #endif
Reply.Header.ID = 0x051E; Reply.Header.ID = 0x051E;
Reply.Header.Size = sizeof(Reply.Data); Reply.Header.Size = sizeof(Reply.Data);
Reply.Data.Offset = pCmd->Offset; Reply.Data.Offset = pCmd->Offset;
@@ -389,8 +404,12 @@ static void CMD_052F(const uint8_t *pBuffer)
if (gCurrentFunction == FUNCTION_POWER_SAVE) if (gCurrentFunction == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_FOREGROUND); FUNCTION_Select(FUNCTION_FOREGROUND);
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
Timestamp = pCmd->Timestamp; Timestamp = pCmd->Timestamp;
// turn the LCD backlight off
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
SendVersion(); SendVersion();

View File

@@ -717,14 +717,14 @@ void BK4819_SetupSquelch(
// //
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000 BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
#if 0 #if 0
// original
(1u << 14) // 1 ??? (1u << 14) // 1 ???
| (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7 | (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7
| (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3 | (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3
| SquelchOpenGlitchThresh); // 0 ~ 255 | SquelchOpenGlitchThresh); // 0 ~ 255
#else #else
// supposedly fast
(1u << 14) // 1 ??? (1u << 14) // 1 ???
| (2u << 11) // squelch = 1 delay .. 0 ~ 7
| (1u << 9) // squelch = 0 delay .. 0 ~ 3
| SquelchOpenGlitchThresh); // 0 ~ 255 | SquelchOpenGlitchThresh); // 0 ~ 255
#endif #endif
@@ -1487,10 +1487,15 @@ void BK4819_PlayRogerMDC(void)
unsigned int i; unsigned int i;
BK4819_SetAF(BK4819_AF_MUTE); BK4819_SetAF(BK4819_AF_MUTE);
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable, RX Bandwidth FFSK1200/1800, 0xAA or 0x55 Preamble, 11 RX Gain,
// 101 RX Mode, FFSK1200/1800 TX BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable,
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone2 to 1200Hz // RX Bandwidth FFSK 1200/1800
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone2 and Set Tone2 Gain // 0xAA or 0x55 Preamble
// 11 RX Gain,
// 101 RX Mode
// TX FFSK 1200/1800
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone-2 to 1200Hz
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone-2 and Set Tone2 Gain
BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes
BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO
BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done) BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done)
@@ -1509,7 +1514,7 @@ void BK4819_PlayRogerMDC(void)
SYSTEM_DelayMs(180); SYSTEM_DelayMs(180);
// Stop FSK TX, reset Tone2, disable FSK // Stop FSK TX, reset Tone-2, disable FSK
BK4819_WriteRegister(BK4819_REG_59, 0x0068); BK4819_WriteRegister(BK4819_REG_59, 0x0068);
BK4819_WriteRegister(BK4819_REG_70, 0x0000); BK4819_WriteRegister(BK4819_REG_70, 0x0000);
BK4819_WriteRegister(BK4819_REG_58, 0x0000); BK4819_WriteRegister(BK4819_REG_58, 0x0000);

Binary file not shown.

Binary file not shown.

View File

@@ -19,52 +19,29 @@
#include "settings.h" #include "settings.h"
// the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz // the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz
const freq_band_table_t BX4819_band1 = { 1800000, 63000000};
const freq_band_table_t BX4819_band2 = {84000000, 130000000};
const uint32_t bx_start1_Hz = 1800000; // 18MHz const freq_band_table_t frequencyBandTable[7] =
const uint32_t bx_stop1_Hz = 63000000; // 630MHz
//const uint32_t bx_start2_Hz = 76000000; // 760MHz // my one radio the BK chip managed to lock down to this frequency
const uint32_t bx_start2_Hz = 84000000; // 840MHz // but best to go with datasheet specification really
const uint32_t bx_stop2_Hz = 130000000; // 1300MHz
const uint32_t LowerLimitFrequencyBandTable[7] =
{ {
#ifndef ENABLE_WIDE_RX #ifndef ENABLE_WIDE_RX
5000000, // QS original
{ 5000000, 7600000},
{10800000, 13600000},
{13600000, 17400000},
{17400000, 35000000},
{35000000, 40000000},
{40000000, 47000000},
{47000000, 60000000}
#else #else
1800000, // extended range
#endif { 1800000, 10800000},
10800000, {10800000, 13600000},
13600000, {13600000, 17400000},
17400000, {17400000, 35000000},
35000000, {35000000, 40000000},
40000000, {40000000, 47000000},
47000000 {47000000, 130000000}
};
const uint32_t MiddleFrequencyBandTable[7] =
{
6500000,
12200000,
15000000,
26000000,
37000000,
43500000,
55000000
};
const uint32_t UpperLimitFrequencyBandTable[7] =
{
7600000,
13599990,
17399990,
34999990,
39999990,
46999990,
#ifndef ENABLE_WIDE_RX
60000000
#else
130000000
#endif #endif
}; };
@@ -84,37 +61,24 @@ const uint32_t UpperLimitFrequencyBandTable[7] =
}; };
#endif #endif
#if 0 #ifndef ENABLE_12_5KHZ_STEP
const uint16_t StepFrequencyTable[7] = // QS steps (*10 Hz)
{ const uint16_t StepFrequencyTable[7] = {250, 500, 625, 1000, 1250, 2500, 833};
250,
500,
625,
1000,
1250,
2500,
833
};
#else #else
const uint16_t StepFrequencyTable[7] = // includes 1.25kHz step
{ const uint16_t StepFrequencyTable[7] = {125, 250, 625, 1000, 1250, 2500, 833};
125,
250,
625,
1000,
1250,
2500,
833
};
#endif #endif
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency) FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
{ {
int band; int band;
for (band = BAND7_470MHz; band >= BAND1_50MHz; band--) for (band = ARRAY_SIZE(frequencyBandTable) - 1; band >= 0; band--)
if (Frequency >= LowerLimitFrequencyBandTable[band]) if (Frequency >= frequencyBandTable[band].lower)
return band; // if (Frequency < frequencyBandTable[band].upper)
return (FREQUENCY_Band_t)band;
return BAND1_50MHz; return BAND1_50MHz;
// return BAND_NONE;
} }
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency) uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
@@ -156,26 +120,16 @@ uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
return Lower + (Step * Index); return Lower + (Step * Index);
} }
/*
int TX_freq_check(VFO_Info_t *pInfo)
{ // return '0' if TX frequency is allowed
// otherwise return '-1'
const uint32_t Frequency = pInfo->pTX->Frequency;
#ifdef ENABLE_NOAA
if (pInfo->CHANNEL_SAVE > FREQ_CHANNEL_LAST)
return -1;
#endif
*/
int TX_freq_check(const uint32_t Frequency) int TX_freq_check(const uint32_t Frequency)
{ // return '0' if TX frequency is allowed { // return '0' if TX frequency is allowed
// otherwise return '-1' // otherwise return '-1'
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6]) if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
return -1; return -1; // not allowed outside this range
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
return -1; if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
return -1; // BX chip does not work in this range
switch (gSetting_F_LOCK) switch (gSetting_F_LOCK)
{ {
@@ -239,9 +193,10 @@ int RX_freq_check(const uint32_t Frequency)
{ // return '0' if RX frequency is allowed { // return '0' if RX frequency is allowed
// otherwise return '-1' // otherwise return '-1'
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6]) if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
return -1; return -1;
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
return -1; return -1;
return 0; // OK frequency return 0; // OK frequency

View File

@@ -19,17 +19,20 @@
#include <stdint.h> #include <stdint.h>
#include "radio.h" #define ENABLE_12_5KHZ_STEP
extern const uint32_t bx_start1_Hz; typedef struct {
extern const uint32_t bx_stop1_Hz; const uint32_t lower;
const uint32_t upper;
} freq_band_table_t;
extern const uint32_t bx_start2_Hz; extern const freq_band_table_t BX4819_band1;
extern const uint32_t bx_stop2_Hz; extern const freq_band_table_t BX4819_band2;
enum FREQUENCY_Band_t extern const freq_band_table_t frequencyBandTable[7];
{
BAND1_NONE = -1, enum FREQUENCY_Band_t {
BAND_NONE = -1,
BAND1_50MHz = 0, BAND1_50MHz = 0,
BAND2_108MHz, BAND2_108MHz,
BAND3_136MHz, BAND3_136MHz,
@@ -38,26 +41,44 @@ enum FREQUENCY_Band_t
BAND6_400MHz, BAND6_400MHz,
BAND7_470MHz BAND7_470MHz
}; };
typedef enum FREQUENCY_Band_t FREQUENCY_Band_t; typedef enum FREQUENCY_Band_t FREQUENCY_Band_t;
extern const uint32_t LowerLimitFrequencyBandTable[7]; #ifndef ENABLE_12_5KHZ_STEP
extern const uint32_t MiddleFrequencyBandTable[7]; // QS steps
extern const uint32_t UpperLimitFrequencyBandTable[7]; enum STEP_Setting_t {
STEP_2_5kHz = 0,
STEP_5_0kHz,
STEP_6_25kHz,
STEP_10_0kHz,
STEP_12_5kHz,
STEP_25_0kHz,
STEP_8_33kHz
};
#else
// includes 1.25kHz step
enum STEP_Setting_t {
STEP_1_25kHz = 0,
STEP_2_5kHz,
STEP_6_25kHz,
STEP_10_0kHz,
STEP_12_5kHz,
STEP_25_0kHz,
STEP_8_33kHz
};
#endif
typedef enum STEP_Setting_t STEP_Setting_t;
extern const uint16_t StepFrequencyTable[7];
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
extern const uint32_t NoaaFrequencyTable[10]; extern const uint32_t NoaaFrequencyTable[10];
#endif #endif
extern const uint16_t StepFrequencyTable[7];
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency); FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency);
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency); uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency);
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower); uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower);
//int TX_freq_check(VFO_Info_t *pInfo);
int TX_freq_check(const uint32_t Frequency); int TX_freq_check(const uint32_t Frequency);
int RX_freq_check(const uint32_t Frequency); int RX_freq_check(const uint32_t Frequency);
#endif #endif

View File

@@ -28,6 +28,7 @@
#include "driver/bk4819.h" #include "driver/bk4819.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "driver/system.h" #include "driver/system.h"
#include "frequencies.h"
#include "functions.h" #include "functions.h"
#include "helper/battery.h" #include "helper/battery.h"
#include "misc.h" #include "misc.h"

View File

@@ -86,37 +86,22 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
gBatteryDisplayLevel = 0; gBatteryDisplayLevel = 0;
if (Voltage >= gBatteryCalibration[5]) if (gBatteryCalibration[5] < Voltage)
gBatteryDisplayLevel = 11;
else
if (Voltage >= ((gBatteryCalibration[4] + gBatteryCalibration[5]) / 2))
gBatteryDisplayLevel = 10;
else
if (Voltage >= gBatteryCalibration[4])
gBatteryDisplayLevel = 9;
else
if (Voltage >= ((gBatteryCalibration[3] + gBatteryCalibration[4]) / 2))
gBatteryDisplayLevel = 8;
else
if (Voltage >= gBatteryCalibration[3])
gBatteryDisplayLevel = 7;
else
if (Voltage >= ((gBatteryCalibration[2] + gBatteryCalibration[3]) / 2))
gBatteryDisplayLevel = 6; gBatteryDisplayLevel = 6;
else else
if (Voltage >= gBatteryCalibration[2]) if (gBatteryCalibration[4] < Voltage)
gBatteryDisplayLevel = 5; gBatteryDisplayLevel = 5;
else else
if (Voltage >= ((gBatteryCalibration[1] + gBatteryCalibration[2]) / 2)) if (gBatteryCalibration[3] < Voltage)
gBatteryDisplayLevel = 4; gBatteryDisplayLevel = 4;
else else
if (Voltage >= gBatteryCalibration[1]) if (gBatteryCalibration[2] < Voltage)
gBatteryDisplayLevel = 3; gBatteryDisplayLevel = 3;
else else
if (Voltage >= ((gBatteryCalibration[0] + gBatteryCalibration[1]) / 2)) if (gBatteryCalibration[1] < Voltage)
gBatteryDisplayLevel = 2; gBatteryDisplayLevel = 2;
else else
if (Voltage >= gBatteryCalibration[0]) if (gBatteryCalibration[0] < Voltage)
gBatteryDisplayLevel = 1; gBatteryDisplayLevel = 1;
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3]; gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];

15
main.c
View File

@@ -110,9 +110,18 @@ void Main(void)
gMenuListCount++; gMenuListCount++;
if (BootMode == BOOT_MODE_F_LOCK) if (BootMode == BOOT_MODE_F_LOCK)
gF_LOCK = true; // flag to say use the hidden menu items {
gF_LOCK = true; // flag to say include the hidden menu items
}
else else
gMenuListCount -= 9; // hide the last few menu items { // hide the hidden menu items
gMenuListCount -= 9;
#ifndef ENABLE_F_CAL_MENU
gMenuListCount++;
#endif
}
// wait for user to release all butts before moving on // wait for user to release all butts before moving on
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
@@ -132,7 +141,7 @@ void Main(void)
gDebounceCounter = 0; gDebounceCounter = 0;
} }
if (!gChargingWithTypeC && !gBatteryDisplayLevel) if (!gChargingWithTypeC && gBatteryDisplayLevel == 0)
{ {
FUNCTION_Select(FUNCTION_POWER_SAVE); FUNCTION_Select(FUNCTION_POWER_SAVE);

21
misc.c
View File

@@ -24,7 +24,8 @@ const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
@@ -51,6 +52,9 @@ const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
@@ -121,6 +125,9 @@ volatile uint16_t gDualWatchCountdown_10ms;
volatile bool gDualWatchCountdownExpired = true; volatile bool gDualWatchCountdownExpired = true;
bool gDualWatchActive = false; bool gDualWatchActive = false;
volatile uint8_t gSerialConfigCountDown_500ms;
volatile bool gSerialConfigCountDown_done;
volatile bool gNextTimeslice_500ms; volatile bool gNextTimeslice_500ms;
volatile uint16_t gTxTimerCountdown_500ms; volatile uint16_t gTxTimerCountdown_500ms;
@@ -152,7 +159,7 @@ bool gUpdateRSSI;
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
AlarmState_t gAlarmState; AlarmState_t gAlarmState;
#endif #endif
uint8_t gVoltageMenuCountdown; uint16_t gMenuCountdown;
bool gPttWasReleased; bool gPttWasReleased;
bool gPttWasPressed; bool gPttWasPressed;
uint8_t gKeypadLocked; uint8_t gKeypadLocked;
@@ -169,7 +176,6 @@ bool gFlagPrepareTX;
bool gFlagAcceptSetting; bool gFlagAcceptSetting;
bool gFlagRefreshSetting; bool gFlagRefreshSetting;
bool gFlagBackupSetting;
bool gFlagSaveVfo; bool gFlagSaveVfo;
bool gFlagSaveSettings; bool gFlagSaveSettings;
@@ -192,10 +198,11 @@ bool gFlagEndTransmission;
uint16_t gLowBatteryCountdown; uint16_t gLowBatteryCountdown;
uint8_t gNextMrChannel; uint8_t gNextMrChannel;
ReceptionMode_t gRxReceptionMode; ReceptionMode_t gRxReceptionMode;
uint8_t gRestoreMrChannel;
uint8_t gCurrentScanList; uint8_t gRestoreMrChannel;
uint8_t gPreviousMrChannel; enum scan_next_chan_t gCurrentScanList;
uint32_t gRestoreFrequency; uint32_t gRestoreFrequency;
bool gRxVfoIsActive; bool gRxVfoIsActive;
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
uint8_t gAlarmToneCounter; uint8_t gAlarmToneCounter;

27
misc.h
View File

@@ -63,7 +63,6 @@ enum AlarmState_t {
ALARM_STATE_ALARM, ALARM_STATE_ALARM,
ALARM_STATE_TX1750 ALARM_STATE_TX1750
}; };
typedef enum AlarmState_t AlarmState_t; typedef enum AlarmState_t AlarmState_t;
enum ReceptionMode_t { enum ReceptionMode_t {
@@ -71,7 +70,6 @@ enum ReceptionMode_t {
RX_MODE_DETECTED, // signal detected RX_MODE_DETECTED, // signal detected
RX_MODE_LISTENING // RX_MODE_LISTENING //
}; };
typedef enum ReceptionMode_t ReceptionMode_t; typedef enum ReceptionMode_t ReceptionMode_t;
enum CssScanMode_t enum CssScanMode_t
@@ -80,9 +78,17 @@ enum CssScanMode_t
CSS_SCAN_MODE_SCANNING, CSS_SCAN_MODE_SCANNING,
CSS_SCAN_MODE_FOUND, CSS_SCAN_MODE_FOUND,
}; };
typedef enum CssScanMode_t CssScanMode_t; typedef enum CssScanMode_t CssScanMode_t;
enum scan_next_chan_t {
SCAN_NEXT_CHAN_SCANLIST1 = 0,
SCAN_NEXT_CHAN_SCANLIST2,
SCAN_NEXT_CHAN_DUAL_WATCH,
SCAN_NEXT_CHAN_MR,
SCAN_NEXT_NUM
};
typedef enum scan_next_chan_t scan_next_chan_t;
extern const uint8_t fm_resume_countdown_500ms; extern const uint8_t fm_resume_countdown_500ms;
extern const uint8_t fm_radio_countdown_500ms; extern const uint8_t fm_radio_countdown_500ms;
extern const uint16_t fm_play_countdown_scan_10ms; extern const uint16_t fm_play_countdown_scan_10ms;
@@ -90,6 +96,7 @@ extern const uint16_t fm_play_countdown_noscan_10ms;
extern const uint16_t fm_restore_countdown_10ms; extern const uint16_t fm_restore_countdown_10ms;
extern const uint8_t menu_timeout_500ms; extern const uint8_t menu_timeout_500ms;
extern const uint16_t menu_timeout_long_500ms;
extern const uint8_t DTMF_RX_live_timeout_500ms; extern const uint8_t DTMF_RX_live_timeout_500ms;
extern const uint8_t DTMF_RX_timeout_500ms; extern const uint8_t DTMF_RX_timeout_500ms;
@@ -127,6 +134,9 @@ extern const uint16_t scan_pause_delay_in_1_10ms;
extern const uint16_t scan_pause_delay_in_2_10ms; extern const uint16_t scan_pause_delay_in_2_10ms;
extern const uint16_t scan_pause_delay_in_3_10ms; extern const uint16_t scan_pause_delay_in_3_10ms;
extern const uint16_t scan_pause_delay_in_4_10ms; extern const uint16_t scan_pause_delay_in_4_10ms;
extern const uint16_t scan_pause_delay_in_5_10ms;
extern const uint16_t scan_pause_delay_in_6_10ms;
extern const uint16_t scan_pause_delay_in_7_10ms;
//extern const uint16_t gMax_bat_v; //extern const uint16_t gMax_bat_v;
//extern const uint16_t gMin_bat_v; //extern const uint16_t gMin_bat_v;
@@ -185,6 +195,9 @@ extern volatile uint16_t gDualWatchCountdown_10ms;
extern volatile bool gDualWatchCountdownExpired; extern volatile bool gDualWatchCountdownExpired;
extern bool gDualWatchActive; extern bool gDualWatchActive;
extern volatile uint8_t gSerialConfigCountDown_500ms;
extern volatile bool gSerialConfigCountDown_done;
extern volatile bool gNextTimeslice_500ms; extern volatile bool gNextTimeslice_500ms;
extern volatile uint16_t gTxTimerCountdown_500ms; extern volatile uint16_t gTxTimerCountdown_500ms;
@@ -216,7 +229,7 @@ extern uint8_t gBatteryVoltageIndex;
extern CssScanMode_t gCssScanMode; extern CssScanMode_t gCssScanMode;
extern bool gUpdateRSSI; extern bool gUpdateRSSI;
extern AlarmState_t gAlarmState; extern AlarmState_t gAlarmState;
extern uint8_t gVoltageMenuCountdown; extern uint16_t gMenuCountdown;
extern bool gPttWasReleased; extern bool gPttWasReleased;
extern bool gPttWasPressed; extern bool gPttWasPressed;
extern bool gFlagReconfigureVfos; extern bool gFlagReconfigureVfos;
@@ -233,7 +246,6 @@ extern bool gFlagPrepareTX;
extern bool gFlagAcceptSetting; // accept menu setting extern bool gFlagAcceptSetting; // accept menu setting
extern bool gFlagRefreshSetting; // refresh menu display extern bool gFlagRefreshSetting; // refresh menu display
extern bool gFlagBackupSetting; // save a copy of the current menu setting
extern bool gFlagSaveVfo; extern bool gFlagSaveVfo;
extern bool gFlagSaveSettings; extern bool gFlagSaveSettings;
@@ -256,10 +268,11 @@ extern bool gFlagEndTransmission;
extern uint16_t gLowBatteryCountdown; extern uint16_t gLowBatteryCountdown;
extern uint8_t gNextMrChannel; extern uint8_t gNextMrChannel;
extern ReceptionMode_t gRxReceptionMode; extern ReceptionMode_t gRxReceptionMode;
extern uint8_t gRestoreMrChannel; extern uint8_t gRestoreMrChannel;
extern uint8_t gCurrentScanList; extern scan_next_chan_t gCurrentScanList;
extern uint8_t gPreviousMrChannel;
extern uint32_t gRestoreFrequency; extern uint32_t gRestoreFrequency;
extern bool gRxVfoIsActive; extern bool gRxVfoIsActive;
extern uint8_t gAlarmToneCounter; extern uint8_t gAlarmToneCounter;
extern uint16_t gAlarmRunningCounter; extern uint16_t gAlarmRunningCounter;

59
radio.c
View File

@@ -122,7 +122,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
pInfo->SCANLIST1_PARTICIPATION = true; pInfo->SCANLIST1_PARTICIPATION = true;
pInfo->SCANLIST2_PARTICIPATION = true; pInfo->SCANLIST2_PARTICIPATION = true;
pInfo->STEP_SETTING = STEP_12_5kHz; pInfo->STEP_SETTING = STEP_12_5kHz;
pInfo->StepFrequency = 2500; pInfo->StepFrequency = StepFrequencyTable[pInfo->STEP_SETTING];
pInfo->CHANNEL_SAVE = ChannelSave; pInfo->CHANNEL_SAVE = ChannelSave;
pInfo->FrequencyReverse = false; pInfo->FrequencyReverse = false;
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW; pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
@@ -210,7 +210,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
Index = Channel - FREQ_CHANNEL_FIRST; Index = Channel - FREQ_CHANNEL_FIRST;
RADIO_InitInfo(pRadio, Channel, LowerLimitFrequencyBandTable[Index]); RADIO_InitInfo(pRadio, Channel, frequencyBandTable[Index].lower);
return; return;
} }
@@ -369,14 +369,14 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
Band = FREQUENCY_GetBand(Frequency); Band = FREQUENCY_GetBand(Frequency);
#endif #endif
if (Frequency < LowerLimitFrequencyBandTable[Band]) if (Frequency < frequencyBandTable[Band].lower)
Frequency = LowerLimitFrequencyBandTable[Band]; Frequency = frequencyBandTable[Band].lower;
else else
if (Frequency > UpperLimitFrequencyBandTable[Band]) if (Frequency > frequencyBandTable[Band + 1].upper)
Frequency = UpperLimitFrequencyBandTable[Band]; Frequency = frequencyBandTable[Band + 1].upper;
else else
if (Channel >= FREQ_CHANNEL_FIRST) if (Channel >= FREQ_CHANNEL_FIRST)
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]); Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, frequencyBandTable[Band].lower);
pRadio->freq_config_RX.Frequency = Frequency; pRadio->freq_config_RX.Frequency = Frequency;
@@ -485,9 +485,9 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
Txp[0], Txp[0],
Txp[1], Txp[1],
Txp[2], Txp[2],
LowerLimitFrequencyBandTable[Band], frequencyBandTable[Band].lower,
MiddleFrequencyBandTable[Band], (frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
UpperLimitFrequencyBandTable[Band], frequencyBandTable[Band].upper,
pInfo->pTX->Frequency); pInfo->pTX->Frequency);
} }
@@ -507,20 +507,11 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
break; break;
} }
#if 0 if (Frequency < frequencyBandTable[0].lower)
// limit to 50MHz to 600MHz Frequency = frequencyBandTable[0].lower;
if (Frequency < 5000000) else
Frequency = 5000000; if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
else Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
if (Frequency > 60000000)
Frequency = 60000000;
#else
if (Frequency < LowerLimitFrequencyBandTable[0])
Frequency = LowerLimitFrequencyBandTable[0];
else
if (Frequency > UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1])
Frequency = UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1];
#endif
pInfo->freq_config_TX.Frequency = Frequency; pInfo->freq_config_TX.Frequency = Frequency;
} }
@@ -575,8 +566,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
case BK4819_FILTER_BW_WIDE: case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW: case BK4819_FILTER_BW_NARROW:
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix); BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
BK4819_SetFilterBandwidth(Bandwidth, false); // BK4819_SetFilterBandwidth(Bandwidth, false);
#else #else
BK4819_SetFilterBandwidth(Bandwidth, false); BK4819_SetFilterBandwidth(Bandwidth, false);
#endif #endif
@@ -807,7 +798,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
void RADIO_SetTxParameters(void) void RADIO_SetTxParameters(void)
{ {
BK4819_FilterBandwidth_t Bandwidth; BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
@@ -815,7 +806,6 @@ void RADIO_SetTxParameters(void)
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false); BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
switch (Bandwidth) switch (Bandwidth)
{ {
default: default:
@@ -823,8 +813,8 @@ void RADIO_SetTxParameters(void)
case BK4819_FILTER_BW_WIDE: case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW: case BK4819_FILTER_BW_NARROW:
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix); BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
BK4819_SetFilterBandwidth(Bandwidth, false); // BK4819_SetFilterBandwidth(Bandwidth, false);
#else #else
BK4819_SetFilterBandwidth(Bandwidth, false); BK4819_SetFilterBandwidth(Bandwidth, false);
#endif #endif
@@ -865,9 +855,7 @@ void RADIO_SetTxParameters(void)
case CODE_TYPE_DIGITAL: case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL: case CODE_TYPE_REVERSE_DIGITAL:
BK4819_SetCDCSSCodeWord( BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code));
DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code)
);
break; break;
} }
} }
@@ -962,8 +950,7 @@ void RADIO_PrepareTX(void)
if (gBatteryDisplayLevel == 0) if (gBatteryDisplayLevel == 0)
State = VFO_STATE_BAT_LOW; // charge your battery ! State = VFO_STATE_BAT_LOW; // charge your battery !
else else
//if (gBatteryDisplayLevel >= 6) if (gBatteryDisplayLevel >= 6)
if (gBatteryDisplayLevel >= 11) // I've increased the battery level bar resolution
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
} }
else else
@@ -1061,7 +1048,7 @@ void RADIO_SendEndOfTransmission(void)
BK4819_PlayRogerMDC(); BK4819_PlayRogerMDC();
if (gDTMF_CallState == DTMF_CALL_STATE_NONE && if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)) (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
{ // end-of-tx { // end-of-tx
if (gEeprom.DTMF_SIDE_TONE) if (gEeprom.DTMF_SIDE_TONE)
{ {

37
radio.h
View File

@@ -21,6 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include "dcs.h" #include "dcs.h"
#include "frequencies.h"
enum { enum {
MR_CH_BAND_MASK = 0x0F << 0, MR_CH_BAND_MASK = 0x0F << 0,
@@ -42,40 +43,13 @@ enum {
}; };
enum PTT_ID_t { enum PTT_ID_t {
PTT_ID_OFF = 0, PTT_ID_OFF = 0, // OFF
PTT_ID_BOT, PTT_ID_TX_UP, // BEGIN OF TX
PTT_ID_EOT, PTT_ID_TX_DOWN, // END OF TX
PTT_ID_BOTH PTT_ID_BOTH // BOTH
}; };
typedef enum PTT_ID_t PTT_ID_t; typedef enum PTT_ID_t PTT_ID_t;
#if 0
enum STEP_Setting_t
{
STEP_2_5kHz,
STEP_5_0kHz,
STEP_6_25kHz,
STEP_10_0kHz,
STEP_12_5kHz,
STEP_25_0kHz,
STEP_8_33kHz
};
#else
enum STEP_Setting_t
{
STEP_1_25kHz,
STEP_2_5kHz,
STEP_6_25kHz,
STEP_10_0kHz,
STEP_12_5kHz,
STEP_25_0kHz,
STEP_8_33kHz
};
#endif
typedef enum STEP_Setting_t STEP_Setting_t;
enum VfoState_t enum VfoState_t
{ {
VFO_STATE_NORMAL = 0, VFO_STATE_NORMAL = 0,
@@ -86,7 +60,6 @@ enum VfoState_t
VFO_STATE_ALARM, VFO_STATE_ALARM,
VFO_STATE_VOLTAGE_HIGH VFO_STATE_VOLTAGE_HIGH
}; };
typedef enum VfoState_t VfoState_t; typedef enum VfoState_t VfoState_t;
typedef struct typedef struct

View File

@@ -57,6 +57,7 @@ void SystickHandler(void)
gNextTimeslice_500ms = true; gNextTimeslice_500ms = true;
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached); DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
DECREMENT_AND_TRIGGER(gSerialConfigCountDown_500ms, gSerialConfigCountDown_done);
} }
if ((gGlobalSysTickCounter & 3) == 0) if ((gGlobalSysTickCounter & 3) == 0)

View File

@@ -20,6 +20,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "frequencies.h"
#include "radio.h" #include "radio.h"
enum POWER_OnDisplayMode_t { enum POWER_OnDisplayMode_t {
@@ -28,7 +29,6 @@ enum POWER_OnDisplayMode_t {
POWER_ON_DISPLAY_MODE_VOLTAGE, POWER_ON_DISPLAY_MODE_VOLTAGE,
POWER_ON_DISPLAY_MODE_NONE POWER_ON_DISPLAY_MODE_NONE
}; };
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t; typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
enum { enum {
@@ -90,7 +90,6 @@ enum {
VOICE_PROMPT_CHINESE, VOICE_PROMPT_CHINESE,
VOICE_PROMPT_ENGLISH VOICE_PROMPT_ENGLISH
}; };
typedef enum VOICE_Prompt_t VOICE_Prompt_t; typedef enum VOICE_Prompt_t VOICE_Prompt_t;
#endif #endif
@@ -98,7 +97,6 @@ enum ALARM_Mode_t {
ALARM_MODE_SITE = 0, ALARM_MODE_SITE = 0,
ALARM_MODE_TONE ALARM_MODE_TONE
}; };
typedef enum ALARM_Mode_t ALARM_Mode_t; typedef enum ALARM_Mode_t ALARM_Mode_t;
enum ROGER_Mode_t { enum ROGER_Mode_t {
@@ -106,7 +104,6 @@ enum ROGER_Mode_t {
ROGER_MODE_ROGER, ROGER_MODE_ROGER,
ROGER_MODE_MDC ROGER_MODE_MDC
}; };
typedef enum ROGER_Mode_t ROGER_Mode_t; typedef enum ROGER_Mode_t ROGER_Mode_t;
enum CHANNEL_DisplayMode_t { enum CHANNEL_DisplayMode_t {
@@ -115,7 +112,6 @@ enum CHANNEL_DisplayMode_t {
MDF_NAME, MDF_NAME,
MDF_NAME_FREQ MDF_NAME_FREQ
}; };
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t; typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
typedef struct { typedef struct {
@@ -226,7 +222,6 @@ typedef struct {
VFO_Info_t VfoInfo[2]; VFO_Info_t VfoInfo[2];
} EEPROM_Config_t; } EEPROM_Config_t;
extern EEPROM_Config_t gEeprom; extern EEPROM_Config_t gEeprom;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO

View File

@@ -36,7 +36,18 @@
#include "ui/main.h" #include "ui/main.h"
#include "ui/ui.h" #include "ui/ui.h"
bool center_line_is_free = true; enum center_line_t {
CENTER_LINE_NONE = 0,
CENTER_LINE_IN_USE,
CENTER_LINE_AUDIO_BAR,
CENTER_LINE_RSSI,
CENTER_LINE_AM_FIX_DATA,
CENTER_LINE_DTMF_DEC,
CENTER_LINE_CHARGE_DATA
};
typedef enum center_line_t center_line_t;
center_line_t center_line = CENTER_LINE_NONE;
// *************************************************************************** // ***************************************************************************
@@ -154,14 +165,14 @@ bool center_line_is_free = true;
if (rssi_dBm >= (s9_dBm + 6)) if (rssi_dBm >= (s9_dBm + 6))
{ // S9+XXdB, 1dB increment { // S9+XXdB, 1dB increment
const char *fmt[] = {"%-4d +%u ", "%-4d +%2u "}; const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
const unsigned int dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99; const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
sprintf(s, (dB < 10) ? fmt[0] : fmt[1], rssi_dBm, dB); sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
} }
else else
{ // S0 ~ S9, 6dB per S-point { // S0 ~ S9, 6dB per S-point
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0; const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
sprintf(s, "%-4d S%u ", rssi_dBm, s_level); sprintf(s, "%4d S%u ", rssi_dBm, s_level);
} }
UI_PrintStringSmall(s, 2, 0, line); UI_PrintStringSmall(s, 2, 0, line);
@@ -184,7 +195,9 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
{ {
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
if (!center_line_is_free) // optional larger RSSI dBm, S-point and bar level
if (center_line != CENTER_LINE_RSSI)
return; return;
if (gCurrentFunction == FUNCTION_RECEIVE || if (gCurrentFunction == FUNCTION_RECEIVE ||
@@ -196,6 +209,8 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
#else #else
// original little RS bars
// const int16_t dBm = (rssi / 2) - 160; // const int16_t dBm = (rssi / 2) - 160;
const uint8_t Line = (vfo == 0) ? 3 : 7; const uint8_t Line = (vfo == 0) ? 3 : 7;
uint8_t *p_line = gFrameBuffer[Line - 1]; uint8_t *p_line = gFrameBuffer[Line - 1];
@@ -290,8 +305,7 @@ void UI_DisplayMain(void)
char String[16]; char String[16];
unsigned int vfo_num; unsigned int vfo_num;
// true if the center screen line is available to use center_line = CENTER_LINE_NONE;
center_line_is_free = true;
// #ifdef SINGLE_VFO_CHAN // #ifdef SINGLE_VFO_CHAN
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false; // const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
@@ -356,7 +370,7 @@ void UI_DisplayMain(void)
{ {
sprintf(String, ">%s", gDTMF_InputBox); sprintf(String, ">%s", gDTMF_InputBox);
center_line_is_free = false; center_line = CENTER_LINE_IN_USE;
} }
UI_PrintString(String, 2, 0, vfo_num * 3, 8); UI_PrintString(String, 2, 0, vfo_num * 3, 8);
@@ -375,11 +389,11 @@ void UI_DisplayMain(void)
} }
else else
{ {
center_line_is_free = false; center_line = CENTER_LINE_IN_USE;
} }
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8); UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
center_line_is_free = false; center_line = CENTER_LINE_IN_USE;
continue; continue;
} }
@@ -483,7 +497,7 @@ void UI_DisplayMain(void)
{ // user entering a frequency { // user entering a frequency
UI_DisplayFrequency(gInputBox, 32, line, true, false); UI_DisplayFrequency(gInputBox, 32, line, true, false);
center_line_is_free = false; // center_line = CENTER_LINE_IN_USE;
} }
else else
{ {
@@ -689,7 +703,7 @@ void UI_DisplayMain(void)
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1); UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
} }
if (center_line_is_free) if (center_line == CENTER_LINE_NONE)
{ // we're free to use the middle line { // we're free to use the middle line
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE || const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
@@ -700,7 +714,7 @@ void UI_DisplayMain(void)
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT) if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
{ {
UI_DisplayAudioBar(); UI_DisplayAudioBar();
center_line_is_free = false; center_line = CENTER_LINE_AUDIO_BAR;
} }
else else
#endif #endif
@@ -710,7 +724,7 @@ void UI_DisplayMain(void)
{ {
AM_fix_print_data(gEeprom.RX_CHANNEL, String); AM_fix_print_data(gEeprom.RX_CHANNEL, String);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false; center_line = CENTER_LINE_AM_FIX_DATA;
} }
else else
#endif #endif
@@ -719,7 +733,7 @@ void UI_DisplayMain(void)
if (rx) if (rx)
{ {
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false); UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
center_line_is_free = false; center_line = CENTER_LINE_RSSI;
} }
else else
#endif #endif
@@ -734,7 +748,7 @@ void UI_DisplayMain(void)
strcpy(String, "DTMF "); strcpy(String, "DTMF ");
strcat(String, gDTMF_RX_live + idx); strcat(String, gDTMF_RX_live + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false; center_line = CENTER_LINE_DTMF_DEC;
} }
#else #else
if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0) if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0)
@@ -744,7 +758,7 @@ void UI_DisplayMain(void)
strcpy(String, "DTMF "); strcpy(String, "DTMF ");
strcat(String, gDTMF_RX + idx); strcat(String, gDTMF_RX + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false; center_line = CENTER_LINE_DTMF_DEC;
} }
#endif #endif
@@ -756,7 +770,7 @@ void UI_DisplayMain(void)
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
BATTERY_VoltsToPercent(gBatteryVoltageAverage)); BATTERY_VoltsToPercent(gBatteryVoltageAverage));
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false; center_line = CENTER_LINE_CHARGE_DATA;
} }
#endif #endif
} }

163
ui/menu.c
View File

@@ -44,22 +44,22 @@ const t_menu_item MenuList[] =
{"SQL", VOICE_ID_SQUELCH, MENU_SQL }, {"SQL", VOICE_ID_SQUELCH, MENU_SQL },
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP }, {"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
{"T-PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP" {"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
{"R-DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS" {"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
{"R-CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS" {"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
{"T-DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS" {"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
{"T-CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS" {"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
{"T-DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D" {"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
{"T-OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET" {"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
{"T-VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX" {"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
{"T-TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT" {"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N }, {"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR" {"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL" {"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
{"CH-SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH" {"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
{"CH-DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH" {"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH-NAM", VOICE_ID_INVALID, MENU_MEM_NAME }, {"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH-DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF" {"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE" {"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
{"VOX", VOICE_ID_VOX, MENU_VOX }, {"VOX", VOICE_ID_VOX, MENU_VOX },
{"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR" {"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
@@ -68,12 +68,12 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE }, {"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif #endif
{"SC-REV", VOICE_ID_INVALID, MENU_SC_REV }, {"SC REV", VOICE_ID_INVALID, MENU_SC_REV },
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk" {"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
{"S-ADD1", VOICE_ID_INVALID, MENU_S_ADD1 }, {"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S-ADD2", VOICE_ID_INVALID, MENU_S_ADD2 }, {"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE }, {"STE", VOICE_ID_INVALID, MENU_STE },
{"RP-STE", VOICE_ID_INVALID, MENU_RP_STE }, {"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
{"MIC", VOICE_ID_INVALID, MENU_MIC }, {"MIC", VOICE_ID_INVALID, MENU_MIC },
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR }, {"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
@@ -81,34 +81,34 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_COMPANDER #ifdef ENABLE_COMPANDER
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND }, {"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
#endif #endif
{"1-CALL", VOICE_ID_INVALID, MENU_1_CALL }, {"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST }, {"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 }, {"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 }, {"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD }, {"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
#endif #endif
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID }, {"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE }, {"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE }, {"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID }, {"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D-ST", VOICE_ID_INVALID, MENU_D_ST }, {"D ST", VOICE_ID_INVALID, MENU_D_ST },
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP }, {"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD }, {"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE }, {"D PRE", VOICE_ID_INVALID, MENU_D_PRE },
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD }, {"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST }, {"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder {"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG }, {"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
{"ROGER", VOICE_ID_INVALID, MENU_ROGER }, {"ROGER", VOICE_ID_INVALID, MENU_ROGER },
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL" {"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT }, {"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM" {"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
{"AM-FIX", VOICE_ID_INVALID, MENU_AM_FIX }, {"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
#endif #endif
#ifdef ENABLE_AM_FIX_TEST1 #ifdef ENABLE_AM_FIX_TEST1
{"AM-FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1}, {"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
#endif #endif
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S }, {"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
@@ -118,15 +118,17 @@ const t_menu_item MenuList[] =
// hidden menu items from here on // hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on // enabled if pressing both the PTT and upper side button at power-on
{"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK }, {"F LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
{"TX-200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX" {"TX 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
{"TX-350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX" {"TX 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"TX-500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX" {"TX 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350-EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN" {"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"SCR-EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN" {"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX {"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration #ifdef ENABLE_F_CAL_MENU
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
#endif
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration {"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this {"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
@@ -207,9 +209,6 @@ const char gSubMenu_XB[3][10] =
const char gSubMenu_SC_REV[3][13] = const char gSubMenu_SC_REV[3][13] =
{ {
// "TIME\nOPER",
// "CARRIER\nOPER",
// "SEARCH\nOPER"
"TIME", "TIME",
"CARRIER", "CARRIER",
"SEARCH" "SEARCH"
@@ -231,9 +230,9 @@ const char gSubMenu_MDF[4][15] =
}; };
#endif #endif
const char gSubMenu_D_RSP[4][6] = const char gSubMenu_D_RSP[4][11] =
{ {
"NULL", "DO\nNOTHING",
"RING", "RING",
"REPLY", "REPLY",
"BOTH" "BOTH"
@@ -255,11 +254,11 @@ const char gSubMenu_PONMSG[4][8] =
"NONE" "NONE"
}; };
const char gSubMenu_ROGER[3][6] = const char gSubMenu_ROGER[3][9] =
{ {
"OFF", "OFF",
"ROGER", "ROGER",
"MDC" "MDC\n1200"
}; };
const char gSubMenu_RESET[2][4] = const char gSubMenu_RESET[2][4] =
@@ -336,10 +335,9 @@ bool gIsInSubMenu;
uint8_t gMenuCursor; uint8_t gMenuCursor;
int8_t gMenuScrollDirection; int8_t gMenuScrollDirection;
int32_t gSubMenuSelection; int32_t gSubMenuSelection;
int32_t gSubMenuSelection_original = 0; // copy of the original value
// edit box // edit box
char edit_original[17] = {0}; // a copy of the text before editing so that we can easily test for changes/difference char edit_original[17]; // a copy of the text before editing so that we can easily test for changes/difference
char edit[17]; char edit[17];
int edit_index; int edit_index;
@@ -349,21 +347,21 @@ void UI_DisplayMenu(void)
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2; const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
const unsigned int menu_item_x2 = LCD_WIDTH - 1; const unsigned int menu_item_x2 = LCD_WIDTH - 1;
unsigned int i; unsigned int i;
char String[64]; char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
char Contact[16]; char Contact[16];
// clear the screen // clear the screen buffer
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
// draw the left menu list
#if 0 #if 0
// original menu layout
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (gMenuCursor > 0 || i > 0) if (gMenuCursor > 0 || i > 0)
if ((gMenuListCount - 1) != gMenuCursor || i != 2) if ((gMenuListCount - 1) != gMenuCursor || i != 2)
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8); UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
// invert the current menu list item text pixels // invert the current menu list item pixels
for (i = 0; i < (8 * menu_list_width); i++) for (i = 0; i < (8 * menu_list_width); i++)
{ {
gFrameBuffer[2][i] ^= 0xFF; gFrameBuffer[2][i] ^= 0xFF;
@@ -374,7 +372,7 @@ void UI_DisplayMenu(void)
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA; gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
// draw the little triangle marker if we're in the sub-menu // draw the little sub-menu triangle marker
if (gIsInSubMenu) if (gIsInSubMenu)
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator)); memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
@@ -383,14 +381,15 @@ void UI_DisplayMenu(void)
UI_PrintStringSmall(String, 2, 0, 6); UI_PrintStringSmall(String, 2, 0, 6);
#else #else
{ { // new menu layout .. experimental & unfinished
const int menu_index = gMenuCursor; // current selected menu item const int menu_index = gMenuCursor; // current selected menu item
i = 1; i = 1;
if (!gIsInSubMenu) if (!gIsInSubMenu)
{ {
while (i < 2) while (i < 2)
{ // leading menu items { // leading menu items - small text
const int k = menu_index + i - 2; const int k = menu_index + i - 2;
if (k < 0) if (k < 0)
UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
@@ -400,13 +399,13 @@ void UI_DisplayMenu(void)
i++; i++;
} }
// current menu item // current menu item - keep big n fat
if (menu_index >= 0 && menu_index < (int)gMenuListCount) if (menu_index >= 0 && menu_index < (int)gMenuListCount)
UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8); UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8);
i++; i++;
while (i < 4) while (i < 4)
{ // trailing menu item { // trailing menu item - small text
const int k = menu_index + i - 2; const int k = menu_index + i - 2;
if (k >= 0 && k < (int)gMenuListCount) if (k >= 0 && k < (int)gMenuListCount)
UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i); UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i);
@@ -457,7 +456,7 @@ void UI_DisplayMenu(void)
#endif #endif
case MENU_STEP: case MENU_STEP:
sprintf(String, "%d.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100); sprintf(String, "%d.%02ukHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
break; break;
case MENU_TXP: case MENU_TXP:
@@ -589,7 +588,6 @@ void UI_DisplayMenu(void)
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection); const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000); sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
} }
already_printed = true; already_printed = true;
@@ -619,7 +617,6 @@ void UI_DisplayMenu(void)
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
// UI_PrintStringSmall("^", menu_item_x1 + (8 * edit_index), 0, 4);
} }
if (!gAskForConfirmation) if (!gAskForConfirmation)
@@ -629,7 +626,6 @@ void UI_DisplayMenu(void)
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
else else
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
} }
} }
@@ -746,19 +742,21 @@ void UI_DisplayMenu(void)
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]); strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
break; break;
case MENU_F_CALI: #ifdef ENABLE_F_CAL_MENU
{ case MENU_F_CALI:
const uint32_t value = 22656 + gSubMenuSelection; {
const uint32_t xtal_Hz = (0x4f0000u + value) * 5; const uint32_t value = 22656 + gSubMenuSelection;
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value //gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
BK4819_WriteRegister(BK4819_REG_3B, value); BK4819_WriteRegister(BK4819_REG_3B, value);
sprintf(String, "%d\n%u.%06u\nMHz", sprintf(String, "%d\n%u.%06u\nMHz",
gSubMenuSelection, gSubMenuSelection,
xtal_Hz / 1000000, xtal_Hz % 1000000); xtal_Hz / 1000000, xtal_Hz % 1000000);
} }
break; break;
#endif
case MENU_BATCAL: case MENU_BATCAL:
{ {
@@ -769,9 +767,9 @@ void UI_DisplayMenu(void)
} }
if (!already_printed) if (!already_printed)
{ { // we now do multi-line text in a single string
unsigned int y; unsigned int y;
unsigned int k = 0;
unsigned int lines = 1; unsigned int lines = 1;
unsigned int len = strlen(String); unsigned int len = strlen(String);
bool small = false; bool small = false;
@@ -782,9 +780,9 @@ void UI_DisplayMenu(void)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
if (String[i] == '\n' && i < (len - 1)) if (String[i] == '\n' && i < (len - 1))
{ { // found new line char
lines++; lines++;
String[i] = 0; String[i] = 0; // null terminate the line
} }
} }
@@ -795,21 +793,28 @@ void UI_DisplayMenu(void)
lines = 7; lines = 7;
} }
// move the 1st line up // center vertically'ish
if (small) if (small)
y = 3 - ((lines + 0) / 2); y = 3 - ((lines + 0) / 2); // untested
else else
y = 2 - ((lines + 0) / 2); y = 2 - ((lines + 0) / 2);
// draw the text lines
for (i = 0; i < len && lines > 0; lines--) for (i = 0; i < len && lines > 0; lines--)
{ {
if (small) if (small)
UI_PrintStringSmall(String + k, menu_item_x1, menu_item_x2, y); UI_PrintStringSmall(String + i, menu_item_x1, menu_item_x2, y);
else else
UI_PrintString(String + k, menu_item_x1, menu_item_x2, y, 8); UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
// look for start of next line
while (i < len && String[i] >= 32) while (i < len && String[i] >= 32)
i++; i++;
k = ++i;
// hop over the null term char(s)
while (i < len && String[i] < 32)
i++;
y += small ? 1 : 2; y += small ? 1 : 2;
} }
} }

View File

@@ -53,9 +53,9 @@ enum
MENU_ABR, MENU_ABR,
MENU_TDR, MENU_TDR,
MENU_BEEP, MENU_BEEP,
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
MENU_VOICE, MENU_VOICE,
#endif #endif
MENU_SC_REV, MENU_SC_REV,
MENU_AUTOLK, MENU_AUTOLK,
MENU_S_ADD1, MENU_S_ADD1,
@@ -63,19 +63,19 @@ enum
MENU_STE, MENU_STE,
MENU_RP_STE, MENU_RP_STE,
MENU_MIC, MENU_MIC,
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
MENU_MIC_BAR, MENU_MIC_BAR,
#endif #endif
#ifdef ENABLE_COMPANDER #ifdef ENABLE_COMPANDER
MENU_COMPAND, MENU_COMPAND,
#endif #endif
MENU_1_CALL, MENU_1_CALL,
MENU_S_LIST, MENU_S_LIST,
MENU_SLIST1, MENU_SLIST1,
MENU_SLIST2, MENU_SLIST2,
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
MENU_AL_MOD, MENU_AL_MOD,
#endif #endif
MENU_ANI_ID, MENU_ANI_ID,
MENU_UPCODE, MENU_UPCODE,
MENU_DWCODE, MENU_DWCODE,
@@ -92,15 +92,15 @@ enum
MENU_VOL, MENU_VOL,
MENU_BAT_TXT, MENU_BAT_TXT,
MENU_AM, MENU_AM,
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
MENU_AM_FIX, MENU_AM_FIX,
#endif #endif
#ifdef ENABLE_AM_FIX_TEST1 #ifdef ENABLE_AM_FIX_TEST1
MENU_AM_FIX_TEST1, MENU_AM_FIX_TEST1,
#endif #endif
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
MENU_NOAA_S, MENU_NOAA_S,
#endif #endif
MENU_RESET, MENU_RESET,
// items after here are normally hidden // items after here are normally hidden
@@ -113,7 +113,9 @@ enum
MENU_SCREN, MENU_SCREN,
MENU_TX_EN, // enable TX MENU_TX_EN, // enable TX
#ifdef ENABLE_F_CAL_MENU
MENU_F_CALI, // reference xtal calibration MENU_F_CALI, // reference xtal calibration
#endif
MENU_BATCAL // battery voltage calibration MENU_BATCAL // battery voltage calibration
}; };
@@ -135,10 +137,10 @@ extern const char gSubMenu_MDF[4][15];
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
extern const char gSubMenu_AL_MOD[2][5]; extern const char gSubMenu_AL_MOD[2][5];
#endif #endif
extern const char gSubMenu_D_RSP[4][6]; extern const char gSubMenu_D_RSP[4][11];
extern const char gSubMenu_PTT_ID[4][7]; extern const char gSubMenu_PTT_ID[4][7];
extern const char gSubMenu_PONMSG[4][8]; extern const char gSubMenu_PONMSG[4][8];
extern const char gSubMenu_ROGER[3][6]; extern const char gSubMenu_ROGER[3][9];
extern const char gSubMenu_RESET[2][4]; extern const char gSubMenu_RESET[2][4];
extern const char gSubMenu_F_LOCK[6][4]; extern const char gSubMenu_F_LOCK[6][4];
extern const char gSubMenu_BACKLIGHT[8][7]; extern const char gSubMenu_BACKLIGHT[8][7];
@@ -157,7 +159,6 @@ extern bool gIsInSubMenu;
extern uint8_t gMenuCursor; extern uint8_t gMenuCursor;
extern int8_t gMenuScrollDirection; extern int8_t gMenuScrollDirection;
extern int32_t gSubMenuSelection; extern int32_t gSubMenuSelection;
extern int32_t gSubMenuSelection_original;
extern char edit_original[17]; extern char edit_original[17];
extern char edit[17]; extern char edit[17];

View File

@@ -187,54 +187,35 @@ void UI_DisplayStatus(const bool test_display)
x += sizeof(BITMAP_USB_C); x += sizeof(BITMAP_USB_C);
// BATTERY LEVEL indicator // BATTERY LEVEL indicator
#if 1
if (gBatteryDisplayLevel >= 2 && !gLowBattery) if (gBatteryDisplayLevel >= 2 && !gLowBattery)
{ {
line += x; line += x;
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1)); memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
#ifndef ENABLE_REVERSE_BAT_SYMBOL #ifndef ENABLE_REVERSE_BAT_SYMBOL
line += sizeof(BITMAP_BatteryLevel1); line += sizeof(BITMAP_BatteryLevel1);
if (gBatteryDisplayLevel >= 2) if (gBatteryDisplayLevel >= 2)
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 5) if (gBatteryDisplayLevel >= 3)
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 7) if (gBatteryDisplayLevel >= 4)
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 9) if (gBatteryDisplayLevel >= 5)
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
#else #else
if (gBatteryDisplayLevel >= 2) if (gBatteryDisplayLevel >= 2)
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 5) if (gBatteryDisplayLevel >= 3)
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 7) if (gBatteryDisplayLevel >= 4)
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 9) if (gBatteryDisplayLevel >= 5)
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
#endif #endif
} }
else else
if (gLowBatteryBlink == 1) if (gLowBatteryBlink == 1)
memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1)); memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
#else
// UI_DisplayBattery(gBatteryDisplayLevel);
line += x;
if (gBatteryDisplayLevel > 0)
{
const uint8_t level = (gBatteryDisplayLevel <= 11) ? gBatteryDisplayLevel : 11;
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
#ifdef ENABLE_REVERSE_BAT_SYMBOL
for (uint8_t i = 0; i < level; i++)
line[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
#else
for (uint8_t i = 0; i < level; i++)
line[sizeof(BITMAP_BatteryLevel1) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
#endif
}
else
memset(line, 0, sizeof(BITMAP_BatteryLevel1));
#endif
// ************** // **************