Maybe fixed reboot when serial comms start

This commit is contained in:
OneOfEleven 2023-10-03 10:13:22 +01:00
parent 6a3a26c470
commit b3ca095af1
11 changed files with 32 additions and 34 deletions

View File

@ -28,7 +28,7 @@ ENABLE_REVERSE_BAT_SYMBOL := 1
ENABLE_CODE_SCAN_TIMEOUT := 0
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 1
ENABLE_SQUELCH_LOWER := 0
ENABLE_SQUELCH_LOWER := 1
ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1
#ENABLE_COPY_CHAN_TO_VFO := 1
@ -39,7 +39,8 @@ ENABLE_AUDIO_BAR := 1
TARGET = firmware
ifeq ($(ENABLE_LTO),1)
ifeq ($(ENABLE_LTO), 1)
# can't have LTO and OVERLAY enabled at same time
ENABLE_OVERLAY := 0
endif
@ -101,7 +102,9 @@ OBJS += app/scanner.o
ifeq ($(ENABLE_UART),1)
OBJS += app/uart.o
endif
OBJS += am_fix.o
ifeq ($(ENABLE_AM_FIX), 1)
OBJS += am_fix.o
endif
OBJS += audio.o
OBJS += bitmaps.o
OBJS += board.o
@ -134,7 +137,7 @@ OBJS += ui/welcome.o
OBJS += version.o
OBJS += main.o
ifeq ($(OS),Windows_NT)
ifeq ($(OS), Windows_NT)
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
else
TOP := $(shell pwd)
@ -163,7 +166,7 @@ CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delet
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
ifeq ($(ENABLE_LTO),1)
ifeq ($(ENABLE_LTO), 1)
# CFLAGS += -flto
CFLAGS += -flto=2
endif

View File

@ -30,12 +30,6 @@
#include "functions.h"
#include "misc.h"
// original QS front end register settings
const uint8_t orig_lna_short = 3; // 0dB
const uint8_t orig_lna = 2; // -14dB
const uint8_t orig_mixer = 3; // 0dB
const uint8_t orig_pga = 6; // -3dB
#ifdef ENABLE_AM_FIX
typedef struct

View File

@ -62,6 +62,12 @@
#include "ui/status.h"
#include "ui/ui.h"
// original QS front end register settings
const uint8_t orig_lna_short = 3; // 0dB
const uint8_t orig_lna = 2; // -14dB
const uint8_t orig_mixer = 3; // 0dB
const uint8_t orig_pga = 6; // -3dB
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
static void updateRSSI(const int vfo)
@ -538,10 +544,10 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
// ******************************************
// original setting
uint8_t lna_short = orig_lna_short;
uint8_t lna = orig_lna;
uint8_t mixer = orig_mixer;
uint8_t pga = orig_pga;
uint16_t lna_short = orig_lna_short;
uint16_t lna = orig_lna;
uint16_t mixer = orig_mixer;
uint16_t pga = orig_pga;
if (gRxVfo->AM_mode)
{ // AM
@ -577,7 +583,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
}
// apply the front end gain settings
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)lna_short << 8) | ((uint16_t)lna << 5) | ((uint16_t)mixer << 3) | ((uint16_t)pga << 0));
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
// ******************************************
@ -1728,12 +1734,7 @@ void APP_TimeSlice500ms(void)
if (gSerialConfigCountDown_500ms > 0)
{
gReducedService = true; // a serial config upload/download is in progress
// if (gCurrentFunction == FUNCTION_TRANSMIT)
// { // stop transmitting
//
// }
// gReducedService = true; // a serial config upload/download is in progress
}
// Skipped authentic device check

View File

@ -23,6 +23,11 @@
#include "frequencies.h"
#include "radio.h"
extern const uint8_t orig_lna_short;
extern const uint8_t orig_lna;
extern const uint8_t orig_mixer;
extern const uint8_t orig_pga;
void APP_EndTransmission(void);
void CHANNEL_Next(bool bFlag, int8_t Direction);
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);

View File

@ -230,8 +230,7 @@ static void CMD_0514(const uint8_t *pBuffer)
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
#endif
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
gSerialConfigCountDown_500ms = 12; // 6 sec
// turn the LCD backlight off
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
@ -248,8 +247,7 @@ static void CMD_051B(const uint8_t *pBuffer)
if (pCmd->Timestamp != Timestamp)
return;
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
gSerialConfigCountDown_500ms = 12; // 6 sec
#ifdef ENABLE_FMRADIO
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
@ -280,9 +278,8 @@ static void CMD_051D(const uint8_t *pBuffer)
if (pCmd->Timestamp != Timestamp)
return;
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
gSerialConfigCountDown_500ms = 12; // 6 sec
bReloadEeprom = false;
#ifdef ENABLE_FMRADIO
@ -404,8 +401,7 @@ static void CMD_052F(const uint8_t *pBuffer)
if (gCurrentFunction == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_FOREGROUND);
gSerialConfigCountDown_500ms = 6; // 3 sec
gSerialConfigCountDown_done = false;
gSerialConfigCountDown_500ms = 12; // 6 sec
Timestamp = pCmd->Timestamp;

Binary file not shown.

Binary file not shown.

1
misc.c
View File

@ -126,7 +126,6 @@ volatile bool gDualWatchCountdownExpired = true;
bool gDualWatchActive = false;
volatile uint8_t gSerialConfigCountDown_500ms;
volatile bool gSerialConfigCountDown_done;
volatile bool gNextTimeslice_500ms;

1
misc.h
View File

@ -196,7 +196,6 @@ extern volatile bool gDualWatchCountdownExpired;
extern bool gDualWatchActive;
extern volatile uint8_t gSerialConfigCountDown_500ms;
extern volatile bool gSerialConfigCountDown_done;
extern volatile bool gNextTimeslice_500ms;

View File

@ -57,7 +57,7 @@ void SystickHandler(void)
gNextTimeslice_500ms = true;
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
DECREMENT_AND_TRIGGER(gSerialConfigCountDown_500ms, gSerialConfigCountDown_done);
DECREMENT(gSerialConfigCountDown_500ms);
}
if ((gGlobalSysTickCounter & 3) == 0)

View File

@ -574,6 +574,7 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_AM_FIX_TEST1
case MENU_AM_FIX_TEST1:
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
// gSetting_AM_fix = gSubMenuSelection;
break;
#endif