This commit is contained in:
wu58430 2023-12-08 12:22:16 +08:00
parent 6beefb34c9
commit ff92e4aca0
15 changed files with 202 additions and 90 deletions

View file

@ -20,14 +20,21 @@
</configurations> </configurations>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="dtmf显示"> <list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="Makefile">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/scanner.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/scanner.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/Makefile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/scanner.h" beforeDir="false" afterPath="$PROJECT_DIR$/app/scanner.h" afterDir="false" /> <change beforePath="$PROJECT_DIR$/am_fix.c" beforeDir="false" afterPath="$PROJECT_DIR$/am_fix.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dcs.c" beforeDir="false" afterPath="$PROJECT_DIR$/dcs.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/am_fix.h" beforeDir="false" afterPath="$PROJECT_DIR$/am_fix.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dcs.h" beforeDir="false" afterPath="$PROJECT_DIR$/dcs.h" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/app.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/app.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ui/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/ui/main.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/spectrum.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/spectrum.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ui/scanner.c" beforeDir="false" afterPath="$PROJECT_DIR$/ui/scanner.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/compile-with-docker.bat" beforeDir="false" afterPath="$PROJECT_DIR$/compile-with-docker.bat" afterDir="false" />
<change beforePath="$PROJECT_DIR$/debugging.h" beforeDir="false" afterPath="$PROJECT_DIR$/debugging.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/firmware.ld" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/frequencies.c" beforeDir="false" afterPath="$PROJECT_DIR$/frequencies.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/radio.c" beforeDir="false" afterPath="$PROJECT_DIR$/radio.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings.c" beforeDir="false" afterPath="$PROJECT_DIR$/settings.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings.h" beforeDir="false" afterPath="$PROJECT_DIR$/settings.h" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -99,6 +106,12 @@
</key> </key>
</component> </component>
<component name="RunManager" selected="Shell Script.未命名"> <component name="RunManager" selected="Shell Script.未命名">
<configuration name="clean" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" temporary="true">
<makefile filename="$PROJECT_DIR$/Makefile" target="clean" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2" />
</configuration>
<configuration name="未命名 (1)" type="ShConfigurationType" nameIsGenerated="true"> <configuration name="未命名 (1)" type="ShConfigurationType" nameIsGenerated="true">
<option name="SCRIPT_TEXT" value="" /> <option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" /> <option name="INDEPENDENT_SCRIPT_PATH" value="true" />
@ -130,9 +143,15 @@
<method v="2" /> <method v="2" />
</configuration> </configuration>
<list> <list>
<item itemvalue="Makefile 目标.clean" />
<item itemvalue="Shell Script.未命名" /> <item itemvalue="Shell Script.未命名" />
<item itemvalue="Shell Script.未命名 (1)" /> <item itemvalue="Shell Script.未命名 (1)" />
</list> </list>
<recent_temporary>
<list>
<item itemvalue="Makefile 目标.clean" />
</list>
</recent_temporary>
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager"> <component name="TaskManager">
@ -159,42 +178,8 @@
<workItem from="1701908787854" duration="5232000" /> <workItem from="1701908787854" duration="5232000" />
<workItem from="1701917497420" duration="1955000" /> <workItem from="1701917497420" duration="1955000" />
<workItem from="1701921618473" duration="1000" /> <workItem from="1701921618473" duration="1000" />
<workItem from="1701934352200" duration="2423000" /> <workItem from="1701934352200" duration="14088000" />
</task> <workItem from="1702006730071" duration="2234000" />
<task id="LOCAL-00021" summary="按键锁定改回以前逻辑">
<created>1701563372624</created>
<option name="number" value="00021" />
<option name="presentableId" value="LOCAL-00021" />
<option name="project" value="LOCAL" />
<updated>1701563372624</updated>
</task>
<task id="LOCAL-00022" summary="mdc tx end test">
<created>1701577655637</created>
<option name="number" value="00022" />
<option name="presentableId" value="LOCAL-00022" />
<option name="project" value="LOCAL" />
<updated>1701577655637</updated>
</task>
<task id="LOCAL-00023" summary="test create">
<created>1701669851368</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1701669851368</updated>
</task>
<task id="LOCAL-00024" summary="reduce flash">
<created>1701670725835</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1701670725835</updated>
</task>
<task id="LOCAL-00025" summary="rebuild chinese">
<created>1701674241852</created>
<option name="number" value="00025" />
<option name="presentableId" value="LOCAL-00025" />
<option name="project" value="LOCAL" />
<updated>1701674241852</updated>
</task> </task>
<task id="LOCAL-00026" summary="MDC RX"> <task id="LOCAL-00026" summary="MDC RX">
<created>1701675179288</created> <created>1701675179288</created>
@ -504,7 +489,42 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1701920351386</updated> <updated>1701920351386</updated>
</task> </task>
<option name="localTasksCounter" value="70" /> <task id="LOCAL-00070" summary="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/15">
<created>1701941650076</created>
<option name="number" value="00070" />
<option name="presentableId" value="LOCAL-00070" />
<option name="project" value="LOCAL" />
<updated>1701941650076</updated>
</task>
<task id="LOCAL-00071" summary="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/15">
<created>1701941657863</created>
<option name="number" value="00071" />
<option name="presentableId" value="LOCAL-00071" />
<option name="project" value="LOCAL" />
<updated>1701941657863</updated>
</task>
<task id="LOCAL-00072" summary="增加开机画面">
<created>1701941724553</created>
<option name="number" value="00072" />
<option name="presentableId" value="LOCAL-00072" />
<option name="project" value="LOCAL" />
<updated>1701941724553</updated>
</task>
<task id="LOCAL-00073" summary="关闭MDC1200信息显示">
<created>1701941769531</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1701941769531</updated>
</task>
<task id="LOCAL-00074" summary="Makefile">
<created>1701963619702</created>
<option name="number" value="00074" />
<option name="presentableId" value="LOCAL-00074" />
<option name="project" value="LOCAL" />
<updated>1701963619702</updated>
</task>
<option name="localTasksCounter" value="75" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -528,7 +548,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="bug fix" />
<MESSAGE value="payment" /> <MESSAGE value="payment" />
<MESSAGE value="1129 190 update" /> <MESSAGE value="1129 190 update" />
<MESSAGE value="lite create" /> <MESSAGE value="lite create" />
@ -550,6 +569,10 @@
<MESSAGE value="106 MDC crc fix" /> <MESSAGE value="106 MDC crc fix" />
<MESSAGE value="fix EEPROM" /> <MESSAGE value="fix EEPROM" />
<MESSAGE value="dtmf显示" /> <MESSAGE value="dtmf显示" />
<option name="LAST_COMMIT_MESSAGE" value="dtmf显示" /> <MESSAGE value="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/15" />
<MESSAGE value="增加开机画面" />
<MESSAGE value="关闭MDC1200信息显示" />
<MESSAGE value="Makefile" />
<option name="LAST_COMMIT_MESSAGE" value="Makefile" />
</component> </component>
</project> </project>

View file

@ -45,14 +45,14 @@ ENABLE_REDUCE_LOW_MID_TX_POWER:= 0
ENABLE_BYP_RAW_DEMODULATORS := 0 ENABLE_BYP_RAW_DEMODULATORS := 0
ENABLE_BLMIN_TMP_OFF := 0 ENABLE_BLMIN_TMP_OFF := 0
ENABLE_SCAN_RANGES := 1 ENABLE_SCAN_RANGES := 1
TEST_UNDE_CTCSS := 1 ENABLE_MDC1200 := 1
ENABLE_MDC1200_SHOW_OP_ARG := 1
ENABLE_MDC1200_SIDE_BEEP := 0
# ---- DEBUGGING ---- # ---- DEBUGGING ----
ENABLE_AM_FIX_SHOW_DATA := 0 ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_AGC_SHOW_DATA := 0 ENABLE_AGC_SHOW_DATA := 0
ENABLE_MDC1200 := 1
ENABLE_MDC1200_SHOW_OP_ARG := 0
ENABLE_MDC1200_SIDE_BEEP := 0
############################################################# #############################################################
TARGET = firmware TARGET = firmware
@ -79,6 +79,9 @@ ifeq ($(ENABLE_OVERLAY),1)
OBJS += sram-overlay.o OBJS += sram-overlay.o
endif endif
OBJS += external/printf/printf.o OBJS += external/printf/printf.o
ifeq ($(ENABLE_MDC1200),1)
OBJS += app/mdc1200.o
endif
# Drivers # Drivers
OBJS += driver/adc.o OBJS += driver/adc.o
@ -107,9 +110,7 @@ OBJS += driver/systick.o
ifeq ($(ENABLE_UART),1) ifeq ($(ENABLE_UART),1)
OBJS += driver/uart.o OBJS += driver/uart.o
endif endif
ifeq ($(ENABLE_MDC1200),1)
OBJS += app/mdc1200.o
endif
# Main # Main
OBJS += app/action.o OBJS += app/action.o
ifeq ($(ENABLE_AIRCOPY),1) ifeq ($(ENABLE_AIRCOPY),1)
@ -179,7 +180,7 @@ else
endif endif
ifdef OS # windows ifdef OS # windows
RM = del /Q RM = del
FixPath = $(subst /,\,$1) FixPath = $(subst /,\,$1)
WHERE = where WHERE = where
NULL_OUTPUT = nul NULL_OUTPUT = nul
@ -209,7 +210,7 @@ endif
OBJCOPY = arm-none-eabi-objcopy OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size SIZE = arm-none-eabi-size
AUTHOR_STRING := LOSEHU AUTHOR_STRING := EGZUMER
# the user might not have/want git installed # the user might not have/want git installed
# can set own version string here (max 7 chars) # can set own version string here (max 7 chars)
ifneq (, $(shell $(WHERE) git)) ifneq (, $(shell $(WHERE) git))
@ -258,6 +259,16 @@ CFLAGS += -DAUTHOR_STRING=\"$(AUTHOR_STRING)\" -DVERSION_STRING=\"$(VERSION_STRI
ifeq ($(ENABLE_SPECTRUM),1) ifeq ($(ENABLE_SPECTRUM),1)
CFLAGS += -DENABLE_SPECTRUM CFLAGS += -DENABLE_SPECTRUM
endif endif
ifeq ($(ENABLE_MDC1200),1)
CFLAGS += -DENABLE_MDC1200
endif
ifeq ($(ENABLE_MDC1200_SHOW_OP_ARG),1)
CFLAGS += -DENABLE_MDC1200_SHOW_OP_ARG
endif
ifeq ($(ENABLE_MDC1200_SIDE_BEEP),1)
CFLAGS += -DENABLE_MDC1200_SIDE_BEEP
endif
ifeq ($(ENABLE_SWD),1) ifeq ($(ENABLE_SWD),1)
CFLAGS += -DENABLE_SWD CFLAGS += -DENABLE_SWD
endif endif
@ -375,15 +386,7 @@ endif
ifeq ($(ENABLE_FLASHLIGHT),1) ifeq ($(ENABLE_FLASHLIGHT),1)
CFLAGS += -DENABLE_FLASHLIGHT CFLAGS += -DENABLE_FLASHLIGHT
endif endif
ifeq ($(ENABLE_MDC1200),1)
CFLAGS += -DENABLE_MDC1200
endif
ifeq ($(ENABLE_MDC1200_SHOW_OP_ARG),1)
CFLAGS += -DENABLE_MDC1200_SHOW_OP_ARG
endif
ifeq ($(ENABLE_MDC1200_SIDE_BEEP),1)
CFLAGS += -DENABLE_MDC1200_SIDE_BEEP
endif
LDFLAGS = LDFLAGS =
LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld -Wl,--gc-sections LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld -Wl,--gc-sections
@ -430,7 +433,7 @@ else ifneq (,$(HAS_CRCMOD))
$(info !!!!!!!! run: pip install crcmod) $(info !!!!!!!! run: pip install crcmod)
$(info ) $(info )
else else
-$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING) $<.packed.bin -$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING) $(VERSION_STRING) $<.packed.bin
endif endif
$(SIZE) $< $(SIZE) $<
@ -458,5 +461,15 @@ bsp/dp32g030/%.h: hardware/dp32g030/%.def
-include $(DEPS) -include $(DEPS)
ifdef OS
ifeq ($(OS),Windows_NT)
clean:
.\clean.bat
else
clean: clean:
$(RM) $(call FixPath, $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS)) $(RM) $(call FixPath, $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS))
endif
else
clean:
@echo "Unsupported OS. Please use this Makefile on Windows or Linux."
endif

View file

@ -25,7 +25,7 @@
#include "app/main.h" #include "app/main.h"
#include "board.h" #include "board.h"
#include "driver/bk4819.h" #include "driver/bk4819.h"
#include "external/printf/printf.h" //#include "external/printf/printf.h"
#include "frequencies.h" #include "frequencies.h"
#include "functions.h" #include "functions.h"
#include "misc.h" #include "misc.h"
@ -303,23 +303,24 @@ void AM_fix_reset(const unsigned vfo)
// won't/don't do it for itself, we're left to bodging it ourself by // won't/don't do it for itself, we're left to bodging it ourself by
// playing with the RF front end gain setting // playing with the RF front end gain setting
// //
void AM_fix_10ms(const unsigned vfo, bool force) void AM_fix_10ms(const unsigned vfo)
{ {
if(!gSetting_AM_fix || !enabled || vfo > 1 ) if(!gSetting_AM_fix || !enabled || vfo > 1 )
return; return;
if(!force) switch (gCurrentFunction) switch (gCurrentFunction)
{ {
case FUNCTION_TRANSMIT: case FUNCTION_TRANSMIT:
case FUNCTION_BAND_SCOPE: case FUNCTION_BAND_SCOPE:
case FUNCTION_POWER_SAVE: case FUNCTION_POWER_SAVE:
case FUNCTION_FOREGROUND:
#ifdef ENABLE_AM_FIX_SHOW_DATA #ifdef ENABLE_AM_FIX_SHOW_DATA
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
#endif #endif
return; return;
// only adjust stuff if we're in one of these modes // only adjust stuff if we're in one of these modes、
case FUNCTION_FOREGROUND:
case FUNCTION_RECEIVE: case FUNCTION_RECEIVE:
case FUNCTION_MONITOR: case FUNCTION_MONITOR:
case FUNCTION_INCOMING: case FUNCTION_INCOMING:

View file

@ -23,7 +23,8 @@
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
void AM_fix_init(void); void AM_fix_init(void);
void AM_fix_reset(const unsigned vfo); void AM_fix_reset(const unsigned vfo);
void AM_fix_10ms(const unsigned vfo, bool force);
void AM_fix_10ms(const unsigned vfo);
#ifdef ENABLE_AM_FIX_SHOW_DATA #ifdef ENABLE_AM_FIX_SHOW_DATA
void AM_fix_print_data(const unsigned vfo, char *s); void AM_fix_print_data(const unsigned vfo, char *s);
#endif #endif

View file

@ -50,7 +50,7 @@
#include "driver/system.h" #include "driver/system.h"
#include "am_fix.h" #include "am_fix.h"
#include "dtmf.h" #include "dtmf.h"
#include "external/printf/printf.h" //#include "external/printf/printf.h"
#include "frequencies.h" #include "frequencies.h"
#include "functions.h" #include "functions.h"
#include "helper/battery.h" #include "helper/battery.h"
@ -1136,7 +1136,7 @@ void APP_TimeSlice10ms(void)
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
if (gRxVfo->Modulation == MODULATION_AM) if (gRxVfo->Modulation == MODULATION_AM)
AM_fix_10ms(gEeprom.RX_VFO, false); AM_fix_10ms(gEeprom.RX_VFO);
#endif #endif
if (UART_IsCommandAvailable()) if (UART_IsCommandAvailable())

View file

@ -113,7 +113,7 @@ static uint16_t GetRegMenuValue(uint8_t st) {
void LockAGC() void LockAGC()
{ {
RADIO_SetupAGC(true, lockAGC); RADIO_SetupAGC(settings.modulationType==MODULATION_AM, lockAGC);
lockAGC = true; lockAGC = true;
} }
@ -290,8 +290,12 @@ uint16_t GetRssi() {
while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) { while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) {
SYSTICK_DelayUs(100); SYSTICK_DelayUs(100);
} }
uint16_t rssi = BK4819_GetRSSI();
return BK4819_GetRSSI(); #ifdef ENABLE_AM_FIX
if(settings.modulationType==MODULATION_AM && gSetting_AM_fix)
rssi += AM_fix_get_gain_diff()*2;
#endif
return rssi;
} }
static void ToggleAudio(bool on) { static void ToggleAudio(bool on) {
@ -309,6 +313,7 @@ static void ToggleAudio(bool on) {
static void ToggleRX(bool on) { static void ToggleRX(bool on) {
isListening = on; isListening = on;
RADIO_SetupAGC(on, lockAGC);
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on); BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on);
ToggleAudio(on); ToggleAudio(on);
@ -1121,8 +1126,11 @@ static void UpdateListening() {
static void Tick() { static void Tick() {
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
if(settings.modulationType == MODULATION_AM) { if (gNextTimeslice) {
AM_fix_10ms(vfo, !lockAGC); //allow AM_Fix to apply its AGC action gNextTimeslice = false;
if(settings.modulationType == MODULATION_AM && !lockAGC) {
AM_fix_10ms(vfo); //allow AM_Fix to apply its AGC action
}
} }
#endif #endif

18
clean.bat Normal file
View file

@ -0,0 +1,18 @@
@echo off
cd /d %~dp0
rem 删除当前文件夹下的所有 .d 和 .o 文件
for /r %%i in (*.d *.o) do (
del "%%i"
)
rem 删除子文件夹下的 .d 和 .o 文件
for /d /r %%i in (*) do (
pushd "%%i"
for %%j in (*.d *.o) do (
del "%%j"
)
popd
)
echo "删除完成"

View file

@ -1,4 +1,4 @@
@echo off @echo off
docker build -t uvk5 . docker build -t uvk5 .
docker run --rm -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp firmware* compiled-firmware/" docker run -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp firmware* compiled-firmware/"
pause pause

View file

@ -4,7 +4,8 @@
#include "driver/uart.h" #include "driver/uart.h"
#include "driver/bk4819.h" #include "driver/bk4819.h"
#include "string.h" #include "string.h"
#include "external/printf/printf.h" #include <stdio.h>
#include "am_fix.h" #include "am_fix.h"

View file

@ -2,8 +2,8 @@ ENTRY(HandlerReset)
_estack = 0x20004000; /* end of 16K RAM */ _estack = 0x20004000; /* end of 16K RAM */
_Min_Heap_Size = 0x100; /* required amount of heap */ _Min_Heap_Size = 0; /* required amount of heap */
_Min_Stack_Size = 0x100; /* required amount of stack */ _Min_Stack_Size = 0x80; /* required amount of stack */
MEMORY MEMORY
{ {
@ -76,4 +76,3 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
} >RAM } >RAM
} }

View file

@ -126,6 +126,8 @@ uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step)
} }
if(step == 1) if(step == 1)
return freq; return freq;
if(step >= 1000)
step = step/2;
return (freq + (step + 1) / 2) / step * step; return (freq + (step + 1) / 2) / step * step;
} }

2
main.c
View file

@ -85,7 +85,7 @@ void Main(void)
SETTINGS_InitEEPROM(); SETTINGS_InitEEPROM();
SETTINGS_WriteBuildOptions();
SETTINGS_LoadCalibration(); SETTINGS_LoadCalibration();
#ifdef ENABLE_MDC1200 #ifdef ENABLE_MDC1200
MDC1200_init(); MDC1200_init();

View file

@ -787,7 +787,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
BK4819_DisableDTMF(); BK4819_DisableDTMF();
} }
#endif #endif
RADIO_SetupAGC(false, false); RADIO_SetupAGC(gRxVfo->Modulation == MODULATION_AM, false);
// enable/disable BK4819 selected interrupts // enable/disable BK4819 selected interrupts
#ifdef ENABLE_MDC1200 #ifdef ENABLE_MDC1200
BK4819_enable_mdc1200_rx(true); BK4819_enable_mdc1200_rx(true);
@ -954,7 +954,7 @@ void RADIO_SetupAGC(bool listeningAM, bool disable)
if(!listeningAM) { // if not actively listening AM we don't need any AM specific regulation if(!listeningAM) { // if not actively listening AM we don't need any AM specific regulation
BK4819_SetAGC(1); BK4819_SetAGC(!disable);
BK4819_InitAGC(false); BK4819_InitAGC(false);
} }
else { else {

View file

@ -717,3 +717,49 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep)
} }
} }
} }
void SETTINGS_WriteBuildOptions(void)
{
uint8_t buf[8]= {};
buf[0] = 0
#ifdef ENABLE_FMRADIO
| (1 << 0)
#endif
#ifdef ENABLE_NOAA
| (1 << 1)
#endif
#ifdef ENABLE_VOICE
| (1 << 2)
#endif
#ifdef ENABLE_VOX
| (1 << 3)
#endif
#ifdef ENABLE_ALARM
| (1 << 4)
#endif
#ifdef ENABLE_TX1750
| (1 << 5)
#endif
#ifdef ENABLE_PWRON_PASSWORD
| (1 << 6)
#endif
#ifdef ENABLE_DTMF_CALLING
| (1 << 7)
#endif
;
buf[1] = 0
#ifdef ENABLE_FLASHLIGHT
| (1 << 0)
#endif
#ifdef ENABLE_WIDE_RX
| (1 << 1)
#endif
#ifdef ENABLE_BYP_RAW_DEMODULATORS
| (1 << 2)
#endif
#ifdef ENABLE_BLMIN_TMP_OFF
| (1 << 3)
#endif
;
EEPROM_WriteBuffer(0x1FF0, buf);
}

View file

@ -273,5 +273,5 @@ void SETTINGS_SaveChannelName(uint8_t channel, const char * name);
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode); void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode);
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration); void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration);
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep); void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep);
void SETTINGS_WriteBuildOptions(void);
#endif #endif