Some fixes and improvements.

This commit is contained in:
Dual Tachyon 2023-09-03 23:41:44 +01:00
parent fdfed3dc62
commit c0a9151100
10 changed files with 35 additions and 49 deletions

View File

@ -337,7 +337,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
if (gCssScanMode != CSS_SCAN_MODE_OFF) {
gCssScanMode = CSS_SCAN_MODE_FOUND;
}
if ((gStepDirection == 0 || gCssScanMode == CSS_SCAN_MODE_OFF) && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
if ((gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
g_2000041F = 1;
gDualWatchCountdown = 360;
gScheduleDualWatch = false;
@ -419,6 +419,8 @@ void FUN_00007dd4(void)
}
if (gCurrentScanList == 2) {
gNextMrChannel = gPreviousMrChannel;
} else {
goto Skip;
}
}
@ -428,6 +430,8 @@ void FUN_00007dd4(void)
}
gNextMrChannel = Ch;
Skip:
if (PreviousCh != gNextMrChannel) {
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
@ -453,7 +457,7 @@ void NOAA_IncreaseChannel(void)
}
}
void DUALWATCH_Alternate(void)
static void DUALWATCH_Alternate(void)
{
if (gIsNoaaMode) {
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) {
@ -602,7 +606,7 @@ static void FUN_00008334(void)
FUNCTION_Select(FUNCTION_0);
}
if (gCurrentFunction != FUNCTION_TRANSMIT) {
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
RADIO_PrepareTX();
gUpdateDisplay = true;
}
@ -714,7 +718,7 @@ void APP_Update(void)
}
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) {
DUALWATCH_Alternate();
g_20000382 = 0;
g_20000382 = false;
}
FUNCTION_Init();
gBatterySave = 10;
@ -730,7 +734,7 @@ void APP_Update(void)
// Authentic device checked removed
} else {
DUALWATCH_Alternate();
g_20000382 = 1;
g_20000382 = true;
gBatterySave = 10;
}
gBatterySaveCountdownExpired = false;
@ -1028,10 +1032,9 @@ void APP_TimeSlice500ms(void)
}
if (gReducedService) {
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
if ((gBatteryCurrent < 0x1f5) && (gBatteryCurrentVoltage <= gBatteryCalibration[3])) {
return;
if (gBatteryCurrent > 500 || gBatteryCalibration[3] < gBatteryCurrentVoltage) {
overlay_FLASH_RebootToBootloader();
}
overlay_FLASH_RebootToBootloader();
return;
}

View File

@ -204,7 +204,7 @@ void DTMF_HandleRequest(void)
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
} else {
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
}
} else {
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
@ -270,12 +270,12 @@ void DTMF_HandleRequest(void)
break;
default:
gDTMF_DecodeRing = false;
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
break;
}
if (g_20000439) {
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
}
}
@ -306,14 +306,14 @@ void DTMF_Reply(void)
default:
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || (gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOT && gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOTH)) {
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
return;
}
pString = gEeprom.DTMF_UP_CODE;
break;
}
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
Delay = gEeprom.DTMF_PRELOAD_TIME;
if (gEeprom.DTMF_SIDE_TONE) {
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);

View File

@ -37,7 +37,7 @@ enum DTMF_CallState_t {
typedef enum DTMF_CallState_t DTMF_CallState_t;
enum DTMF_ReplyState_t {
DTMF_REPLY_UP_CODE = 0U,
DTMF_REPLY_NONE = 0U,
DTMF_REPLY_ANI = 1U,
DTMF_REPLY_AB = 2U,
DTMF_REPLY_AAAAA = 3U,

View File

@ -502,24 +502,21 @@ void FM_Play(void)
}
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true;
} else {
if (gFM_ChannelPosition < 20) {
gFM_Channels[gFM_ChannelPosition++] = gEeprom.FM_FrequencyPlaying;
if (gEeprom.FM_UpperLimit > gEeprom.FM_FrequencyPlaying) {
FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_Step, false);
} else {
FM_PlayAndUpdate();
}
} else {
FM_PlayAndUpdate();
}
GUI_SelectNextDisplay(DISPLAY_FM);
return;
}
} else if (gFM_AutoScan) {
if (gEeprom.FM_UpperLimit > gEeprom.FM_FrequencyPlaying) {
FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_Step, false);
} else {
if (gFM_ChannelPosition < 20) {
gFM_Channels[gFM_ChannelPosition++] = gEeprom.FM_FrequencyPlaying;
}
if (gFM_ChannelPosition >= 20) {
FM_PlayAndUpdate();
GUI_SelectNextDisplay(DISPLAY_FM);
return;
}
}
if (gFM_AutoScan && gEeprom.FM_FrequencyPlaying >= gEeprom.FM_UpperLimit) {
FM_PlayAndUpdate();
} else {
FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_Step, false);
}

View File

@ -526,7 +526,7 @@ void MENU_SelectNextDCS(void)
gSubMenuSelection = NUMBER_AddWithWraparound(gSubMenuSelection, gMenuScrollDirection, 1, UpperLimit);
if (gMenuCursor == MENU_R_DCS) {
if (gSubMenuSelection > 105) {
if (gSubMenuSelection > 104) {
gCodeType = CODE_TYPE_REVERSE_DIGITAL;
gCode = gSubMenuSelection - 105;
} else {

View File

@ -65,7 +65,7 @@ void BATTERY_GetReadings(bool bDisplayBatteryLevel)
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
if ((gScreenToDisplay == DISPLAY_MENU) && gMenuCursor == MENU_VOL) {
g_20000370 = 1;
gUpdateDisplay = true;
}
if (gBatteryCurrent < 501) {
if (gChargingWithTypeC) {

12
main.c
View File

@ -14,31 +14,19 @@
* limitations under the License.
*/
#include <stdbool.h>
#include <string.h>
#include "ARMCM0.h"
#include "app/app.h"
#include "app/dtmf.h"
#include "audio.h"
#include "bsp/dp32g030/gpio.h"
#include "bsp/dp32g030/portcon.h"
#include "bsp/dp32g030/syscon.h"
#include "board.h"
#include "driver/backlight.h"
#include "driver/bk1080.h"
#include "driver/bk4819.h"
#include "driver/crc.h"
#include "driver/eeprom.h"
#include "driver/flash.h"
#include "driver/gpio.h"
#include "driver/keyboard.h"
#include "driver/st7565.h"
#include "driver/system.h"
#include "driver/systick.h"
#include "driver/uart.h"
#include "external/printf/printf.h"
#include "functions.h"
#include "helper/battery.h"
#include "helper/boot.h"
#include "misc.h"

3
misc.c
View File

@ -64,7 +64,6 @@ uint8_t gKeyLockCountdown;
uint8_t gRTTECountdown;
bool bIsInLockScreen;
uint8_t gUpdateStatus;
uint8_t g_20000370;
uint8_t gFoundCTCSS;
uint8_t gFoundCDCSS;
bool gEndOfRxDetectedMaybe;
@ -72,7 +71,7 @@ uint8_t gVFO_RSSI_Level[2];
uint8_t gReducedService;
uint8_t gBatteryVoltageIndex;
CssScanMode_t gCssScanMode;
uint8_t g_20000382;
bool g_20000382;
AlarmState_t gAlarmState;
uint16_t g_2000038E;
uint8_t g_20000393;

3
misc.h
View File

@ -114,7 +114,6 @@ extern uint8_t gKeyLockCountdown;
extern uint8_t gRTTECountdown;
extern bool bIsInLockScreen;
extern uint8_t gUpdateStatus;
extern uint8_t g_20000370;
extern uint8_t gFoundCTCSS;
extern uint8_t gFoundCDCSS;
extern bool gEndOfRxDetectedMaybe;
@ -122,7 +121,7 @@ extern uint8_t gVFO_RSSI_Level[2];
extern uint8_t gReducedService;
extern uint8_t gBatteryVoltageIndex;
extern CssScanMode_t gCssScanMode;
extern uint8_t g_20000382;
extern bool g_20000382;
extern AlarmState_t gAlarmState;
extern uint16_t g_2000038E;
extern volatile int8_t gFM_Step;

View File

@ -741,7 +741,7 @@ void RADIO_PrepareTX(void)
RADIO_SetVfoState(State);
gAlarmState = ALARM_STATE_OFF;
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
return;
}
@ -765,7 +765,7 @@ Skip:
gTxTimeoutReached = false;
gFlagEndTransmission = false;
gRTTECountdown = 0;
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
gDTMF_ReplyState = DTMF_REPLY_NONE;
}
void RADIO_EnableCxCSS(void)