diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f40416f..a4297b5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -20,14 +20,21 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -99,6 +106,12 @@
+
+
+
+
+
+
@@ -130,9 +143,15 @@
+
+
+
+
+
+
@@ -159,42 +178,8 @@
-
-
-
- 1701563372624
-
-
-
- 1701563372624
-
-
- 1701577655637
-
-
-
- 1701577655637
-
-
- 1701669851368
-
-
-
- 1701669851368
-
-
- 1701670725835
-
-
-
- 1701670725835
-
-
- 1701674241852
-
-
-
- 1701674241852
+
+
1701675179288
@@ -504,7 +489,42 @@
1701920351386
-
+
+ 1701941650076
+
+
+
+ 1701941650076
+
+
+ 1701941657863
+
+
+
+ 1701941657863
+
+
+ 1701941724553
+
+
+
+ 1701941724553
+
+
+ 1701941769531
+
+
+
+ 1701941769531
+
+
+ 1701963619702
+
+
+
+ 1701963619702
+
+
@@ -528,7 +548,6 @@
-
@@ -550,6 +569,10 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 5e348d1..7a30b2a 100644
--- a/Makefile
+++ b/Makefile
@@ -45,14 +45,14 @@ ENABLE_REDUCE_LOW_MID_TX_POWER:= 0
ENABLE_BYP_RAW_DEMODULATORS := 0
ENABLE_BLMIN_TMP_OFF := 0
ENABLE_SCAN_RANGES := 1
-TEST_UNDE_CTCSS := 1
+ENABLE_MDC1200 := 1
+ENABLE_MDC1200_SHOW_OP_ARG := 1
+ENABLE_MDC1200_SIDE_BEEP := 0
# ---- DEBUGGING ----
ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_AGC_SHOW_DATA := 0
-ENABLE_MDC1200 := 1
-ENABLE_MDC1200_SHOW_OP_ARG := 0
-ENABLE_MDC1200_SIDE_BEEP := 0
+
#############################################################
TARGET = firmware
@@ -79,6 +79,9 @@ ifeq ($(ENABLE_OVERLAY),1)
OBJS += sram-overlay.o
endif
OBJS += external/printf/printf.o
+ifeq ($(ENABLE_MDC1200),1)
+ OBJS += app/mdc1200.o
+endif
# Drivers
OBJS += driver/adc.o
@@ -107,9 +110,7 @@ OBJS += driver/systick.o
ifeq ($(ENABLE_UART),1)
OBJS += driver/uart.o
endif
-ifeq ($(ENABLE_MDC1200),1)
- OBJS += app/mdc1200.o
-endif
+
# Main
OBJS += app/action.o
ifeq ($(ENABLE_AIRCOPY),1)
@@ -179,7 +180,7 @@ else
endif
ifdef OS # windows
- RM = del /Q
+ RM = del
FixPath = $(subst /,\,$1)
WHERE = where
NULL_OUTPUT = nul
@@ -209,7 +210,7 @@ endif
OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size
-AUTHOR_STRING := LOSEHU
+AUTHOR_STRING := EGZUMER
# the user might not have/want git installed
# can set own version string here (max 7 chars)
ifneq (, $(shell $(WHERE) git))
@@ -258,6 +259,16 @@ CFLAGS += -DAUTHOR_STRING=\"$(AUTHOR_STRING)\" -DVERSION_STRING=\"$(VERSION_STRI
ifeq ($(ENABLE_SPECTRUM),1)
CFLAGS += -DENABLE_SPECTRUM
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)
CFLAGS += -DENABLE_SWD
endif
@@ -375,15 +386,7 @@ endif
ifeq ($(ENABLE_FLASHLIGHT),1)
CFLAGS += -DENABLE_FLASHLIGHT
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 += -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 )
else
- -$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING) $<.packed.bin
+ -$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING) $(VERSION_STRING) $<.packed.bin
endif
$(SIZE) $<
@@ -458,5 +461,15 @@ bsp/dp32g030/%.h: hardware/dp32g030/%.def
-include $(DEPS)
-clean:
- $(RM) $(call FixPath, $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS))
\ No newline at end of file
+ifdef OS
+ ifeq ($(OS),Windows_NT)
+ clean:
+ .\clean.bat
+ else
+ clean:
+ $(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
\ No newline at end of file
diff --git a/am_fix.c b/am_fix.c
index eef04dc..339f563 100644
--- a/am_fix.c
+++ b/am_fix.c
@@ -25,7 +25,7 @@
#include "app/main.h"
#include "board.h"
#include "driver/bk4819.h"
-#include "external/printf/printf.h"
+//#include "external/printf/printf.h"
#include "frequencies.h"
#include "functions.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
// 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 )
return;
- if(!force) switch (gCurrentFunction)
- {
+switch (gCurrentFunction)
+{
case FUNCTION_TRANSMIT:
case FUNCTION_BAND_SCOPE:
case FUNCTION_POWER_SAVE:
- case FUNCTION_FOREGROUND:
#ifdef ENABLE_AM_FIX_SHOW_DATA
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
#endif
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_MONITOR:
case FUNCTION_INCOMING:
diff --git a/am_fix.h b/am_fix.h
index 16b017e..8c6a475 100644
--- a/am_fix.h
+++ b/am_fix.h
@@ -23,7 +23,8 @@
#ifdef ENABLE_AM_FIX
void AM_fix_init(void);
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
void AM_fix_print_data(const unsigned vfo, char *s);
#endif
diff --git a/app/app.c b/app/app.c
index 51191e8..573970d 100644
--- a/app/app.c
+++ b/app/app.c
@@ -50,7 +50,7 @@
#include "driver/system.h"
#include "am_fix.h"
#include "dtmf.h"
-#include "external/printf/printf.h"
+//#include "external/printf/printf.h"
#include "frequencies.h"
#include "functions.h"
#include "helper/battery.h"
@@ -1136,7 +1136,7 @@ void APP_TimeSlice10ms(void)
#ifdef ENABLE_AM_FIX
if (gRxVfo->Modulation == MODULATION_AM)
- AM_fix_10ms(gEeprom.RX_VFO, false);
+AM_fix_10ms(gEeprom.RX_VFO);
#endif
if (UART_IsCommandAvailable())
diff --git a/app/spectrum.c b/app/spectrum.c
index 98a988d..cf9a36c 100644
--- a/app/spectrum.c
+++ b/app/spectrum.c
@@ -113,7 +113,7 @@ static uint16_t GetRegMenuValue(uint8_t st) {
void LockAGC()
{
- RADIO_SetupAGC(true, lockAGC);
+ RADIO_SetupAGC(settings.modulationType==MODULATION_AM, lockAGC);
lockAGC = true;
}
@@ -290,8 +290,12 @@ uint16_t GetRssi() {
while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) {
SYSTICK_DelayUs(100);
}
-
- return BK4819_GetRSSI();
+ uint16_t rssi = 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) {
@@ -309,6 +313,7 @@ static void ToggleAudio(bool on) {
static void ToggleRX(bool on) {
isListening = on;
+ RADIO_SetupAGC(on, lockAGC);
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on);
ToggleAudio(on);
@@ -1121,8 +1126,11 @@ static void UpdateListening() {
static void Tick() {
#ifdef ENABLE_AM_FIX
- if(settings.modulationType == MODULATION_AM) {
- AM_fix_10ms(vfo, !lockAGC); //allow AM_Fix to apply its AGC action
+ if (gNextTimeslice) {
+ gNextTimeslice = false;
+ if(settings.modulationType == MODULATION_AM && !lockAGC) {
+ AM_fix_10ms(vfo); //allow AM_Fix to apply its AGC action
+ }
}
#endif
diff --git a/clean.bat b/clean.bat
new file mode 100644
index 0000000..485cbbc
--- /dev/null
+++ b/clean.bat
@@ -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 "删除完成"
diff --git a/compile-with-docker.bat b/compile-with-docker.bat
index ae96c98..baf4a7c 100644
--- a/compile-with-docker.bat
+++ b/compile-with-docker.bat
@@ -1,4 +1,4 @@
@echo off
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
\ No newline at end of file
diff --git a/debugging.h b/debugging.h
index 38e15cf..9f1bed9 100644
--- a/debugging.h
+++ b/debugging.h
@@ -4,7 +4,8 @@
#include "driver/uart.h"
#include "driver/bk4819.h"
#include "string.h"
-#include "external/printf/printf.h"
+#include
+
#include "am_fix.h"
diff --git a/firmware.ld b/firmware.ld
index 3de1960..5d427e1 100644
--- a/firmware.ld
+++ b/firmware.ld
@@ -2,8 +2,8 @@ ENTRY(HandlerReset)
_estack = 0x20004000; /* end of 16K RAM */
-_Min_Heap_Size = 0x100; /* required amount of heap */
-_Min_Stack_Size = 0x100; /* required amount of stack */
+_Min_Heap_Size = 0; /* required amount of heap */
+_Min_Stack_Size = 0x80; /* required amount of stack */
MEMORY
{
@@ -76,4 +76,3 @@ SECTIONS
. = ALIGN(4);
} >RAM
}
-
diff --git a/frequencies.c b/frequencies.c
index 2657407..58c07bb 100644
--- a/frequencies.c
+++ b/frequencies.c
@@ -126,6 +126,8 @@ uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step)
}
if(step == 1)
return freq;
+ if(step >= 1000)
+ step = step/2;
return (freq + (step + 1) / 2) / step * step;
}
diff --git a/main.c b/main.c
index 0bdbfd6..ae24afa 100644
--- a/main.c
+++ b/main.c
@@ -85,7 +85,7 @@ void Main(void)
SETTINGS_InitEEPROM();
-
+ SETTINGS_WriteBuildOptions();
SETTINGS_LoadCalibration();
#ifdef ENABLE_MDC1200
MDC1200_init();
diff --git a/radio.c b/radio.c
index 4034f5f..102be9d 100644
--- a/radio.c
+++ b/radio.c
@@ -787,7 +787,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
BK4819_DisableDTMF();
}
#endif
- RADIO_SetupAGC(false, false);
+ RADIO_SetupAGC(gRxVfo->Modulation == MODULATION_AM, false);
// enable/disable BK4819 selected interrupts
#ifdef ENABLE_MDC1200
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
- BK4819_SetAGC(1);
+ BK4819_SetAGC(!disable);
BK4819_InitAGC(false);
}
else {
diff --git a/settings.c b/settings.c
index 9171c11..5c9e367 100644
--- a/settings.c
+++ b/settings.c
@@ -716,4 +716,50 @@ 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);
}
\ No newline at end of file
diff --git a/settings.h b/settings.h
index 19503bf..9bcc385 100644
--- a/settings.h
+++ b/settings.h
@@ -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_SaveBatteryCalibration(const uint16_t * batteryCalibration);
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep);
-
+void SETTINGS_WriteBuildOptions(void);
#endif
\ No newline at end of file