Skip to content

Commit

Permalink
version 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
reald committed May 19, 2024
1 parent b8d33f2 commit b3de0f7
Show file tree
Hide file tree
Showing 16 changed files with 202 additions and 80 deletions.
84 changes: 55 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Anyway, have fun.

* [Main Features](#main-features)
* [Manual](#manual)
* [Manual for ARDF](#manual-for-ardf)
* [Manual for ARDF](#Specific-ARDF-Features)
* {Headphones](#headphones)
* [Radio Performance](#radio-performance)
* [User Customization](#user-customization)
* [Compiler](#compiler)
Expand Down Expand Up @@ -68,7 +69,7 @@ Anyway, have fun.

Up to date manual is available in the [Wiki section](https://github.com/egzumer/uv-k5-firmware-custom/wiki)

## Specific Manual for ARDF Features
## Specific ARDF Features

Download a [precompiled release](https://github.com/reald/uv-k5-firmware-custom/releases) or compile with ENABLE_ARDF=1 and preferable with ENABLE_PREVENT_TX=1.
To get enough free flash space disable some unneeded TX features (e.g. ENABLE_DTMF_CALLING=0).
Expand Down Expand Up @@ -96,69 +97,95 @@ Gain steps should be roughly 5dB but they are completely uncalibrated. Expect su

- Disable squelch (Menu: Sql = 0)
- Disable dual watch (Menu: RxMode = MAIN ONLY).
- Select number of foxes in menu "NumFox" (default = 5, min = 1, max = 10).
- Choose duration time of one fox transmission in menu "FoxDur". Default is 60s. Modify with up/down in 0.1s steps or enter value as *5 digit number* in 1/100s resolution. Confirm with menu button (min = 1s, max = 999.99s).
- Adjust clock correction if necessary (menu "ClkCor", details below).

- Activate VFO 1 (long pressing key "2 A/B" toggles between both VFOs).
- Enter the frequency of the foxes using the number keys.
- Select number of foxes in menu "NumFox" (default = 5, min = 1, max = 10).
- Choose duration time of one fox transmission in menu "FoxDur". Default is 60s.
Modify with UP/DOWN key in 0.1s steps or enter value as *5 digit number* in 1/100s resolution. Confirm with menu button (min = 1s, max = 999.99s).
- Activate VFO A (long pressing key "2 A/B" toggles between both VFOs.
- Enter the frequency of the foxes using the number keys. If memory mode is active long press "3 VFO MR" to change to frequency mode.
- Choose the used modulation of the foxes in menu "Demod" (e.g. AM).
- Use a narrow bandwidth mode in menu "BW W/N": "U 1K7" is 1.7 kHz, (this is the smallest possible value; shown as "U-") or "NARROWER" which is 2.5 kHz (shown as "N-" in the status bar).
- Switch to VFO 2 by long pressing "2 A/B". This VFO will mostly be used for the return beacon.
- Configure frequency, modulation and bandwidth the same way as for VFO 1.
- Change back to VFO 1 by long pressing "2 A/B".
- Select a narrow bandwidth mode in menu "BW W/N": "U 1K7" is 1.7 kHz, (this is the smallest possible value; shown as "U-") or "U 2K5" which is 2.5 kHz (shown as "N-" on the ARDF screen).
- Switch to VFO B by long pressing "2 A/B". This VFO will mostly be used for the return beacon.
- Configure frequency, modulation and bandwidth the same way as for VFO A.
- Change back to VFO A by long pressing "2 A/B".

- Unscrew antenna and add a directional antenna with good front/back ratio.
- Listen for foxes, synchronize fox number and timer in menu with "ActFox" and "TiRst" options (details below).
- Start hunting foxes and have fun!

#### Main Screen ####

<img src="/images/ardf_mainscreen.jpg" width=800 />

This is the radio screen if ARDF mode is enabled. The manual gain index value can be choosen with UP/DOWN keys from 0 to 21. RSSI_max is
the max RSSI in the last half second. This is an uncalibrated raw value. (The RSSI value next to the S-meter shows roughly dBm.)
This pictures shows the radio screen if ARDF mode is enabled. The manual gain index value can be chosen with UP/DOWN keys from 0 (silent) to 21 (max gain).
RSSI_max is the highest RSSI in the last half second. This is an uncalibrated raw value. (The RSSI value next to the S-meter shows roughly dBm.)
The **bold line** below show the settings for the **active VFO**:
VFO number "1", demodulation "USB", smallest bandwidth mode "U-" (1.7kHz) and
VFO "A", demodulation "USB", smallest bandwidth mode "U-" (1.7kHz) and
receiving frequency "144.001 MHz". For this VFO the gain remember mode (details below) is active so the gain index history for up to 5 foxes is shown.
The active fox number is bold.

The **last line** shows the configuration for the **inactive VFO**. It is recommended to put the fox settings in VFO 1 and the return beacon on VFO 2.
The **last line** shows the configuration for the **inactive VFO**. It is recommended to put the fox settings in VFO A and the return beacon on VFO B.
By long pressing "2 A/B" key can quickly be switched between both configurations.

On system boot the device starts with active fox number 1 and full duration time left. In menu "ActFox" the active fox can be changed.
The timer can be reset in menu "TiRst". Select "TiRst" with "M"-key, a triangle appears. Another press on "M"-key will reset the timer.
Use this for synchronization. Active fox and timer are shown on the top in the status bar if the menu is opened.


#### Gain Remember Mode ####
This firmware supports **gain remember** for manual gain control. If gain remember is **activated**, the
**manual gain index** is handled **for every fox seperately**. At the **beginning of a fox cycle** the **last gain
**manual gain index** is handled **for every fox separately**. At the **beginning of a fox cycle** the **last gain
index for this fox** is **restored from the last cycle**. The manual gain index history for up to 5 foxes is shown
in the lower part of the screen.

If **gain remember** is **off**, there is only one gain index for all foxes independent from any fox cycle times.
This feature can be **configured for both VFOs separately** (menu "GainRe": Off / VFO 1 / VFO 2 / BOTH).
This feature can be **configured for both VFOs separately** (menu "GainRe": Off / VFO A / VFO B / BOTH).

A usage scenario would be to configure the fox frequency on VFO 1 with gain remember mode on. Put the return beacon
frequency on VFO 2 without gain remember on. (Because the return beacon is permanently transmitting there is no need
A usage scenario would be to configure the fox frequency on VFO A with gain remember mode on. Put the return beacon
frequency on VFO B without gain remember on. (Because the return beacon is permanently transmitting there is no need
different gains in different time slots.)

You can quickly switch between both VFOs by long pressing "2 (A/B)" or a configured function key (see below).

If gain remember is not activated on the actual VFO, no gain index history is shown in the lower part of the screen.

On system boot the device starts with active fox number 1 and full duration time left. In menu "ActFox" the active fox can be changed.
The timer can be reset in menu "TiRst". Select "TiRst" with "M"-key, a triangle appears. Another press on "M"-key will reset the timer.
Use this for synchronization. Active fox and timer are shown on the top in the status bar if the menu is openend.
#### Clock Correction ####
The microcontroller clock of the radio seems to be not very precise. This leads to a heavily drifting clock. The firmware provides a correction
mechanism to reach acceptable ranges. Start ARDF mode and stop **how many seconds really pass** until **the radio tells 1 hour is up**.
(Useful settings: NumFox = 10, FoxDur = 60.00s, sync to reference clock.) The formula for the correction value is:

$$ CorrectionValue = 6000 - (StoppedSeconds * 100)/60 $$

E.g. if the radio finished 60 one minute cycles in 59 min and 36 seconds = 59 * 60 + 36 = 3576s the calculation would be:

Unscrew antenna and add a directional antenna with good front/back ratio. Start hunting foxes and have fun.
$$ CorrectionValue = 6000 - (3576 * 100)/60 = 40 $$

Enter this value in menu "ClkCor" using UP/DOWN keys (allowed range: -500 ... 500). The value is stored in eeprom.

#### Function keys ####
Two different ARDF actions can be mapped to function keys:
* Set manual gain to a medium index value (10). It is recommended to configure "ARDF Set Med.Gain" to short press on F2 key)
* Enable/Disable ARDF function (e.g. for long press on F1 key).
It is recommended to configure "Switch VFO" to F1 short.

#### Chirp ####
There is a [chirp](https://chirpmyradio.com/projects/chirp/wiki/Home) driver in folder [chirp_module/](chirp_module/) for this firmware.
The radio (including ARDF settings) can be programmed with this driver only not with the standard UV-K5 driver.

Chirp does not support separate settings for modulation and bandwidth, bandwidth is selected implicitly by the modulation.
This chirp driver uses in AM mode already "narrow" bandwidth and "U1K7" (1.7kHz) for "NAM" and "USB".

#### Notes ####
* Because four bandwidth modes are available (WIDE, NARROW, NARROWER, U 1K7) they cannot programmed with chirp at the moment. Chirps default UV K5 profile only supports 1 bit for bandwidth settings.
* The lowest possible frequency of the receiver chip is 18 Mhz. So this is NOT usable on 80 m.
* If ARDF mode is active any TX functionality is disabled. However it is recommended to compile with ENABLE_PREVENT_TX=1 to permanently disable TX. ARDF receivers with a builtin TX functionality are not permitted in official competitions anyway.
* The lowest possible frequency of the receiver chip is 18 MHz. So this is NOT usable on 80 m.
* If ARDF mode is active any TX functionality is disabled. However it is recommended to compile with ENABLE_PREVENT_TX=1 to
permanently disable TX. This is done for official releases. ARDF receivers with a builtin TX functionality are not permitted
in official competitions anyway.
* You can glue an arrow on the volume knob to keep the position under control (simply cut a triangle from a sticker).
* It is possible (but not recommended) to use memory mode instead of frequency mode on each VFO. If memory mode is active on the current VFO,
frequency and memory number are are displayed alternately one after each other. Number keys change the memory number (enter 3 digits)
and not the frequency. You can switch between memory mode and frequency mode by long pressing "3 VFO/MR" key.
* It is possible (but not recommended because it is more complicated) to use memory mode instead of frequency mode on each VFO.
If memory mode is active on the current VFO, frequency and memory number are are displayed alternately one after each other.
Number keys change the memory number (enter 3 digits) and not the frequency. You can switch between memory mode and
frequency mode by long pressing "3 VFO/MR" key.
* If you modify settings in memory mode don´t forget to save them before switching off (menu "ChSave").

#### Troubleshooting ####
Expand All @@ -168,7 +195,6 @@ and not the frequency. You can switch between memory mode and frequency mode by
* Decrease frequency step in menu "Step" to desired channel raster.
* Chirp does read different channel settings than in my radio.
* If you changed channel settings on the radio you have to store them first (menu "ChSave").
* Chirp does not support seperate settings for modulation and bandwidth. So bandwidth is selected implicitily by the modulation. This chirp driver uses in AM mode already "narrow" bandwidth and "U1K7" (1.7kHz) for "NAM" and "USB".

## Headphones

Expand Down
13 changes: 7 additions & 6 deletions app/ardf.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ b=b;
void ARDF_10ms(void)
{

if ( gARDFTime10ms >= (gARDFFoxDuration10ms * 151 / 150) ) // time correction factor: -24s in 60min
if ( gARDFTime10ms >= gARDFFoxDuration10ms_corr )
{
// new fox cycle
gARDFTime10ms = 0;
Expand Down Expand Up @@ -90,16 +90,17 @@ void ARDF_10ms(void)
}
else if ( (gScreenToDisplay == DISPLAY_ARDF) && ( (gARDFTime10ms % 50) == 0) )
{
// update most important values 2 times per second
// update most important values ~2 times per second
UI_DisplayARDF_Timer();
UI_DisplayARDF_RSSI();

gARDFRssiMax = 0;
gARDFRssiMax = BK4819_GetRSSI();

#ifdef ENABLE_AGC_SHOW_DATA
#ifdef ARDF_ENABLE_SHOW_DEBUG_DATA
UI_DisplayARDF_Debug();
#elif defined(ENABLE_AGC_SHOW_DATA)
UI_MAIN_PrintAGC(true);
#else
// UI_DisplayARDF_Debug();
center_line = CENTER_LINE_RSSI;
DisplayRSSIBar(true);
#endif
Expand All @@ -115,7 +116,6 @@ void ARDF_10ms(void)
}
}


}


Expand All @@ -140,6 +140,7 @@ void ARDF_500ms(void)

if ( u8Secnd >= 2 )
{

// update status bar every second
gUpdateStatus = 1;
u8Secnd = 0;
Expand Down
49 changes: 44 additions & 5 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ void MENU_AcceptSetting(void)
// value updated
gSetting_ARDFEnable = gSubMenuSelection;
RADIO_SetupAGC(gRxVfo->Modulation == MODULATION_AM, false); // if gSetting_ARDFEnable is set, AGC will be switched off

gARDFRequestSaveEEPROM = true;
}

Expand All @@ -510,6 +511,7 @@ void MENU_AcceptSetting(void)
{
// value updated
gARDFNumFoxes = gSubMenuSelection;

gARDFRequestSaveEEPROM = true;
}
return;
Expand All @@ -520,6 +522,8 @@ void MENU_AcceptSetting(void)
{
// value updated
gARDFFoxDuration10ms = gSubMenuSelection;
gARDFFoxDuration10ms_corr = (uint32_t)( (int32_t)gARDFFoxDuration10ms + ( (int32_t)gARDFFoxDuration10ms * (int32_t)gARDFClockCorrAddTicksPerMin)/6000 ); // fixme: limit to 1s

gARDFRequestSaveEEPROM = true;
}
return;
Expand All @@ -542,10 +546,24 @@ void MENU_AcceptSetting(void)
{
// value updated
gARDFGainRemember = gSubMenuSelection;

gARDFRequestSaveEEPROM = true;
}

return;

case MENU_ARDF_CLOCK_CORR:

if ( gARDFClockCorrAddTicksPerMin != gSubMenuSelection )
{
// value updated
gARDFClockCorrAddTicksPerMin = gSubMenuSelection;
gARDFFoxDuration10ms_corr = (uint32_t)( (int32_t)gARDFFoxDuration10ms + ( (int32_t)gARDFFoxDuration10ms * (int32_t)gARDFClockCorrAddTicksPerMin)/6000 ); // fixme: limit to 1s

gARDFRequestSaveEEPROM = true;
}
return;


#endif

Expand Down Expand Up @@ -1008,7 +1026,10 @@ void MENU_ShowCurrentSetting(void)
case MENU_ARDF_GAIN_REMEMBER:
gSubMenuSelection = gARDFGainRemember;
break;


case MENU_ARDF_CLOCK_CORR:
gSubMenuSelection = gARDFClockCorrAddTicksPerMin;
break;
#endif

case MENU_SCR:
Expand Down Expand Up @@ -1790,22 +1811,40 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)

if (UI_MENU_GetCurrentMenuId() == MENU_ARDF_FOXDURATION)
{
int32_t duration = (-Direction * 10) + gSubMenuSelection;
if (duration < 99999)
int32_t duration = (Direction * 10) + gSubMenuSelection;
if (duration <= 99999)
{
if (duration < 0)
if (duration < 100)
duration = 99999;
}
else
{
duration = 0;
duration = 100;
}

gSubMenuSelection = duration;
gRequestDisplayScreen = DISPLAY_MENU;
return;
}

if (UI_MENU_GetCurrentMenuId() == MENU_ARDF_CLOCK_CORR )
{
int16_t correction = Direction + gSubMenuSelection;
if (correction <= 500)
{
if (correction < -500)
correction = -500;
}
else
{
correction = 500;
}

gSubMenuSelection = correction;
gRequestDisplayScreen = DISPLAY_MENU;
return;
}

#endif

VFO = 0;
Expand Down
12 changes: 10 additions & 2 deletions chirp_module/uvk5_ARDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@
#seekto 0xf24;
ul32 ARDFFoxDuration;
il16 ARDFClockCorrTicksMin;
u8 __unused3:1,
ARDFGainRemember:2,
ARDFNumFoxes:4,
ARDFEnable:1;
#seekto 0xf40;
u8 int_flock;
u8 int_350tx;
Expand Down Expand Up @@ -438,7 +438,7 @@

MIC_GAIN_LIST = ["+1.1dB", "+4.0dB", "+8.0dB", "+12.0dB", "+15.1dB"]

ARDFGainRemember_LIST = ["off", "VFO 1", "VFO 2", "Both"]
ARDFGainRemember_LIST = ["off", "VFO A", "VFO B", "Both"]

def min_max_def(value, min_val, max_val, default):
"""returns value if in bounds or default otherwise"""
Expand Down Expand Up @@ -931,6 +931,9 @@ def set_settings(self, settings):
elif elname == "ARDFEnable":
_mem.ARDFEnable = element.value

elif elname == "ARDFClockCorrTicksMin":
_mem.ARDFClockCorrTicksMin = element.value

elif elname == "ARDFFoxDuration":
_mem.ARDFFoxDuration = element.value

Expand Down Expand Up @@ -1418,6 +1421,10 @@ def get_action(action_num):
tmp_ARDFFoxDuration = _mem.ARDFFoxDuration
val = RadioSettingValueInteger(100, 99999, tmp_ARDFFoxDuration)
ARDFFoxDuration_setting = RadioSetting("ARDFFoxDuration", "ARDF Fox Transmitting Duration [1/100 s] (FoxDur)", val)

tmp_ARDFClockCorrTicksMin = _mem.ARDFClockCorrTicksMin
val = RadioSettingValueInteger(-500, 500, tmp_ARDFClockCorrTicksMin)
ARDFClockCorrTicksMin_setting = RadioSetting("ARDFClockCorrTicksMin", "ARDF Clock Correction add. 10ms Ticks per Minute", val)

val = RadioSettingValueBoolean(_mem.ARDFEnable)
ARDFEnable_setting = RadioSetting("ARDFEnable", "ARDF Enable (ARDF)", val)
Expand Down Expand Up @@ -1762,6 +1769,7 @@ def validate_int_flock(value):
# ARDF
ardf.append(ARDFEnable_setting)
ardf.append(ARDFFoxDuration_setting)
ardf.append(ARDFClockCorrTicksMin_setting)
ardf.append(ARDFNumFoxes_setting)
ardf.append(ARDFGainRemember_setting)

Expand Down
2 changes: 1 addition & 1 deletion driver/bk4819.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
}
break; */

case BK4819_FILTER_BW_NARROWER: // 2.5 kHz modified for ARDF
case BK4819_FILTER_BW_NARROWER:// 2.5 kHz modified for ARDF
val = (2u << 12) | // RF filter bandwidth (010 = 2.5 kHz)
(2u << 9) | // RF filter bandwidth when signal is weak, same (010 = 2.5 kHz)
(1u << 6) | // AFTxLPF2 filter Band Width (smallest, but we don´t care about TX)
Expand Down
Binary file modified images/ardf_mainscreen.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading

0 comments on commit b3de0f7

Please sign in to comment.