From 43c90645936cac13307abe49bcacb32b317f4e39 Mon Sep 17 00:00:00 2001 From: Nunu Date: Mon, 29 Jan 2024 14:38:14 +0100 Subject: [PATCH 1/9] spectrum: enable att, norm, bl in vfo and scn rng modes. unify key bindings across all modes. --- app/spectrum.c | 179 ++++++++++++++++++++----------------------------- 1 file changed, 73 insertions(+), 106 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index c1e012a4c..08362be0b 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -46,8 +46,8 @@ bool isBlacklistApplied; #define ATTENUATE_STEP 10 bool isNormalizationApplied; bool isAttenuationApplied; - uint8_t gainOffset[128]; - uint8_t attenuationOffset[128]; + uint8_t gainOffset[129]; + uint8_t attenuationOffset[129]; uint8_t scanChannel[MR_CHANNEL_LAST+3]; uint8_t scanChannelsCount; void ToggleScanList(); @@ -92,7 +92,7 @@ KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0}; static uint16_t blacklistFreqs[BLACKLIST_SIZE]; static uint8_t blacklistFreqsIdx; static bool IsBlacklisted(uint16_t idx); -static uint8_t ScanRangeidx(); +static uint8_t CurrentScanIndex(); #endif const char *bwOptions[] = {" 25k", "12.5k", "6.25k"}; @@ -373,10 +373,8 @@ uint16_t GetRssi() { rssi+=UHF_NOISE_FLOOR; } - if (appMode==CHANNEL_MODE) { - rssi+=gainOffset[scanInfo.i]; - rssi-=attenuationOffset[scanInfo.i]; - } + rssi+=gainOffset[CurrentScanIndex()]; + rssi-=attenuationOffset[CurrentScanIndex()]; #endif return rssi; @@ -442,7 +440,8 @@ static void InitScan() { scanInfo.measurementsCount++; } -static void ResetBlacklist() { +// resets modifiers like blacklist, attenuation, normalization +static void ResetModifiers() { for (int i = 0; i < 128; ++i) { if (rssiHistory[i] == RSSI_MAX_VALUE) rssiHistory[i] = 0; @@ -454,10 +453,10 @@ static void ResetBlacklist() { if(appMode==CHANNEL_MODE){ LoadValidMemoryChannels(); AutoAdjustResolution(); - ToggleNormalizeRssi(false); - memset(attenuationOffset, 0, sizeof(attenuationOffset)); - isAttenuationApplied = false; } + ToggleNormalizeRssi(false); + memset(attenuationOffset, 0, sizeof(attenuationOffset)); + isAttenuationApplied = false; isBlacklistApplied = false; RelaunchScan(); } @@ -481,7 +480,7 @@ static void UpdateScanInfo() { } // add attenuation offset to prevent noise floor lowering when attenuated rx is over // essentially we measure non-attenuated lowest rssi - if (scanInfo.rssi+attenuationOffset[scanInfo.i] < scanInfo.rssiMin) { + if (scanInfo.rssi+attenuationOffset[CurrentScanIndex()] < scanInfo.rssiMin) { scanInfo.rssiMin = scanInfo.rssi; settings.dbMin = Rssi2DBm(scanInfo.rssiMin); redrawStatus = true; @@ -513,15 +512,15 @@ static void UpdatePeakInfo() { static void Measure() { uint16_t rssi = scanInfo.rssi = GetRssi(); -#ifdef ENABLE_SCAN_RANGES - if(scanInfo.measurementsCount > 128) { - uint8_t idx = ScanRangeidx(); - if(rssiHistory[idx] < rssi || isListening) - rssiHistory[idx] = rssi; - rssiHistory[(idx+1)%128] = 0; - return; - } -#endif + #ifdef ENABLE_SCAN_RANGES + if(scanInfo.measurementsCount > 128) { + uint8_t idx = CurrentScanIndex(); + if(rssiHistory[idx] < rssi || isListening) + rssiHistory[idx] = rssi; + rssiHistory[(idx+1)%128] = 0; + return; + } + #endif rssiHistory[scanInfo.i] = rssi; } @@ -573,7 +572,7 @@ static void UpdateScanStep(bool inc) { return; } settings.frequencyChangeStep = GetBW() >> 1; - ResetBlacklist(); + ResetModifiers(); redrawScreen = true; } @@ -585,7 +584,7 @@ static void UpdateCurrentFreq(bool inc) { } else { return; } - ResetBlacklist(); + ResetModifiers(); redrawScreen = true; } @@ -601,16 +600,16 @@ static void UpdateCurrentFreqStill(bool inc) { redrawScreen = true; } -static void UpdateFreqChangeStep(bool inc) { - uint16_t diff = GetScanStep() * 4; - if (inc && settings.frequencyChangeStep < 200000) { - settings.frequencyChangeStep += diff; - } else if (!inc && settings.frequencyChangeStep > 10000) { - settings.frequencyChangeStep -= diff; - } - SYSTEM_DelayMs(100); - redrawScreen = true; -} +// static void UpdateFreqChangeStep(bool inc) { +// uint16_t diff = GetScanStep() * 4; +// if (inc && settings.frequencyChangeStep < 200000) { +// settings.frequencyChangeStep += diff; +// } else if (!inc && settings.frequencyChangeStep > 10000) { +// settings.frequencyChangeStep -= diff; +// } +// SYSTEM_DelayMs(100); +// redrawScreen = true; +// } static void ToggleModulation() { if (settings.modulationType < MODULATION_UKNOWN - 1) { @@ -644,7 +643,7 @@ static void ToggleStepsCount() { settings.stepsCount--; } settings.frequencyChangeStep = GetBW() >> 1; - ResetBlacklist(); + ResetModifiers(); redrawScreen = true; } @@ -714,7 +713,7 @@ static void UpdateFreqInput(KEY_Code_t key) { static void Blacklist() { #ifdef ENABLE_SCAN_RANGES blacklistFreqs[blacklistFreqsIdx++ % ARRAY_SIZE(blacklistFreqs)] = peak.i; - rssiHistory[ScanRangeidx()] = RSSI_MAX_VALUE; + rssiHistory[CurrentScanIndex()] = RSSI_MAX_VALUE; #endif rssiHistory[peak.i] = RSSI_MAX_VALUE; isBlacklistApplied = true; @@ -724,7 +723,7 @@ static void Blacklist() { } #ifdef ENABLE_SCAN_RANGES -static uint8_t ScanRangeidx() +static uint8_t CurrentScanIndex() { if(scanInfo.measurementsCount > 128) { uint8_t i = (uint32_t)ARRAY_SIZE(rssiHistory) * 1000 / scanInfo.measurementsCount * scanInfo.i / 1000; @@ -732,7 +731,7 @@ static uint8_t ScanRangeidx() } else { - return 0; + return scanInfo.i; } } @@ -869,43 +868,31 @@ static void DrawNums() { } - if (IsCenterMode()) { - sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000, - currentFreq % 100000, settings.frequencyChangeStep / 100, - settings.frequencyChangeStep % 100); - GUI_DisplaySmallest(String, 36, 49, false, true); - } else { - if (appMode==CHANNEL_MODE) - { - sprintf(String, "M:%d", scanChannel[0]+1); - GUI_DisplaySmallest(String, 0, 49, false, true); - - if(isAttenuationApplied){ - sprintf(String, "ATT"); - GUI_DisplaySmallest(String, 48, 49, false, true); - } - - if(isBlacklistApplied){ - sprintf(String, "BL"); - GUI_DisplaySmallest(String, 63, 49, false, true); - } + if (appMode==CHANNEL_MODE) + { + sprintf(String, "M:%d", scanChannel[0]+1); + GUI_DisplaySmallest(String, 0, 49, false, true); - sprintf(String, "M:%d", scanChannel[GetStepsCount()-1]+1); - GUI_DisplaySmallest(String, 108, 49, false, true); - } - else - { - sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000); - GUI_DisplaySmallest(String, 0, 49, false, true); + sprintf(String, "M:%d", scanChannel[GetStepsCount()-1]+1); + GUI_DisplaySmallest(String, 108, 49, false, true); + } + else + { + sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000); + GUI_DisplaySmallest(String, 0, 49, false, true); - sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100, - settings.frequencyChangeStep % 100); - GUI_DisplaySmallest(String, 48, 49, false, true); + sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000); + GUI_DisplaySmallest(String, 93, 49, false, true); + } - sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000); - GUI_DisplaySmallest(String, 93, 49, false, true); - } + if(isAttenuationApplied){ + sprintf(String, "ATT"); + GUI_DisplaySmallest(String, 50, 49, false, true); + } + if(isBlacklistApplied){ + sprintf(String, "BL"); + GUI_DisplaySmallest(String, 65, 49, false, true); } } @@ -931,18 +918,11 @@ static void DrawTicks() { gFrameBuffer[5][i] |= barValue; } + memset(gFrameBuffer[5] + 1, 0x80, 3); + memset(gFrameBuffer[5] + 124, 0x80, 3); - // center - if (IsCenterMode()) { - memset(gFrameBuffer[5] + 62, 0x80, 5); - gFrameBuffer[5][64] = 0xff; - } else { - memset(gFrameBuffer[5] + 1, 0x80, 3); - memset(gFrameBuffer[5] + 124, 0x80, 3); - - gFrameBuffer[5][0] = 0xff; - gFrameBuffer[5][127] = 0xff; - } + gFrameBuffer[5][0] = 0xff; + gFrameBuffer[5][127] = 0xff; } static void DrawArrow(uint8_t x) { @@ -975,43 +955,33 @@ static void OnKeyDown(uint8_t key) { } break; case KEY_2: - if(appMode==CHANNEL_MODE){ - ToggleNormalizeRssi(!isNormalizationApplied); - } - else { - UpdateFreqChangeStep(true); - } + ToggleNormalizeRssi(!isNormalizationApplied); break; case KEY_8: - if(appMode==CHANNEL_MODE){ - ToggleBacklight(); - } - else{ - UpdateFreqChangeStep(false); - } + ToggleBacklight(); break; case KEY_UP: #ifdef ENABLE_SCAN_RANGES - if(!gScanRangeStart && appMode!=CHANNEL_MODE) + if(appMode!=CHANNEL_MODE) { #endif UpdateCurrentFreq(true); } - else if (appMode==CHANNEL_MODE) + else { - ResetBlacklist(); + ResetModifiers(); } break; case KEY_DOWN: #ifdef ENABLE_SCAN_RANGES - if(!gScanRangeStart && appMode!= CHANNEL_MODE) + if(appMode!= CHANNEL_MODE) { #endif UpdateCurrentFreq(false); } - else if (appMode==CHANNEL_MODE) + else { - ResetBlacklist(); + ResetModifiers(); } break; case KEY_SIDE1: @@ -1046,13 +1016,10 @@ static void OnKeyDown(uint8_t key) { } break; case KEY_SIDE2: - if(appMode==CHANNEL_MODE) { + // attenuate is disabled with scan ranges due to way scan ranges work + if (!gScanRangeStart){ Attenuate(ATTENUATE_STEP); } - else { - ToggleBacklight(); - } - break; case KEY_PTT: #ifdef ENABLE_SPECTRUM_COPY_VFO @@ -1109,7 +1076,7 @@ static void OnKeyDownFreqInput(uint8_t key) { SetState(previousState); currentFreq = tempFreq; if (currentState == SPECTRUM) { - ResetBlacklist(); + ResetModifiers(); } else { SetF(currentFreq); } @@ -1589,7 +1556,7 @@ void APP_RunSpectrum() { } LoadValidMemoryChannels(); - ResetBlacklist(); + ResetModifiers(); AutoAdjustResolution(); } From 8d36932eab4ec1b7a20beeebbca1012840abf77c Mon Sep 17 00:00:00 2001 From: Nunu Date: Mon, 29 Jan 2024 14:48:26 +0100 Subject: [PATCH 2/9] spectrum indicators positioning --- app/spectrum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index 08362be0b..cbe6c8c38 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -887,12 +887,12 @@ static void DrawNums() { if(isAttenuationApplied){ sprintf(String, "ATT"); - GUI_DisplaySmallest(String, 50, 49, false, true); + GUI_DisplaySmallest(String, 52, 49, false, true); } if(isBlacklistApplied){ sprintf(String, "BL"); - GUI_DisplaySmallest(String, 65, 49, false, true); + GUI_DisplaySmallest(String, 67, 49, false, true); } } From c5bd937f6fd6b1497c20d6f0018cadfc5e816b1a Mon Sep 17 00:00:00 2001 From: Nunu Date: Tue, 30 Jan 2024 11:13:55 +0100 Subject: [PATCH 3/9] refactor --- app/action.c | 20 +++++++++++++++++++- app/action.h | 1 + app/main.c | 8 +------- app/spectrum.c | 27 ++++++++++++++------------- app/spectrum.h | 3 ++- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/app/action.c b/app/action.c index dc85d92ae..49bbe8a72 100644 --- a/app/action.c +++ b/app/action.c @@ -245,6 +245,24 @@ void ACTION_Scan(bool bRestart) } #endif +void ACTION_RunSpectrum(void) +{ + #ifdef ENABLE_SPECTRUM_CHANNEL_SCAN + + if(gScanRangeStart){ + // if scanRangeStart then we enter in scan range mode + APP_RunSpectrum(SCAN_RANGE_MODE); + } + else{ + // if we are in channel mode then enter spectrum in channel mode + // otherwise enter spectrum in frequency mode + APP_RunSpectrum(IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)); + } + #elif + APP_RunSpectrum(); + #endif +} + void ACTION_SwitchDemodul(void) { gTxVfo->Modulation++; @@ -408,7 +426,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) ACTION_NextBandwidth(gTxVfo->CHANNEL_BANDWIDTH, gTxVfo->Modulation != MODULATION_AM); break; case ACTION_OPT_SPECTRUM: - APP_RunSpectrum(IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)); + ACTION_RunSpectrum(); break; #ifdef ENABLE_BLMIN_TMP_OFF case ACTION_OPT_BLMIN_TMP_OFF: diff --git a/app/action.h b/app/action.h index 767bbc4be..e01cd4e3d 100644 --- a/app/action.h +++ b/app/action.h @@ -24,6 +24,7 @@ void ACTION_Power(void); void ACTION_Monitor(void); void ACTION_Scan(bool bRestart); +void ACTION_RunSpectrum(void); #ifdef ENABLE_VOX void ACTION_Vox(void); #endif diff --git a/app/main.c b/app/main.c index 78f67f0bb..e0c7c2962 100644 --- a/app/main.c +++ b/app/main.c @@ -237,13 +237,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) gRequestSaveVFO = true; gVfoConfigureMode = VFO_CONFIGURE_RELOAD; #elif defined(ENABLE_SPECTRUM) - #ifdef ENABLE_SPECTRUM_CHANNEL_SCAN - // if we are in channel mode then enter spectrum in channel mode - // otherwise enter spectrum in frequency mode - APP_RunSpectrum(IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)); - #elif - APP_RunSpectrum(); - #endif + ACTION_RunSpectrum(); gRequestDisplayScreen = DISPLAY_MAIN; #endif } diff --git a/app/spectrum.c b/app/spectrum.c index cbe6c8c38..38be6dad1 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -285,7 +285,7 @@ uint16_t GetStepsCount() } #endif #ifdef ENABLE_SCAN_RANGES - if(gScanRangeStart) { + if(appMode==SCAN_RANGE_MODE) { return (gScanRangeStop - gScanRangeStart) / GetScanStep(); } #endif @@ -995,7 +995,7 @@ static void OnKeyDown(uint8_t key) { break; case KEY_5: #ifdef ENABLE_SCAN_RANGES - if(!gScanRangeStart && appMode!= CHANNEL_MODE) + if(appMode==FREQUENCY_MODE) #endif FreqInput(); break; @@ -1010,14 +1010,14 @@ static void OnKeyDown(uint8_t key) { { ToggleScanList(); } - else if (!gScanRangeStart) + else if (appMode!=SCAN_RANGE_MODE) { ToggleStepsCount(); } break; case KEY_SIDE2: // attenuate is disabled with scan ranges due to way scan ranges work - if (!gScanRangeStart){ + if (appMode!=SCAN_RANGE_MODE){ Attenuate(ATTENUATE_STEP); } break; @@ -1458,6 +1458,10 @@ static void Tick() { #ifdef ENABLE_SPECTRUM_CHANNEL_SCAN void APP_RunSpectrum(Mode mode) { + // reset modifiers if we launched in a different then previous mode + if(appMode!=mode){ + ResetModifiers(); + } appMode = mode; #elif void APP_RunSpectrum() { @@ -1470,7 +1474,7 @@ void APP_RunSpectrum() { } #endif #ifdef ENABLE_SCAN_RANGES - if(gScanRangeStart) { + if(mode==SCAN_RANGE_MODE) { currentFreq = initialFreq = gScanRangeStart; for(uint8_t i = 0; i < ARRAY_SIZE(scanStepValues); i++) { if(scanStepValues[i] >= gTxVfo->StepFrequency) { @@ -1595,16 +1599,13 @@ void APP_RunSpectrum() { void Attenuate(uint8_t amount) { - // we don't want to attenuate random scan measurments, only active rx measurment - if(!IsPeakOverLevel()) - return; - // we don't want to lower the whole scan minimum rssi, otherwise the screen re-renders to show new lowest signal - if((GetRssi()-amount) <= scanInfo.rssiMin) - return; // idea: consider amount to be 10% of rssiMax-rssiMin - if(attenuationOffset[scanInfo.i] < MAX_ATTENUATION){ - attenuationOffset[scanInfo.i]+=amount; + if(attenuationOffset[peak.i] < MAX_ATTENUATION){ + attenuationOffset[peak.i] += amount; isAttenuationApplied = true; + + ResetPeak(); + ResetScanStats(); } } diff --git a/app/spectrum.h b/app/spectrum.h index 93348468f..e45874aaf 100644 --- a/app/spectrum.h +++ b/app/spectrum.h @@ -95,7 +95,8 @@ typedef enum State { #ifdef ENABLE_SPECTRUM_CHANNEL_SCAN typedef enum Mode { FREQUENCY_MODE, - CHANNEL_MODE + CHANNEL_MODE, + SCAN_RANGE_MODE } Mode; #endif From 7a598e79ce4beb007b0d88b2b8b4a35f56ff6d46 Mon Sep 17 00:00:00 2001 From: Nunu Date: Tue, 30 Jan 2024 11:28:09 +0100 Subject: [PATCH 4/9] spectrum small bug fix --- app/spectrum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index 38be6dad1..4166dfa64 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -962,7 +962,7 @@ static void OnKeyDown(uint8_t key) { break; case KEY_UP: #ifdef ENABLE_SCAN_RANGES - if(appMode!=CHANNEL_MODE) + if(appMode==FREQUENCY_MODE) { #endif UpdateCurrentFreq(true); @@ -974,7 +974,7 @@ static void OnKeyDown(uint8_t key) { break; case KEY_DOWN: #ifdef ENABLE_SCAN_RANGES - if(appMode!= CHANNEL_MODE) + if(appMode==FREQUENCY_MODE) { #endif UpdateCurrentFreq(false); From 52599c06a7e4fe28724838aa6fb8ddeb16a25e49 Mon Sep 17 00:00:00 2001 From: Nunu Date: Tue, 30 Jan 2024 11:38:38 +0100 Subject: [PATCH 5/9] disable attenuate if samples > 128 --- app/spectrum.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index 4166dfa64..ddafb4cb1 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -1016,10 +1016,7 @@ static void OnKeyDown(uint8_t key) { } break; case KEY_SIDE2: - // attenuate is disabled with scan ranges due to way scan ranges work - if (appMode!=SCAN_RANGE_MODE){ - Attenuate(ATTENUATE_STEP); - } + Attenuate(ATTENUATE_STEP); break; case KEY_PTT: #ifdef ENABLE_SPECTRUM_COPY_VFO @@ -1599,6 +1596,11 @@ void APP_RunSpectrum() { void Attenuate(uint8_t amount) { + // attenuate doesn't work with more than 128 samples, + // since we select max rssi in such mode ignoring attenuation + if(scanInfo.measurementsCount > 128) + return; + // idea: consider amount to be 10% of rssiMax-rssiMin if(attenuationOffset[peak.i] < MAX_ATTENUATION){ attenuationOffset[peak.i] += amount; From 1cbba4111fcd647d93b95f5a0f3591ccf475939d Mon Sep 17 00:00:00 2001 From: Nunu Date: Tue, 30 Jan 2024 11:46:45 +0100 Subject: [PATCH 6/9] spectrum auto adjust freq change step --- app/spectrum.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index ddafb4cb1..7ca5123b7 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -600,16 +600,9 @@ static void UpdateCurrentFreqStill(bool inc) { redrawScreen = true; } -// static void UpdateFreqChangeStep(bool inc) { -// uint16_t diff = GetScanStep() * 4; -// if (inc && settings.frequencyChangeStep < 200000) { -// settings.frequencyChangeStep += diff; -// } else if (!inc && settings.frequencyChangeStep > 10000) { -// settings.frequencyChangeStep -= diff; -// } -// SYSTEM_DelayMs(100); -// redrawScreen = true; -// } +static void AutoAdjustFreqChangeStep() { + settings.frequencyChangeStep = GetBW() >> 1; +} static void ToggleModulation() { if (settings.modulationType < MODULATION_UKNOWN - 1) { @@ -642,7 +635,7 @@ static void ToggleStepsCount() { } else { settings.stepsCount--; } - settings.frequencyChangeStep = GetBW() >> 1; + AutoAdjustFreqChangeStep(); ResetModifiers(); redrawScreen = true; } @@ -1488,6 +1481,8 @@ void APP_RunSpectrum() { BackupRegisters(); + AutoAdjustFreqChangeStep(); + ResetInterrupts(); // turn of GREEN LED if spectrum was started during active RX From 79544ccb304031cbe6db90337b61199157ced4eb Mon Sep 17 00:00:00 2001 From: Nunu Date: Tue, 30 Jan 2024 13:14:27 +0100 Subject: [PATCH 7/9] fix: messenger to work reliably with all channel bandwidths --- app/messenger.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/messenger.c b/app/messenger.c index 73669dbcf..28df1eee4 100644 --- a/app/messenger.c +++ b/app/messenger.c @@ -84,9 +84,11 @@ void MSG_FSKSendData() { uint16_t deviation = 850; switch (gEeprom.VfoInfo[gEeprom.TX_VFO].CHANNEL_BANDWIDTH) { - case BK4819_FILTER_BW_WIDE: deviation = 1050; break; - case BK4819_FILTER_BW_NARROW: deviation = 850; break; - case BK4819_FILTER_BW_NARROWER: deviation = 750; break; + BK4819_FILTER_BW_WIDE: deviation = 1050; break; + BK4819_FILTER_BW_NARROW: deviation = 525; break; + BK4819_FILTER_BW_NARROWAVIATION: deviation = 350; break; + BK4819_FILTER_BW_NARROWER: deviation = 250; break; + BK4819_FILTER_BW_NARROWEST: deviation = 210; break; } //BK4819_WriteRegister(0x40, (3u << 12) | (deviation & 0xfff)); BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0xfff)); From b6e51af0e9b30ff9bffe97a657ceadb46ff1f987 Mon Sep 17 00:00:00 2001 From: Nunu Date: Tue, 30 Jan 2024 16:54:13 +0100 Subject: [PATCH 8/9] remove unused flag --- Makefile | 6 ------ README.md | 2 -- 2 files changed, 8 deletions(-) diff --git a/Makefile b/Makefile index e97cc71b3..1fdd29c59 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,6 @@ ENABLE_TX1750 := 0 ENABLE_PWRON_PASSWORD := 1 ENABLE_DTMF_CALLING := 0 -#---- DEBUG ---- -ENABLE_ULTRA_LOW_POWER_TX := 0 - # ---- CUSTOM MODS ---- ENABLE_BIG_FREQ := 1 ENABLE_SMALL_BOLD := 1 @@ -364,9 +361,6 @@ endif ifeq ($(ENABLE_DTMF_CALLING),1) CFLAGS += -DENABLE_DTMF_CALLING endif -ifeq ($(ENABLE_ULTRA_LOW_POWER_TX),1) - CFLAGS += -DENABLE_ULTRA_LOW_POWER_TX -endif ifeq ($(ENABLE_SPECTRUM_CHANNEL_SCAN),1) CFLAGS += -DENABLE_SPECTRUM_CHANNEL_SCAN endif diff --git a/README.md b/README.md index 2e90ea323..e81390e00 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ This repository is a fork of [Egzumer firmare](https://github.com/egzumer/uv-k5- * `RxOff` menu setting offsets the receive frequency by any specified amount in the range of `0-150Mhz` for use with upconverters. Allows to fine tune frequency (in `1kHz` steps) as opposed to other implementations that use hardcoded offsets. (**IMPORTANT: Make sure you set this value to 0 if not using an upconverter, when used for the first time. Otherwise it might load some random offset from EEPROM.**) * `ENABLE_SPECTRUM_COPY_VFO` allowing to exit the spectrum and fine tuning screen with PTT button and copy current peak frequency, modulation, step, bandwidth to VFO. Also entering spectrum will carry these settings from VFO (full integration). Now to enter fine tuning screen in spectrum press MENU button. This allows you to save and respond to the frequencies found much faster. * `ENABLE_SPECTRUM_SHOW_CHANNEL_NAME` shows channel number and channel name of the peak frequency in spectrum -* `ENABLE_ULTRA_LOW_POWER_TX` flag allows to transmit with ultra low power (thanks to egzumer work) for local testing of communication between radios. * `ENABLE_ADJUSTABLE_RX_GAIN_SETTINGS` keeps the rx gain settings set in spectrum mode after exit (otherwise these are always overwritten to default value), this makes much more sense considering that we have a radio with user adjustable gain so why not use it to adjust to current radio conditions, maximum gain allows to greatly increase reception in scan memory channels mode (in this configuration default gain settings are only set at boot and when exiting AM modulation mode to set it to sane value after am fix) * `VOXSen` fixed and improved VOX sensitivity setting from menu. Added `VoxDel` - VOX delay setting allowing to set value to `0` for no VOX delay which might be useful for packet radio enthusiasts (APRS etc.). * `SqTone` configurable squelch tail tones and 180* phase shift tail when in CTCSS mode @@ -159,7 +158,6 @@ ENABLE_BLMIN_TMP_OFF := 0 additional function for configurab ENABLE_SCAN_RANGES := 1 scan range mode for frequency scanning, see wiki for instructions (radio operation -> frequency scanning) ENABLE_SPECTRUM_COPY_VFO := 1 pressing MENU in spectrum mode will exit and copy current peak frequency, bw, step, modulation to current VFO, also entering spectrum will carry these settings from VFO (full integration) ENABLE_SPECTRUM_SHOW_CHANNEL_NAME := 1 shows channel number and channel name of the peak frequency in spectrum -ENABLE_ULTRA_LOW_POWER_TX := 0 transmits with ultra low power. useful for dev/testing ENABLE_ADJUSTABLE_RX_GAIN_SETTINGS := 1 keeps the rx gain settings set in spectrum mode after exit (otherwise these are always overwritten to default value), this makes much more sense considering that we have a radio with user adjustable gain so why not use it to adjust to current radio conditions, maximum gain allows to greatly increase reception in scan memory channels mode (in this configuration default gain settings are only set at boot and when exiting AM modulation mode to set it to sane value after am fix) ENABLE_SPECTRUM_CHANNEL_SCAN := 1 this enables spectrum channel scan mode (enter by going into memory mode and press F+5, this allows SUPER fast channel scanning (4.5x faster than regular scanning), regular scan of 200 memory channels takes roughly 18 seconds, spectrum memory scan takes roughly 4 seconds, if you have less channels stored i.e 50 - the spectrum memory scan will take only **1 second** ENABLE_ENCRYPTION := 1 enable ChaCha20 256 bit encryption for messenger From 34cb598b4ee06d4b88201064a31f0a55070dd0ad Mon Sep 17 00:00:00 2001 From: Nunu Date: Tue, 30 Jan 2024 18:37:06 +0100 Subject: [PATCH 9/9] fix --- app/messenger.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/messenger.c b/app/messenger.c index 28df1eee4..c73c034d0 100644 --- a/app/messenger.c +++ b/app/messenger.c @@ -84,11 +84,11 @@ void MSG_FSKSendData() { uint16_t deviation = 850; switch (gEeprom.VfoInfo[gEeprom.TX_VFO].CHANNEL_BANDWIDTH) { - BK4819_FILTER_BW_WIDE: deviation = 1050; break; - BK4819_FILTER_BW_NARROW: deviation = 525; break; - BK4819_FILTER_BW_NARROWAVIATION: deviation = 350; break; - BK4819_FILTER_BW_NARROWER: deviation = 250; break; - BK4819_FILTER_BW_NARROWEST: deviation = 210; break; + case BK4819_FILTER_BW_WIDE: deviation = 1350; break; // 20k // measurements by kamilsss655 + case BK4819_FILTER_BW_NARROW: deviation = 1200; break; // 10k + case BK4819_FILTER_BW_NARROWAVIATION: deviation = 850; break; // 5k + case BK4819_FILTER_BW_NARROWER: deviation = 850; break; // 5k + case BK4819_FILTER_BW_NARROWEST: deviation = 850; break; // 5k } //BK4819_WriteRegister(0x40, (3u << 12) | (deviation & 0xfff)); BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0xfff));