Skip to content

Commit

Permalink
Apply changes to v0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
armel committed Jan 29, 2024
1 parent ad9cc0c commit 74421ed
Show file tree
Hide file tree
Showing 23 changed files with 1,181 additions and 22 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ENABLE_KEEP_MEM_NAME ?= 1
ENABLE_WIDE_RX ?= 1
ENABLE_TX_WHEN_AM ?= 0
ENABLE_F_CAL_MENU ?= 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT ?= 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT ?= 1
ENABLE_BOOT_BEEPS ?= 0
ENABLE_SHOW_CHARGE_LEVEL ?= 0
ENABLE_REVERSE_BAT_SYMBOL ?= 0
Expand All @@ -40,6 +40,7 @@ ENABLE_REDUCE_LOW_MID_TX_POWER?= 0
ENABLE_BYP_RAW_DEMODULATORS ?= 0
ENABLE_BLMIN_TMP_OFF ?= 0
ENABLE_SCAN_RANGES ?= 1
ENABLE_FEAT_F4HWN ?= 1

# ---- DEBUGGING ----
ENABLE_AM_FIX_SHOW_DATA ?= 0
Expand Down Expand Up @@ -377,6 +378,11 @@ endif
ifeq ($(ENABLE_CUSTOM_MENU_LAYOUT),1)
CFLAGS += -DENABLE_CUSTOM_MENU_LAYOUT
endif
ifeq ($(ENABLE_FEAT_F4HWN),1)
CFLAGS += -DENABLE_FEAT_F4HWN
FEAT_STRING ?= "F4HWN v1.5"
CFLAGS += -DFEAT_STRING=\"$(FEAT_STRING)\" -DALERT_TOT=10
endif

LDFLAGS =
LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld -Wl,--gc-sections
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) .
| ENABLE_BYP_RAW_DEMODULATORS | additional BYP (bypass?) and RAW demodulation options, proved not to be very useful, but it is there if you want to experiment |
| ENABLE_BLMIN_TMP_OFF | additional function for configurable buttons that toggles `BLMin` on and off wihout saving it to the EEPROM |
| ENABLE_SCAN_RANGES | scan range mode for frequency scanning, see wiki for instructions (radio operation -> frequency scanning) |
| ENABLE_FEAT_F4HWN | improve by F4HWN |

|🧰 **DEBUGGING** ||
| ENABLE_AM_FIX_SHOW_DATA| displays settings used by AM-fix when AM transmission is received |
| ENABLE_AGC_SHOW_DATA | displays AGC settings |
Expand Down
54 changes: 54 additions & 0 deletions app/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ void (*action_opt_table[])(void) = {
#else
[ACTION_OPT_BLMIN_TMP_OFF] = &FUNCTION_NOP,
#endif

#ifdef ENABLE_FEAT_F4HWN
[ACTION_OPT_MAIN] = &ACTION_Main,
[ACTION_OPT_PTT] = &ACTION_Ptt,
#else
[ACTION_OPT_MAIN] = &FUNCTION_NOP,
#endif
};

static_assert(ARRAY_SIZE(action_opt_table) == ACTION_OPT_LEN);
Expand Down Expand Up @@ -441,3 +448,50 @@ void ACTION_BlminTmpOff(void)
}
}
#endif

#ifdef ENABLE_FEAT_F4HWN
void ACTION_Main(void)
{
static uint8_t cycle = 0;
static uint8_t a;
static uint8_t b;


if(gEeprom.DUAL_WATCH == 0 && gEeprom.CROSS_BAND_RX_TX == 0 && cycle != 1)
{
return;
}
else
{
if(cycle == 0)
{
a = gEeprom.DUAL_WATCH;
b = gEeprom.CROSS_BAND_RX_TX;

gEeprom.DUAL_WATCH = 0;
gEeprom.CROSS_BAND_RX_TX = 0;

gFlagReconfigureVfos = true;
gUpdateStatus = true;

cycle = 1;
}
else
{
gEeprom.DUAL_WATCH = a;
gEeprom.CROSS_BAND_RX_TX = b;

gFlagReconfigureVfos = true;
gUpdateStatus = true;

cycle = 0;
}
}
}

void ACTION_Ptt(void)
{
gSetting_set_ptt = (gSetting_set_ptt == 0) ? 1: 0;

}
#endif
7 changes: 6 additions & 1 deletion app/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ void ACTION_Scan(bool bRestart);
void ACTION_SwitchDemodul(void);

#ifdef ENABLE_BLMIN_TMP_OFF
void ACTION_BlminTmpOff(void);
void ACTION_BlminTmpOff(void);
#endif

#ifdef ENABLE_FEAT_F4HWN
void ACTION_Main(void);
void ACTION_Ptt(void);
#endif

void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
Expand Down
113 changes: 113 additions & 0 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,10 +825,48 @@ void APP_Update(void)
}
#endif

#ifdef ENABLE_FEAT_F4HWN
if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReachedAlert || SerialConfigInProgress()))
{
if (gEeprom.BACKLIGHT_TIME == 0) {
if (gBlinkCounter == 0)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
else if(gBlinkCounter == 250)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
}
else
{
if (gBlinkCounter == 0)
{
BACKLIGHT_TurnOn();
}
else if(gBlinkCounter == 15000)
{
BACKLIGHT_TurnOff();
}
}

gBlinkCounter++;

if(gBlinkCounter > 30000)
{
gBlinkCounter = 0;
}
}
#endif

if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReached || SerialConfigInProgress()))
{ // transmitter timed out or must de-key
gTxTimeoutReached = false;

#ifdef ENABLE_FEAT_F4HWN
gTxTimeoutReachedAlert = false;
#endif

APP_EndTransmission();

AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
Expand Down Expand Up @@ -1012,6 +1050,80 @@ static void CheckKeys(void)
#endif

// -------------------- PTT ------------------------
#ifdef ENABLE_FEAT_F4HWN
if (gSetting_set_ptt == 1)
{
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress() && gPttOnePushCounter == 0)
{ // PTT pressed
if (++gPttDebounceCounter >= 3) // 30ms
{ // start transmitting
boot_counter_10ms = 0;
gPttDebounceCounter = 0;
gPttIsPressed = true;
gPttOnePushCounter = 1;
ProcessKey(KEY_PTT, true, false);
}
}
else if ((GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress()) && gPttOnePushCounter == 1)
{
// PTT released or serial comms config in progress
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
gPttOnePushCounter = 2;
}
}
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress() && gPttOnePushCounter == 2)
{ // PTT pressed again
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
ProcessKey(KEY_PTT, false, false);
gPttIsPressed = false;
gPttOnePushCounter = 3;
if (gKeyReading1 != KEY_INVALID)
gPttWasReleased = true;
}
}
else if ((GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress()) && gPttOnePushCounter == 3)
{ // PTT released or serial comms config in progress
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
gPttOnePushCounter = 0;
}
}
else
gPttDebounceCounter = 0;
}
else
{
if (gPttIsPressed)
{
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress())
{ // PTT released or serial comms config in progress
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
{ // stop transmitting
ProcessKey(KEY_PTT, false, false);
gPttIsPressed = false;
if (gKeyReading1 != KEY_INVALID)
gPttWasReleased = true;
}
}
else
gPttDebounceCounter = 0;
}
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress())
{ // PTT pressed
if (++gPttDebounceCounter >= 3) // 30ms
{ // start transmitting
boot_counter_10ms = 0;
gPttDebounceCounter = 0;
gPttIsPressed = true;
ProcessKey(KEY_PTT, true, false);
}
}
else
gPttDebounceCounter = 0;
}
#else
if (gPttIsPressed)
{
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress())
Expand Down Expand Up @@ -1039,6 +1151,7 @@ static void CheckKeys(void)
}
else
gPttDebounceCounter = 0;
#endif

// --------------------- OTHER KEYS ----------------------------

Expand Down
30 changes: 30 additions & 0 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,17 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
break;

#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_LOW:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_LOW) - 1;
break;
case MENU_SET_PTT:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
break;
#endif

default:
return -1;
}
Expand Down Expand Up @@ -797,6 +808,16 @@ void MENU_AcceptSetting(void)
}
break;

#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_LOW:
gSetting_set_low = gSubMenuSelection;
gRequestSaveChannel = 1;
break;
case MENU_SET_PTT:
gSetting_set_ptt = gSubMenuSelection;
gRequestSaveChannel = 1;
break;
#endif
}

gRequestSaveSettings = true;
Expand Down Expand Up @@ -1159,6 +1180,15 @@ void MENU_ShowCurrentSetting(void)
break;
}

#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_LOW:
gSubMenuSelection = gSetting_set_low;
break;
case MENU_SET_PTT:
gSubMenuSelection = gSetting_set_ptt;
break;
#endif

default:
return;
}
Expand Down
7 changes: 5 additions & 2 deletions compile-with-docker.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/sh
docker build -t uvk5 .
docker run --rm -v ${PWD}/compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/"

IMAGE_NAME="uvk5"

docker build -t $IMAGE_NAME .
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/"
Loading

0 comments on commit 74421ed

Please sign in to comment.