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

This commit is contained in:
Krzysiek Egzmont
2023-10-04 22:35:03 +02:00
14 changed files with 86 additions and 62 deletions

View File

@@ -13,7 +13,7 @@ ENABLE_NOAA := 0
ENABLE_VOICE := 0 ENABLE_VOICE := 0
ENABLE_VOX := 1 ENABLE_VOX := 1
ENABLE_ALARM := 0 ENABLE_ALARM := 0
ENABLE_TX1750 := 0 ENABLE_TX1750 := 1
ENABLE_BIG_FREQ := 1 ENABLE_BIG_FREQ := 1
ENABLE_SMALL_BOLD := 1 ENABLE_SMALL_BOLD := 1
ENABLE_KEEP_MEM_NAME := 1 ENABLE_KEEP_MEM_NAME := 1
@@ -176,7 +176,7 @@ ifeq ($(ENABLE_LTO), 1)
CFLAGS += -flto=2 CFLAGS += -flto=2
endif endif
CFLAGS += -Wpadded #CFLAGS += -Wpadded
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\" CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"

View File

@@ -1711,12 +1711,18 @@ void APP_TimeSlice500ms(void)
if (gDTMF_RX_live_timeout > 0) if (gDTMF_RX_live_timeout > 0)
{ {
if (--gDTMF_RX_live_timeout == 0) #ifdef ENABLE_RSSI_BAR
if (center_line == CENTER_LINE_DTMF_DEC ||
center_line == CENTER_LINE_NONE) // wait till the center line is free for us to use before timing out
#endif
{ {
if (gDTMF_RX_live[0] != 0) if (--gDTMF_RX_live_timeout == 0)
{ {
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live)); if (gDTMF_RX_live[0] != 0)
gUpdateDisplay = true; {
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
gUpdateDisplay = true;
}
} }
} }
} }
@@ -1973,9 +1979,9 @@ void APP_TimeSlice500ms(void)
gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_TRANSMIT &&
gCurrentFunction != FUNCTION_RECEIVE) gCurrentFunction != FUNCTION_RECEIVE)
{ {
if (gDTMF_AUTO_RESET_TIME > 0) if (gDTMF_auto_reset_time_500ms > 0)
{ {
if (--gDTMF_AUTO_RESET_TIME == 0) if (--gDTMF_auto_reset_time_500ms == 0)
{ {
gDTMF_CallState = DTMF_CALL_STATE_NONE; gDTMF_CallState = DTMF_CALL_STATE_NONE;
gUpdateDisplay = true; gUpdateDisplay = true;
@@ -2463,7 +2469,7 @@ Skip:
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
gDTMF_AUTO_RESET_TIME = 0; gDTMF_auto_reset_time_500ms = 0;
gDTMF_CallState = DTMF_CALL_STATE_NONE; gDTMF_CallState = DTMF_CALL_STATE_NONE;
gDTMF_TxStopCountdown_500ms = 0; gDTMF_TxStopCountdown_500ms = 0;
gDTMF_IsTx = false; gDTMF_IsTx = false;

View File

@@ -54,8 +54,8 @@ char gDTMF_Caller[4];
char gDTMF_Callee[4]; char gDTMF_Callee[4];
DTMF_State_t gDTMF_State; DTMF_State_t gDTMF_State;
uint8_t gDTMF_DecodeRingCountdown_500ms; uint8_t gDTMF_DecodeRingCountdown_500ms;
uint8_t gDTMFChosenContact; uint8_t gDTMF_chosen_contact;
uint8_t gDTMF_AUTO_RESET_TIME; uint8_t gDTMF_auto_reset_time_500ms;
DTMF_CallState_t gDTMF_CallState; DTMF_CallState_t gDTMF_CallState;
DTMF_ReplyState_t gDTMF_ReplyState; DTMF_ReplyState_t gDTMF_ReplyState;
DTMF_CallMode_t gDTMF_CallMode; DTMF_CallMode_t gDTMF_CallMode;
@@ -403,13 +403,12 @@ void DTMF_Reply(void)
if (pString == NULL) if (pString == NULL)
return; return;
Delay = gEeprom.DTMF_PRELOAD_TIME; Delay = (gEeprom.DTMF_PRELOAD_TIME < 200) ? 200 : gEeprom.DTMF_PRELOAD_TIME;
if (gEeprom.DTMF_SIDE_TONE) if (gEeprom.DTMF_SIDE_TONE)
{ // the will also hear the transmitted tones { // the user will also hear the transmitted tones
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true; gEnableSpeaker = true;
Delay = (gEeprom.DTMF_PRELOAD_TIME < 60) ? 60 : gEeprom.DTMF_PRELOAD_TIME;
} }
SYSTEM_DelayMs(Delay); SYSTEM_DelayMs(Delay);

View File

@@ -83,8 +83,8 @@ extern char gDTMF_Caller[4];
extern char gDTMF_Callee[4]; extern char gDTMF_Callee[4];
extern DTMF_State_t gDTMF_State; extern DTMF_State_t gDTMF_State;
extern uint8_t gDTMF_DecodeRingCountdown_500ms; extern uint8_t gDTMF_DecodeRingCountdown_500ms;
extern uint8_t gDTMFChosenContact; extern uint8_t gDTMF_chosen_contact;
extern uint8_t gDTMF_AUTO_RESET_TIME; extern uint8_t gDTMF_auto_reset_time_500ms;
extern DTMF_CallState_t gDTMF_CallState; extern DTMF_CallState_t gDTMF_CallState;
extern DTMF_ReplyState_t gDTMF_ReplyState; extern DTMF_ReplyState_t gDTMF_ReplyState;
extern DTMF_CallMode_t gDTMF_CallMode; extern DTMF_CallMode_t gDTMF_CallMode;

View File

@@ -630,7 +630,7 @@ void MENU_AcceptSetting(void)
break; break;
case MENU_D_HOLD: case MENU_D_HOLD:
gEeprom.DTMF_AUTO_RESET_TIME = gSubMenuSelection; gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
break; break;
case MENU_D_PRE: case MENU_D_PRE:
@@ -663,7 +663,7 @@ void MENU_AcceptSetting(void)
break; break;
case MENU_D_LIST: case MENU_D_LIST:
gDTMFChosenContact = gSubMenuSelection - 1; gDTMF_chosen_contact = gSubMenuSelection - 1;
if (gIsDtmfContactValid) if (gIsDtmfContactValid)
{ {
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
@@ -758,19 +758,24 @@ void MENU_AcceptSetting(void)
#endif #endif
case MENU_BATCAL: case MENU_BATCAL:
gBatteryCalibration[0] = 520*gSubMenuSelection/760; //5.2V empty, blinking above this value, reduced functionality below {
gBatteryCalibration[1] = 700*gSubMenuSelection/760; // 7V, ~5%, 1 bars above this value uint16_t buf[4];
gBatteryCalibration[2] = 745*gSubMenuSelection/760; // 7.45V, ~17%, 2 bars above this value
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below
gBatteryCalibration[4] = 788*gSubMenuSelection/760; // 7.88V, ~65% 4 bars above this value gBatteryCalibration[1] = (700ul * gSubMenuSelection) / 760; // 7.00V, ~5%, 1 bars above this value
gBatteryCalibration[2] = (745ul * gSubMenuSelection) / 760; // 7.45V, ~17%, 2 bars above this value
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value
gBatteryCalibration[4] = (788ul * gSubMenuSelection) / 760; // 7.88V, ~65%, 4 bars above this value
gBatteryCalibration[5] = 2300; gBatteryCalibration[5] = 2300;
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration); EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
uint16_t buf[4];
EEPROM_ReadBuffer(0x1F48, buf, sizeof(buf)); EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
buf[0] = gBatteryCalibration[4]; buf[0] = gBatteryCalibration[4];
buf[1] = gBatteryCalibration[5]; buf[1] = gBatteryCalibration[5];
EEPROM_WriteBuffer(0x1F48, buf); EEPROM_WriteBuffer(0x1F48, buf);
break; break;
}
} }
gRequestSaveSettings = true; gRequestSaveSettings = true;
@@ -1039,7 +1044,7 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_D_HOLD: case MENU_D_HOLD:
gSubMenuSelection = gEeprom.DTMF_AUTO_RESET_TIME; gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
break; break;
case MENU_D_PRE: case MENU_D_PRE:
@@ -1059,7 +1064,7 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_D_LIST: case MENU_D_LIST:
gSubMenuSelection = gDTMFChosenContact + 1; gSubMenuSelection = gDTMF_chosen_contact + 1;
break; break;
case MENU_D_LIVE_DEC: case MENU_D_LIVE_DEC:

View File

@@ -125,18 +125,14 @@ typedef struct SpectrumSettings {
uint32_t frequencyChangeStep; uint32_t frequencyChangeStep;
StepsCount stepsCount; StepsCount stepsCount;
ScanStep scanStepIndex; ScanStep scanStepIndex;
uint16_t scanDelay; uint16_t scanDelay;
uint16_t rssiTriggerLevel; uint16_t rssiTriggerLevel;
BK4819_FilterBandwidth_t bw; BK4819_FilterBandwidth_t bw;
BK4819_FilterBandwidth_t listenBw; BK4819_FilterBandwidth_t listenBw;
int dbMin; int dbMin;
int dbMax; int dbMax;
ModulationType modulationType; ModulationType modulationType;
bool backlightState; bool backlightState;
uint8_t _pad[2];
} SpectrumSettings; } SpectrumSettings;
typedef struct KeyboardState { typedef struct KeyboardState {
@@ -151,7 +147,6 @@ typedef struct ScanInfo {
uint32_t f, fPeak; uint32_t f, fPeak;
uint16_t scanStep; uint16_t scanStep;
uint8_t measurementsCount; uint8_t measurementsCount;
uint8_t _pad[1];
} ScanInfo; } ScanInfo;
typedef struct RegisterSpec { typedef struct RegisterSpec {
@@ -160,7 +155,6 @@ typedef struct RegisterSpec {
uint8_t offset; uint8_t offset;
uint16_t maxValue; uint16_t maxValue;
uint16_t inc; uint16_t inc;
uint8_t _pad[2];
} RegisterSpec; } RegisterSpec;
typedef struct PeakInfo { typedef struct PeakInfo {
@@ -168,7 +162,6 @@ typedef struct PeakInfo {
uint16_t rssi; uint16_t rssi;
uint32_t f; uint32_t f;
uint8_t i; uint8_t i;
uint8_t _pad[3];
} PeakInfo; } PeakInfo;
void APP_RunSpectrum(void); void APP_RunSpectrum(void);

View File

@@ -624,7 +624,7 @@ void BOARD_EEPROM_Init(void)
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*'; gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#'; gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0; gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
gEeprom.DTMF_AUTO_RESET_TIME = (Data[4] < 61) ? Data[4] : 5; gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 10) ? Data[4] : 10;
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300; gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100; gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100; gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;

View File

@@ -913,7 +913,7 @@ void BK4819_EnableDTMF(void)
// REG_24 <3:0> 14 Max symbol number for SelCall detection // REG_24 <3:0> 14 Max symbol number for SelCall detection
// const uint16_t threshold = 24; // doesn't decode non-QS radios // const uint16_t threshold = 24; // doesn't decode non-QS radios
const uint16_t threshold = 140; // but 128 ~ 247 does const uint16_t threshold = 200; // but 128 ~ 247 does
BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110 BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110
(1u << BK4819_REG_24_SHIFT_UNKNOWN_15) (1u << BK4819_REG_24_SHIFT_UNKNOWN_15)
| (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255 | (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255
@@ -1183,7 +1183,25 @@ void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
{ {
BK4819_EnterTxMute(); BK4819_EnterTxMute();
BK4819_WriteRegister(BK4819_REG_70, 0 | BK4819_REG_70_MASK_ENABLE_TONE1 | (96U << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); // REG_70 <15> 0 Enable TONE1
// 1 = Enable
// 0 = Disable
//
// REG_70 <14:8> 0 TONE1 tuning gain
// 0 ~ 127
//
// REG_70 <7> 0 Enable TONE2
// 1 = Enable
// 0 = Disable
//
// REG_70 <6:0> 0 TONE2/FSK tuning gain
// 0 ~ 127
//
// set the tone amplitude
//
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_MASK_ENABLE_TONE1 | (50u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency)); BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency));
BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE); BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE);

View File

@@ -117,7 +117,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
#endif #endif
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED) if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2); gDTMF_auto_reset_time_500ms = 1 + (gEeprom.DTMF_auto_reset_time * 2);
gUpdateStatus = true; gUpdateStatus = true;
return; return;

View File

@@ -564,8 +564,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, true);
#else #else
BK4819_SetFilterBandwidth(Bandwidth, false); BK4819_SetFilterBandwidth(Bandwidth, false);
#endif #endif
@@ -732,6 +732,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
#else #else
if (gCurrentFunction != FUNCTION_TRANSMIT) if (gCurrentFunction != FUNCTION_TRANSMIT)
{ {
BK4819_DisableDTMF();
BK4819_EnableDTMF(); BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND; InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
} }
@@ -812,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, true);
#else #else
BK4819_SetFilterBandwidth(Bandwidth, false); BK4819_SetFilterBandwidth(Bandwidth, false);
#endif #endif

View File

@@ -140,7 +140,7 @@ void SETTINGS_SaveSettings(void)
State[1] = gEeprom.DTMF_SEPARATE_CODE; State[1] = gEeprom.DTMF_SEPARATE_CODE;
State[2] = gEeprom.DTMF_GROUP_CALL_CODE; State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
State[3] = gEeprom.DTMF_DECODE_RESPONSE; State[3] = gEeprom.DTMF_DECODE_RESPONSE;
State[4] = gEeprom.DTMF_AUTO_RESET_TIME; State[4] = gEeprom.DTMF_auto_reset_time;
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U; State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U; State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U; State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;

View File

@@ -194,7 +194,7 @@ typedef struct {
char DTMF_SEPARATE_CODE; char DTMF_SEPARATE_CODE;
char DTMF_GROUP_CALL_CODE; char DTMF_GROUP_CALL_CODE;
uint8_t DTMF_DECODE_RESPONSE; uint8_t DTMF_DECODE_RESPONSE;
uint8_t DTMF_AUTO_RESET_TIME; uint8_t DTMF_auto_reset_time;
uint16_t DTMF_PRELOAD_TIME; uint16_t DTMF_PRELOAD_TIME;
uint16_t DTMF_FIRST_CODE_PERSIST_TIME; uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
uint16_t DTMF_HASH_CODE_PERSIST_TIME; uint16_t DTMF_HASH_CODE_PERSIST_TIME;

View File

@@ -36,17 +36,6 @@
#include "ui/main.h" #include "ui/main.h"
#include "ui/ui.h" #include "ui/ui.h"
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; center_line_t center_line = CENTER_LINE_NONE;
// *************************************************************************** // ***************************************************************************

View File

@@ -17,6 +17,19 @@
#ifndef UI_MAIN_H #ifndef UI_MAIN_H
#define UI_MAIN_H #define UI_MAIN_H
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;
extern center_line_t center_line;
void UI_DisplayAudioBar(void); void UI_DisplayAudioBar(void);
void UI_UpdateRSSI(const int16_t rssi, const int vfo); void UI_UpdateRSSI(const int16_t rssi, const int vfo);
void UI_DisplayMain(void); void UI_DisplayMain(void);