Skip to content

Commit d365896

Browse files
authored
Merge pull request #341 from armel/feature_update_v3
Feature update v3
2 parents bfc5a1e + f23861d commit d365896

23 files changed

+185
-69
lines changed

Makefile

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ENABLE_FEAT_F4HWN ?= 1
4444
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
4545
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
4646
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1
47-
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
47+
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
4848
ENABLE_FEAT_F4HWN_SLEEP ?= 1
4949
ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1
5050
ENABLE_FEAT_F4HWN_NARROWER ?= 1
@@ -224,12 +224,14 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
224224
VERSION_STRING_1 ?= v0.22
225225

226226
AUTHOR_STRING_2 ?= F4HWN
227-
VERSION_STRING_2 ?= v3.8
227+
VERSION_STRING_2 ?= v3.9
228228

229229
EDITION_STRING ?= Custom
230230

231231
AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
232232
VERSION_STRING ?= $(VERSION_STRING_2)
233+
234+
SQL_TONE ?= 550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open
233235
else
234236
AUTHOR_STRING ?= EGZUMER
235237
# the user might not have/want git installed
@@ -412,7 +414,7 @@ endif
412414
ifeq ($(ENABLE_FEAT_F4HWN),1)
413415
CFLAGS += -DENABLE_FEAT_F4HWN
414416
CFLAGS += -DALERT_TOT=10
415-
CFLAGS += -DSQL_TONE=550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open
417+
CFLAGS += -DSQL_TONE=$(SQL_TONE)
416418
CFLAGS += -DAUTHOR_STRING_1=\"$(AUTHOR_STRING_1)\" -DVERSION_STRING_1=\"$(VERSION_STRING_1)\"
417419
CFLAGS += -DAUTHOR_STRING_2=\"$(AUTHOR_STRING_2)\" -DVERSION_STRING_2=\"$(VERSION_STRING_2)\"
418420
CFLAGS += -DEDITION_STRING=\"$(EDITION_STRING)\"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Anyway, have fun.
2626
2727
# Donations
2828

29-
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 🙏🏻
29+
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 🙏🏻
3030

3131
## Table of Contents
3232

app/action.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,14 @@ void ACTION_Scan(bool bRestart)
234234
gScheduleScanListen = false;
235235
} else {
236236
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
237-
gEeprom.CURRENT_STATE = 1;
237+
if(gScanRangeStart == 0) // No ScanRange
238+
{
239+
gEeprom.CURRENT_STATE = 1;
240+
}
241+
else // ScanRange
242+
{
243+
gEeprom.CURRENT_STATE = 2;
244+
}
238245
SETTINGS_WriteCurrentState();
239246
#endif
240247
// start scanning

app/main.c

+12
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ void channelMove(uint16_t Channel)
349349
//gRequestSaveVFO = true;
350350
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
351351

352+
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
353+
gRemoveOffset = false;
354+
gPowerHigh = false;
355+
#endif
356+
352357
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
353358

354359
return;
@@ -735,6 +740,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
735740
if (!bKeyPressed) // released
736741
return;
737742

743+
/*
738744
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
739745
if(gScanRangeStart == 0) // No ScanRange
740746
{
@@ -746,6 +752,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
746752
}
747753
SETTINGS_WriteCurrentState();
748754
#endif
755+
*/
749756
ACTION_Scan(false);// toggle scanning
750757

751758
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
@@ -821,6 +828,11 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
821828
}
822829
#endif
823830

831+
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
832+
gRemoveOffset = false;
833+
gPowerHigh = false;
834+
#endif
835+
824836
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
825837

826838
if (bKeyHeld || !bKeyPressed) { // key held or released

app/menu.c

+6
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,12 @@ void MENU_AcceptSetting(void)
840840
gUnlockAllTxConfCnt = 0;
841841

842842
gSetting_F_LOCK = gSubMenuSelection;
843+
844+
#ifdef ENABLE_FEAT_F4HWN
845+
if(gSetting_F_LOCK == F_LOCK_ALL) {
846+
SETTINGS_ResetTxLock();
847+
}
848+
#endif
843849
break;
844850
}
845851
#ifndef ENABLE_FEAT_F4HWN

app/spectrum.c

+15-1
Original file line numberDiff line numberDiff line change
@@ -952,12 +952,23 @@ static void ShowChannelName(uint32_t f)
952952
if (SETTINGS_FetchChannelFrequency(i) == f)
953953
{
954954
SETTINGS_FetchChannelName(String, i);
955-
UI_PrintStringSmallBold(String[0] ? String : "--", 8, 127, 1);
955+
if (String[0] != 0) {
956+
UI_PrintStringSmallBufferNormal(String, gStatusLine + 36);
957+
//GUI_DisplaySmallest(String, 127, 1, true, true);
958+
}
956959
break;
957960
}
958961
}
959962
}
960963
}
964+
else
965+
{
966+
for (int i = 36; i < 100; i++)
967+
{
968+
gStatusLine[i] = 0b00000000;
969+
}
970+
}
971+
ST7565_BlitStatusLine();
961972
}
962973
#endif
963974

@@ -1281,6 +1292,9 @@ static void RenderStatus()
12811292
{
12821293
memset(gStatusLine, 0, sizeof(gStatusLine));
12831294
DrawStatus();
1295+
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
1296+
ShowChannelName(peak.f);
1297+
#endif
12841298
ST7565_BlitStatusLine();
12851299
}
12861300

60 KB
Binary file not shown.
60 KB
Binary file not shown.
58.2 KB
Binary file not shown.
58.2 KB
Binary file not shown.
56.5 KB
Binary file not shown.
56.5 KB
Binary file not shown.

driver/st7565.c

+19
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,25 @@ uint8_t cmds[] = {
219219
ST7565_Cmd(i);
220220
}
221221
}
222+
223+
int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max) {
224+
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
225+
}
226+
227+
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
228+
{
229+
gFrameBuffer[line][54] = 0x0c;
230+
gFrameBuffer[line][55] = 0x12;
231+
232+
gFrameBuffer[line][121] = 0x12;
233+
gFrameBuffer[line][122] = 0x0c;
234+
235+
uint8_t filled = map(value, min, max, 56, 120);
236+
237+
for (uint8_t i = 56; i <= 120; i++) {
238+
gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
239+
}
240+
}
222241
#endif
223242

224243
void ST7565_Init(void)

driver/st7565.h

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ void ST7565_WriteByte(uint8_t Value);
4343

4444
#ifdef ENABLE_FEAT_F4HWN
4545
void ST7565_ContrastAndInv(void);
46+
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value);
47+
int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max);
4648
#endif
4749

4850
#endif

radio.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -427,21 +427,19 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
427427

428428
pVfo->Compander = att.compander;
429429

430-
RADIO_ConfigureSquelchAndOutputPower(pVfo);
431-
432430
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
433431
if(gRemoveOffset)
434432
{
435433
pVfo->pTX = &pVfo->freq_config_RX;
436-
gRequestSaveChannel = 1;
437434
}
438435

439436
if(gPowerHigh)
440437
{
441438
pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
442-
gRequestSaveChannel = 1;
443439
}
444440
#endif
441+
442+
RADIO_ConfigureSquelchAndOutputPower(pVfo);
445443
}
446444

447445
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)

settings.c

+14
Original file line numberDiff line numberDiff line change
@@ -1026,3 +1026,17 @@ State[1] = 0
10261026
EEPROM_WriteBuffer(0x1F88, State);
10271027
}
10281028
#endif
1029+
1030+
#ifdef ENABLE_FEAT_F4HWN
1031+
void SETTINGS_ResetTxLock(void)
1032+
{
1033+
uint8_t State[8];
1034+
for(uint8_t channel = 0; channel < 200; channel++)
1035+
{
1036+
uint16_t OffsetVFO = channel * 16;
1037+
EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State));
1038+
State[4] |= (1 << 6);
1039+
EEPROM_WriteBuffer(OffsetVFO + 8, State);
1040+
}
1041+
}
1042+
#endif

settings.h

+3
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,7 @@ void SETTINGS_WriteBuildOptions(void);
319319
#ifdef ENABLE_FEAT_F4HWN_VOL
320320
void SETTINGS_WriteCurrentVol(void);
321321
#endif
322+
#ifdef ENABLE_FEAT_F4HWN
323+
void SETTINGS_ResetTxLock(void);
324+
#endif
322325
#endif

ui/main.c

+38-26
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,9 @@ center_line_t center_line = CENTER_LINE_NONE;
5353

5454
bool isMainOnlyInputDTMF = false;
5555

56-
static int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max) {
57-
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
58-
}
59-
6056
static bool isMainOnly()
6157
{
62-
if((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
63-
return true;
64-
else
65-
return false;
58+
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
6659
}
6760
#endif
6861

@@ -281,22 +274,15 @@ void DisplayRSSIBar(const bool now)
281274

282275
if(RxLine >= 0 && center_line != CENTER_LINE_IN_USE)
283276
{
284-
switch(RxBlink)
285-
{
286-
case 0:
287-
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
288-
break;
289-
case 1:
290-
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
291-
RxBlink = 2;
292-
break;
293-
case 2:
294-
for (uint8_t i = 8; i < 24; i++)
295-
{
296-
gFrameBuffer[RxLine][i] = 0x00;
297-
}
298-
RxBlink = 1;
299-
break;
277+
if (RxBlink == 0 || RxBlink == 1) {
278+
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
279+
if (RxBlink == 1) RxBlink = 2;
280+
} else {
281+
for (uint8_t i = 8; i < 24; i++)
282+
{
283+
gFrameBuffer[RxLine][i] = 0x00;
284+
}
285+
RxBlink = 1;
300286
}
301287
ST7565_BlitLine(RxLine);
302288
}
@@ -1070,10 +1056,11 @@ void UI_DisplayMain(void)
10701056
// ************
10711057

10721058
{ // show the TX/RX level
1073-
uint8_t Level = 0;
1059+
int8_t Level = -1;
10741060

10751061
if (mode == VFO_MODE_TX)
10761062
{ // TX power level
1063+
/*
10771064
switch (gRxVfo->OUTPUT_POWER)
10781065
{
10791066
case OUTPUT_POWER_LOW1: Level = 2; break;
@@ -1084,6 +1071,16 @@ void UI_DisplayMain(void)
10841071
case OUTPUT_POWER_MID: Level = 4; break;
10851072
case OUTPUT_POWER_HIGH: Level = 6; break;
10861073
}
1074+
1075+
if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_MID) {
1076+
Level = 4;
1077+
} else if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_HIGH) {
1078+
Level = 6;
1079+
} else {
1080+
Level = 2;
1081+
}
1082+
*/
1083+
Level = gRxVfo->OUTPUT_POWER - 1;
10871084
}
10881085
else
10891086
if (mode == VFO_MODE_RX)
@@ -1094,7 +1091,7 @@ void UI_DisplayMain(void)
10941091
Level = gVFO_RSSI_bar_level[vfo_num];
10951092
#endif
10961093
}
1097-
if(Level)
1094+
if(Level >= 0)
10981095
DrawSmallAntennaAndBars(p_line1 + LCD_WIDTH, Level);
10991096
}
11001097

@@ -1339,6 +1336,7 @@ void UI_DisplayMain(void)
13391336
#endif
13401337

13411338
#ifdef ENABLE_FEAT_F4HWN
1339+
/*
13421340
if(isMainVFO)
13431341
{
13441342
if(gMonitor)
@@ -1363,6 +1361,20 @@ void UI_DisplayMain(void)
13631361
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
13641362
}
13651363
}
1364+
*/
1365+
if (isMainVFO) {
1366+
if (gMonitor) {
1367+
sprintf(String, "MONI");
1368+
} else {
1369+
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
1370+
}
1371+
1372+
if (gSetting_set_gui) {
1373+
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
1374+
} else {
1375+
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
1376+
}
1377+
}
13661378
#endif
13671379
}
13681380

0 commit comments

Comments
 (0)