Skip to content

Commit

Permalink
Merge pull request #341 from armel/feature_update_v3
Browse files Browse the repository at this point in the history
Feature update v3
  • Loading branch information
armel authored Dec 25, 2024
2 parents bfc5a1e + f23861d commit d365896
Show file tree
Hide file tree
Showing 23 changed files with 185 additions and 69 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ENABLE_FEAT_F4HWN ?= 1
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
ENABLE_FEAT_F4HWN_SLEEP ?= 1
ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1
ENABLE_FEAT_F4HWN_NARROWER ?= 1
Expand Down Expand Up @@ -224,12 +224,14 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
VERSION_STRING_1 ?= v0.22

AUTHOR_STRING_2 ?= F4HWN
VERSION_STRING_2 ?= v3.8
VERSION_STRING_2 ?= v3.9

EDITION_STRING ?= Custom

AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
VERSION_STRING ?= $(VERSION_STRING_2)

SQL_TONE ?= 550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open
else
AUTHOR_STRING ?= EGZUMER
# the user might not have/want git installed
Expand Down Expand Up @@ -412,7 +414,7 @@ endif
ifeq ($(ENABLE_FEAT_F4HWN),1)
CFLAGS += -DENABLE_FEAT_F4HWN
CFLAGS += -DALERT_TOT=10
CFLAGS += -DSQL_TONE=550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open
CFLAGS += -DSQL_TONE=$(SQL_TONE)
CFLAGS += -DAUTHOR_STRING_1=\"$(AUTHOR_STRING_1)\" -DVERSION_STRING_1=\"$(VERSION_STRING_1)\"
CFLAGS += -DAUTHOR_STRING_2=\"$(AUTHOR_STRING_2)\" -DVERSION_STRING_2=\"$(VERSION_STRING_2)\"
CFLAGS += -DEDITION_STRING=\"$(EDITION_STRING)\"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Anyway, have fun.
# Donations

Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas (4 times), Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle, Rafael Sundorf, Paul Harker, Peter Fintl, Pascal F4ICR (2 times), Mike DL2MF, Eric KI1C (2 times) and Phil G0ELM for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻
Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas (4 times), Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle, Rafael Sundorf, Paul Harker, Peter Fintl, Pascal F4ICR (2 times), Mike DL2MF, Eric KI1C (2 times), Phil G0ELM, Jérôme Lambert, Meinhard Frank Günther and Eliot Vedel for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻

## Table of Contents

Expand Down
9 changes: 8 additions & 1 deletion app/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,14 @@ void ACTION_Scan(bool bRestart)
gScheduleScanListen = false;
} else {
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
gEeprom.CURRENT_STATE = 1;
if(gScanRangeStart == 0) // No ScanRange
{
gEeprom.CURRENT_STATE = 1;
}
else // ScanRange
{
gEeprom.CURRENT_STATE = 2;
}
SETTINGS_WriteCurrentState();
#endif
// start scanning
Expand Down
12 changes: 12 additions & 0 deletions app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ void channelMove(uint16_t Channel)
//gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;

#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gRemoveOffset = false;
gPowerHigh = false;
#endif

RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);

return;
Expand Down Expand Up @@ -735,6 +740,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
if (!bKeyPressed) // released
return;

/*
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
if(gScanRangeStart == 0) // No ScanRange
{
Expand All @@ -746,6 +752,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
}
SETTINGS_WriteCurrentState();
#endif
*/
ACTION_Scan(false);// toggle scanning

gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
Expand Down Expand Up @@ -821,6 +828,11 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
}
#endif

#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gRemoveOffset = false;
gPowerHigh = false;
#endif

uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];

if (bKeyHeld || !bKeyPressed) { // key held or released
Expand Down
6 changes: 6 additions & 0 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,12 @@ void MENU_AcceptSetting(void)
gUnlockAllTxConfCnt = 0;

gSetting_F_LOCK = gSubMenuSelection;

#ifdef ENABLE_FEAT_F4HWN
if(gSetting_F_LOCK == F_LOCK_ALL) {
SETTINGS_ResetTxLock();
}
#endif
break;
}
#ifndef ENABLE_FEAT_F4HWN
Expand Down
16 changes: 15 additions & 1 deletion app/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,12 +952,23 @@ static void ShowChannelName(uint32_t f)
if (SETTINGS_FetchChannelFrequency(i) == f)
{
SETTINGS_FetchChannelName(String, i);
UI_PrintStringSmallBold(String[0] ? String : "--", 8, 127, 1);
if (String[0] != 0) {
UI_PrintStringSmallBufferNormal(String, gStatusLine + 36);
//GUI_DisplaySmallest(String, 127, 1, true, true);
}
break;
}
}
}
}
else
{
for (int i = 36; i < 100; i++)
{
gStatusLine[i] = 0b00000000;
}
}
ST7565_BlitStatusLine();
}
#endif

Expand Down Expand Up @@ -1281,6 +1292,9 @@ static void RenderStatus()
{
memset(gStatusLine, 0, sizeof(gStatusLine));
DrawStatus();
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
ShowChannelName(peak.f);
#endif
ST7565_BlitStatusLine();
}

Expand Down
Binary file added archive/f4hwn.bandscope.packed.v3.9.bin
Binary file not shown.
Binary file added archive/f4hwn.bandscope.packed.v3.9.sa818.bin
Binary file not shown.
Binary file added archive/f4hwn.broadcast.packed.v3.9.bin
Binary file not shown.
Binary file added archive/f4hwn.broadcast.packed.v3.9.sa818.bin
Binary file not shown.
Binary file added archive/f4hwn.rescueops.packed.v3.9.bin
Binary file not shown.
Binary file added archive/f4hwn.rescueops.packed.v3.9.sa818.bin
Binary file not shown.
19 changes: 19 additions & 0 deletions driver/st7565.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,25 @@ uint8_t cmds[] = {
ST7565_Cmd(i);
}
}

int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
{
gFrameBuffer[line][54] = 0x0c;
gFrameBuffer[line][55] = 0x12;

gFrameBuffer[line][121] = 0x12;
gFrameBuffer[line][122] = 0x0c;

uint8_t filled = map(value, min, max, 56, 120);

for (uint8_t i = 56; i <= 120; i++) {
gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
}
}
#endif

void ST7565_Init(void)
Expand Down
2 changes: 2 additions & 0 deletions driver/st7565.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ void ST7565_WriteByte(uint8_t Value);

#ifdef ENABLE_FEAT_F4HWN
void ST7565_ContrastAndInv(void);
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value);
int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max);
#endif

#endif
Expand Down
6 changes: 2 additions & 4 deletions radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,21 +427,19 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure

pVfo->Compander = att.compander;

RADIO_ConfigureSquelchAndOutputPower(pVfo);

#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gRemoveOffset)
{
pVfo->pTX = &pVfo->freq_config_RX;
gRequestSaveChannel = 1;
}

if(gPowerHigh)
{
pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
gRequestSaveChannel = 1;
}
#endif

RADIO_ConfigureSquelchAndOutputPower(pVfo);
}

void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
Expand Down
14 changes: 14 additions & 0 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,3 +1026,17 @@ State[1] = 0
EEPROM_WriteBuffer(0x1F88, State);
}
#endif

#ifdef ENABLE_FEAT_F4HWN
void SETTINGS_ResetTxLock(void)
{
uint8_t State[8];
for(uint8_t channel = 0; channel < 200; channel++)
{
uint16_t OffsetVFO = channel * 16;
EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State));
State[4] |= (1 << 6);
EEPROM_WriteBuffer(OffsetVFO + 8, State);
}
}
#endif
3 changes: 3 additions & 0 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,7 @@ void SETTINGS_WriteBuildOptions(void);
#ifdef ENABLE_FEAT_F4HWN_VOL
void SETTINGS_WriteCurrentVol(void);
#endif
#ifdef ENABLE_FEAT_F4HWN
void SETTINGS_ResetTxLock(void);
#endif
#endif
64 changes: 38 additions & 26 deletions ui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,9 @@ center_line_t center_line = CENTER_LINE_NONE;

bool isMainOnlyInputDTMF = false;

static int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

static bool isMainOnly()
{
if((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
return true;
else
return false;
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
}
#endif

Expand Down Expand Up @@ -281,22 +274,15 @@ void DisplayRSSIBar(const bool now)

if(RxLine >= 0 && center_line != CENTER_LINE_IN_USE)
{
switch(RxBlink)
{
case 0:
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
break;
case 1:
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
RxBlink = 2;
break;
case 2:
for (uint8_t i = 8; i < 24; i++)
{
gFrameBuffer[RxLine][i] = 0x00;
}
RxBlink = 1;
break;
if (RxBlink == 0 || RxBlink == 1) {
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
if (RxBlink == 1) RxBlink = 2;
} else {
for (uint8_t i = 8; i < 24; i++)
{
gFrameBuffer[RxLine][i] = 0x00;
}
RxBlink = 1;
}
ST7565_BlitLine(RxLine);
}
Expand Down Expand Up @@ -1070,10 +1056,11 @@ void UI_DisplayMain(void)
// ************

{ // show the TX/RX level
uint8_t Level = 0;
int8_t Level = -1;

if (mode == VFO_MODE_TX)
{ // TX power level
/*
switch (gRxVfo->OUTPUT_POWER)
{
case OUTPUT_POWER_LOW1: Level = 2; break;
Expand All @@ -1084,6 +1071,16 @@ void UI_DisplayMain(void)
case OUTPUT_POWER_MID: Level = 4; break;
case OUTPUT_POWER_HIGH: Level = 6; break;
}
if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_MID) {
Level = 4;
} else if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_HIGH) {
Level = 6;
} else {
Level = 2;
}
*/
Level = gRxVfo->OUTPUT_POWER - 1;
}
else
if (mode == VFO_MODE_RX)
Expand All @@ -1094,7 +1091,7 @@ void UI_DisplayMain(void)
Level = gVFO_RSSI_bar_level[vfo_num];
#endif
}
if(Level)
if(Level >= 0)
DrawSmallAntennaAndBars(p_line1 + LCD_WIDTH, Level);
}

Expand Down Expand Up @@ -1339,6 +1336,7 @@ void UI_DisplayMain(void)
#endif

#ifdef ENABLE_FEAT_F4HWN
/*
if(isMainVFO)
{
if(gMonitor)
Expand All @@ -1363,6 +1361,20 @@ void UI_DisplayMain(void)
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
}
}
*/
if (isMainVFO) {
if (gMonitor) {
sprintf(String, "MONI");
} else {
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
}

if (gSetting_set_gui) {
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
} else {
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
}
}
#endif
}

Expand Down
Loading

0 comments on commit d365896

Please sign in to comment.