Live DTMF decoder display tidy up

This commit is contained in:
OneOfEleven 2023-09-17 09:54:24 +01:00
parent d1bbe69b91
commit 78c62d5489
21 changed files with 191 additions and 157 deletions

View File

@ -650,28 +650,30 @@ void APP_CheckRadioInterrupts(void)
// fetch the RX'ed char // fetch the RX'ed char
const char c = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code()); const char c = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code());
if (c != 0xff)
gDTMF_RequestPending = true;
gDTMF_RecvTimeout = DTMF_RX_timeout_500ms;
// shift the RX buffer down one - if need be
if (gDTMF_WriteIndex >= sizeof(gDTMF_Received))
memmove(gDTMF_Received, &gDTMF_Received[1], gDTMF_WriteIndex-- - 1);
gDTMF_Received[gDTMF_WriteIndex++] = c;
if (gCurrentFunction == FUNCTION_RECEIVE)
{ {
#ifdef ENABLE_DTMF_DECODER gDTMF_RequestPending = true;
gDTMF_RecvTimeoutSaved = DTMF_RX_timeout_saved_500ms; gDTMF_RecvTimeout = DTMF_RX_timeout_500ms;
size_t len = strlen(gDTMF_ReceivedSaved); // shift the RX buffer down one - if need be
// shift the RX buffer down one if (gDTMF_WriteIndex >= sizeof(gDTMF_Received))
if (len >= (sizeof(gDTMF_ReceivedSaved) - 1)) memmove(gDTMF_Received, &gDTMF_Received[1], gDTMF_WriteIndex-- - 1);
memmove(gDTMF_ReceivedSaved, &gDTMF_ReceivedSaved[1], len--); gDTMF_Received[gDTMF_WriteIndex++] = c;
gDTMF_ReceivedSaved[len++] = c;
gDTMF_ReceivedSaved[len] = '\0'; if (gCurrentFunction == FUNCTION_RECEIVE)
gUpdateDisplay = true; {
#endif #ifdef ENABLE_DTMF_DECODER
gDTMF_RecvTimeoutSaved = DTMF_RX_timeout_saved_500ms;
DTMF_HandleRequest(); size_t len = strlen(gDTMF_ReceivedSaved);
// shift the RX buffer down one - if need be
if (len >= (sizeof(gDTMF_ReceivedSaved) - 1))
memmove(gDTMF_ReceivedSaved, &gDTMF_ReceivedSaved[1], len--);
gDTMF_ReceivedSaved[len++] = c;
gDTMF_ReceivedSaved[len] = '\0';
gUpdateDisplay = true;
#endif
DTMF_HandleRequest();
}
} }
} }
@ -877,7 +879,7 @@ void APP_Update(void)
APP_HandleFunction(); APP_HandleFunction();
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFmRadioCountdown) if (gFmRadioCountdown_500ms > 0)
return; return;
#endif #endif
@ -1253,7 +1255,7 @@ void APP_TimeSlice10ms(void)
// Skipping authentic device checks // Skipping authentic device checks
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFmRadioCountdown > 0) if (gFmRadioCountdown_500ms > 0)
return; return;
#endif #endif
@ -1496,9 +1498,9 @@ void APP_TimeSlice500ms(void)
// Skipped authentic device check // Skipped authentic device check
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFmRadioCountdown > 0) if (gFmRadioCountdown_500ms > 0)
{ {
gFmRadioCountdown--; gFmRadioCountdown_500ms--;
return; return;
} }
#endif #endif
@ -1597,9 +1599,9 @@ void APP_TimeSlice500ms(void)
} }
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (!gPttIsPressed && gFM_ResumeCountdown > 0) if (!gPttIsPressed && gFM_ResumeCountdown_500ms > 0)
{ {
if (--gFM_ResumeCountdown == 0) if (--gFM_ResumeCountdown_500ms == 0)
{ {
RADIO_SetVfoState(VFO_STATE_NORMAL); RADIO_SetVfoState(VFO_STATE_NORMAL);
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_MONITOR && gFmRadioMode) if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_MONITOR && gFmRadioMode)

View File

@ -113,7 +113,7 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
if (j == 3) if (j == 3)
{ {
memcpy(pResult, Contact, 8); memmove(pResult, Contact, 8);
pResult[8] = 0; pResult[8] = 0;
return true; return true;
} }
@ -263,8 +263,8 @@ void DTMF_HandleRequest(void)
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 4, true)) if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 4, true))
{ {
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED; gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
memcpy(gDTMF_Callee, gDTMF_Received + Offset, 3); memmove(gDTMF_Callee, gDTMF_Received + Offset, 3);
memcpy(gDTMF_Caller, gDTMF_Received + Offset + 4, 3); memmove(gDTMF_Caller, gDTMF_Received + Offset + 4, 3);
gUpdateDisplay = true; gUpdateDisplay = true;

View File

@ -38,14 +38,14 @@
uint16_t gFM_Channels[20]; uint16_t gFM_Channels[20];
bool gFmRadioMode; bool gFmRadioMode;
uint8_t gFmRadioCountdown; uint8_t gFmRadioCountdown_500ms;
volatile uint16_t gFmPlayCountdown; volatile uint16_t gFmPlayCountdown_10ms;
volatile int8_t gFM_ScanState; volatile int8_t gFM_ScanState;
bool gFM_AutoScan; bool gFM_AutoScan;
uint8_t gFM_ChannelPosition; uint8_t gFM_ChannelPosition;
bool gFM_FoundFrequency; bool gFM_FoundFrequency;
bool gFM_AutoScan; bool gFM_AutoScan;
uint8_t gFM_ResumeCountdown; uint8_t gFM_ResumeCountdown_500ms;
uint16_t gFM_RestoreCountdown; uint16_t gFM_RestoreCountdown;
bool FM_CheckValidChannel(uint8_t Channel) bool FM_CheckValidChannel(uint8_t Channel)
@ -120,7 +120,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
gEnableSpeaker = false; gEnableSpeaker = false;
gFmPlayCountdown = (gFM_ScanState == FM_SCAN_OFF) ? 120 : 10; gFmPlayCountdown_10ms = (gFM_ScanState == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms : fm_play_countdown_scan_10ms;
gScheduleFM = false; gScheduleFM = false;
gFM_FoundFrequency = false; gFM_FoundFrequency = false;
@ -159,9 +159,9 @@ void FM_PlayAndUpdate(void)
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying); BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
SETTINGS_SaveFM(); SETTINGS_SaveFM();
gFmPlayCountdown = 0; gFmPlayCountdown_10ms = 0;
gScheduleFM = false; gScheduleFM = false;
gAskToSave = false; gAskToSave = false;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
@ -617,8 +617,8 @@ void FM_Play(void)
{ {
if (!gFM_AutoScan) if (!gFM_AutoScan)
{ {
gFmPlayCountdown = 0; gFmPlayCountdown_10ms = 0;
gFM_FoundFrequency = true; gFM_FoundFrequency = true;
if (!gEeprom.FM_IsMrMode) if (!gEeprom.FM_IsMrMode)
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying; gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;

View File

@ -28,34 +28,34 @@ enum {
FM_SCAN_OFF = 0U, FM_SCAN_OFF = 0U,
}; };
extern uint16_t gFM_Channels[20]; extern uint16_t gFM_Channels[20];
extern bool gFmRadioMode; extern bool gFmRadioMode;
extern uint8_t gFmRadioCountdown; extern uint8_t gFmRadioCountdown_500ms;
extern volatile uint16_t gFmPlayCountdown; extern volatile uint16_t gFmPlayCountdown_10ms;
extern volatile int8_t gFM_ScanState; extern volatile int8_t gFM_ScanState;
extern bool gFM_AutoScan; extern bool gFM_AutoScan;
extern uint8_t gFM_ChannelPosition; extern uint8_t gFM_ChannelPosition;
// Doubts about whether this should be signed or not. // Doubts about whether this should be signed or not
extern uint16_t gFM_FrequencyDeviation; extern uint16_t gFM_FrequencyDeviation;
extern bool gFM_FoundFrequency; extern bool gFM_FoundFrequency;
extern bool gFM_AutoScan; extern bool gFM_AutoScan;
extern uint8_t gFM_ResumeCountdown; extern uint8_t gFM_ResumeCountdown_500ms;
extern uint16_t gFM_RestoreCountdown; extern uint16_t gFM_RestoreCountdown;
bool FM_CheckValidChannel(uint8_t Channel); bool FM_CheckValidChannel(uint8_t Channel);
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction); uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction);
int FM_ConfigureChannelState(void); int FM_ConfigureChannelState(void);
void FM_TurnOff(void); void FM_TurnOff(void);
void FM_EraseChannels(void); void FM_EraseChannels(void);
void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag); void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag);
void FM_PlayAndUpdate(void); void FM_PlayAndUpdate(void);
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit); int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit);
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
void FM_Play(void); void FM_Play(void);
void FM_Start(void); void FM_Start(void);
#endif #endif

View File

@ -509,7 +509,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
{ {
gKeyInputCountdown = key_input_timeout_500ms; gKeyInputCountdown = key_input_timeout_500ms;
gDTMF_InputMode = true; gDTMF_InputMode = true;
memcpy(gDTMF_InputBox, gDTMF_String, 15); memmove(gDTMF_InputBox, gDTMF_String, 15);
gDTMF_InputIndex = 0; gDTMF_InputIndex = 0;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
return; return;

View File

@ -616,7 +616,7 @@ void MENU_AcceptSetting(void)
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
gDTMF_InputMode = true; gDTMF_InputMode = true;
gDTMF_InputIndex = 3; gDTMF_InputIndex = 3;
memcpy(gDTMF_InputBox, gDTMF_ID, 4); memmove(gDTMF_InputBox, gDTMF_ID, 4);
gRequestDisplayScreen = DISPLAY_INVALID; gRequestDisplayScreen = DISPLAY_INVALID;
} }
return; return;

View File

@ -223,7 +223,7 @@ static void CMD_0514(const uint8_t *pBuffer)
Timestamp = pCmd->Timestamp; Timestamp = pCmd->Timestamp;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown = 4; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif #endif
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
SendVersion(); SendVersion();
@ -240,7 +240,7 @@ static void CMD_051B(const uint8_t *pBuffer)
} }
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown = 4; 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;
@ -273,7 +273,7 @@ static void CMD_051D(const uint8_t *pBuffer)
bReloadEeprom = false; bReloadEeprom = false;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown = 4; 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);
@ -340,7 +340,7 @@ static void CMD_052D(const uint8_t *pBuffer)
bool bIsLocked; bool bIsLocked;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFmRadioCountdown = 4; gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif #endif
Reply.Header.ID = 0x052E; Reply.Header.ID = 0x052E;
Reply.Header.Size = sizeof(Reply.Data); Reply.Header.Size = sizeof(Reply.Data);
@ -458,11 +458,11 @@ bool UART_IsCommandAvailable(void)
if (TailIndex < Index) if (TailIndex < Index)
{ {
const uint16_t ChunkSize = sizeof(UART_DMA_Buffer) - Index; const uint16_t ChunkSize = sizeof(UART_DMA_Buffer) - Index;
memcpy(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize); memmove(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize);
memcpy(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex); memmove(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex);
} }
else else
memcpy(UART_Command.Buffer, UART_DMA_Buffer + Index, TailIndex - Index); memmove(UART_Command.Buffer, UART_DMA_Buffer + Index, TailIndex - Index);
TailIndex = DMA_INDEX(TailIndex, 2); TailIndex = DMA_INDEX(TailIndex, 2);
if (TailIndex < gUART_WriteIndex) if (TailIndex < gUART_WriteIndex)

32
board.c
View File

@ -609,7 +609,7 @@ void BOARD_EEPROM_Init(void)
// 0E98..0E9F // 0E98..0E9F
EEPROM_ReadBuffer(0x0E98, Data, 8); EEPROM_ReadBuffer(0x0E98, Data, 8);
memcpy(&gEeprom.POWER_ON_PASSWORD, Data, 4); memmove(&gEeprom.POWER_ON_PASSWORD, Data, 4);
// 0EA0..0EA7 // 0EA0..0EA7
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@ -646,38 +646,38 @@ void BOARD_EEPROM_Init(void)
// 0EE0..0EE7 // 0EE0..0EE7
EEPROM_ReadBuffer(0x0EE0, Data, 8); EEPROM_ReadBuffer(0x0EE0, Data, 8);
if (DTMF_ValidateCodes((char *)Data, 8)) if (DTMF_ValidateCodes((char *)Data, 8))
memcpy(gEeprom.ANI_DTMF_ID, Data, 8); memmove(gEeprom.ANI_DTMF_ID, Data, 8);
else else
// Original firmware overflows into the next string // Original firmware overflows into the next string
memcpy(gEeprom.ANI_DTMF_ID, "123\0\0\0\0", 8); memmove(gEeprom.ANI_DTMF_ID, "123\0\0\0\0", 8);
// 0EE8..0EEF // 0EE8..0EEF
EEPROM_ReadBuffer(0x0EE8, Data, 8); EEPROM_ReadBuffer(0x0EE8, Data, 8);
if (DTMF_ValidateCodes((char *)Data, 8)) if (DTMF_ValidateCodes((char *)Data, 8))
memcpy(gEeprom.KILL_CODE, Data, 8); memmove(gEeprom.KILL_CODE, Data, 8);
else else
memcpy(gEeprom.KILL_CODE, "ABCD9\0\0", 8); memmove(gEeprom.KILL_CODE, "ABCD9\0\0", 8);
// 0EF0..0EF7 // 0EF0..0EF7
EEPROM_ReadBuffer(0x0EF0, Data, 8); EEPROM_ReadBuffer(0x0EF0, Data, 8);
if (DTMF_ValidateCodes((char *)Data, 8)) if (DTMF_ValidateCodes((char *)Data, 8))
memcpy(gEeprom.REVIVE_CODE, Data, 8); memmove(gEeprom.REVIVE_CODE, Data, 8);
else else
memcpy(gEeprom.REVIVE_CODE, "9DCBA\0\0", 8); memmove(gEeprom.REVIVE_CODE, "9DCBA\0\0", 8);
// 0EF8..0F07 // 0EF8..0F07
EEPROM_ReadBuffer(0x0EF8, Data, 16); EEPROM_ReadBuffer(0x0EF8, Data, 16);
if (DTMF_ValidateCodes((char *)Data, 16)) if (DTMF_ValidateCodes((char *)Data, 16))
memcpy(gEeprom.DTMF_UP_CODE, Data, 16); memmove(gEeprom.DTMF_UP_CODE, Data, 16);
else else
memcpy(gEeprom.DTMF_UP_CODE, "12345\0\0\0\0\0\0\0\0\0\0", 16); memmove(gEeprom.DTMF_UP_CODE, "12345\0\0\0\0\0\0\0\0\0\0", 16);
// 0F08..0F17 // 0F08..0F17
EEPROM_ReadBuffer(0x0F08, Data, 16); EEPROM_ReadBuffer(0x0F08, Data, 16);
if (DTMF_ValidateCodes((char *)Data, 16)) if (DTMF_ValidateCodes((char *)Data, 16))
memcpy(gEeprom.DTMF_DOWN_CODE, Data, 16); memmove(gEeprom.DTMF_DOWN_CODE, Data, 16);
else else
memcpy(gEeprom.DTMF_DOWN_CODE, "54321\0\0\0\0\0\0\0\0\0\0", 16); memmove(gEeprom.DTMF_DOWN_CODE, "54321\0\0\0\0\0\0\0\0\0\0", 16);
// 0F18..0F1F // 0F18..0F1F
EEPROM_ReadBuffer(0x0F18, Data, 8); EEPROM_ReadBuffer(0x0F18, Data, 8);
@ -728,16 +728,16 @@ void BOARD_EEPROM_LoadMoreSettings(void)
// uint8_t Mic; // uint8_t Mic;
EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8); EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8);
memcpy(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8); memmove(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8);
memcpy(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8); memmove(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8);
memcpy(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8); memmove(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8);
// 3 bands, 4 * 16-bit values per band // 3 bands, 4 * 16-bit values per band
// both my radios are -70dBm, -65dBm, -60dBm, -55dBm (0xB4, 0xBE, 0xC8, 0xD2) // both my radios are -70dBm, -65dBm, -60dBm, -55dBm (0xB4, 0xBE, 0xC8, 0xD2)
// -93, -75, -57, -39 seems to be a better choice (0x86, 0xAA, 0xCE, 0xF2) // -93, -75, -57, -39 seems to be a better choice (0x86, 0xAA, 0xCE, 0xF2)
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8); EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8);
memcpy(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8); memmove(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8);
memcpy(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8); memmove(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8);
EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12); EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12);
if (gBatteryCalibration[0] >= 5000) if (gBatteryCalibration[0] >= 5000)

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -134,11 +134,14 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
case FUNCTION_POWER_SAVE: case FUNCTION_POWER_SAVE:
gBatterySave = gEeprom.BATTERY_SAVE * 10; gBatterySave = gEeprom.BATTERY_SAVE * 10;
gRxIdleMode = true; gRxIdleMode = true;
BK4819_DisableVox(); BK4819_DisableVox();
BK4819_Sleep(); BK4819_Sleep();
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false); BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
gBatterySaveCountdownExpired = false; gBatterySaveCountdownExpired = false;
gUpdateStatus = true; gUpdateStatus = true;
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
return; return;
@ -184,8 +187,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
} }
#endif #endif
if (gCurrentVfo->SCRAMBLING_TYPE && gSetting_ScrambleEnable) if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1U); BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
else else
BK4819_DisableScramble(); BK4819_DisableScramble();

5
misc.c
View File

@ -18,6 +18,11 @@
#include "misc.h" #include "misc.h"
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
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 uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
const uint8_t DTMF_RX_timeout_500ms = 2500 / 500; // 2.5 seconds const uint8_t DTMF_RX_timeout_500ms = 2500 / 500; // 2.5 seconds

7
misc.h
View File

@ -78,6 +78,11 @@ enum CssScanMode_t
typedef enum CssScanMode_t CssScanMode_t; typedef enum CssScanMode_t CssScanMode_t;
extern const uint8_t fm_resume_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_noscan_10ms;
extern const uint8_t menu_timeout_500ms; extern const uint8_t menu_timeout_500ms;
extern const uint8_t DTMF_RX_timeout_500ms; extern const uint8_t DTMF_RX_timeout_500ms;
@ -138,7 +143,7 @@ extern volatile uint16_t gDualWatchCountdown;
extern volatile uint16_t gTxTimerCountdown; extern volatile uint16_t gTxTimerCountdown;
extern volatile uint16_t gTailNoteEliminationCountdown; extern volatile uint16_t gTailNoteEliminationCountdown;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
extern volatile uint16_t gFmPlayCountdown; extern volatile uint16_t gFmPlayCountdown_10ms;
#endif #endif
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
extern volatile uint16_t gNOAA_Countdown; extern volatile uint16_t gNOAA_Countdown;

39
radio.c
View File

@ -645,10 +645,10 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
break; break;
} }
if (gRxVfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable) if (gRxVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
BK4819_DisableScramble();
else
BK4819_EnableScramble(gRxVfo->SCRAMBLING_TYPE - 1); BK4819_EnableScramble(gRxVfo->SCRAMBLING_TYPE - 1);
else
BK4819_DisableScramble();
} }
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@ -688,18 +688,26 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
#endif #endif
#ifndef ENABLE_DTMF_DECODER #ifndef ENABLE_DTMF_DECODER
// there's no reason the DTMF decoder can't be used in AM RX mode too
// aircraft comms use it on HF (AM and SSB)
if (gRxVfo->IsAM || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)) if (gRxVfo->IsAM || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
{ {
BK4819_DisableDTMF(); BK4819_DisableDTMF();
} }
else else
{
BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
}
#else
if (!gSetting_KILLED)
{
BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
}
#endif #endif
{
BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
}
// enable/disable BK4819 interrupts // enable/disable BK4819 selected interrupts
BK4819_WriteRegister(BK4819_REG_3F, InterruptMask); BK4819_WriteRegister(BK4819_REG_3F, InterruptMask);
FUNCTION_Init(); FUNCTION_Init();
@ -765,7 +773,7 @@ void RADIO_SetTxParameters(void)
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH; Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
if (Bandwidth != BK4819_FILTER_BW_WIDE) if (Bandwidth != BK4819_FILTER_BW_WIDE)
Bandwidth = BK4819_FILTER_BW_NARROW; Bandwidth = BK4819_FILTER_BW_NARROW;
BK4819_SetFilterBandwidth(Bandwidth); BK4819_SetFilterBandwidth(Bandwidth);
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency); BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
@ -816,7 +824,7 @@ void RADIO_SetVfoState(VfoState_t State)
VfoState[1] = VFO_STATE_NORMAL; VfoState[1] = VFO_STATE_NORMAL;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFM_ResumeCountdown = 0; gFM_ResumeCountdown_500ms = 0;
#endif #endif
} }
else else
@ -833,7 +841,7 @@ void RADIO_SetVfoState(VfoState_t State)
} }
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
gFM_ResumeCountdown = 5; gFM_ResumeCountdown_500ms = fm_resume_countdown_500ms;
#endif #endif
} }
@ -858,7 +866,9 @@ void RADIO_PrepareTX(void)
RADIO_SelectCurrentVfo(); RADIO_SelectCurrentVfo();
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_OFF || gAlarmState == ALARM_STATE_TX1750 || (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) if (gAlarmState == ALARM_STATE_OFF ||
gAlarmState == ALARM_STATE_TX1750 ||
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
#endif #endif
{ {
VfoState_t State; VfoState_t State;
@ -892,10 +902,9 @@ void RADIO_PrepareTX(void)
gAlarmState = ALARM_STATE_OFF; gAlarmState = ALARM_STATE_OFF;
#endif #endif
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
gDTMF_ReplyState = DTMF_REPLY_NONE; gDTMF_ReplyState = DTMF_REPLY_NONE;
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
return; return;
} }
@ -953,7 +962,9 @@ void RADIO_EnableCxCSS(void)
void RADIO_PrepareCssTX(void) void RADIO_PrepareCssTX(void)
{ {
RADIO_PrepareTX(); RADIO_PrepareTX();
SYSTEM_DelayMs(200); SYSTEM_DelayMs(200);
RADIO_EnableCxCSS(); RADIO_EnableCxCSS();
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
} }

View File

@ -98,7 +98,7 @@ void SystickHandler(void)
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFM_ScanState != FM_SCAN_OFF && gCurrentFunction != FUNCTION_MONITOR) if (gFM_ScanState != FM_SCAN_OFF && gCurrentFunction != FUNCTION_MONITOR)
if (gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE) if (gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
DECREMENT_AND_TRIGGER(gFmPlayCountdown, gScheduleFM); DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
#endif #endif
if (gVoxStopCountdown) if (gVoxStopCountdown)

View File

@ -76,8 +76,8 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
{ {
const unsigned int Index = pString[i] - ' '; const unsigned int Index = pString[i] - ' ';
const unsigned int ofs = (unsigned int)Start + (i * Width); const unsigned int ofs = (unsigned int)Start + (i * Width);
memcpy(gFrameBuffer[Line + 0] + ofs, &gFontBig[Index][0], 8); memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[Index][0], 8);
memcpy(gFrameBuffer[Line + 1] + ofs, &gFontBig[Index][8], 7); memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[Index][8], 7);
} }
} }
} }
@ -99,7 +99,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
{ {
const unsigned int Index = (unsigned int)pString[i] - 32; const unsigned int Index = (unsigned int)pString[i] - 32;
if (Index < ARRAY_SIZE(gFontSmall)) if (Index < ARRAY_SIZE(gFontSmall))
memcpy(pFb + (i * char_spacing), &gFontSmall[Index], char_width); memmove(pFb + (i * char_spacing), &gFontSmall[Index], char_width);
} }
} }
} }
@ -119,8 +119,8 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
if (bDisplayLeadingZero || bCanDisplay || Digit > 0) if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{ {
bCanDisplay = true; bCanDisplay = true;
memcpy(pFb0, gFontBigDigits[Digit], char_width); memmove(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width); memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
} }
else else
if (bFlag) if (bFlag)
@ -141,8 +141,8 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
while (i < 6) while (i < 6)
{ {
const unsigned int Digit = pDigits[i++]; const unsigned int Digit = pDigits[i++];
memcpy(pFb0, gFontBigDigits[Digit], char_width); memmove(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width); memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
pFb0 += char_width; pFb0 += char_width;
pFb1 += char_width; pFb1 += char_width;
} }
@ -162,7 +162,7 @@ void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bD
if (bDisplayLeadingZero || bCanDisplay || Digit > 0) if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{ {
bCanDisplay = true; bCanDisplay = true;
memcpy(pFb, gFontSmallDigits[Digit], char_width); memmove(pFb, gFontSmallDigits[Digit], char_width);
pFb += char_width; pFb += char_width;
} }
} }
@ -178,7 +178,7 @@ void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bD
while (i < 8) while (i < 8)
{ {
const unsigned int Digit = pDigits[i++]; const unsigned int Digit = pDigits[i++];
memcpy(pFb, gFontSmallDigits[Digit], char_width); memmove(pFb, gFontSmallDigits[Digit], char_width);
pFb += char_width; pFb += char_width;
} }
} }
@ -196,7 +196,7 @@ void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x,
display = true; display = true;
if (display && c < ARRAY_SIZE(gFontSmallDigits)) if (display && c < ARRAY_SIZE(gFontSmallDigits))
{ {
memcpy(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width); memmove(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width);
xx += char_width; xx += char_width;
} }
} }

View File

@ -54,6 +54,10 @@ void UI_DisplayMain(void)
const bool single_vfo = false; const bool single_vfo = false;
// #endif // #endif
#ifdef ENABLE_DTMF_DECODER
bool show_dtmf_rx = true;
#endif
for (vfo_num = 0; vfo_num < 2; vfo_num++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
{ {
uint8_t Channel = gEeprom.TX_CHANNEL; uint8_t Channel = gEeprom.TX_CHANNEL;
@ -112,24 +116,28 @@ void UI_DisplayMain(void)
} }
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8); UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
#ifdef ENABLE_DTMF_DECODER
show_dtmf_rx = false;
#endif
continue; continue;
} }
// highlight the selected/used VFO with a marker // highlight the selected/used VFO with a marker
if (!single_vfo && bIsSameVfo) if (!single_vfo && bIsSameVfo)
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memmove(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else else
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); memmove(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
} }
else else
if (!single_vfo) if (!single_vfo)
{ // highlight the selected/used VFO with a marker { // highlight the selected/used VFO with a marker
if (bIsSameVfo) if (bIsSameVfo)
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memmove(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else else
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) //if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); memmove(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
} }
uint32_t SomeValue = 0; uint32_t SomeValue = 0;
@ -167,7 +175,7 @@ void UI_DisplayMain(void)
if (!inputting) if (!inputting)
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
else else
memcpy(String + 5, gInputBox, 3); // show the input text memmove(String + 5, gInputBox, 3); // show the input text
UI_PrintStringSmall("M", x, 0, Line + 1); UI_PrintStringSmall("M", x, 0, Line + 1);
UI_DisplaySmallDigits(3, String + 5, x + 7, Line + 1, inputting); UI_DisplaySmallDigits(3, String + 5, x + 7, Line + 1, inputting);
} }
@ -234,9 +242,9 @@ void UI_DisplayMain(void)
{ // show the scanlist symbols { // show the scanlist symbols
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (Attributes & MR_CH_SCANLIST1) if (Attributes & MR_CH_SCANLIST1)
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList)); memmove(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
if (Attributes & MR_CH_SCANLIST2) if (Attributes & MR_CH_SCANLIST2)
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList)); memmove(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
} }
switch (gEeprom.CHANNEL_DISPLAY_MODE) switch (gEeprom.CHANNEL_DISPLAY_MODE)
@ -270,7 +278,7 @@ void UI_DisplayMain(void)
else else
{ // channel name { // channel name
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 10); memmove(String, gEeprom.VfoInfo[vfo_num].Name, 10);
} }
UI_PrintString(String, 31, 112, Line, 8); UI_PrintString(String, 31, 112, Line, 8);
break; break;
@ -285,7 +293,7 @@ void UI_DisplayMain(void)
else else
{ // channel name { // channel name
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 10); memmove(String, gEeprom.VfoInfo[vfo_num].Name, 10);
} }
UI_PrintStringSmall(String, 31 + 8, 0, Line); UI_PrintStringSmall(String, 31 + 8, 0, Line);
@ -336,18 +344,18 @@ void UI_DisplayMain(void)
if (Level >= 1) if (Level >= 1)
{ {
memcpy(pLine1 + display_width + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); memmove(pLine1 + display_width + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
memcpy(pLine1 + display_width + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); memmove(pLine1 + display_width + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (Level >= 2) if (Level >= 2)
memcpy(pLine1 + display_width + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); memmove(pLine1 + display_width + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (Level >= 3) if (Level >= 3)
memcpy(pLine1 + display_width + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); memmove(pLine1 + display_width + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (Level >= 4) if (Level >= 4)
memcpy(pLine1 + display_width + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); memmove(pLine1 + display_width + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (Level >= 5) if (Level >= 5)
memcpy(pLine1 + display_width + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); memmove(pLine1 + display_width + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (Level >= 6) if (Level >= 6)
memcpy(pLine1 + display_width + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); memmove(pLine1 + display_width + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
} }
} }
@ -404,7 +412,7 @@ void UI_DisplayMain(void)
} }
#ifdef ENABLE_DTMF_DECODER #ifdef ENABLE_DTMF_DECODER
if (gDTMF_ReceivedSaved[0] >= 32) if (show_dtmf_rx && gDTMF_ReceivedSaved[0] >= 32)
{ // show the incoming DTMF live on-screen { // show the incoming DTMF live on-screen
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3); UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
} }

View File

@ -302,7 +302,7 @@ void UI_DisplayMenu(void)
#endif #endif
if (gIsInSubMenu) if (gIsInSubMenu)
memcpy(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator)); memmove(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
@ -523,7 +523,7 @@ void UI_DisplayMenu(void)
if (!gIsDtmfContactValid) if (!gIsDtmfContactValid)
strcpy(String, "NULL"); strcpy(String, "NULL");
else else
memcpy(String, Contact, 8); memmove(String, Contact, 8);
break; break;
case MENU_PONMSG: case MENU_PONMSG:
@ -650,7 +650,7 @@ void UI_DisplayMenu(void)
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid) if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
{ {
Contact[11] = 0; Contact[11] = 0;
memcpy(&gDTMF_ID, Contact + 8, 4); memmove(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%s", Contact + 8); sprintf(String, "ID:%s", Contact + 8);
UI_PrintString(String, 50, 127, 4, 8); UI_PrintString(String, 50, 127, 4, 8);
} }

View File

@ -53,19 +53,19 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
} }
else else
{ {
memcpy(pLine, BITMAP_Antenna, 5); memmove(pLine, BITMAP_Antenna, 5);
if (RssiLevel >= 2) if (RssiLevel >= 2)
memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); memmove(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (RssiLevel >= 3) if (RssiLevel >= 3)
memcpy(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); memmove(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (RssiLevel >= 4) if (RssiLevel >= 4)
memcpy(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); memmove(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (RssiLevel >= 5) if (RssiLevel >= 5)
memcpy(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); memmove(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (RssiLevel >= 6) if (RssiLevel >= 6)
memcpy(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); memmove(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (RssiLevel >= 7) if (RssiLevel >= 7)
memcpy(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
} }
ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode); ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode);

View File

@ -34,11 +34,11 @@ void UI_DisplayStatus(const bool test_display)
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display) if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
memcpy(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave)); memmove(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (gIsNoaaMode || test_display) if (gIsNoaaMode || test_display)
memcpy(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA)); memmove(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
#endif #endif
if (gSetting_KILLED || test_display) if (gSetting_KILLED || test_display)
@ -46,46 +46,46 @@ void UI_DisplayStatus(const bool test_display)
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
else else
if (gFmRadioMode || test_display) if (gFmRadioMode || test_display)
memcpy(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM)); memmove(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
#endif #endif
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display) if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display)
memcpy(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); memmove(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
#endif #endif
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display) if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
memcpy(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR)); memmove(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display) if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
memcpy(gStatusLine + 58, BITMAP_XB, sizeof(BITMAP_XB)); memmove(gStatusLine + 58, BITMAP_XB, sizeof(BITMAP_XB));
if (gEeprom.VOX_SWITCH || test_display) if (gEeprom.VOX_SWITCH || test_display)
memcpy(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX)); memmove(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
if (gEeprom.KEY_LOCK || test_display) if (gEeprom.KEY_LOCK || test_display)
memcpy(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock)); memmove(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
else else
if (gWasFKeyPressed) if (gWasFKeyPressed)
memcpy(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key)); memmove(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key));
if (gChargingWithTypeC || test_display) if (gChargingWithTypeC || test_display)
memcpy(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C)); memmove(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
if (gBatteryDisplayLevel >= 5 || test_display) if (gBatteryDisplayLevel >= 5 || test_display)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5)); memmove(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
else else
if (gBatteryDisplayLevel >= 4) if (gBatteryDisplayLevel >= 4)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4)); memmove(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
else else
if (gBatteryDisplayLevel >= 3) if (gBatteryDisplayLevel >= 3)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3)); memmove(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
else else
if (gBatteryDisplayLevel >= 2) if (gBatteryDisplayLevel >= 2)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2)); memmove(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
else else
if (gLowBatteryBlink == 1) if (gLowBatteryBlink == 1)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1)); memmove(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
ST7565_BlitStatusLine(); ST7565_BlitStatusLine();
} }