Merge pull request #235 from armel/feature_update_v3

Feature update v3
This commit is contained in:
Armel FAUVEAU
2024-08-20 18:30:20 +02:00
committed by GitHub
104 changed files with 17312 additions and 16960 deletions

View File

@@ -6,7 +6,7 @@
# ---- STOCK QUANSHENG FERATURES ---- # ---- STOCK QUANSHENG FERATURES ----
ENABLE_FMRADIO ?= 0 ENABLE_FMRADIO ?= 0
ENABLE_UART ?= 1 ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 0 ENABLE_AIRCOPY ?= 1
ENABLE_NOAA ?= 0 ENABLE_NOAA ?= 0
ENABLE_VOICE ?= 0 ENABLE_VOICE ?= 0
ENABLE_VOX ?= 1 ENABLE_VOX ?= 1
@@ -217,7 +217,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
VERSION_STRING_1 ?= v0.22 VERSION_STRING_1 ?= v0.22
AUTHOR_STRING_2 ?= F4HWN AUTHOR_STRING_2 ?= F4HWN
VERSION_STRING_2 ?= v3.2 VERSION_STRING_2 ?= v3.3
AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
VERSION_STRING ?= $(VERSION_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2)

View File

@@ -68,6 +68,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
* rename BackLt to BLTime, * rename BackLt to BLTime,
* rename BltTRX to BLTxRx, * rename BltTRX to BLTxRx,
* improve memory channel input, * improve memory channel input,
* add percent and gauge to Air Copy,
* improve audio bar,
* and more... * and more...
* new menu entries and changes: * new menu entries and changes:
* add SetPwr menu to set User power (<20mW, 125mW, 250mW, 500mW, 1W, 2W or 5W), * add SetPwr menu to set User power (<20mW, 125mW, 250mW, 500mW, 1W, 2W or 5W),
@@ -79,7 +81,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
* add SetMet menu to set s-meter style (Classic or Tiny), * add SetMet menu to set s-meter style (Classic or Tiny),
* add SetLck menu to set what is locked (Keys or Keys + PTT), * add SetLck menu to set what is locked (Keys or Keys + PTT),
* add SetGui menu to set font size on the VFO baseline (Classic or Tiny), * add SetGui menu to set font size on the VFO baseline (Classic or Tiny),
* add TXLock menu to open TX on channel * add TXLock menu to open TX on channel,
* add SetTmr menu to set RX and TX timers (Off or On)
* rename BatVol menu (52/63) to SysInf, which displays the firmware version in addition to the battery status, * rename BatVol menu (52/63) to SysInf, which displays the firmware version in addition to the battery status,
* improve PonMsg menu, * improve PonMsg menu,
* improve BackLt menu, * improve BackLt menu,

View File

@@ -16,6 +16,10 @@
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
//#if !defined(ENABLE_OVERLAY)
// #include "ARMCM0.h"
//#endif
#include "app/aircopy.h" #include "app/aircopy.h"
#include "audio.h" #include "audio.h"
#include "driver/bk4819.h" #include "driver/bk4819.h"
@@ -28,6 +32,10 @@
#include "ui/inputbox.h" #include "ui/inputbox.h"
#include "ui/ui.h" #include "ui/ui.h"
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
#include "screenshot.h"
#endif
static const uint16_t Obfuscation[8] = { 0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9 }; static const uint16_t Obfuscation[8] = { 0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9 };
AIRCOPY_State_t gAircopyState; AIRCOPY_State_t gAircopyState;
@@ -37,6 +45,14 @@ uint8_t gAirCopyIsSendMode;
uint16_t g_FSK_Buffer[36]; uint16_t g_FSK_Buffer[36];
static void AIRCOPY_clear()
{
for (uint8_t i = 0; i < 15; i++)
{
crc[i] = 0;
}
}
bool AIRCOPY_SendMessage(void) bool AIRCOPY_SendMessage(void)
{ {
static uint8_t gAircopySendCountdown = 1; static uint8_t gAircopySendCountdown = 1;
@@ -61,6 +77,10 @@ bool AIRCOPY_SendMessage(void)
if (++gAirCopyBlockNumber >= 0x78) { if (++gAirCopyBlockNumber >= 0x78) {
gAircopyState = AIRCOPY_COMPLETE; gAircopyState = AIRCOPY_COMPLETE;
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
getScreenShot();
#endif
//NVIC_SystemReset();
} }
RADIO_SetTxParameters(); RADIO_SetTxParameters();
@@ -118,6 +138,9 @@ void AIRCOPY_StorePacket(void)
if (Offset == 0x1E00) { if (Offset == 0x1E00) {
gAircopyState = AIRCOPY_COMPLETE; gAircopyState = AIRCOPY_COMPLETE;
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
getScreenShot();
#endif
} }
gAirCopyBlockNumber++; gAirCopyBlockNumber++;
@@ -178,12 +201,15 @@ static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
} }
if (gInputBoxIndex == 0) { if (gInputBoxIndex == 0) {
gAircopyStep = 1;
gFSKWriteIndex = 0; gFSKWriteIndex = 0;
gAirCopyBlockNumber = 0; gAirCopyBlockNumber = 0;
gInputBoxIndex = 0; gInputBoxIndex = 0;
gErrorsDuringAirCopy = 0; gErrorsDuringAirCopy = lErrorsDuringAirCopy = 0;
gAirCopyIsSendMode = 0; gAirCopyIsSendMode = 0;
AIRCOPY_clear();
BK4819_PrepareFSKReceive(); BK4819_PrepareFSKReceive();
gAircopyState = AIRCOPY_TRANSFER; gAircopyState = AIRCOPY_TRANSFER;
@@ -200,6 +226,7 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
return; return;
} }
gAircopyStep = 1;
gFSKWriteIndex = 0; gFSKWriteIndex = 0;
gAirCopyBlockNumber = 0; gAirCopyBlockNumber = 0;
gInputBoxIndex = 0; gInputBoxIndex = 0;
@@ -208,6 +235,8 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
g_FSK_Buffer[1] = 0; g_FSK_Buffer[1] = 0;
g_FSK_Buffer[35] = 0xDCBA; g_FSK_Buffer[35] = 0xDCBA;
AIRCOPY_clear();
GUI_DisplayScreen(); GUI_DisplayScreen();
gAircopyState = AIRCOPY_TRANSFER; gAircopyState = AIRCOPY_TRANSFER;

View File

@@ -171,18 +171,11 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
char DTMF_GetCharacter(const unsigned int code) char DTMF_GetCharacter(const unsigned int code)
{ {
if (code <= KEY_9)
return '0' + code;
switch (code) switch (code)
{ {
case KEY_0: return '0';
case KEY_1: return '1';
case KEY_2: return '2';
case KEY_3: return '3';
case KEY_4: return '4';
case KEY_5: return '5';
case KEY_6: return '6';
case KEY_7: return '7';
case KEY_8: return '8';
case KEY_9: return '9';
case KEY_MENU: return 'A'; case KEY_MENU: return 'A';
case KEY_UP: return 'B'; case KEY_UP: return 'B';
case KEY_DOWN: return 'C'; case KEY_DOWN: return 'C';

View File

@@ -405,23 +405,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (gScanStateDir != SCAN_OFF){ if (gScanStateDir != SCAN_OFF){
switch(Key) { switch(Key) {
case KEY_0: case KEY_0...KEY_5:
gEeprom.SCAN_LIST_DEFAULT = 0; gEeprom.SCAN_LIST_DEFAULT = Key;
break;
case KEY_1:
gEeprom.SCAN_LIST_DEFAULT = 1;
break;
case KEY_2:
gEeprom.SCAN_LIST_DEFAULT = 2;
break;
case KEY_3:
gEeprom.SCAN_LIST_DEFAULT = 3;
break;
case KEY_4:
gEeprom.SCAN_LIST_DEFAULT = 4;
break;
case KEY_5:
gEeprom.SCAN_LIST_DEFAULT = 5;
break; break;
default: default:
break; break;

View File

@@ -254,6 +254,9 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
case MENU_350EN: case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
#endif
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR:
#endif #endif
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
@@ -895,6 +898,9 @@ void MENU_AcceptSetting(void)
case MENU_SET_GUI: case MENU_SET_GUI:
gSetting_set_gui = gSubMenuSelection; gSetting_set_gui = gSubMenuSelection;
break; break;
case MENU_SET_TMR:
gSetting_set_tmr = gSubMenuSelection;
break;
case MENU_TX_LOCK: case MENU_TX_LOCK:
gTxVfo->TX_LOCK = gSubMenuSelection; gTxVfo->TX_LOCK = gSubMenuSelection;
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
@@ -1316,6 +1322,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_GUI: case MENU_SET_GUI:
gSubMenuSelection = gSetting_set_gui; gSubMenuSelection = gSetting_set_gui;
break; break;
case MENU_SET_TMR:
gSubMenuSelection = gSetting_set_tmr;
break;
case MENU_TX_LOCK: case MENU_TX_LOCK:
gSubMenuSelection = gTxVfo->TX_LOCK; gSubMenuSelection = gTxVfo->TX_LOCK;
break; break;

File diff suppressed because it is too large Load Diff

View File

@@ -41,12 +41,34 @@
static const uint8_t DrawingEndY = 40; static const uint8_t DrawingEndY = 40;
static const uint8_t U8RssiMap[] = { static const uint8_t U8RssiMap[] = {
121, 115, 109, 103, 97, 91, 85, 79, 73, 63, 121,
115,
109,
103,
97,
91,
85,
79,
73,
63,
}; };
static const uint16_t scanStepValues[] = { static const uint16_t scanStepValues[] = {
1, 10, 50, 100, 250, 500, 625, 833, 1,
1000, 1250, 1500, 2000, 2500, 5000, 10000, 10,
50,
100,
250,
500,
625,
833,
1000,
1250,
1500,
2000,
2500,
5000,
10000,
}; };
static const uint16_t scanStepBWRegValues[] = { static const uint16_t scanStepBWRegValues[] = {
@@ -84,20 +106,23 @@ static const uint16_t listenBWRegValues[] = {
0b0100100001011000, // 6.25 0b0100100001011000, // 6.25
}; };
typedef enum State { typedef enum State
{
SPECTRUM, SPECTRUM,
FREQ_INPUT, FREQ_INPUT,
STILL, STILL,
} State; } State;
typedef enum StepsCount { typedef enum StepsCount
{
STEPS_128, STEPS_128,
STEPS_64, STEPS_64,
STEPS_32, STEPS_32,
STEPS_16, STEPS_16,
} StepsCount; } StepsCount;
typedef enum ScanStep { typedef enum ScanStep
{
S_STEP_0_01kHz, S_STEP_0_01kHz,
S_STEP_0_1kHz, S_STEP_0_1kHz,
S_STEP_0_5kHz, S_STEP_0_5kHz,
@@ -116,7 +141,8 @@ typedef enum ScanStep {
S_STEP_100_0kHz, S_STEP_100_0kHz,
} ScanStep; } ScanStep;
typedef struct SpectrumSettings { typedef struct SpectrumSettings
{
uint32_t frequencyChangeStep; uint32_t frequencyChangeStep;
StepsCount stepsCount; StepsCount stepsCount;
ScanStep scanStepIndex; ScanStep scanStepIndex;
@@ -130,13 +156,15 @@ typedef struct SpectrumSettings {
bool backlightState; bool backlightState;
} SpectrumSettings; } SpectrumSettings;
typedef struct KeyboardState { typedef struct KeyboardState
{
KEY_Code_t current; KEY_Code_t current;
KEY_Code_t prev; KEY_Code_t prev;
uint8_t counter; uint8_t counter;
} KeyboardState; } KeyboardState;
typedef struct ScanInfo { typedef struct ScanInfo
{
uint16_t rssi, rssiMin, rssiMax; uint16_t rssi, rssiMin, rssiMax;
uint16_t i, iPeak; uint16_t i, iPeak;
uint32_t f, fPeak; uint32_t f, fPeak;
@@ -144,7 +172,8 @@ typedef struct ScanInfo {
uint16_t measurementsCount; uint16_t measurementsCount;
} ScanInfo; } ScanInfo;
typedef struct PeakInfo { typedef struct PeakInfo
{
uint16_t t; uint16_t t;
uint16_t rssi; uint16_t rssi;
uint32_t f; uint32_t f;

View File

@@ -42,6 +42,7 @@
#include "sram-overlay.h" #include "sram-overlay.h"
#endif #endif
#define UNUSED(x) (void)(x)
#define DMA_INDEX(x, y) (((x) + (y)) % sizeof(UART_DMA_Buffer)) #define DMA_INDEX(x, y) (((x) + (y)) % sizeof(UART_DMA_Buffer))
@@ -211,6 +212,11 @@ static void SendVersion(void)
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse) static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
{ {
#ifdef ENABLE_FEAT_F4HWN
UNUSED(pKey);
UNUSED(pIn);
UNUSED(pResponse);
#else
unsigned int i; unsigned int i;
uint32_t IV[4]; uint32_t IV[4];
@@ -224,7 +230,7 @@ static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
if (IV[i] != pResponse[i]) if (IV[i] != pResponse[i])
return true; return true;
#endif
return false; return false;
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -4,7 +4,6 @@
// all these images are on their right sides // all these images are on their right sides
// turn your monitor 90-deg anti-clockwise to see the images // turn your monitor 90-deg anti-clockwise to see the images
const uint8_t gFontPowerSave[2][6] = const uint8_t gFontPowerSave[2][6] =
{ {
{0x00, 0x7f, 0x9, 0x9, 0x9, 0x6}, {0x00, 0x7f, 0x9, 0x9, 0x9, 0x6},

View File

@@ -101,6 +101,8 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
gAircopyState = AIRCOPY_READY; gAircopyState = AIRCOPY_READY;
gEeprom.BACKLIGHT_TIME = 61;
GUI_SelectNextDisplay(DISPLAY_AIRCOPY); GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
} }
#endif #endif

BIN
images/AIR_COPY.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

4
main.c
View File

@@ -129,9 +129,9 @@ void Main(void)
gEeprom.KEY_LOCK = 0; gEeprom.KEY_LOCK = 0;
SETTINGS_SaveSettings(); SETTINGS_SaveSettings();
#ifndef ENABLE_VOX #ifndef ENABLE_VOX
gMenuCursor = 63; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar gMenuCursor = 64; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
#else #else
gMenuCursor = 65; // move to hidden section, fix me if change... !!! gMenuCursor = 66; // move to hidden section, fix me if change... !!!
#endif #endif
gSubMenuSelection = gSetting_F_LOCK; gSubMenuSelection = gSetting_F_LOCK;
#endif #endif

4
misc.c
View File

@@ -114,11 +114,15 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
bool gSetting_set_lck = false; bool gSetting_set_lck = false;
bool gSetting_set_met = 0; bool gSetting_set_met = 0;
bool gSetting_set_gui = 0; bool gSetting_set_gui = 0;
bool gSetting_set_tmr = 0;
bool gSetting_set_ptt_session; bool gSetting_set_ptt_session;
uint8_t gDebug; uint8_t gDebug;
uint8_t gDW = 0; uint8_t gDW = 0;
uint8_t gCB = 0; uint8_t gCB = 0;
bool gSaveRxMode = false; bool gSaveRxMode = false;
uint8_t crc[15] = { 0 };
uint8_t lErrorsDuringAirCopy = 0;
uint8_t gAircopyStep = 0;
#endif #endif
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR

4
misc.h
View File

@@ -166,11 +166,15 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern bool gSetting_set_lck; extern bool gSetting_set_lck;
extern bool gSetting_set_met; extern bool gSetting_set_met;
extern bool gSetting_set_gui; extern bool gSetting_set_gui;
extern bool gSetting_set_tmr;
extern bool gSetting_set_ptt_session; extern bool gSetting_set_ptt_session;
extern uint8_t gDebug; extern uint8_t gDebug;
extern uint8_t gDW; extern uint8_t gDW;
extern uint8_t gCB; extern uint8_t gCB;
extern bool gSaveRxMode; extern bool gSaveRxMode;
extern uint8_t crc[15];
extern uint8_t lErrorsDuringAirCopy;
extern uint8_t gAircopyStep;
#endif #endif
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR

View File

@@ -324,6 +324,7 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0; gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0; gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0;
/*
int tmp = ((Data[5] & 0xF0) >> 4); int tmp = ((Data[5] & 0xF0) >> 4);
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0; gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
@@ -332,6 +333,25 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_gui = (((tmp >> 3) & 0x01) < 2) ? ((tmp >> 3) & 0x01): 0; gSetting_set_gui = (((tmp >> 3) & 0x01) < 2) ? ((tmp >> 3) & 0x01): 0;
gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10; gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10;
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
*/
int tmp = (Data[5] & 0xF0) >> 4;
gSetting_set_inv = (tmp >> 0) & 0x01;
gSetting_set_lck = (tmp >> 1) & 0x01;
gSetting_set_met = (tmp >> 2) & 0x01;
gSetting_set_gui = (tmp >> 3) & 0x01;
int ctr_value = Data[5] & 0x0F;
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
gSetting_set_tmr = Data[4] & 1;
// Warning
// Be aware, Data[3] is use by Spectrum
// Warning
// And set special session settings for actions // And set special session settings for actions
gSetting_set_ptt_session = gSetting_set_ptt; gSetting_set_ptt_session = gSetting_set_ptt;
gEeprom.KEY_LOCK_PTT = gSetting_set_lck; gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
@@ -700,6 +720,14 @@ void SETTINGS_SaveSettings(void)
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
/*
tmp = 0;
if(gSetting_set_tmr == 1)
tmp = tmp | (1 << 0);
State[4] = tmp;
tmp = 0; tmp = 0;
if(gSetting_set_inv == 1) if(gSetting_set_inv == 1)
@@ -710,6 +738,14 @@ void SETTINGS_SaveSettings(void)
tmp = tmp | (1 << 2); tmp = tmp | (1 << 2);
if (gSetting_set_gui == 1) if (gSetting_set_gui == 1)
tmp = tmp | (1 << 3); tmp = tmp | (1 << 3);
*/
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
tmp = (gSetting_set_inv << 0) |
(gSetting_set_lck << 1) |
(gSetting_set_met << 2) |
(gSetting_set_gui << 3);
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F)); State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F)); State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));

View File

@@ -27,10 +27,19 @@
#include "ui/helper.h" #include "ui/helper.h"
#include "ui/inputbox.h" #include "ui/inputbox.h"
static void set_bit(uint8_t* array, int bit_index) {
array[bit_index / 8] |= (1 << (bit_index % 8));
}
static int get_bit(uint8_t* array, int bit_index) {
return (array[bit_index / 8] >> (bit_index % 8)) & 1;
}
void UI_DisplayAircopy(void) void UI_DisplayAircopy(void)
{ {
char String[16] = { 0 }; char String[16] = { 0 };
char *pPrintStr = { 0 }; char *pPrintStr = { 0 };
uint16_t percent;
UI_DisplayClear(); UI_DisplayClear();
@@ -40,6 +49,7 @@ void UI_DisplayAircopy(void)
pPrintStr = "AIR COPY"; pPrintStr = "AIR COPY";
} else { } else {
pPrintStr = "AIR COPY(CMP)"; pPrintStr = "AIR COPY(CMP)";
gAircopyState = AIRCOPY_READY;
} }
UI_PrintString(pPrintStr, 2, 127, 0, 8); UI_PrintString(pPrintStr, 2, 127, 0, 8);
@@ -59,12 +69,49 @@ void UI_DisplayAircopy(void)
} }
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
percent = (gAirCopyBlockNumber * 10000) / 120;
if (gAirCopyIsSendMode == 0) { if (gAirCopyIsSendMode == 0) {
sprintf(String, "RCV:%u E:%u", gAirCopyBlockNumber, gErrorsDuringAirCopy); sprintf(String, "RCV:%02u.%02u%% E:%d", percent / 100, percent % 100, gErrorsDuringAirCopy);
} else if (gAirCopyIsSendMode == 1) { } else if (gAirCopyIsSendMode == 1) {
sprintf(String, "SND:%u", gAirCopyBlockNumber); sprintf(String, "SND:%02u.%02u%%", percent / 100, percent % 100);
}
// Draw gauge
if(gAircopyStep != 0)
{
UI_PrintString(String, 2, 127, 5, 8);
gFrameBuffer[4][1] = 0x3c;
gFrameBuffer[4][2] = 0x42;
for(uint8_t i = 1; i <= 122; i++)
{
gFrameBuffer[4][2 + i] = 0x81;
}
gFrameBuffer[4][125] = 0x42;
gFrameBuffer[4][126] = 0x3c;
}
if(gAirCopyBlockNumber + gErrorsDuringAirCopy != 0)
{
// Check CRC
if(gErrorsDuringAirCopy != lErrorsDuringAirCopy)
{
set_bit(crc, gAirCopyBlockNumber + gErrorsDuringAirCopy);
lErrorsDuringAirCopy = gErrorsDuringAirCopy;
}
for(uint8_t i = 0; i < (gAirCopyBlockNumber + gErrorsDuringAirCopy); i++)
{
if(get_bit(crc, i) == 0)
{
gFrameBuffer[4][i + 4] = 0xbd;
}
}
} }
UI_PrintString(String, 2, 127, 4, 8);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }

View File

@@ -112,7 +112,7 @@ static void DrawSmallAntennaAndBars(uint8_t *p, unsigned int level)
} }
#if defined ENABLE_AUDIO_BAR || defined ENABLE_RSSI_BAR #if defined ENABLE_AUDIO_BAR || defined ENABLE_RSSI_BAR
static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level) static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level, uint8_t bars)
{ {
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
const char hollowBar[] = { const char hollowBar[] = {
@@ -124,7 +124,7 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level)
#endif #endif
uint8_t *p_line = gFrameBuffer[line]; uint8_t *p_line = gFrameBuffer[line];
level = MIN(level, 13); level = MIN(level, bars);
for(uint8_t i = 0; i < level; i++) { for(uint8_t i = 0; i < level; i++) {
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
@@ -137,7 +137,7 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level)
0b01111111 0b01111111
}; };
if(i < 9) { if(i < bars - 4) {
for(uint8_t j = 0; j < 4; j++) for(uint8_t j = 0; j < 4; j++)
p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F; p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F;
} }
@@ -161,7 +161,7 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level)
0b00111110 0b00111110
}; };
if(i < 9) { if(i < bars - 4) {
memcpy(p_line + (xpos + i * 5), &simpleBar, ARRAY_SIZE(simpleBar)); memcpy(p_line + (xpos + i * 5), &simpleBar, ARRAY_SIZE(simpleBar));
} }
else { else {
@@ -169,7 +169,7 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level)
} }
} }
#else #else
if(i < 9) { if(i < bars - 4) {
for(uint8_t j = 0; j < 4; j++) for(uint8_t j = 0; j < 4; j++)
p_line[xpos + i * 5 + j] = (~(0x7F >> (i+1))) & 0x7F; p_line[xpos + i * 5 + j] = (~(0x7F >> (i+1))) & 0x7F;
} }
@@ -183,21 +183,13 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level)
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
unsigned int sqrt16(unsigned int value) // Approximation of a logarithmic scale using integer arithmetic
{ // return square root of 'value' uint8_t log2_approx(unsigned int value) {
unsigned int shift = 16; // number of bits supplied in 'value' .. 2 ~ 32 uint8_t log = 0;
unsigned int bit = 1u << --shift; while (value >>= 1) {
unsigned int sqrti = 0; log++;
while (bit)
{
const unsigned int temp = ((sqrti << 1) | bit) << shift--;
if (value >= temp) {
value -= temp;
sqrti |= bit;
} }
bit >>= 1; return log;
}
return sqrti;
} }
void UI_DisplayAudioBar(void) void UI_DisplayAudioBar(void)
@@ -238,17 +230,24 @@ void UI_DisplayAudioBar(void)
if (gAlarmState != ALARM_STATE_OFF) if (gAlarmState != ALARM_STATE_OFF)
return; return;
#endif #endif
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0 static uint8_t barsOld = 0;
const uint8_t thresold = 18; // arbitrary thresold
//const uint8_t barsList[] = {0, 0, 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 25};
const uint8_t barsList[] = {0, 0, 0, 1, 2, 3, 5, 7, 9, 12, 15, 18, 21, 25, 25, 25};
uint8_t logLevel;
uint8_t bars;
// make non-linear to make more sensitive at low values unsigned int voiceLevel = BK4819_GetVoiceAmplitudeOut(); // 15:0
const unsigned int level = MIN(voice_amp * 8, 65535u);
const unsigned int sqrt_level = MIN(sqrt16(level), 124u); voiceLevel = (voiceLevel >= thresold) ? (voiceLevel - thresold) : 0;
uint8_t bars = 13 * sqrt_level / 124; logLevel = log2_approx(MIN(voiceLevel * 16, 32768u) + 1);
bars = barsList[logLevel];
barsOld = (barsOld - bars > 1) ? (barsOld - 1) : bars;
uint8_t *p_line = gFrameBuffer[line]; uint8_t *p_line = gFrameBuffer[line];
memset(p_line, 0, LCD_WIDTH); memset(p_line, 0, LCD_WIDTH);
DrawLevelBar(62, line, bars); DrawLevelBar(2, line, barsOld, 25);
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT)
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
@@ -414,7 +413,7 @@ void DisplayRSSIBar(const bool now)
UI_PrintStringSmallNormal(str, 2, 0, line); UI_PrintStringSmallNormal(str, 2, 0, line);
#endif #endif
DrawLevelBar(bar_x, line, s_level + overS9Bars); DrawLevelBar(bar_x, line, s_level + overS9Bars, 13);
if (now) if (now)
ST7565_BlitLine(line); ST7565_BlitLine(line);
#else #else

View File

@@ -146,6 +146,7 @@ const t_menu_item MenuList[] =
{"SetLck", MENU_SET_LCK }, {"SetLck", MENU_SET_LCK },
{"SetMet", MENU_SET_MET }, {"SetMet", MENU_SET_MET },
{"SetGui", MENU_SET_GUI }, {"SetGui", MENU_SET_GUI },
{"SetTmr", MENU_SET_TMR },
#endif #endif
// hidden menu items from here on // hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on // enabled if pressing both the PTT and upper side button at power-on
@@ -737,6 +738,9 @@ void UI_DisplayMenu(void)
case MENU_350EN: case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
#endif
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR:
#endif #endif
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]); strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break; break;

View File

@@ -135,6 +135,7 @@ enum
MENU_SET_LCK, MENU_SET_LCK,
MENU_SET_MET, MENU_SET_MET,
MENU_SET_GUI, MENU_SET_GUI,
MENU_SET_TMR,
#endif #endif
MENU_BATCAL, // battery voltage calibration MENU_BATCAL, // battery voltage calibration
MENU_F1SHRT, MENU_F1SHRT,

View File

@@ -37,26 +37,16 @@
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER #ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
static void convertTime(uint8_t *line, uint8_t type) static void convertTime(uint8_t *line, uint8_t type)
{ {
char str[8] = ""; uint16_t t = (type == 0) ? (gTxTimerCountdown_500ms / 2) : (3600 - gRxTimerCountdown_500ms / 2);
uint8_t m, s; // Declare variables for seconds, hours, minutes, and seconds uint8_t m = t / 60;
uint16_t t; uint8_t s = t % 60; // Utilisation de l'opérateur modulo pour simplifier le calcul des secondes
if(type == 0) // Tx timer gStatusLine[0] = gStatusLine[7] = gStatusLine[14] = 0x00; // Quick fix on display (on scanning I, II, etc.)
t = (gTxTimerCountdown_500ms / 2);
//t = ((gEeprom.TX_TIMEOUT_TIMER + 1) * 5) - (gTxTimerCountdown_500ms / 2);
else // Rx timer
t = 3600 - (gRxTimerCountdown_500ms / 2);
m = t / 60;
s = t - (m * 60);
gStatusLine[0] = 0x00; // Quick fix on display (on scanning I, II, etc.)
gStatusLine[7] = 0x00; // Quick fix on display (on scanning I, II, etc.)
gStatusLine[14] = 0x00; // Quick fix on display (on scanning I, II, etc.)
char str[8];
sprintf(str, "%02d:%02d", m, s); sprintf(str, "%02d:%02d", m, s);
UI_PrintStringSmallBufferNormal(str, line + 0); UI_PrintStringSmallBufferNormal(str, line);
gUpdateStatus = true; gUpdateStatus = true;
} }
@@ -153,11 +143,11 @@ void UI_DisplayStatus()
if(!SCANNER_IsScanning()) { if(!SCANNER_IsScanning()) {
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER #ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
if(gCurrentFunction == FUNCTION_TRANSMIT) if(gCurrentFunction == FUNCTION_TRANSMIT && gSetting_set_tmr == true)
{ {
convertTime(line, 0); convertTime(line, 0);
} }
else if(FUNCTION_IsRx()) else if(FUNCTION_IsRx() && gSetting_set_tmr == true)
{ {
convertTime(line, 1); convertTime(line, 1);
} }