This commit is contained in:
2
Makefile
2
Makefile
@@ -9,7 +9,7 @@ ENABLE_UART ?= 1
|
|||||||
ENABLE_AIRCOPY ?= 0
|
ENABLE_AIRCOPY ?= 0
|
||||||
ENABLE_NOAA ?= 0
|
ENABLE_NOAA ?= 0
|
||||||
ENABLE_VOICE ?= 0
|
ENABLE_VOICE ?= 0
|
||||||
ENABLE_VOX ?= 1
|
ENABLE_VOX ?= 0
|
||||||
ENABLE_ALARM ?= 0
|
ENABLE_ALARM ?= 0
|
||||||
ENABLE_TX1750 ?= 1
|
ENABLE_TX1750 ?= 1
|
||||||
ENABLE_PWRON_PASSWORD ?= 0
|
ENABLE_PWRON_PASSWORD ?= 0
|
||||||
|
@@ -440,7 +440,7 @@ static void ACTION_Scan_FM(bool bRestart)
|
|||||||
static void ACTION_AlarmOr1750(const bool b1750)
|
static void ACTION_AlarmOr1750(const bool b1750)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(gEeprom.KEY_LOCK && gEeprom.KEY_LOCK_PTT)
|
if(gEeprom.KEY_LOCK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM)
|
#if defined(ENABLE_ALARM)
|
||||||
|
24
app/app.c
24
app/app.c
@@ -970,13 +970,13 @@ void APP_Update(void) {
|
|||||||
&& gScanStateDir == SCAN_OFF
|
&& gScanStateDir == SCAN_OFF
|
||||||
&& !gPttIsPressed
|
&& !gPttIsPressed
|
||||||
&& gCurrentFunction != FUNCTION_POWER_SAVE
|
&& gCurrentFunction != FUNCTION_POWER_SAVE
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
&& gVoiceWriteIndex == 0
|
&& gVoiceWriteIndex == 0
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
&& !gFmRadioMode
|
&& !gFmRadioMode
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
#ifdef ENABLE_DTMF_CALLING
|
||||||
&& gDTMF_CallState == DTMF_CALL_STATE_NONE
|
&& gDTMF_CallState == DTMF_CALL_STATE_NONE
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@@ -1012,10 +1012,10 @@ void APP_Update(void) {
|
|||||||
|| gScanStateDir != SCAN_OFF
|
|| gScanStateDir != SCAN_OFF
|
||||||
|| gCssBackgroundScan
|
|| gCssBackgroundScan
|
||||||
|| gScreenToDisplay != DISPLAY_MAIN
|
|| gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
|| gFmRadioMode
|
|| gFmRadioMode
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
#ifdef ENABLE_DTMF_CALLING
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
@@ -1395,6 +1395,10 @@ void APP_TimeSlice10ms(void) {
|
|||||||
|
|
||||||
SCANNER_TimeSlice10ms();
|
SCANNER_TimeSlice10ms();
|
||||||
|
|
||||||
|
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||||
|
MSG_FSKReceiveData();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {
|
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {
|
||||||
if (!AIRCOPY_SendMessage()) {
|
if (!AIRCOPY_SendMessage()) {
|
||||||
@@ -1818,8 +1822,8 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
|
|
||||||
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
||||||
|
|
||||||
if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT)
|
if ((gEeprom.KEY_LOCK || lowBatPopup) &&
|
||||||
{ // keyboard is locked or low battery popup
|
gCurrentFunction != FUNCTION_TRANSMIT) { // keyboard is locked or low battery popup
|
||||||
|
|
||||||
// close low battery popup
|
// close low battery popup
|
||||||
if (Key == KEY_EXIT && bKeyPressed && lowBatPopup) {
|
if (Key == KEY_EXIT && bKeyPressed && lowBatPopup) {
|
||||||
|
101
app/fskmodem.c
101
app/fskmodem.c
@@ -98,6 +98,88 @@ void MSG_ConfigureFSK(bool rx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t calculateCRC(uint8_t *data, size_t length) {
|
||||||
|
uint16_t crc = 0xFFFF; // Example CRC-16 initialization
|
||||||
|
for (size_t i = 0; i < length; i++) {
|
||||||
|
crc ^= data[i];
|
||||||
|
for (uint8_t j = 0; j < 8; j++) {
|
||||||
|
if (crc & 1) {
|
||||||
|
crc = (crc >> 1) ^ 0xA001; // Example polynomial (CRC-16-IBM)
|
||||||
|
} else {
|
||||||
|
crc >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void processReceivedPacket(DataPacket *packet) {
|
||||||
|
char String[31 + DataPacketDataSize];
|
||||||
|
char numBuf[11]; // Enough for any 64-bit unsigned integer
|
||||||
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||||
|
: gEeprom.TX_VFO;
|
||||||
|
if (dataPacket.dest == gEeprom.FSKSRCAddress) {
|
||||||
|
BK4819_PlaySingleTone(1000, 250, 127, true);
|
||||||
|
strcpy(String, "SMS by ");
|
||||||
|
itoa(packet->src, numBuf); // Convert number to string
|
||||||
|
strcat(String, numBuf);
|
||||||
|
strcat(String, ": ");
|
||||||
|
strcat(String, (char *)packet->data);
|
||||||
|
|
||||||
|
UI_DisplayPopup(String);
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
|
if (isMainOnly()) {
|
||||||
|
UI_PrintStringSmallNormal(String, 2, 0, 5);
|
||||||
|
} else {
|
||||||
|
UI_PrintStringSmallNormal(String, 2, 0, 3);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
UI_PrintStringSmallNormal(String, 2, 0, 3);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} else if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||||
|
if (packet->ttl--) {
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
MSG_FSKSendData(packet);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(packet, 0, DataPacketDataSize); // Clear data after processing (example action)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool MSG_FSKReceiveData() {
|
||||||
|
if (!(BK4819_ReadRegister(BK4819_REG_0C) & (1U << 1))) {
|
||||||
|
return false; // No data available
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the received data from FIFO
|
||||||
|
uint16_t *ptr = (uint16_t *) &inBoundPacket;
|
||||||
|
size_t wordCount = sizeof(inBoundPacket) / sizeof(uint16_t);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < wordCount; i++) {
|
||||||
|
ptr[i] = BK4819_ReadRegister(BK4819_REG_5F);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the RX interrupt flag
|
||||||
|
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
|
||||||
|
// Validate checksum (assuming last 2 bytes are CRC-16)
|
||||||
|
size_t dataLength = sizeof(inBoundPacket.data) - 2;
|
||||||
|
uint16_t receivedCRC = (inBoundPacket.data[dataLength] << 8) | inBoundPacket.data[dataLength + 1];
|
||||||
|
uint16_t calculatedCRC = calculateCRC(inBoundPacket.data, dataLength);
|
||||||
|
|
||||||
|
if (receivedCRC == calculatedCRC) {
|
||||||
|
processReceivedPacket(&inBoundPacket);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; // CRC check failed
|
||||||
|
}
|
||||||
|
|
||||||
void MSG_EnableRX(const bool enable) {
|
void MSG_EnableRX(const bool enable) {
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
@@ -111,8 +193,14 @@ void MSG_EnableRX(const bool enable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSG_FSKSendData() {
|
void MSG_FSKSendData(DataPacket *dataPacketIn) {
|
||||||
|
|
||||||
|
bool isAudioOn = gEnableSpeaker;
|
||||||
|
if (gEnableSpeaker) {
|
||||||
|
AUDIO_AudioPathOff();
|
||||||
|
BK4819_EnterTxMute();
|
||||||
|
gEnableSpeaker = false;
|
||||||
|
}
|
||||||
// turn off CTCSS/CDCSS during FFSK
|
// turn off CTCSS/CDCSS during FFSK
|
||||||
const uint16_t css_val = BK4819_ReadRegister(BK4819_REG_51);
|
const uint16_t css_val = BK4819_ReadRegister(BK4819_REG_51);
|
||||||
BK4819_WriteRegister(BK4819_REG_51, 0);
|
BK4819_WriteRegister(BK4819_REG_51, 0);
|
||||||
@@ -163,8 +251,8 @@ void MSG_FSKSendData() {
|
|||||||
SYSTEM_DelayMs(100);
|
SYSTEM_DelayMs(100);
|
||||||
|
|
||||||
{ // load the entire packet data into the TX FIFO buffer
|
{ // load the entire packet data into the TX FIFO buffer
|
||||||
uint16_t *ptr = (uint16_t *) &dataPacket;
|
uint16_t *ptr = (uint16_t *) dataPacketIn;
|
||||||
size_t wordCount = sizeof(dataPacket) / sizeof(uint16_t);
|
size_t wordCount = sizeof(*dataPacketIn) / sizeof(uint16_t);
|
||||||
|
|
||||||
for (size_t i = 0; i < wordCount; i++) {
|
for (size_t i = 0; i < wordCount; i++) {
|
||||||
BK4819_WriteRegister(BK4819_REG_5F, ptr[i]);
|
BK4819_WriteRegister(BK4819_REG_5F, ptr[i]);
|
||||||
@@ -211,9 +299,16 @@ void MSG_FSKSendData() {
|
|||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
gFlagEndTransmission = false;
|
gFlagEndTransmission = false;
|
||||||
|
|
||||||
|
if (isAudioOn) {
|
||||||
|
AUDIO_AudioPathOn();
|
||||||
|
gEnableSpeaker = true;
|
||||||
|
BK4819_ExitTxMute();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepareDataPacket() {
|
void prepareDataPacket() {
|
||||||
dataPacket.src = gEeprom.FSKSRCAddress;
|
dataPacket.src = gEeprom.FSKSRCAddress;
|
||||||
dataPacket.seq = seq++;
|
dataPacket.seq = seq++;
|
||||||
|
dataPacket.ttl = 20;
|
||||||
}
|
}
|
@@ -14,6 +14,11 @@
|
|||||||
#include "../driver/system.h"
|
#include "../driver/system.h"
|
||||||
#include "../misc.h"
|
#include "../misc.h"
|
||||||
#include "../app/app.h"
|
#include "../app/app.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "../audio.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "../ui/helper.h"
|
||||||
|
#include "../ui/main.h"
|
||||||
|
|
||||||
// REG_70 bit definitions
|
// REG_70 bit definitions
|
||||||
#define TONE1_ENABLE_BIT (1U << 15)
|
#define TONE1_ENABLE_BIT (1U << 15)
|
||||||
@@ -73,22 +78,27 @@
|
|||||||
#define FSK_CRC_ON (1U << 6)
|
#define FSK_CRC_ON (1U << 6)
|
||||||
#define FSK_CRC_OFF (0U << 6)
|
#define FSK_CRC_OFF (0U << 6)
|
||||||
|
|
||||||
#define DataPacketDataSize (36)
|
#define DataPacketDataSize (35)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t dest;
|
uint32_t dest;
|
||||||
uint32_t src;
|
uint32_t src;
|
||||||
uint8_t seq;
|
uint8_t seq;
|
||||||
|
uint8_t ttl;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
uint8_t data[DataPacketDataSize];
|
uint8_t data[DataPacketDataSize];
|
||||||
} DataPacket;
|
} DataPacket;
|
||||||
|
|
||||||
void prepareDataPacket();
|
void prepareDataPacket();
|
||||||
|
|
||||||
void MSG_FSKSendData();
|
void MSG_FSKSendData(DataPacket *dataPacketIn);
|
||||||
|
|
||||||
void MSG_EnableRX(bool enable);
|
void MSG_EnableRX(bool enable);
|
||||||
|
|
||||||
|
void processReceivedPacket(DataPacket *packet);
|
||||||
|
uint16_t calculateCRC(uint8_t *data, size_t length);
|
||||||
|
bool MSG_FSKReceiveData();
|
||||||
|
|
||||||
extern DataPacket dataPacket;
|
extern DataPacket dataPacket;
|
||||||
|
|
||||||
extern DataPacket inBoundPacket;
|
extern DataPacket inBoundPacket;
|
||||||
|
@@ -968,19 +968,15 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||||
: gEeprom.TX_VFO;
|
: gEeprom.TX_VFO;
|
||||||
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||||
AUDIO_AudioPathOff();
|
|
||||||
gEnableSpeaker = false;
|
|
||||||
RADIO_PrepareTX();
|
RADIO_PrepareTX();
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||||
else
|
else
|
||||||
BK4819_DisableScramble();
|
BK4819_DisableScramble();
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
MSG_FSKSendData();
|
MSG_FSKSendData(&dataPacket);
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
AUDIO_AudioPathOn();
|
|
||||||
gEnableSpeaker = true;
|
|
||||||
BK4819_ExitTxMute();
|
|
||||||
MSG_EnableRX(true);
|
MSG_EnableRX(true);
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
dataPTR = dataPacket.data;
|
dataPTR = dataPacket.data;
|
||||||
|
22
app/menu.c
22
app/menu.c
@@ -390,12 +390,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
*pMin = 1;
|
|
||||||
*pMax = 15;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
@@ -855,17 +849,9 @@ void MENU_AcceptSetting(void) {
|
|||||||
case MENU_SET_EOT:
|
case MENU_SET_EOT:
|
||||||
gSetting_set_eot = gSubMenuSelection;
|
gSetting_set_eot = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
gSetting_set_ctr = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
gSetting_set_inv = gSubMenuSelection;
|
gSetting_set_inv = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_LCK:
|
|
||||||
gSetting_set_lck = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||||
case MENU_SET_NFM:
|
case MENU_SET_NFM:
|
||||||
gSetting_set_nfm = gSubMenuSelection;
|
gSetting_set_nfm = gSubMenuSelection;
|
||||||
@@ -1262,17 +1248,9 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
case MENU_SET_EOT:
|
case MENU_SET_EOT:
|
||||||
gSubMenuSelection = gSetting_set_eot;
|
gSubMenuSelection = gSetting_set_eot;
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
gSubMenuSelection = gSetting_set_ctr;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
gSubMenuSelection = gSetting_set_inv;
|
gSubMenuSelection = gSetting_set_inv;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_LCK:
|
|
||||||
gSubMenuSelection = gSetting_set_lck;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||||
case MENU_SET_NFM:
|
case MENU_SET_NFM:
|
||||||
gSubMenuSelection = gSetting_set_nfm;
|
gSubMenuSelection = gSetting_set_nfm;
|
||||||
|
@@ -856,7 +856,7 @@ static void ShowChannelName(uint32_t f) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void DrawF(uint32_t f) {
|
static void DrawF(uint32_t f) {
|
||||||
sprintf(String, "%u.%05u", f / 100000, f % 100000);
|
sprintf(String, "%lu.%05lu", f / 100000, f % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
||||||
|
|
||||||
sprintf(String, "%3s", gModulationStr[settings.modulationType]);
|
sprintf(String, "%3s", gModulationStr[settings.modulationType]);
|
||||||
@@ -879,19 +879,19 @@ static void DrawNums() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsCenterMode()) {
|
if (IsCenterMode()) {
|
||||||
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
|
sprintf(String, "%lu.%05lu \x7F%lu.%02luk", currentFreq / 100000,
|
||||||
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 36, 39, false, true);
|
GUI_DisplaySmallest(String, 36, 39, false, true);
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
sprintf(String, "%lu.%05lu", GetFStart() / 100000, GetFStart() % 100000);
|
||||||
GUI_DisplaySmallest(String, 0, 49, false, true);
|
GUI_DisplaySmallest(String, 0, 49, false, true);
|
||||||
|
|
||||||
sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100,
|
sprintf(String, "\x7F%lu.%02luk", settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 48, 10, false, true);
|
GUI_DisplaySmallest(String, 48, 10, false, true);
|
||||||
|
|
||||||
sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000);
|
sprintf(String, "%lu.%05lu", GetFEnd() / 100000, GetFEnd() % 100000);
|
||||||
GUI_DisplaySmallest(String, 93, 49, false, true);
|
GUI_DisplaySmallest(String, 93, 49, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -202,7 +202,7 @@ uint8_t cmds[] = {
|
|||||||
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
|
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
ST7565_WriteByte(21 + gSetting_set_ctr);
|
ST7565_WriteByte(21 + ST7565_CTR_SETTING_VAL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ST7565_WriteByte(cmds[i]);
|
ST7565_WriteByte(cmds[i]);
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
extern uint8_t gStatusLine[LCD_WIDTH];
|
extern uint8_t gStatusLine[LCD_WIDTH];
|
||||||
extern uint8_t gFrameBuffer[FRAME_LINES][LCD_WIDTH];
|
extern uint8_t gFrameBuffer[FRAME_LINES][LCD_WIDTH];
|
||||||
|
|
||||||
|
#define ST7565_CTR_SETTING_VAL (15)
|
||||||
|
|
||||||
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const uint8_t *pBitmap, const unsigned int Size);
|
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const uint8_t *pBitmap, const unsigned int Size);
|
||||||
void ST7565_BlitFullScreen(void);
|
void ST7565_BlitFullScreen(void);
|
||||||
void ST7565_BlitLine(unsigned line);
|
void ST7565_BlitLine(unsigned line);
|
||||||
|
2
misc.c
2
misc.c
@@ -112,10 +112,8 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
bool gSetting_set_ptt = 0;
|
bool gSetting_set_ptt = 0;
|
||||||
uint8_t gSetting_set_tot = 0;
|
uint8_t gSetting_set_tot = 0;
|
||||||
uint8_t gSetting_set_ctr = 10;
|
|
||||||
bool gSetting_set_inv = false;
|
bool gSetting_set_inv = false;
|
||||||
uint8_t gSetting_set_eot = 0;
|
uint8_t gSetting_set_eot = 0;
|
||||||
bool gSetting_set_lck = false;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||||
bool gSetting_set_nfm = 0;
|
bool gSetting_set_nfm = 0;
|
||||||
#endif
|
#endif
|
||||||
|
2
misc.h
2
misc.h
@@ -165,10 +165,8 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
extern bool gSetting_set_ptt;
|
extern bool gSetting_set_ptt;
|
||||||
extern uint8_t gSetting_set_tot;
|
extern uint8_t gSetting_set_tot;
|
||||||
extern uint8_t gSetting_set_ctr;
|
|
||||||
extern bool gSetting_set_inv;
|
extern bool gSetting_set_inv;
|
||||||
extern uint8_t gSetting_set_eot;
|
extern uint8_t gSetting_set_eot;
|
||||||
extern bool gSetting_set_lck;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||||
extern bool gSetting_set_nfm;
|
extern bool gSetting_set_nfm;
|
||||||
#endif
|
#endif
|
||||||
|
19
settings.c
19
settings.c
@@ -338,8 +338,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
int tmp = ((Data[5] & 0xF0) >> 4);
|
int tmp = ((Data[5] & 0xF0) >> 4);
|
||||||
|
|
||||||
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
||||||
gSetting_set_lck = (((tmp >> 1) & 0x01) < 2) ? ((tmp >> 1) & 0x01): 0;
|
|
||||||
gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10;
|
|
||||||
|
|
||||||
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
||||||
*/
|
*/
|
||||||
@@ -351,14 +349,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
#else
|
#else
|
||||||
gSetting_set_inv = 0;
|
gSetting_set_inv = 0;
|
||||||
#endif
|
#endif
|
||||||
gSetting_set_lck = (tmp >> 1) & 0x01;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
int ctr_value = Data[5] & 0x0F;
|
|
||||||
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
|
|
||||||
#else
|
|
||||||
gSetting_set_ctr = 10;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gSetting_set_tmr = Data[4] & 0x01;
|
gSetting_set_tmr = Data[4] & 0x01;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -371,7 +361,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
|
|
||||||
// And set special session settings for actions
|
// And set special session settings for actions
|
||||||
gSetting_set_ptt_session = gSetting_set_ptt;
|
gSetting_set_ptt_session = gSetting_set_ptt;
|
||||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,8 +752,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
|
|
||||||
if(gSetting_set_inv == 1)
|
if(gSetting_set_inv == 1)
|
||||||
tmp = tmp | (1 << 0);
|
tmp = tmp | (1 << 0);
|
||||||
if (gSetting_set_lck == 1)
|
|
||||||
tmp = tmp | (1 << 1);
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -773,13 +760,11 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = (gSetting_set_inv << 0) |
|
tmp = (gSetting_set_inv << 0);
|
||||||
(gSetting_set_lck << 1);
|
|
||||||
|
|
||||||
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
|
State[5] = (tmp << 4);
|
||||||
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
|
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
|
||||||
State[7] = gSetting_set_ptt & 0x0F;
|
State[7] = gSetting_set_ptt & 0x0F;
|
||||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x1FF0, State);
|
EEPROM_WriteBuffer(0x1FF0, State);
|
||||||
#endif
|
#endif
|
||||||
|
25
ui/helper.c
25
ui/helper.c
@@ -110,6 +110,31 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
|||||||
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font, inv);
|
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font, inv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void itoa(unsigned long num, char *str) {
|
||||||
|
char buf[20]; // Enough to store any 32-bit or 64-bit unsigned number
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
// Handle 0 explicitly
|
||||||
|
if (num == 0) {
|
||||||
|
str[i++] = '0';
|
||||||
|
str[i] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert number to string in reverse order
|
||||||
|
while (num > 0) {
|
||||||
|
buf[i++] = (num % 10) + '0'; // Get last digit and convert to ASCII
|
||||||
|
num /= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse the string
|
||||||
|
int j = 0;
|
||||||
|
while (i > 0) {
|
||||||
|
str[j++] = buf[--i];
|
||||||
|
}
|
||||||
|
str[j] = '\0'; // Null-terminate the string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
||||||
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
|
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
|
||||||
|
@@ -41,7 +41,7 @@ void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black
|
|||||||
#endif
|
#endif
|
||||||
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
||||||
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
||||||
|
void itoa(unsigned long num, char *str);
|
||||||
void UI_DisplayClear();
|
void UI_DisplayClear();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
26
ui/main.c
26
ui/main.c
@@ -59,7 +59,7 @@ static uint32_t RxOnVfofrequency;
|
|||||||
|
|
||||||
bool isMainOnlyInputDTMF = false;
|
bool isMainOnlyInputDTMF = false;
|
||||||
|
|
||||||
static bool isMainOnly() {
|
bool isMainOnly() {
|
||||||
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
|
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ void DisplayRSSIBar(const bool now) {
|
|||||||
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(str, "% 4d %2d", -rssi_dBm, overS9dBm);
|
sprintf(str, "% 4d %2ld", -rssi_dBm, overS9dBm);
|
||||||
memcpy(p_line + 2 + 7*5, &plus, ARRAY_SIZE(plus));
|
memcpy(p_line + 2 + 7*5, &plus, ARRAY_SIZE(plus));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ void UI_MAIN_PrintAGC(bool now)
|
|||||||
int8_t pgaTab[] = {-33, -27, -21, -15, -9, -6, -3, 0};
|
int8_t pgaTab[] = {-33, -27, -21, -15, -9, -6, -3, 0};
|
||||||
int16_t agcGain = lnaShortTab[agcGainReg.lnaS] + lnaTab[agcGainReg.lna] + mixerTab[agcGainReg.mixer] + pgaTab[agcGainReg.pga];
|
int16_t agcGain = lnaShortTab[agcGainReg.lnaS] + lnaTab[agcGainReg.lna] + mixerTab[agcGainReg.mixer] + pgaTab[agcGainReg.pga];
|
||||||
|
|
||||||
sprintf(buf, "%d%2d %2d %2d %3d", reg7e.agcEnab, reg7e.gainIdx, -agcGain, reg7e.agcSigStrength, BK4819_GetRSSI());
|
sprintf(buf, "%d%2ld %2ld %2ld %3ld", reg7e.agcEnab, reg7e.gainIdx, -agcGain, reg7e.agcSigStrength, BK4819_GetRSSI());
|
||||||
UI_PrintStringSmallNormal(buf, 2, 0, 3);
|
UI_PrintStringSmallNormal(buf, 2, 0, 3);
|
||||||
if(now)
|
if(now)
|
||||||
ST7565_BlitLine(3);
|
ST7565_BlitLine(3);
|
||||||
@@ -564,9 +564,9 @@ void UI_DisplayMain(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString("ScnRng", 5, 0, line + shift /*, 8 */);
|
UI_PrintString("ScnRng", 5, 0, line + shift /*, 8 */);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
|
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
|
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
|
||||||
|
|
||||||
if (!isMainOnly())
|
if (!isMainOnly())
|
||||||
@@ -576,9 +576,9 @@ void UI_DisplayMain(void) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
|
UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line);
|
UI_PrintStringSmallNormal(String, 56, 0, line);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + 1);
|
UI_PrintStringSmallNormal(String, 56, 0, line + 1);
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@@ -588,7 +588,7 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
UI_PrintString("SMS Dst", 0, 0, line - 1 /*, 8 */);
|
UI_PrintString("SMS Dst", 0, 0, line - 1 /*, 8 */);
|
||||||
sprintf(String, "%d", dataPacket.dest);
|
sprintf(String, "%ld", dataPacket.dest);
|
||||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
UI_PrintStringSmallNormal(String, 0, 0, line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -835,7 +835,7 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
|
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
|
||||||
case MDF_FREQUENCY: // show the channel frequency
|
case MDF_FREQUENCY: // show the channel frequency
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
@@ -884,7 +884,7 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (isMainOnly()) {
|
if (isMainOnly()) {
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
||||||
@@ -897,11 +897,11 @@ void UI_DisplayMain(void) {
|
|||||||
UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
|
UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintStringSmallBold(String, 40 + 4, 0, line + 1);
|
UI_PrintStringSmallBold(String, 40 + 4, 0, line + 1);
|
||||||
}
|
}
|
||||||
#else // show the channel frequency below the channel number/name
|
#else // show the channel frequency below the channel number/name
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03u.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 20 + 4, 0, line + 1);
|
UI_PrintStringSmallNormal(String, 20 + 4, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -909,7 +909,7 @@ void UI_DisplayMain(void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else { // frequency mode
|
} else { // frequency mode
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
|
|
||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
|
@@ -41,6 +41,7 @@ extern const int8_t dBmCorrTable[7];
|
|||||||
void UI_DisplayAudioBar(void);
|
void UI_DisplayAudioBar(void);
|
||||||
void UI_MAIN_TimeSlice500ms(void);
|
void UI_MAIN_TimeSlice500ms(void);
|
||||||
void UI_DisplayMain(void);
|
void UI_DisplayMain(void);
|
||||||
|
bool isMainOnly();
|
||||||
|
|
||||||
#ifdef ENABLE_AGC_SHOW_DATA
|
#ifdef ENABLE_AGC_SHOW_DATA
|
||||||
void UI_MAIN_PrintAGC(bool force);
|
void UI_MAIN_PrintAGC(bool force);
|
||||||
|
62
ui/menu.c
62
ui/menu.c
@@ -133,9 +133,7 @@ const t_menu_item MenuList[] =
|
|||||||
{"SPTT", MENU_SET_PTT},
|
{"SPTT", MENU_SET_PTT},
|
||||||
{"STOT", MENU_SET_TOT},
|
{"STOT", MENU_SET_TOT},
|
||||||
{"SEOT", MENU_SET_EOT},
|
{"SEOT", MENU_SET_EOT},
|
||||||
{"SCtr", MENU_SET_CTR},
|
|
||||||
{"SInv", MENU_SET_INV},
|
{"SInv", MENU_SET_INV},
|
||||||
{"SLck", MENU_SET_LCK},
|
|
||||||
{"STmr", MENU_SET_TMR},
|
{"STmr", MENU_SET_TMR},
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
{"SOff", MENU_SET_OFF},
|
{"SOff", MENU_SET_OFF},
|
||||||
@@ -552,7 +550,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
switch (UI_MENU_GetCurrentMenuId()) {
|
switch (UI_MENU_GetCurrentMenuId()) {
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_MIC: { // display the mic gain in actual dB rather than just an index number
|
case MENU_MIC: { // display the mic gain in actual dB rather than just an index number
|
||||||
@@ -605,7 +603,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_OFFSET:
|
case MENU_OFFSET:
|
||||||
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
||||||
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
sprintf(String, "%3ld.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
||||||
} else {
|
} else {
|
||||||
const char *ascii = INPUTBOX_GetAscii();
|
const char *ascii = INPUTBOX_GetAscii();
|
||||||
@@ -624,7 +622,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
if (gSubMenuSelection > 0) {
|
if (gSubMenuSelection > 0) {
|
||||||
sprintf(String, "%d00", gSubMenuSelection + 25);
|
sprintf(String, "%ld00", gSubMenuSelection + 25);
|
||||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||||
} else {
|
} else {
|
||||||
strcpy(String, "OFF");
|
strcpy(String, "OFF");
|
||||||
@@ -634,7 +632,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_VOX:
|
case MENU_VOX:
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%u", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%lu", gSubMenuSelection);
|
||||||
#else
|
#else
|
||||||
strcpy(String, gSubMenu_NA);
|
strcpy(String, gSubMenu_NA);
|
||||||
#endif
|
#endif
|
||||||
@@ -644,7 +642,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 61) {
|
} else if (gSubMenuSelection < 61) {
|
||||||
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
|
sprintf(String, "%02ldm:%02lds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(4, 1, 60, gSubMenuSelection);
|
//ST7565_Gauge(4, 1, 60, gSubMenuSelection);
|
||||||
gaugeLine = 4;
|
gaugeLine = 4;
|
||||||
@@ -662,7 +660,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_ABR_MIN:
|
case MENU_ABR_MIN:
|
||||||
case MENU_ABR_MAX:
|
case MENU_ABR_MAX:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
if (gIsInSubMenu)
|
if (gIsInSubMenu)
|
||||||
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
||||||
// Obsolete ???
|
// Obsolete ???
|
||||||
@@ -678,7 +676,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
else {
|
else {
|
||||||
sprintf(String, "%02dm:%02ds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
|
sprintf(String, "%02ldm:%02lds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(4, 1, 40, gSubMenuSelection);
|
//ST7565_Gauge(4, 1, 40, gSubMenuSelection);
|
||||||
gaugeLine = 4;
|
gaugeLine = 4;
|
||||||
@@ -689,7 +687,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_FSKSRC:
|
case MENU_FSKSRC:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_COMPAND:
|
case MENU_COMPAND:
|
||||||
@@ -732,7 +730,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||||
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%lu.%05lu", 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 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -767,7 +765,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -777,7 +775,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MENU_SAVE:
|
case MENU_SAVE:
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "1:%u", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "1:%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
@@ -785,7 +783,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
case MENU_TOT:
|
||||||
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
|
sprintf(String, "%02ldm:%02lds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(4, 5, 179, gSubMenuSelection);
|
//ST7565_Gauge(4, 5, 179, gSubMenuSelection);
|
||||||
gaugeLine = 4;
|
gaugeLine = 4;
|
||||||
@@ -804,7 +802,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, "STOP");
|
strcpy(String, "STOP");
|
||||||
} else if (gSubMenuSelection < 81) {
|
} else if (gSubMenuSelection < 81) {
|
||||||
sprintf(String, "CARRIER\n%02ds:%03dms", ((gSubMenuSelection * 250) / 1000),
|
sprintf(String, "CARRIER\n%02lds:%03ldms", ((gSubMenuSelection * 250) / 1000),
|
||||||
((gSubMenuSelection * 250) % 1000));
|
((gSubMenuSelection * 250) % 1000));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(5, 1, 80, gSubMenuSelection);
|
//ST7565_Gauge(5, 1, 80, gSubMenuSelection);
|
||||||
@@ -813,7 +811,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
gaugeMax = 80;
|
gaugeMax = 80;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "TIMEOUT\n%02dm:%02ds", (((gSubMenuSelection - 80) * 5) / 60),
|
sprintf(String, "TIMEOUT\n%02ldm:%02lds", (((gSubMenuSelection - 80) * 5) / 60),
|
||||||
(((gSubMenuSelection - 80) * 5) % 60));
|
(((gSubMenuSelection - 80) * 5) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(5, 80, 104, gSubMenuSelection);
|
//ST7565_Gauge(5, 80, 104, gSubMenuSelection);
|
||||||
@@ -829,14 +827,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_RP_STE:
|
case MENU_RP_STE:
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%u*100ms", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%lu*100ms", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
strcpy(String, "LIST [0]\nNO LIST");
|
strcpy(String, "LIST [0]\nNO LIST");
|
||||||
else if (gSubMenuSelection < 4)
|
else if (gSubMenuSelection < 4)
|
||||||
sprintf(String, "LIST [%u]", gSubMenuSelection);
|
sprintf(String, "LIST [%lu]", gSubMenuSelection);
|
||||||
else if (gSubMenuSelection == 4)
|
else if (gSubMenuSelection == 4)
|
||||||
strcpy(String, "LISTS\n[1, 2, 3]");
|
strcpy(String, "LISTS\n[1, 2, 3]");
|
||||||
else if (gSubMenuSelection == 5)
|
else if (gSubMenuSelection == 5)
|
||||||
@@ -868,11 +866,11 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
case MENU_D_HOLD:
|
||||||
sprintf(String, "%ds", gSubMenuSelection);
|
sprintf(String, "%lds", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
sprintf(String, "%d*10ms", gSubMenuSelection);
|
sprintf(String, "%ld*10ms", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_PTT_ID:
|
case MENU_PTT_ID:
|
||||||
@@ -916,7 +914,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
writeXtalFreqCal(gSubMenuSelection, false);
|
writeXtalFreqCal(gSubMenuSelection, false);
|
||||||
|
|
||||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
sprintf(String, "%ld\n%lu.%06lu\nMHz",
|
||||||
gSubMenuSelection,
|
gSubMenuSelection,
|
||||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||||
}
|
}
|
||||||
@@ -925,7 +923,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_BATCAL: {
|
case MENU_BATCAL: {
|
||||||
const uint16_t vol = (uint32_t) gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
const uint16_t vol = (uint32_t) gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
sprintf(String, "%u.%02dV\n%lu", vol / 100, vol % 100, gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -946,7 +944,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 121) {
|
} else if (gSubMenuSelection < 121) {
|
||||||
sprintf(String, "%dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
|
sprintf(String, "%ldh:%02ldm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(4, 1, 120, gSubMenuSelection);
|
//ST7565_Gauge(4, 1, 120, gSubMenuSelection);
|
||||||
gaugeLine = 4;
|
gaugeLine = 4;
|
||||||
@@ -967,16 +965,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]); // Same as SET_TOT
|
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]); // Same as SET_TOT
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
|
||||||
gSetting_set_ctr = gSubMenuSelection;
|
|
||||||
ST7565_ContrastAndInv();
|
|
||||||
#else
|
|
||||||
strcpy(String, gSubMenu_NA);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||||
@@ -997,7 +985,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 64) {
|
} else if (gSubMenuSelection < 64) {
|
||||||
sprintf(String, "%02u", gSubMenuSelection);
|
sprintf(String, "%02lu", gSubMenuSelection);
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
|
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
|
||||||
gaugeLine = 4;
|
gaugeLine = 4;
|
||||||
@@ -1108,12 +1096,12 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
||||||
sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
sprintf(String, "PRI%ld:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
||||||
sprintf(String, "PRI%d:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
sprintf(String, "PRI%ld:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -1152,7 +1140,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|| UI_MENU_GetCurrentMenuId() == MENU_D_LIST
|
|| UI_MENU_GetCurrentMenuId() == MENU_D_LIST
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
sprintf(String, "%2d", gSubMenuSelection);
|
sprintf(String, "%2ld", gSubMenuSelection);
|
||||||
UI_PrintStringSmallNormal(String, 105, 0, 0);
|
UI_PrintStringSmallNormal(String, 105, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user