fix power bug
All checks were successful
Build Firmware / build (push) Successful in 37s

This commit is contained in:
2025-03-31 11:51:11 +02:00
parent 85fb527020
commit 101bde7463
11 changed files with 118 additions and 55 deletions

View File

@@ -4,7 +4,7 @@
# 1 = enable
# ---- STOCK QUANSHENG FEATURES ----
ENABLE_FMRADIO ?= 0
ENABLE_FMRADIO ?= 1
ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 0
ENABLE_NOAA ?= 0
@@ -38,7 +38,7 @@ ENABLE_AUDIO_BAR ?= 1
ENABLE_COPY_CHAN_TO_VFO ?= 1
ENABLE_REDUCE_LOW_MID_TX_POWER ?= 1
ENABLE_BYP_RAW_DEMODULATORS ?= 1
ENABLE_BLMIN_TMP_OFF ?= 1
ENABLE_BLMIN_TMP_OFF ?= 0
ENABLE_SCAN_RANGES ?= 1
ENABLE_FEAT_F4HWN ?= 1
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0

View File

@@ -103,6 +103,7 @@ void (*ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
[DISPLAY_MAIN] = &MAIN_ProcessKeys,
[DISPLAY_MENU] = &MENU_ProcessKeys,
[DISPLAY_SCANNER] = &SCANNER_ProcessKeys,
[DISPLAY_MESSAGES] = &MESSAGES_ProcessKeys,
#ifdef ENABLE_FMRADIO
[DISPLAY_FM] = &FM_ProcessKeys,

View File

@@ -3,10 +3,10 @@
//
#include "fskmodem.h"
#include "eeprom.h"
uint16_t TONE2_FREQ;
uint8_t seq = 0;
DataPacket dataPacket;
DataPacket inBoundPacket;
@@ -309,6 +309,10 @@ void MSG_FSKSendData(DataPacket *dataPacketIn) {
void prepareDataPacket() {
dataPacket.src = gEeprom.FSKSRCAddress;
dataPacket.seq = seq++;
uint8_t Data[8];
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
dataPacket.seq = Data[0];
Data[0]++;
EEPROM_WriteBuffer(SEQParameterEEPROM, Data);
dataPacket.ttl = 20;
}

View File

@@ -80,6 +80,8 @@
#define DataPacketDataSize (35)
#define SEQParameterEEPROM 0x1BD0;
typedef struct {
uint32_t dest;
uint32_t src;

5
app/messages.c Normal file
View File

@@ -0,0 +1,5 @@
//
// Created by bruno on 3/30/25.
//
#include "messages.h"

22
app/messages.h Normal file
View File

@@ -0,0 +1,22 @@
//
// Created by bruno on 3/30/25.
//
#ifndef BRNQUANFW_MESSAGES_H
#define BRNQUANFW_MESSAGES_H
#include "fskmodem.h"
#define MESSAGES_START 0X1D00;
#define MESSAGES_COUNT 6;
extern uint8_t gActiveMessage;
void MESSAGES_GET();
void MESSAGES_DELETE();
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
void SCANNER_Stop(void);
void SCANNER_TimeSlice10ms(void);
void SCANNER_TimeSlice500ms(void);
bool SCANNER_IsScanning(void);
#endif //BRNQUANFW_MESSAGES_H

50
radio.c
View File

@@ -488,58 +488,10 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) {
} else if (currentPower == OUTPUT_POWER_HIGH) {
Op = 2; // High eeprom calibration data
}
currentPower--;
EEPROM_ReadBuffer(0x1ED0 + (Band * 20) + (Op * 3), Txp, 3);
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (Op * 3), Txp, 3);
#ifdef ENABLE_FEAT_F4HWN
// make low and mid even lower
// and use calibration values
// be aware with toxic fucking closed firmwares
/*
uint8_t shift[] = {0, 0, 0, 0, 0};
if(Band == 5) // UHF
{
shift[0] = 0;
shift[1] = 0;
shift[2] = 0;
shift[3] = 0;
shift[4] = 0;
}
*/
/*
for(uint8_t p = 0; p < 3; p++)
{
switch (currentPower)
{
case 0:
Txp[p] = (Txp[p] * 4) / 25; //+ shift[pInfo->OUTPUT_POWER];
break;
case 1:
Txp[p] = (Txp[p] * 4) / 19; // + shift[pInfo->OUTPUT_POWER];
break;
case 2:
Txp[p] = (Txp[p] * 4) / 13; // + shift[pInfo->OUTPUT_POWER];
break;
case 3:
Txp[p] = (Txp[p] * 4) / 10; // + shift[pInfo->OUTPUT_POWER];
break;
case 4:
Txp[p] = (Txp[p] * 4) / 7; // + shift[pInfo->OUTPUT_POWER];
break;
case 5:
Txp[p] = (Txp[p] * 3) / 4;
break;
case 6:
Txp[p] = Txp[p] + 30;
break;
}
}
*/
static const uint8_t dividers[6] = {25, 19, 13, 10, 7, 4};
for (uint8_t p = 0; p < 3; p++) {

View File

@@ -89,6 +89,7 @@ const char *VfoStateStr[] = {
// ***************************************************************************
static void DrawSmallAntennaAndBars(uint8_t *p, unsigned int level) {
level++;
if (level > 6)
level = 6;
@@ -925,7 +926,7 @@ void UI_DisplayMain(void) {
Level = 2;
}
*/
Level = gRxVfo->OUTPUT_POWER - 1;
Level = gRxVfo->OUTPUT_POWER;
} else if (mode == VFO_MODE_RX) { // RX signal level
#ifndef ENABLE_RSSI_BAR
// bar graph
@@ -1012,7 +1013,7 @@ void UI_DisplayMain(void) {
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "ME",
"HI", "UN"};
"HI"};
UI_PrintStringSmallNormal(pwr_short[vfoInfo->OUTPUT_POWER], LCD_WIDTH + 25, 0, line + 1);
}

65
ui/messages.c Normal file
View File

@@ -0,0 +1,65 @@
//
// Created by bruno on 3/30/25.
//
#include "messages.h"
void UI_DisplayMessages(void)
{
char String[19] = {0};
char *pPrintStr = String;
sprintf("FRM:%d %d/%d", )
bool bCentered;
uint8_t Start;
UI_DisplayClear();
if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) {
sprintf(String, "FREQ:%u.%05u", gScanFrequency / 100000, gScanFrequency % 100000);
pPrintStr = String;
} else {
pPrintStr = "FREQ:**.*****";
}
UI_PrintString(pPrintStr, 2, 0, 1 /*, 8 */);
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
pPrintStr = "CTC:******";
} else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
sprintf(String, "CTC:%u.%uHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10);
pPrintStr = String;
} else {
sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]);
pPrintStr = String;
}
UI_PrintString(pPrintStr, 2, 0, 3 /*, 8 */);
memset(String, 0, sizeof(String));
if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
pPrintStr = "SAV?";
Start = 0;
bCentered = 1;
} else {
Start = 2;
bCentered = 0;
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
strcpy(String, "SAV:");
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
pPrintStr = String;
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
strcpy(String, "SCN");
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
pPrintStr = String;
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
pPrintStr = "SCN CMP.";
} else {
pPrintStr = "SCN FAIL.";
}
}
UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5 /*, 8 */);
ST7565_BlitFullScreen();
}

10
ui/messages.h Normal file
View File

@@ -0,0 +1,10 @@
//
// Created by bruno on 3/30/25.
//
#ifndef BRNQUANFW_MESSAGES_H
#define BRNQUANFW_MESSAGES_H
void UI_DisplayMessages(void);
#endif //BRNQUANFW_MESSAGES_H

View File

@@ -25,6 +25,7 @@ enum GUI_DisplayType_t
DISPLAY_MAIN = 0,
DISPLAY_MENU,
DISPLAY_SCANNER,
DISPLAY_MESSAGES
#ifdef ENABLE_FMRADIO
DISPLAY_FM,