Initial implementation.

This commit is contained in:
Nunu 2023-12-15 18:27:47 +01:00
parent 80bf95a5d7
commit de15a264bd
4 changed files with 63 additions and 24 deletions

View File

@ -22,30 +22,31 @@ ENABLE_PWRON_PASSWORD := 0
ENABLE_DTMF_CALLING := 0
# ---- CUSTOM MODS ----
ENABLE_BIG_FREQ := 1
ENABLE_SMALL_BOLD := 1
ENABLE_KEEP_MEM_NAME := 1
ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0
ENABLE_F_CAL_MENU := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0
ENABLE_BOOT_BEEPS := 0
ENABLE_SHOW_CHARGE_LEVEL := 1
ENABLE_REVERSE_BAT_SYMBOL := 0
ENABLE_NO_CODE_SCAN_TIMEOUT := 1
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_FASTER_CHANNEL_SCAN := 1
ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1
ENABLE_COPY_CHAN_TO_VFO := 1
ENABLE_SPECTRUM := 1
ENABLE_REDUCE_LOW_MID_TX_POWER:= 0
ENABLE_BYP_RAW_DEMODULATORS := 0
ENABLE_BLMIN_TMP_OFF := 0
ENABLE_SCAN_RANGES := 1
ENABLE_SPECTRUM_COPY_VFO := 1
ENABLE_BIG_FREQ := 1
ENABLE_SMALL_BOLD := 1
ENABLE_KEEP_MEM_NAME := 1
ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0
ENABLE_F_CAL_MENU := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0
ENABLE_BOOT_BEEPS := 0
ENABLE_SHOW_CHARGE_LEVEL := 1
ENABLE_REVERSE_BAT_SYMBOL := 0
ENABLE_NO_CODE_SCAN_TIMEOUT := 1
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_FASTER_CHANNEL_SCAN := 1
ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1
ENABLE_COPY_CHAN_TO_VFO := 1
ENABLE_SPECTRUM := 1
ENABLE_REDUCE_LOW_MID_TX_POWER := 0
ENABLE_BYP_RAW_DEMODULATORS := 0
ENABLE_BLMIN_TMP_OFF := 0
ENABLE_SCAN_RANGES := 1
ENABLE_SPECTRUM_COPY_VFO := 1
ENABLE_SPECTRUM_SHOW_CHANNEL_NAME := 1
#############################################################
@ -359,6 +360,9 @@ endif
ifeq ($(ENABLE_SPECTRUM_COPY_VFO),1)
CFLAGS += -DENABLE_SPECTRUM_COPY_VFO
endif
ifeq ($(ENABLE_SPECTRUM_SHOW_CHANNEL_NAME),1)
CFLAGS += -DENABLE_SPECTRUM_SHOW_CHANNEL_NAME
endif
ifeq ($(ENABLE_DTMF_CALLING),1)
CFLAGS += -DENABLE_DTMF_CALLING
endif

View File

@ -663,6 +663,18 @@ static void DrawF(uint32_t f) {
sprintf(String, "%s", bwOptions[settings.listenBw]);
GUI_DisplaySmallest(String, 108, 7, false, true);
}
#ifdef ENABLE_SPECTRUM_SHOW_CHANNEL_NAME
static void DrawKnownChannelName(uint32_t f) {
int channel;
char name[32];
channel = BOARD_fetchChannel(f);
BOARD_fetchChannelName(name, channel);
sprintf(String, "%s", channel==0 ? "" : name);
GUI_DisplaySmallest(String, 0, 13, false, true);
}
#endif
static void DrawNums() {
@ -936,6 +948,9 @@ static void RenderSpectrum() {
DrawSpectrum();
DrawRssiTriggerLevel();
DrawF(peak.f);
#ifdef ENABLE_SPECTRUM_SHOW_CHANNEL_NAME
DrawKnownChannelName(peak.f);
#endif
DrawNums();
}

17
board.c
View File

@ -827,7 +827,24 @@ uint32_t BOARD_fetchChannelFrequency(const int channel)
return info.frequency;
}
#ifdef ENABLE_SPECTRUM_SHOW_CHANNEL_NAME
// TODO: fetch from memory, reading from eeprom all the time is too slow
int BOARD_fetchChannel(const uint32_t freq)
{
struct
{
uint32_t frequency;
uint32_t offset;
} __attribute__((packed)) info;
for (int i = 1; i <= 200; i++) {
EEPROM_ReadBuffer(i * 16, &info, sizeof(info));
if (info.frequency == freq)
return i;
}
return 0;
}
#endif
void BOARD_fetchChannelName(char *s, const int channel)
{
int i;

View File

@ -29,6 +29,9 @@ void BOARD_Init(void);
void BOARD_EEPROM_Init(void);
void BOARD_EEPROM_LoadCalibration(void);
uint32_t BOARD_fetchChannelFrequency(const int channel);
#ifdef ENABLE_SPECTRUM_SHOW_CHANNEL_NAME
int BOARD_fetchChannel(const uint32_t freq);
#endif
void BOARD_fetchChannelName(char *s, const int channel);
void BOARD_FactoryReset(bool bIsAll);