Skip to content

Commit

Permalink
Merge pull request #305 from armel/feature_update_v3
Browse files Browse the repository at this point in the history
Feature update v3
  • Loading branch information
armel authored Nov 14, 2024
2 parents a847a3e + 1ff9e11 commit 1d08aea
Show file tree
Hide file tree
Showing 32 changed files with 428 additions and 110 deletions.
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# ---- STOCK QUANSHENG FERATURES ----
ENABLE_FMRADIO ?= 0
ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 1
ENABLE_AIRCOPY ?= 0
ENABLE_NOAA ?= 0
ENABLE_VOICE ?= 0
ENABLE_VOX ?= 1
Expand All @@ -17,7 +17,7 @@ ENABLE_DTMF_CALLING ?= 0
ENABLE_FLASHLIGHT ?= 1

# ---- CUSTOM MODS ----
ENABLE_SPECTRUM ?= 1
ENABLE_SPECTRUM ?= 0
ENABLE_BIG_FREQ ?= 1
ENABLE_SMALL_BOLD ?= 1
ENABLE_CUSTOM_MENU_LAYOUT ?= 1
Expand Down Expand Up @@ -48,6 +48,8 @@ ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
ENABLE_FEAT_F4HWN_SLEEP ?= 1
ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1
ENABLE_FEAT_F4HWN_NARROWER ?= 1
ENABLE_FEAT_F4HWN_CONTRAST ?= 1
ENABLE_FEAT_F4HWN_MENU_LOCK ?= 0
ENABLE_FEAT_F4HWN_VOL ?= 0
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
ENABLE_FEAT_F4HWN_PMR ?= 0
Expand Down Expand Up @@ -222,7 +224,9 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
VERSION_STRING_1 ?= v0.22

AUTHOR_STRING_2 ?= F4HWN
VERSION_STRING_2 ?= v3.6
VERSION_STRING_2 ?= v3.7

EDITION_STRING ?= Custom

AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
VERSION_STRING ?= $(VERSION_STRING_2)
Expand Down Expand Up @@ -411,6 +415,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
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 += -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)\"
else
CFLAGS += -DSQL_TONE=550
endif
Expand All @@ -435,6 +440,12 @@ endif
ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1)
CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER
endif
ifeq ($(ENABLE_FEAT_F4HWN_CONTRAST),1)
CFLAGS += -DENABLE_FEAT_F4HWN_CONTRAST
endif
ifneq ($(filter $(ENABLE_FEAT_F4HWN_MENU_LOCK),1 2),)
CFLAGS += -DENABLE_FEAT_F4HWN_MENU_LOCK=$(ENABLE_FEAT_F4HWN_MENU_LOCK)
endif
ifeq ($(ENABLE_FEAT_F4HWN_VOL),1)
CFLAGS += -DENABLE_FEAT_F4HWN_VOL
endif
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,14 @@ This is the least demanding option as you don't have to install enything on your

<img src="images/Code_Space_1.png" width=700 />

5. Open `Makefile`
1. Edit build options, save `Makefile` changes
1. Run `./compile-with-docker.sh` in terminal window
5. Open `Makefile`, edit build options and save changes
1. If necessary, open `compile-with-docker.sh`, edit build versions and save changes
1. Run in terminal window
- `./compile-with-docker.sh bandscope` to compile bandscope version
- `./compile-with-docker.sh broadcast` to compile broadcast version
- `./compile-with-docker.sh voxless` to compile voxless version
- `./compile-with-docker.sh all` to compile all versions
- `./compile-with-docker.sh custom` to compile only with Makefile build options
1. Open folder `compiled-firmware`
1. Right click `firmware.packed.bin`
1. Click `Download`, now you should have a firmware on your computer that you can proceed to flash on your radio. You can use [online flasher](https://egzumer.github.io/uvtools)
Expand Down
4 changes: 4 additions & 0 deletions app/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ void ACTION_Scan(bool bRestart)
gScanPauseDelayIn_10ms = 1;
gScheduleScanListen = false;
} else {
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
gEeprom.CURRENT_STATE = 1;
SETTINGS_WriteCurrentState();
#endif
// start scanning
CHFRSCANNER_Start(true, SCAN_FWD);

Expand Down
2 changes: 1 addition & 1 deletion app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ void APP_TimeSlice10ms(void)
return;
#endif

#ifndef ENABLE_FEAT_F4HWN
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK)
#ifdef ENABLE_FLASHLIGHT
FlashlightTimeSlice();
#endif
Expand Down
2 changes: 1 addition & 1 deletion app/flashlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "flashlight.h"

#ifndef ENABLE_FEAT_F4HWN
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK)
enum FlashlightMode_t gFlashLightState;

void FlashlightTimeSlice()
Expand Down
2 changes: 1 addition & 1 deletion app/flashlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <stdint.h>

#ifndef ENABLE_FEAT_F4HWN
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK)
enum FlashlightMode_t {
FLASHLIGHT_OFF = 0,
FLASHLIGHT_ON,
Expand Down
35 changes: 31 additions & 4 deletions app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
{
uint8_t Vfo = gEeprom.TX_VFO;

#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
if(gEeprom.MENU_LOCK == true) {
return; // prevent F function if MENU LOCK is true
}
#endif

if (gScreenToDisplay == DISPLAY_MENU) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
Expand Down Expand Up @@ -427,7 +433,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)

if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number

gKeyInputCountdown = (key_input_timeout_500ms / 5); // short time...
gKeyInputCountdown = (key_input_timeout_500ms / 4); // short time...

#ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;
Expand All @@ -454,8 +460,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// do nothing
return;
}

gKeyInputCountdown = (key_input_timeout_500ms / 5); // short time...
gKeyInputCountdown = (gInputBoxIndex == totalDigits) ? (key_input_timeout_500ms / 16) : (key_input_timeout_500ms / 3);

const char *inputStr = INPUTBOX_GetAscii();
uint8_t inputLength = gInputBoxIndex;
Expand Down Expand Up @@ -680,11 +686,19 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
return;
}

#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
if(gEeprom.MENU_LOCK == false) {
#endif

gFlagRefreshSetting = true;
gRequestDisplayScreen = DISPLAY_MENU;
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_MENU;
#endif

#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
}
#endif
}
else {
gRequestDisplayScreen = DISPLAY_MAIN;
Expand All @@ -694,6 +708,13 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)

static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
{

#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
if(gEeprom.MENU_LOCK == true) {
return; // prevent F function if MENU LOCK is true
}
#endif

if (gCurrentFunction == FUNCTION_TRANSMIT)
return;

Expand Down Expand Up @@ -927,7 +948,13 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
MAIN_Key_STAR(bKeyPressed, bKeyHeld);
break;
case KEY_F:
GENERIC_Key_F(bKeyPressed, bKeyHeld);
#ifndef ENABLE_FEAT_F4HWN_MENU_LOCK
GENERIC_Key_F(bKeyPressed, bKeyHeld);
#else
if(gEeprom.MENU_LOCK == false) {
GENERIC_Key_F(bKeyPressed, bKeyHeld);
}
#endif
break;
case KEY_PTT:
GENERIC_Key_PTT(bKeyPressed);
Expand Down
22 changes: 22 additions & 0 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
break;
#ifdef ENABLE_FEAT_F4HWN_CONTRAST
case MENU_SET_CTR:
*pMin = 1;
*pMax = 15;
break;
#endif
case MENU_TX_LOCK:
case MENU_SET_INV:
//*pMin = 0;
Expand All @@ -430,6 +432,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = 63;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
case MENU_SET_KEY:
//*pMin = 0;
*pMax = 4;
break;
#endif
#endif

default:
Expand Down Expand Up @@ -914,9 +922,11 @@ void MENU_AcceptSetting(void)
case MENU_SET_EOT:
gSetting_set_eot = gSubMenuSelection;
break;
#ifdef ENABLE_FEAT_F4HWN_CONTRAST
case MENU_SET_CTR:
gSetting_set_ctr = gSubMenuSelection;
break;
#endif
case MENU_SET_INV:
gSetting_set_inv = gSubMenuSelection;
break;
Expand All @@ -941,6 +951,11 @@ void MENU_AcceptSetting(void)
gEeprom.VOLUME_GAIN = gSubMenuSelection;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
case MENU_SET_KEY:
gEeprom.SET_KEY = gSubMenuSelection;
break;
#endif
case MENU_SET_TMR:
gSetting_set_tmr = gSubMenuSelection;
break;
Expand Down Expand Up @@ -1360,9 +1375,11 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_EOT:
gSubMenuSelection = gSetting_set_eot;
break;
#ifdef ENABLE_FEAT_F4HWN_CONTRAST
case MENU_SET_CTR:
gSubMenuSelection = gSetting_set_ctr;
break;
#endif
case MENU_SET_INV:
gSubMenuSelection = gSetting_set_inv;
break;
Expand All @@ -1385,6 +1402,11 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gEeprom.VOLUME_GAIN;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
case MENU_SET_KEY:
gSubMenuSelection = gEeprom.SET_KEY;
break;
#endif
case MENU_SET_TMR:
gSubMenuSelection = gSetting_set_tmr;
break;
Expand Down
34 changes: 27 additions & 7 deletions app/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,17 +867,37 @@ uint8_t Rssi2Y(uint16_t rssi)
return DrawingEndY - Rssi2PX(rssi, 0, DrawingEndY);
}

static void DrawSpectrum()
{
for (uint8_t x = 0; x < 128; ++x)
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
static void DrawSpectrum()
{
uint16_t rssi = rssiHistory[x >> settings.stepsCount];
if (rssi != RSSI_MAX_VALUE)
uint8_t ox = 0;
for (uint8_t i = 0; i < 128; ++i)
{
DrawVLine(Rssi2Y(rssi), DrawingEndY, x, true);
uint16_t rssi = rssiHistory[i >> settings.stepsCount];
if (rssi != RSSI_MAX_VALUE)
{
uint8_t x = i * 128 / GetStepsCount();
for (uint8_t xx = ox; xx < x; xx++)
{
DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true);
}
ox = x;
}
}
}
}
#else
static void DrawSpectrum()
{
for (uint8_t x = 0; x < 128; ++x)
{
uint16_t rssi = rssiHistory[x >> settings.stepsCount];
if (rssi != RSSI_MAX_VALUE)
{
DrawVLine(Rssi2Y(rssi), DrawingEndY, x, true);
}
}
}
#endif

static void DrawStatus()
{
Expand Down
Binary file added archive/f4hwn.bandscope.packed.v3.7.bin
Binary file not shown.
Binary file added archive/f4hwn.bandscope.packed.v3.7.sa818.bin
Binary file not shown.
Binary file added archive/f4hwn.broadcast.packed.v3.7.bin
Binary file not shown.
Binary file added archive/f4hwn.broadcast.packed.v3.7.sa818.bin
Binary file not shown.
Binary file added archive/f4hwn.rescueops.packed.v3.7.bin
Binary file not shown.
Binary file added archive/f4hwn.rescueops.packed.v3.7.sa818.bin
Binary file not shown.
Binary file added archive/f4hwn.voxless.packed.v3.7.bin
Binary file not shown.
Binary file added archive/f4hwn.voxless.packed.v3.7.sa818.bin
Binary file not shown.
46 changes: 40 additions & 6 deletions bitmaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,40 @@ const uint8_t gFontPttClassic[2][6] =
{0x00, 0x7f, 0x40, 0x40, 0x40, 0x40},
};

const uint8_t gFontF[1][8] =
const uint8_t gFontF[8] =
{
{0x7f, 0x00, 0x76, 0x76, 0x76, 0x76, 0x7e, 0x7f}, // 'F'
0b01111111,
0b00000000,
0b01110110,
0b01110110,
0b01110110,
0b01110110,
0b01111110,
0b01111111
};

const uint8_t gFontS[1][6] =
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
const uint8_t gFontR[8] =
{
0b01111111,
0b00000000,
0b01110110,
0b01110110,
0b01100110,
0b01010110,
0b00111001,
0b01111111
};
#endif

const uint8_t gFontS[6] =
{
{0x26, 0x49, 0x49, 0x49, 0x49, 0x32}, // 'S'
0x26, 0x49, 0x49, 0x49, 0x49, 0x32 // 'S'
};

const uint8_t gFontKeyLock[1][9] =
const uint8_t gFontKeyLock[9] =
{
{0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c}
0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c
};

const uint8_t gFontLight[9] =
Expand Down Expand Up @@ -280,6 +301,7 @@ const uint8_t BITMAP_compand[6] =
0b00100100
};

/*
const uint8_t BITMAP_Ready[7] =
{
0b00001000,
Expand All @@ -291,6 +313,18 @@ const uint8_t BITMAP_Ready[7] =
0b00000010,
};
const uint8_t BITMAP_NotReady[7] =
{
0b00000000,
0b01000010,
0b00100100,
0b00011000,
0b00100100,
0b01000010,
0b00000000,
};
*/

const uint8_t BITMAP_PowerUser[3] =
{ // 'arrow' symbol
0b00111110,
Expand Down
Loading

0 comments on commit 1d08aea

Please sign in to comment.