Merge pull request #1 from armel/feature_update

Feature update
This commit is contained in:
Armel FAUVEAU
2024-03-14 18:48:42 +01:00
committed by GitHub
20 changed files with 218 additions and 77 deletions

View File

@@ -38,7 +38,7 @@ ENABLE_COPY_CHAN_TO_VFO ?= 1
ENABLE_SPECTRUM ?= 1
ENABLE_REDUCE_LOW_MID_TX_POWER?= 0
ENABLE_BYP_RAW_DEMODULATORS ?= 0
ENABLE_BLMIN_TMP_OFF ?= 1
ENABLE_BLMIN_TMP_OFF ?= 0
ENABLE_SCAN_RANGES ?= 1
ENABLE_FEAT_F4HWN ?= 1
@@ -55,7 +55,11 @@ ENABLE_LTO ?= 1
#############################################################
TARGET = firmware
ifeq ($(ENABLE_FEAT_F4HWN),1)
TARGET = f4hwn
else
TARGET = firmware
endif
ifeq ($(ENABLE_CLANG),1)
# GCC's linker, ld, doesn't understand LLVM's generated bytecode
@@ -206,7 +210,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
VERSION_STRING_1 ?= v0.22
AUTHOR_STRING_2 ?= F4HWN
VERSION_STRING_2 ?= v2.2
VERSION_STRING_2 ?= v2.3
AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
VERSION_STRING ?= $(VERSION_STRING_2)
@@ -235,7 +239,8 @@ endif
CFLAGS =
ifeq ($(ENABLE_CLANG),0)
CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD
CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD

View File

@@ -47,6 +47,7 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier, Fr
* Step value,
* CTCSS or DCS value,
* KeyLock message,
* last RX,
* and more...
* new menu entries:
* add SetLow menu to set low power (<20mW, 125mW, 250mW, 500mW and 1W),
@@ -71,6 +72,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier, Fr
* new key combinations:
* add the F + UP or F + DOWN key combination to dynamically change the Squelch level,
* add the F + F1 or F + F2 key combination to dynamically change the Step,
* add F+8 to quickly switch backlight between BLMin and BLMax on demand (this bypass BackLt strategy),
* add F+9 to return to BackLt strategy.
* many fix:
* squelch,
* s-meter,
@@ -79,7 +82,6 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier, Fr
* scan range limit,
* and more...
* enabled ENABLE_CTCSS_TAIL_PHASE_SHIFT,
* enabled ENABLE_BLMIN_TMP_OFF,
* disabled ENABLE_DTMF_CALLING,
* disabled SCRAMBLER,
* unlock TX on all bands needs only to be repeat 3 times,

View File

@@ -105,6 +105,7 @@ void (*action_opt_table[])(void) = {
[ACTION_OPT_RXMODE] = &ACTION_RxMode,
[ACTION_OPT_PTT] = &ACTION_Ptt,
[ACTION_OPT_WN] = &ACTION_Wn,
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
#else
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
#endif
@@ -487,4 +488,37 @@ void ACTION_Wn(void)
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
#endif
}
void ACTION_BackLight(void)
{
if(gBackLight)
{
gEeprom.BACKLIGHT_TIME = gBacklightTimeOriginal;
}
gBackLight = false;
BACKLIGHT_TurnOn();
}
void ACTION_BackLightOnDemand(void)
{
if(gBackLight == false)
{
gBacklightTimeOriginal = gEeprom.BACKLIGHT_TIME;
gEeprom.BACKLIGHT_TIME = 7;
gBackLight = true;
}
else
{
if(gBacklightBrightnessOld == gEeprom.BACKLIGHT_MAX)
{
gEeprom.BACKLIGHT_TIME = 0;
}
else
{
gEeprom.BACKLIGHT_TIME = 7;
}
}
BACKLIGHT_TurnOn();
}
#endif

View File

@@ -39,6 +39,8 @@ void ACTION_SwitchDemodul(void);
void ACTION_RxMode(void);
void ACTION_Ptt(void);
void ACTION_Wn(void);
void ACTION_BackLightOnDemand(void);
void ACTION_BackLight(void);
#endif
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);

View File

@@ -161,15 +161,19 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
break;
case KEY_2:
#ifdef ENABLE_FEAT_F4HWN
gVfoConfigureMode = VFO_CONFIGURE;
#endif
COMMON_SwitchVFOs();
if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
break;
case KEY_3:
#ifdef ENABLE_FEAT_F4HWN
gVfoConfigureMode = VFO_CONFIGURE;
#endif
COMMON_SwitchVFOMode();
if (beep)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@@ -456,6 +460,17 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gWasFKeyPressed = false;
gUpdateStatus = true;
if(Key == 8)
{
ACTION_BackLightOnDemand();
return;
}
else if(Key == 9)
{
ACTION_BackLight();
return;
}
processFKeyFunction(Key, true);
}

View File

@@ -559,6 +559,9 @@ void MENU_AcceptSetting(void)
case MENU_ABR:
gEeprom.BACKLIGHT_TIME = gSubMenuSelection;
#ifdef ENABLE_FEAT_F4HWN
gBackLight = false;
#endif
break;
case MENU_ABR_MIN:
@@ -1007,7 +1010,18 @@ void MENU_ShowCurrentSetting(void)
#endif
case MENU_ABR:
gSubMenuSelection = gEeprom.BACKLIGHT_TIME;
#ifdef ENABLE_FEAT_F4HWN
if(gBackLight)
{
gSubMenuSelection = gBacklightTimeOriginal;
}
else
{
gSubMenuSelection = gEeprom.BACKLIGHT_TIME;
}
#else
gSubMenuSelection = gEeprom.BACKLIGHT_TIME;
#endif
break;
case MENU_ABR_MIN:

View File

@@ -44,9 +44,8 @@ const uint8_t gFontKeyLock[1][8] =
{0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c}
};
const uint8_t gFontScanAll[10] =
const uint8_t gFontScanAll[9] =
{
0b00000000,
0b00111110,
0b01000001,
0b01000001,
@@ -58,12 +57,18 @@ const uint8_t gFontScanAll[10] =
0b00111110
};
/*
const uint8_t gFontF[1][7] =
const uint8_t gFontLight[9] =
{
{0x7f, 0x7f, 0x41, 0x75, 0x75, 0x7f, 0x7f},
0b00001100,
0b00010010,
0b00100001,
0b01101101,
0b01111001,
0b01101101,
0b00100001,
0b00010010,
0b00001100,
};
*/
const uint8_t gFontXB[2][6] =
{ // "XB"

View File

@@ -11,10 +11,9 @@ extern const uint8_t gFontPttOnePush[2][6];
extern const uint8_t gFontPttClassic[2][6];
extern const uint8_t gFontFM[2][6];
extern const uint8_t gFontKeyLock[1][8];
extern const uint8_t gFontScanAll[10];
/*
extern const uint8_t gFontF[1][7];
*/
extern const uint8_t gFontScanAll[9];
extern const uint8_t gFontLight[9];
extern const uint8_t gFontXB[2][6];
extern const uint8_t gFontMO[2][6];
extern const uint8_t gFontDWR[3][6];

View File

@@ -3,4 +3,4 @@
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/"
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make && cp f4hwn* compiled-firmware/"

View File

@@ -24,6 +24,7 @@
#ifdef ENABLE_FEAT_F4HWN
#include "driver/system.h"
#include "audio.h"
#include "misc.h"
#endif
// this is decremented once every 500ms
@@ -57,32 +58,45 @@ void BACKLIGHT_InitHardware()
0;
}
static void BACKLIGHT_Sound(void)
{
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL)
{
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
gK5startup = false;
}
}
void BACKLIGHT_TurnOn(void)
{
#ifdef ENABLE_FEAT_F4HWN
gBacklightBrightnessOld = BACKLIGHT_GetBrightness();
#endif
if (gEeprom.BACKLIGHT_TIME == 0) {
BACKLIGHT_TurnOff();
#ifdef ENABLE_FEAT_F4HWN
if(gK5startup == true)
{
BACKLIGHT_Sound();
}
#endif
return;
}
backlightOn = true;
#ifdef ENABLE_FEAT_F4HWN
static bool k5Startup = true;
if(k5Startup == true) {
if(gK5startup == true) {
for(uint8_t i = 0; i <= gEeprom.BACKLIGHT_MAX; i++)
{
BACKLIGHT_SetBrightness(i);
SYSTEM_DelayMs(50);
}
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL)
{
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
}
k5Startup = false;
BACKLIGHT_Sound();
}
else
{

5
misc.c
View File

@@ -276,7 +276,10 @@ uint8_t gIsLocked = 0xFF;
#ifdef ENABLE_FEAT_F4HWN
bool gPttOnePush = true;
bool gK5startup = true;
bool gBackLight = false;
uint8_t gBacklightTimeOriginal;
uint8_t gBacklightBrightnessOld;
uint8_t gPttOnePushCounter = 0;
uint32_t gBlinkCounter = 0;
#endif

4
misc.h
View File

@@ -343,6 +343,10 @@ extern uint8_t gIsLocked;
extern volatile uint8_t boot_counter_10ms;
#ifdef ENABLE_FEAT_F4HWN
extern bool gK5startup;
extern bool gBackLight;
extern uint8_t gBacklightTimeOriginal;
extern uint8_t gBacklightBrightnessOld;
extern uint8_t gPttOnePushCounter;
extern uint32_t gBlinkCounter;
#endif

View File

@@ -528,7 +528,20 @@ void SETTINGS_SaveSettings(void)
State[2] = gEeprom.CROSS_BAND_RX_TX;
State[3] = gEeprom.BATTERY_SAVE;
State[4] = gEeprom.DUAL_WATCH;
State[5] = gEeprom.BACKLIGHT_TIME;
#ifdef ENABLE_FEAT_F4HWN
if(gBackLight)
{
State[5] = gBacklightTimeOriginal;
}
else
{
State[5] = gEeprom.BACKLIGHT_TIME;
}
#else
State[5] = gEeprom.BACKLIGHT_TIME;
#endif
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
State[7] = gEeprom.VFO_OPEN;
EEPROM_WriteBuffer(0x0E78, State);

View File

@@ -99,6 +99,7 @@ enum ACTION_OPT_t {
ACTION_OPT_RXMODE,
ACTION_OPT_PTT,
ACTION_OPT_WN,
ACTION_OPT_BACKLIGHT,
#endif
ACTION_OPT_LEN
};

View File

@@ -199,6 +199,7 @@ static void sort(int16_t *a, int16_t *b)
}
#ifdef ENABLE_FEAT_F4HWN
/*
void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black)
{
if(x2==x1) {
@@ -218,6 +219,7 @@ static void sort(int16_t *a, int16_t *b)
}
}
}
*/
void PutPixel(uint8_t x, uint8_t y, bool fill) {
UI_DrawPixelBuffer(gFrameBuffer, x, y, fill);

View File

@@ -33,7 +33,7 @@ void UI_DisplayPopup(const char *string);
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black);
#ifdef ENABLE_FEAT_F4HWN
void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
//void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
void PutPixel(uint8_t x, uint8_t y, bool fill);
void PutPixelStatus(uint8_t x, uint8_t y, bool fill);
void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y, bool statusbar, bool fill);

View File

@@ -45,10 +45,12 @@
center_line_t center_line = CENTER_LINE_NONE;
#ifdef ENABLE_FEAT_F4HWN
static bool RxBlink;
static int8_t RxBlink;
static int8_t RxBlinkLed = 0;
static int8_t RxBlinkLedCounter;
static int8_t RxLine;
static uint32_t RxOnVfofrequency;
bool isMainOnlyInputDTMF = false;
static bool isMainOnly(bool checkGui)
@@ -264,6 +266,7 @@ void DisplayRSSIBar(const bool now)
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
#ifdef ENABLE_FEAT_F4HWN
/*
const char empty[] = {
0b00000000,
0b00000000,
@@ -273,6 +276,7 @@ void DisplayRSSIBar(const bool now)
0b00000000,
0b00000000,
};
*/
unsigned int line;
if (isMainOnly(false))
@@ -284,28 +288,29 @@ void DisplayRSSIBar(const bool now)
line = 3;
}
char rx[4];
//char rx[4];
//sprintf(String, "%d", RxBlink);
//UI_PrintStringSmallBold(String, 80, 0, RxLine);
if(RxLine >= 0 && center_line != CENTER_LINE_IN_USE)
{
if(RxBlink == true)
switch(RxBlink)
{
sprintf(rx, "%s", "RX");
//UI_PrintStringSmallBold("RX", 14, 0, RxLine);
RxBlink = false;
case 0:
UI_PrintStringSmallBold("RX", 14, 0, RxLine);
break;
case 1:
UI_PrintStringSmallBold("RX", 14, 0, RxLine);
RxBlink = 2;
break;
case 2:
for (uint8_t i = 14; i < 30; i++)
{
gFrameBuffer[RxLine][i] = 0x00;
}
RxBlink = 1;
break;
}
else
{
sprintf(rx, "%s", " ");
memcpy(gFrameBuffer[RxLine] + 14, &empty, ARRAY_SIZE(empty));
memcpy(gFrameBuffer[RxLine] + 21, &empty, ARRAY_SIZE(empty));
//UI_PrintStringSmallBold(" ", 14, 0, RxLine);
RxBlink = true;
}
UI_PrintStringSmallBold(rx, 14, 0, RxLine);
ST7565_BlitLine(RxLine);
}
#else
@@ -646,21 +651,29 @@ void UI_DisplayMain(void)
if(gScanRangeStart) {
#ifdef ENABLE_FEAT_F4HWN
uint8_t shift = 0;
//if(IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1])) {
if(IS_FREQ_CHANNEL(gEeprom.ScreenChannel[activeTxVFO])) {
if (isMainOnly(false))
{
shift = 3;
uint8_t shift = 0;
if (isMainOnly(false))
{
shift = 3;
}
UI_PrintString("ScnRng", 5, 0, line + shift, 8);
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
if (!isMainOnly(false))
continue;
}
else
{
gScanRangeStart = 0;
}
UI_PrintString("ScnRng", 5, 0, line + shift, 8);
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
if (!isMainOnly(false))
continue;
#else
UI_PrintString("ScnRng", 5, 0, line, 8);
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
@@ -745,6 +758,8 @@ void UI_DisplayMain(void)
memcpy(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
}
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting
@@ -768,14 +783,15 @@ void UI_DisplayMain(void)
#ifdef ENABLE_FEAT_F4HWN
RxBlinkLed = 1;
RxBlinkLedCounter = 0;
RxLine = line;
RxOnVfofrequency = frequency;
if(!isMainVFO)
{
RxLine = line;
RxBlink = 1;
}
else
{
RxLine = -1;
UI_PrintStringSmallBold("RX", 14, 0, line);
RxBlink = 0;
}
#else
UI_PrintStringSmallBold("RX", 14, 0, line);
@@ -784,6 +800,12 @@ void UI_DisplayMain(void)
#ifdef ENABLE_FEAT_F4HWN
else
{
if(RxOnVfofrequency == frequency && !isMainOnly(false))
{
UI_PrintStringSmallNormal(">>", 14, 0, line);
//memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
}
if(RxBlinkLed == 1)
RxBlinkLed = 2;
}
@@ -833,9 +855,6 @@ void UI_DisplayMain(void)
state = VFO_STATE_ALARM;
}
#endif
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if (state != VFO_STATE_NORMAL)
{
if (state < ARRAY_SIZE(VfoStateStr))

View File

@@ -469,7 +469,12 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_FEAT_F4HWN
UI_DrawLineBuffer(gFrameBuffer, 50, 0, 50, 55, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64
UI_DrawLineDottedBuffer(gFrameBuffer, 0, 46, 50, 46, 1);
//UI_DrawLineDottedBuffer(gFrameBuffer, 0, 46, 50, 46, 1);
for (uint8_t i = 0; i < 50; i += 2)
{
gFrameBuffer[5][i] = 0x40;
}
#endif
#ifndef ENABLE_CUSTOM_MENU_LAYOUT

View File

@@ -160,11 +160,6 @@ void UI_DisplayStatus()
x1 = x;
}
else if (gWasFKeyPressed) {
/*
memcpy(line + x, gFontF, sizeof(gFontF));
x += sizeof(gFontF);
*/
UI_PrintStringSmallBufferNormal("F", line + x + 1);
x += sizeof(gFontKeyLock);
@@ -174,6 +169,12 @@ void UI_DisplayStatus()
}
x1 = x;
}
else if(gBackLight)
{
memcpy(line + x + 1, gFontLight, sizeof(gFontLight));
x += sizeof(gFontLight);
x1 = x;
}
{ // battery voltage or percentage
char s[8] = "";

View File

@@ -55,8 +55,8 @@ void UI_DisplayWelcome(void)
UI_DisplayClear();
#ifdef ENABLE_FEAT_F4HWN
ST7565_BlitStatusLine(); // blank status line
ST7565_BlitFullScreen();
//ST7565_BlitStatusLine(); // blank status line
//ST7565_BlitFullScreen();
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_NONE || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND) {
ST7565_FillScreen(0x00);
@@ -105,13 +105,16 @@ void UI_DisplayWelcome(void)
#ifdef ENABLE_FEAT_F4HWN
UI_PrintStringSmallNormal(Version, 0, 128, 4);
for (uint8_t i = 0; i < 128; i++)
{
gFrameBuffer[3][i] ^= 0x80;
}
for (uint8_t i = 18; i < 110; i++)
{
gFrameBuffer[4][i] ^= 0xFF;
}
UI_DrawLineBuffer(gFrameBuffer, 0, 31, 126, 31, 1);
UI_PrintStringSmallNormal(Based, 0, 127, 5);
UI_PrintStringSmallNormal(Credits, 0, 127, 6);
#else