Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
72558f93f3
|
|||
fabf38f1bc
|
|||
00786c683d
|
|||
c5464994ed
|
|||
f1b2d085d5
|
|||
ac6e59044d
|
|||
3850025e63
|
|||
dc5919ac6f
|
|||
3e1756697f
|
|||
62f73f8c6c
|
28
.github/workflows/main.yml
vendored
28
.github/workflows/main.yml
vendored
@@ -9,16 +9,22 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Compile firmware
|
||||
run: |
|
||||
chmod +x compile-with-docker.sh
|
||||
./compile-with-docker.sh
|
||||
- name: Compile firmware
|
||||
run: |
|
||||
chmod +x compile-with-docker.sh
|
||||
./compile-with-docker.sh custom
|
||||
|
||||
- name: Upload firmware artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: firmware-artifact
|
||||
path: compiled-firmware/f4hwn.packed.bin
|
||||
- name: Debug files
|
||||
run: ls -lah
|
||||
|
||||
- name: Debug compiled firmware
|
||||
run: ls -lah compiled-firmware
|
||||
|
||||
- name: Upload firmware artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: firmware-artifact
|
||||
path: compiled-firmware/*
|
||||
|
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
7
.idea/discord.xml
generated
Normal file
7
.idea/discord.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="ASK" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
18
.idea/misc.xml
generated
Normal file
18
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MakefileSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<MakefileProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="version" value="2" />
|
||||
</MakefileProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
10
Makefile
10
Makefile
@@ -9,7 +9,7 @@ ENABLE_UART ?= 1
|
||||
ENABLE_AIRCOPY ?= 0
|
||||
ENABLE_NOAA ?= 0
|
||||
ENABLE_VOICE ?= 0
|
||||
ENABLE_VOX ?= 0
|
||||
ENABLE_VOX ?= 1
|
||||
ENABLE_ALARM ?= 0
|
||||
ENABLE_TX1750 ?= 1
|
||||
ENABLE_PWRON_PASSWORD ?= 0
|
||||
@@ -44,12 +44,12 @@ ENABLE_FEAT_F4HWN ?= 1
|
||||
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
|
||||
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
|
||||
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 0
|
||||
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
|
||||
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
|
||||
ENABLE_FEAT_F4HWN_SLEEP ?= 1
|
||||
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
|
||||
ENABLE_FEAT_F4HWN_NARROWER ?= 1
|
||||
ENABLE_FEAT_F4HWN_INV ?= 0
|
||||
ENABLE_FEAT_F4HWN_CTR ?= 1
|
||||
ENABLE_FEAT_F4HWN_INV ?= 1
|
||||
ENABLE_FEAT_F4HWN_CTR ?= 0
|
||||
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
|
||||
ENABLE_FEAT_F4HWN_VOL ?= 1
|
||||
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
|
||||
@@ -67,7 +67,7 @@ ENABLE_UART_RW_BK_REGS ?= 0
|
||||
# ---- COMPILER/LINKER OPTIONS ----
|
||||
ENABLE_CLANG ?= 0
|
||||
ENABLE_SWD ?= 0
|
||||
ENABLE_OVERLAY ?= 0
|
||||
ENABLE_OVERLAY ?= 1
|
||||
ENABLE_LTO ?= 1
|
||||
|
||||
#############################################################
|
||||
|
20
app/app.c
20
app/app.c
@@ -32,6 +32,7 @@
|
||||
#ifdef ENABLE_FLASHLIGHT
|
||||
|
||||
#include "app/flashlight.h"
|
||||
#include "../ui/fmradio.h"
|
||||
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -1485,6 +1486,9 @@ void APP_TimeSlice500ms(void) {
|
||||
if (gFmRadioMode) // 1of11
|
||||
return;
|
||||
}
|
||||
if (gScreenToDisplay == DISPLAY_FM) {
|
||||
UI_UpdateFMThings(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan
|
||||
@@ -1814,18 +1818,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
|
||||
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN // Disable PTT if KEY_LOCK
|
||||
bool lck_condition = false;
|
||||
|
||||
if (gSetting_set_lck)
|
||||
lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT;
|
||||
else
|
||||
lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT;
|
||||
|
||||
if (lck_condition)
|
||||
#else
|
||||
if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT)
|
||||
#endif
|
||||
if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // keyboard is locked or low battery popup
|
||||
|
||||
// close low battery popup
|
||||
@@ -1850,8 +1843,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
// KEY_MENU has a special treatment here, because we want to pass hold event to ACTION_Handle
|
||||
// but we don't want it to complain when initial press happens
|
||||
// we want to react on realese instead
|
||||
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && // pass side buttons
|
||||
!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
|
||||
else if (!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
|
||||
{
|
||||
if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) &&
|
||||
// prevent released or held, prevent KEY_MENU pressed
|
||||
|
35
app/fm.c
35
app/fm.c
@@ -184,7 +184,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07);
|
||||
const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07_TEST1);
|
||||
|
||||
// This is supposed to be a signed value, but above function is unsigned
|
||||
const uint16_t Deviation = BK1080_REG_07_GET_FREQD(Test2);
|
||||
@@ -196,7 +196,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10);
|
||||
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10_RSSI_STATUS);
|
||||
|
||||
if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) {
|
||||
BK1080_FrequencyDeviation = Deviation;
|
||||
@@ -377,6 +377,27 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_4:
|
||||
gEeprom.BK1080_AGC_ENABLED = !gEeprom.BK1080_AGC_ENABLED;
|
||||
BK1080_UpdateSysconf();
|
||||
gRequestSaveSettings = true;
|
||||
gRequestSaveFM = true;
|
||||
break;
|
||||
|
||||
case KEY_5:
|
||||
gEeprom.BK1080_DEEMPHASIS_CONFIG++;
|
||||
BK1080_UpdateSysconf();
|
||||
gRequestSaveSettings = true;
|
||||
gRequestSaveFM = true;
|
||||
break;
|
||||
|
||||
case KEY_6:
|
||||
gEeprom.BK1080_BLEND_CONFIG++;
|
||||
BK1080_UpdateSysconf();
|
||||
gRequestSaveSettings = true;
|
||||
gRequestSaveFM = true;
|
||||
break;
|
||||
|
||||
case KEY_STAR:
|
||||
ACTION_Scan(autoScan);
|
||||
break;
|
||||
@@ -390,12 +411,13 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
||||
|
||||
static void Key_EXIT(uint8_t state)
|
||||
{
|
||||
if (state != BUTTON_EVENT_SHORT)
|
||||
return;
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gFM_ScanState == FM_SCAN_OFF) {
|
||||
if (state == BUTTON_EVENT_SHORT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gFM_ScanState == FM_SCAN_OFF || state == BUTTON_EVENT_LONG) {
|
||||
if (gInputBoxIndex == 0) {
|
||||
if (!gAskToSave && !gAskToDelete) {
|
||||
ACTION_FM();
|
||||
@@ -572,6 +594,7 @@ void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
break;
|
||||
}
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
|
||||
void FM_Play(void)
|
||||
|
219
app/fskmodem.c
Normal file
219
app/fskmodem.c
Normal file
@@ -0,0 +1,219 @@
|
||||
//
|
||||
// Created by bruno on 25.2.2025.
|
||||
//
|
||||
|
||||
#include "fskmodem.h"
|
||||
|
||||
uint16_t TONE2_FREQ;
|
||||
|
||||
uint8_t seq = 0;
|
||||
DataPacket dataPacket;
|
||||
|
||||
DataPacket inBoundPacket;
|
||||
|
||||
uint8_t *dataPTR = dataPacket.data;
|
||||
|
||||
SMSEnteringState gEnteringSMS = SMS_NOT_ENTERING;
|
||||
|
||||
void MSG_ConfigureFSK(bool rx) {
|
||||
BK4819_WriteRegister(BK4819_REG_70, TONE2_ENABLE_BIT | (96U << 0));
|
||||
|
||||
switch (gEeprom.FSKMode) {
|
||||
case MOD_AFSK_2400:
|
||||
TONE2_FREQ = 24779U; // Estimated
|
||||
break;
|
||||
case MOD_AFSK_1200:
|
||||
TONE2_FREQ = 12389U;
|
||||
break;
|
||||
case MOD_FSK_700:
|
||||
TONE2_FREQ = 7227U;
|
||||
break;
|
||||
case MOD_FSK_450:
|
||||
TONE2_FREQ = 4646U;
|
||||
break;
|
||||
case MOD_FSK_1200_2400:
|
||||
TONE2_FREQ = 12389U; // Default to 1200Hz, dynamic switching may be required
|
||||
break;
|
||||
case MOD_NOAA_SAME:
|
||||
TONE2_FREQ = 2083U; // NOAA SAME uses 2083.3 Hz for mark and 1562.5 Hz for space
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_72, TONE2_FREQ);
|
||||
|
||||
// uint16_t fskConfig = FSK_ENABLE_BIT | FSK_RX_BW_1_2K | FSK_RX_GAIN_DEFAULT | FSK_PREAMBLE_TYPE_AA;
|
||||
// if (gEeprom.FSKMode == MOD_AFSK_1200) {
|
||||
// fskConfig = FSK_ENABLE_BIT | FSK_TX_MODE_FSK_1_2K_2_4K | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA;
|
||||
// }
|
||||
|
||||
uint16_t fskConfig = FSK_ENABLE_BIT | FSK_PREAMBLE_TYPE_AA;
|
||||
|
||||
switch (gEeprom.FSKMode) {
|
||||
case MOD_FSK_700:
|
||||
case MOD_FSK_450:
|
||||
case MOD_FSK_1200_2400:
|
||||
fskConfig |= FSK_TX_MODE_FSK_1_2K_2_4K | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA | FSK_RX_BW_1_2K;
|
||||
break;
|
||||
case MOD_AFSK_1200:
|
||||
fskConfig |= FSK_TX_MODE_FFSK_1200_1800 | FSK_RX_MODE_FFSK_1200_1800 | FSK_RX_BW_FFSK_1200_1800;
|
||||
break;
|
||||
case MOD_AFSK_2400:
|
||||
fskConfig |= FSK_TX_MODE_FFSK_1200_2400 | FSK_RX_MODE_FFSK_1200_2400 | FSK_RX_BW_2_4K_FFSK_1200_2400;
|
||||
break;
|
||||
case MOD_NOAA_SAME:
|
||||
fskConfig |= FSK_TX_MODE_NOAA_SAME | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA | FSK_RX_BW_NOAA_SAME;
|
||||
break;
|
||||
default:
|
||||
// Unsupported mode; keep previous setting
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_58, fskConfig);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_5A, FSK_SYNC_BYTE0 << 8 | FSK_SYNC_BYTE1);
|
||||
BK4819_WriteRegister(BK4819_REG_5B, FSK_SYNC_BYTE2 << 8 | FSK_SYNC_BYTE3);
|
||||
BK4819_WriteRegister(BK4819_REG_5C, FSK_CRC_ON);
|
||||
|
||||
if (rx) {
|
||||
BK4819_WriteRegister(BK4819_REG_5E, (64U << 3) | (1U << 0));
|
||||
}
|
||||
|
||||
size_t size = sizeof(dataPacket);
|
||||
if (rx) {
|
||||
size = (((size + 1) / 2) * 2) + 2;
|
||||
}
|
||||
BK4819_WriteRegister(BK4819_REG_5D, (size << 8));
|
||||
|
||||
BK4819_FskClearFifo();
|
||||
|
||||
uint16_t fskParams = FSK_SYNC_LEN_BIT | ((rx ? 0U : 15U) << 4);
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0) {
|
||||
fskParams |= FSK_SCRAMBLE_ENABLE;
|
||||
}
|
||||
BK4819_WriteRegister(BK4819_REG_59, fskParams);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||
}
|
||||
|
||||
|
||||
void MSG_EnableRX(const bool enable) {
|
||||
|
||||
if (enable) {
|
||||
MSG_ConfigureFSK(true);
|
||||
|
||||
//if(gEeprom.MESSENGER_CONFIG.data.receive)
|
||||
BK4819_FskEnableRx();
|
||||
} else {
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0);
|
||||
BK4819_WriteRegister(BK4819_REG_58, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_FSKSendData() {
|
||||
|
||||
// turn off CTCSS/CDCSS during FFSK
|
||||
const uint16_t css_val = BK4819_ReadRegister(BK4819_REG_51);
|
||||
BK4819_WriteRegister(BK4819_REG_51, 0);
|
||||
|
||||
// set the FM deviation level
|
||||
const uint16_t dev_val = BK4819_ReadRegister(BK4819_REG_40);
|
||||
|
||||
{
|
||||
uint16_t deviation;
|
||||
switch (gEeprom.VfoInfo[gEeprom.TX_VFO].CHANNEL_BANDWIDTH) {
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
deviation = 1300;
|
||||
break; // 20k // measurements by kamilsss655
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
deviation = 1200;
|
||||
break; // 10k
|
||||
// case BK4819_FILTER_BW_NARROWAVIATION: deviation = 850; break; // 5k
|
||||
// case BK4819_FILTER_BW_NARROWER: deviation = 850; break; // 5k
|
||||
// case BK4819_FILTER_BW_NARROWEST: deviation = 850; break; // 5k
|
||||
default:
|
||||
deviation = 850;
|
||||
break; // 5k
|
||||
}
|
||||
|
||||
//BK4819_WriteRegister(0x40, (3u << 12) | (deviation & 0xfff));
|
||||
BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0xfff));
|
||||
}
|
||||
|
||||
// REG_2B 0
|
||||
//
|
||||
// <15> 1 Enable CTCSS/CDCSS DC cancellation after FM Demodulation 1 = enable 0 = disable
|
||||
// <14> 1 Enable AF DC cancellation after FM Demodulation 1 = enable 0 = disable
|
||||
// <10> 0 AF RX HPF 300Hz filter 0 = enable 1 = disable
|
||||
// <9> 0 AF RX LPF 3kHz filter 0 = enable 1 = disable
|
||||
// <8> 0 AF RX de-emphasis filter 0 = enable 1 = disable
|
||||
// <2> 0 AF TX HPF 300Hz filter 0 = enable 1 = disable
|
||||
// <1> 0 AF TX LPF filter 0 = enable 1 = disable
|
||||
// <0> 0 AF TX pre-emphasis filter 0 = enable 1 = disable
|
||||
//
|
||||
// disable the 300Hz HPF and FM pre-emphasis filter
|
||||
//
|
||||
const uint16_t filt_val = BK4819_ReadRegister(BK4819_REG_2B);
|
||||
BK4819_WriteRegister(BK4819_REG_2B, (1u << 2) | (1u << 0));
|
||||
|
||||
MSG_ConfigureFSK(false);
|
||||
|
||||
|
||||
SYSTEM_DelayMs(100);
|
||||
|
||||
{ // load the entire packet data into the TX FIFO buffer
|
||||
uint16_t *ptr = (uint16_t *) &dataPacket;
|
||||
size_t wordCount = sizeof(dataPacket) / sizeof(uint16_t);
|
||||
|
||||
for (size_t i = 0; i < wordCount; i++) {
|
||||
BK4819_WriteRegister(BK4819_REG_5F, ptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// enable FSK TX
|
||||
BK4819_FskEnableTx();
|
||||
|
||||
{
|
||||
// allow up to 310ms for the TX to complete
|
||||
// if it takes any longer then somethings gone wrong, we shut the TX down
|
||||
unsigned int timeout = 1000 / 5;
|
||||
|
||||
while (timeout-- > 0) {
|
||||
SYSTEM_DelayMs(5);
|
||||
if (BK4819_ReadRegister(BK4819_REG_0C) & (1u << 0)) { // we have interrupt flags
|
||||
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||
if (BK4819_ReadRegister(BK4819_REG_02) & BK4819_REG_02_FSK_TX_FINISHED)
|
||||
timeout = 0; // TX is complete
|
||||
}
|
||||
}
|
||||
}
|
||||
//BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||
|
||||
SYSTEM_DelayMs(100);
|
||||
|
||||
// disable TX
|
||||
MSG_ConfigureFSK(true);
|
||||
|
||||
// restore FM deviation level
|
||||
BK4819_WriteRegister(BK4819_REG_40, dev_val);
|
||||
|
||||
// restore TX/RX filtering
|
||||
BK4819_WriteRegister(BK4819_REG_2B, filt_val);
|
||||
|
||||
// restore the CTCSS/CDCSS setting
|
||||
BK4819_WriteRegister(BK4819_REG_51, css_val);
|
||||
|
||||
SYSTEM_DelayMs(50);
|
||||
APP_EndTransmission();
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
gUpdateStatus = true;
|
||||
gUpdateDisplay = true;
|
||||
gFlagEndTransmission = false;
|
||||
|
||||
}
|
||||
|
||||
void prepareDataPacket() {
|
||||
dataPacket.src = gEeprom.FSKSRCAddress;
|
||||
dataPacket.seq = seq++;
|
||||
}
|
106
app/fskmodem.h
Normal file
106
app/fskmodem.h
Normal file
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// Created by bruno on 25.2.2025.
|
||||
//
|
||||
|
||||
#ifndef UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
||||
#define UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "../driver/bk4819.h"
|
||||
#include "../driver/bk4819-regs.h"
|
||||
#include "../settings.h"
|
||||
#include "stddef.h"
|
||||
#include "../driver/system.h"
|
||||
#include "../misc.h"
|
||||
#include "../app/app.h"
|
||||
|
||||
// REG_70 bit definitions
|
||||
#define TONE1_ENABLE_BIT (1U << 15)
|
||||
#define TONE1_GAIN_MASK (0x7FU << 8)
|
||||
#define TONE2_ENABLE_BIT (1U << 7)
|
||||
#define TONE2_GAIN_MASK (0x7FU << 0)
|
||||
|
||||
// REG_58 bit definitions
|
||||
// FSK Tx Mode Selection (REG_58<15:13>)
|
||||
#define FSK_TX_MODE_FSK_1_2K_2_4K (0U << 13) // 000
|
||||
#define FSK_TX_MODE_FFSK_1200_1800 (1U << 13) // 001
|
||||
#define FSK_TX_MODE_FFSK_1200_2400 (3U << 13) // 011
|
||||
#define FSK_TX_MODE_NOAA_SAME (5U << 13) // 101
|
||||
|
||||
// FSK Rx Mode Selection (REG_58<12:10>)
|
||||
#define FSK_RX_MODE_FSK_1_2K_2_4K_NOAA (0U << 10) // 000
|
||||
#define FSK_RX_MODE_FFSK_1200_1800 (7U << 10) // 111
|
||||
#define FSK_RX_MODE_FFSK_1200_2400 (4U << 10) // 100
|
||||
|
||||
// FSK Rx Gain (REG_58<9:8>)
|
||||
#define FSK_RX_GAIN_DEFAULT (0U << 8) // 00
|
||||
#define FSK_RX_GAIN_TYPE_C (1U << 8) // 01
|
||||
#define FSK_RX_GAIN_TYPE_B (2U << 8) // 10
|
||||
#define FSK_UNKNOWN_MASK (3U << 6)
|
||||
// FSK Preamble Type Selection (REG_58<5:4>)
|
||||
#define FSK_PREAMBLE_TYPE_AA (3U << 4) // 11
|
||||
#define FSK_PREAMBLE_TYPE_55 (2U << 4) // 10
|
||||
#define FSK_PREAMBLE_TYPE_UNKNOWN (0U << 4) // 00
|
||||
// FSK Rx Bandwidth Setting (REG_58<3:1>)
|
||||
#define FSK_RX_BW_2_4K_FFSK_1200_2400 (4U << 1) // 100
|
||||
#define FSK_RX_BW_1_2K (0U << 1) // 000
|
||||
#define FSK_RX_BW_FFSK_1200_1800 (1U << 1) // 001
|
||||
#define FSK_RX_BW_NOAA_SAME (2U << 1) // 010
|
||||
#define FSK_ENABLE_BIT (1U << 0)
|
||||
|
||||
// REG_59 bit definitions
|
||||
#define FSK_CLEAR_TX_FIFO (1U << 15)
|
||||
#define FSK_CLEAR_RX_FIFO (1U << 14)
|
||||
#define FSK_SCRAMBLE_ENABLE (1U << 13)
|
||||
#define FSK_RX_ENABLE (1U << 12)
|
||||
#define FSK_TX_ENABLE (1U << 11)
|
||||
#define FSK_INVERT_RX (1U << 10)
|
||||
#define FSK_INVERT_TX (1U << 9)
|
||||
#define FSK_PREAMBLE_LEN_MASK (15U << 4)
|
||||
#define FSK_SYNC_LEN_BIT (1U << 3)
|
||||
|
||||
//#define FSK_SYNC_BYTE0 0x30
|
||||
//#define FSK_SYNC_BYTE1 0x72
|
||||
//#define FSK_SYNC_BYTE2 0x57
|
||||
//#define FSK_SYNC_BYTE3 0x6c
|
||||
|
||||
#define FSK_SYNC_BYTE0 0x42
|
||||
#define FSK_SYNC_BYTE1 0x52
|
||||
#define FSK_SYNC_BYTE2 0x4E
|
||||
#define FSK_SYNC_BYTE3 0x51
|
||||
|
||||
#define FSK_CRC_ON (1U << 6)
|
||||
#define FSK_CRC_OFF (0U << 6)
|
||||
|
||||
#define DataPacketDataSize (36)
|
||||
|
||||
typedef struct {
|
||||
uint32_t dest;
|
||||
uint32_t src;
|
||||
uint8_t seq;
|
||||
uint8_t flags;
|
||||
uint8_t data[DataPacketDataSize];
|
||||
} DataPacket;
|
||||
|
||||
void prepareDataPacket();
|
||||
|
||||
void MSG_FSKSendData();
|
||||
|
||||
void MSG_EnableRX(bool enable);
|
||||
|
||||
extern DataPacket dataPacket;
|
||||
|
||||
extern DataPacket inBoundPacket;
|
||||
|
||||
typedef enum {
|
||||
SMS_NOT_ENTERING,
|
||||
SMS_ENTERING_DEST,
|
||||
SMS_ENTERING_MESSAGE
|
||||
} SMSEnteringState;
|
||||
|
||||
extern SMSEnteringState gEnteringSMS;
|
||||
|
||||
extern uint8_t *dataPTR;
|
||||
|
||||
#endif //UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
40
app/main.c
40
app/main.c
@@ -180,7 +180,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
|
||||
#endif
|
||||
gTxVfo->Band += 1;
|
||||
|
||||
if (gTxVfo->Band == BAND5_350MHz && !gSetting_350EN) {
|
||||
if (gTxVfo->Band == BAND5_350MHz) {
|
||||
// skip if not enabled
|
||||
gTxVfo->Band += 1;
|
||||
} else if (gTxVfo->Band >= BAND_N_ELEM) {
|
||||
@@ -965,23 +965,27 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (bKeyPressed) {
|
||||
if (strlen((char *) dataPacket.data)) {
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
AUDIO_AudioPathOff();
|
||||
gEnableSpeaker = false;
|
||||
RADIO_PrepareTX();
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
MSG_FSKSendData();
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
BK4819_ExitTxMute();
|
||||
MSG_EnableRX(true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||
: gEeprom.TX_VFO;
|
||||
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||
AUDIO_AudioPathOff();
|
||||
gEnableSpeaker = false;
|
||||
RADIO_PrepareTX();
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
MSG_FSKSendData();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
BK4819_ExitTxMute();
|
||||
MSG_EnableRX(true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
}
|
||||
gEnteringSMS = SMS_NOT_ENTERING;
|
||||
}
|
||||
}
|
||||
|
86
app/menu.c
86
app/menu.c
@@ -246,12 +246,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
#endif
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
case MENU_350TX:
|
||||
case MENU_200TX:
|
||||
case MENU_500TX:
|
||||
#endif
|
||||
case MENU_350EN:
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_TMR:
|
||||
#endif
|
||||
@@ -265,7 +259,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
||||
|
||||
case MENU_SCR:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1;
|
||||
*pMax = 10;
|
||||
break;
|
||||
|
||||
case MENU_AUTOLK:
|
||||
@@ -387,9 +381,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
|
||||
break;
|
||||
case MENU_SET_PTT:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
|
||||
@@ -405,22 +396,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
||||
*pMax = 15;
|
||||
break;
|
||||
#endif
|
||||
case MENU_TX_LOCK:
|
||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||
case MENU_SET_INV:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
|
||||
break;
|
||||
#endif
|
||||
case MENU_SET_LCK:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SET_LCK) - 1;
|
||||
break;
|
||||
case MENU_SET_MET:
|
||||
case MENU_SET_GUI:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SET_MET) - 1;
|
||||
break;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
case MENU_SET_NFM:
|
||||
//*pMin = 0;
|
||||
@@ -812,40 +793,14 @@ void MENU_AcceptSetting(void) {
|
||||
SETTINGS_FactoryReset(gSubMenuSelection);
|
||||
return;
|
||||
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
case MENU_350TX:
|
||||
gSetting_350TX = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_F_LOCK: {
|
||||
gSetting_F_LOCK = gSubMenuSelection;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_F_LOCK == F_LOCK_ALL) {
|
||||
if(gSetting_F_LOCK == F_LOCK_ALL) {
|
||||
SETTINGS_ResetTxLock();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
case MENU_200TX:
|
||||
gSetting_200TX = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_500TX:
|
||||
gSetting_500TX = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
case MENU_350EN:
|
||||
gSetting_350EN = gSubMenuSelection;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagResetVfos = true;
|
||||
break;
|
||||
// case MENU_SCREN:
|
||||
// gSetting_ScrambleEnable = gSubMenuSelection;
|
||||
// gFlagReconfigureVfos = true;
|
||||
// break;
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
@@ -890,10 +845,6 @@ void MENU_AcceptSetting(void) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
gSetting_set_pwr = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
break;
|
||||
case MENU_SET_PTT:
|
||||
gSetting_set_ptt = gSubMenuSelection;
|
||||
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
|
||||
@@ -915,12 +866,6 @@ void MENU_AcceptSetting(void) {
|
||||
case MENU_SET_LCK:
|
||||
gSetting_set_lck = gSubMenuSelection;
|
||||
break;
|
||||
case MENU_SET_MET:
|
||||
gSetting_set_met = gSubMenuSelection;
|
||||
break;
|
||||
case MENU_SET_GUI:
|
||||
gSetting_set_gui = gSubMenuSelection;
|
||||
break;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
case MENU_SET_NFM:
|
||||
gSetting_set_nfm = gSubMenuSelection;
|
||||
@@ -941,10 +886,6 @@ void MENU_AcceptSetting(void) {
|
||||
case MENU_SET_TMR:
|
||||
gSetting_set_tmr = gSubMenuSelection;
|
||||
break;
|
||||
case MENU_TX_LOCK:
|
||||
gTxVfo->TX_LOCK = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1268,17 +1209,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
gSubMenuSelection = gSetting_F_LOCK;
|
||||
break;
|
||||
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
case MENU_200TX:
|
||||
gSubMenuSelection = gSetting_200TX;
|
||||
break;
|
||||
|
||||
case MENU_500TX:
|
||||
gSubMenuSelection = gSetting_500TX;
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
@@ -1323,9 +1253,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
gSubMenuSelection = gSetting_set_pwr;
|
||||
break;
|
||||
case MENU_SET_PTT:
|
||||
gSubMenuSelection = gSetting_set_ptt_session;
|
||||
break;
|
||||
@@ -1346,12 +1273,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
case MENU_SET_LCK:
|
||||
gSubMenuSelection = gSetting_set_lck;
|
||||
break;
|
||||
case MENU_SET_MET:
|
||||
gSubMenuSelection = gSetting_set_met;
|
||||
break;
|
||||
case MENU_SET_GUI:
|
||||
gSubMenuSelection = gSetting_set_gui;
|
||||
break;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
case MENU_SET_NFM:
|
||||
gSubMenuSelection = gSetting_set_nfm;
|
||||
@@ -1370,9 +1291,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
case MENU_SET_TMR:
|
||||
gSubMenuSelection = gSetting_set_tmr;
|
||||
break;
|
||||
case MENU_TX_LOCK:
|
||||
gSubMenuSelection = gTxVfo->TX_LOCK;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
@@ -794,7 +794,7 @@ static void DrawStatus() {
|
||||
#else
|
||||
sprintf(String, "%d/%d", settings.dbMin, settings.dbMax);
|
||||
#endif
|
||||
GUI_DisplaySmallest(String, 0, 1, true, true);
|
||||
GUI_DisplaySmallest(String, 50, 20, true, true);
|
||||
|
||||
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryCheckCounter++ % 4],
|
||||
&gBatteryCurrent);
|
||||
@@ -860,9 +860,9 @@ static void DrawF(uint32_t f) {
|
||||
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
||||
|
||||
sprintf(String, "%3s", gModulationStr[settings.modulationType]);
|
||||
GUI_DisplaySmallest(String, 116, 1, false, true);
|
||||
GUI_DisplaySmallest(String, 95, 1, false, true);
|
||||
sprintf(String, "%4sk", bwOptions[settings.listenBw]);
|
||||
GUI_DisplaySmallest(String, 108, 7, false, true);
|
||||
GUI_DisplaySmallest(String, 90, 10, false, true);
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
|
||||
ShowChannelName(f);
|
||||
@@ -882,14 +882,14 @@ static void DrawNums() {
|
||||
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
|
||||
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
||||
settings.frequencyChangeStep % 100);
|
||||
GUI_DisplaySmallest(String, 36, 49, false, true);
|
||||
GUI_DisplaySmallest(String, 36, 39, false, true);
|
||||
} else {
|
||||
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
||||
GUI_DisplaySmallest(String, 0, 49, false, true);
|
||||
|
||||
sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100,
|
||||
settings.frequencyChangeStep % 100);
|
||||
GUI_DisplaySmallest(String, 48, 49, false, true);
|
||||
GUI_DisplaySmallest(String, 48, 10, false, true);
|
||||
|
||||
sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000);
|
||||
GUI_DisplaySmallest(String, 93, 49, false, true);
|
||||
@@ -1139,7 +1139,7 @@ void OnKeyDownStill(KEY_Code_t key) {
|
||||
}
|
||||
}
|
||||
|
||||
static void RenderFreqInput() { UI_PrintString(freqInputString, 2, 127, 0, 8); }
|
||||
static void RenderFreqInput() { UI_PrintString(freqInputString, 2, 127, 0 /*, 8 */); }
|
||||
|
||||
static void RenderStatus() {
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
@@ -1193,8 +1193,8 @@ static void RenderStill() {
|
||||
gFrameBuffer[2][METER_PAD_LEFT + x] = 0b11111111;
|
||||
}
|
||||
|
||||
const uint8_t PAD_LEFT = 4;
|
||||
const uint8_t CELL_WIDTH = 30;
|
||||
const uint8_t PAD_LEFT = 0;
|
||||
const uint8_t CELL_WIDTH = 28;
|
||||
uint8_t offset = PAD_LEFT;
|
||||
uint8_t row = 4;
|
||||
|
||||
|
11
bitmaps.c
11
bitmaps.c
@@ -166,17 +166,6 @@ const uint8_t BITMAP_Antenna[5] =
|
||||
0b00000011
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_VFO_Lock[7] =
|
||||
{
|
||||
0b01111100,
|
||||
0b01000110,
|
||||
0b01000101,
|
||||
0b01000101,
|
||||
0b01000101,
|
||||
0b01000110,
|
||||
0b01111100,
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_VFO_Default[7] =
|
||||
{
|
||||
0b01111111,
|
||||
|
@@ -38,7 +38,6 @@ extern const uint8_t BITMAP_NotReady[7];
|
||||
extern const uint8_t BITMAP_Antenna[5];
|
||||
extern const uint8_t BITMAP_VFO_Default[7];
|
||||
extern const uint8_t BITMAP_VFO_NotDefault[7];
|
||||
extern const uint8_t BITMAP_VFO_Lock[7];
|
||||
extern const uint8_t BITMAP_ScanList0[7];
|
||||
extern const uint8_t BITMAP_ScanList1[7];
|
||||
extern const uint8_t BITMAP_ScanList2[7];
|
||||
|
@@ -2,7 +2,8 @@
|
||||
#export DOCKER_DEFAULT_PLATFORM=linux/amd64
|
||||
#export DOCKER_NETWORK="--network=host"
|
||||
IMAGE_NAME="uvk5"
|
||||
rm "${PWD}/compiled-firmware/*"
|
||||
rm -rf "${PWD}/compiled-firmware/*"
|
||||
mkdir -p "${PWD}/compiled-firmware"
|
||||
echo "Building docker image $IMAGE_NAME"
|
||||
if ! docker build -t $DOCKER_NETWORK $IMAGE_NAME .
|
||||
then
|
||||
@@ -10,121 +11,6 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
custom() {
|
||||
echo "Custom compilation..."
|
||||
docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
|
||||
EDITION_STRING=Custom \
|
||||
TARGET=f4hwn.custom \
|
||||
&& cp f4hwn.custom* compiled-firmware/"
|
||||
}
|
||||
|
||||
standard() {
|
||||
echo "Standard compilation..."
|
||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
|
||||
ENABLE_SPECTRUM=0 \
|
||||
ENABLE_FMRADIO=0 \
|
||||
ENABLE_AIRCOPY=0 \
|
||||
ENABLE_NOAA=0 \
|
||||
EDITION_STRING=Standard \
|
||||
TARGET=f4hwn.standard \
|
||||
&& cp f4hwn.standard* compiled-firmware/"
|
||||
}
|
||||
|
||||
bandscope() {
|
||||
echo "Bandscope compilation..."
|
||||
docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
|
||||
ENABLE_SPECTRUM=1 \
|
||||
ENABLE_FMRADIO=0 \
|
||||
ENABLE_AIRCOPY=1 \
|
||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
||||
ENABLE_NOAA=0 \
|
||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
|
||||
EDITION_STRING=Bandscope \
|
||||
TARGET=f4hwn.bandscope \
|
||||
&& cp f4hwn.bandscope* compiled-firmware/"
|
||||
}
|
||||
|
||||
broadcast() {
|
||||
echo "Broadcast compilation..."
|
||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
|
||||
ENABLE_SPECTRUM=0 \
|
||||
ENABLE_FMRADIO=1 \
|
||||
ENABLE_AIRCOPY=1 \
|
||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
||||
ENABLE_NOAA=0 \
|
||||
EDITION_STRING=Broadcast \
|
||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
|
||||
TARGET=f4hwn.broadcast \
|
||||
&& cp f4hwn.broadcast* compiled-firmware/"
|
||||
}
|
||||
|
||||
basic() {
|
||||
echo "Basic compilation..."
|
||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
|
||||
ENABLE_SPECTRUM=1 \
|
||||
ENABLE_FMRADIO=1 \
|
||||
ENABLE_VOX=0 \
|
||||
ENABLE_AIRCOPY=0 \
|
||||
ENABLE_AUDIO_BAR=0 \
|
||||
ENABLE_FEAT_F4HWN_SPECTRUM=0 \
|
||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
||||
ENABLE_NOAA=0 \
|
||||
ENABLE_FEAT_F4HWN_RESUME_STATE=0 \
|
||||
ENABLE_FEAT_F4HWN_CHARGING_C=0 \
|
||||
ENABLE_FEAT_F4HWN_INV=1 \
|
||||
ENABLE_FEAT_F4HWN_CTR=0 \
|
||||
ENABLE_FEAT_F4HWN_NARROWER=0 \
|
||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
|
||||
EDITION_STRING=Basic \
|
||||
TARGET=f4hwn.basic \
|
||||
&& cp f4hwn.basic* compiled-firmware/"
|
||||
}
|
||||
|
||||
rescueops() {
|
||||
echo "RescueOps compilation..."
|
||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
|
||||
ENABLE_SPECTRUM=0 \
|
||||
ENABLE_FMRADIO=0 \
|
||||
ENABLE_AIRCOPY=1 \
|
||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
||||
ENABLE_NOAA=1 \
|
||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=1 \
|
||||
EDITION_STRING=RescueOps \
|
||||
TARGET=f4hwn.rescueops \
|
||||
&& cp f4hwn.rescueops* compiled-firmware/"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
custom)
|
||||
custom
|
||||
;;
|
||||
standard)
|
||||
standard
|
||||
;;
|
||||
bandscope)
|
||||
bandscope
|
||||
;;
|
||||
broadcast)
|
||||
broadcast
|
||||
;;
|
||||
basic)
|
||||
basic
|
||||
;;
|
||||
rescueops)
|
||||
rescueops
|
||||
;;
|
||||
all)
|
||||
bandscope
|
||||
broadcast
|
||||
rescueops
|
||||
basic
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {custom|bandscope|broadcast|basic|standard|all}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME \
|
||||
/bin/bash -c "cd /app && make -j && cp f4hwn* /app/compiled-firmware/ && ls -l /app/compiled-firmware/ || echo 'No files to copy'"
|
@@ -18,15 +18,43 @@
|
||||
#define BK1080_REGS_H
|
||||
|
||||
enum BK1080_Register_t {
|
||||
BK1080_REG_00 = 0x00U,
|
||||
BK1080_REG_02_POWER_CONFIGURATION = 0x02U,
|
||||
BK1080_REG_03_CHANNEL = 0x03U,
|
||||
BK1080_REG_00 = 0x00U,
|
||||
BK1080_REG_01_CHIP_ID = 0x01U,
|
||||
BK1080_REG_02_POWER_CONFIGURATION = 0x02U,
|
||||
BK1080_REG_03_CHANNEL = 0x03U,
|
||||
BK1080_REG_04_SYSTEM_CONFIGURATION1 = 0x04U,
|
||||
BK1080_REG_05_SYSTEM_CONFIGURATION2 = 0x05U,
|
||||
BK1080_REG_07 = 0x07U,
|
||||
BK1080_REG_10 = 0x0AU,
|
||||
BK1080_REG_25_INTERNAL = 0x19U,
|
||||
BK1080_REG_06_SYSTEM_CONFIGURATION3 = 0x06U,
|
||||
BK1080_REG_07_TEST1 = 0x07U,
|
||||
BK1080_REG_08_TEST2 = 0x08U,
|
||||
BK1080_REG_09_BOOT_CONFIGURATION = 0x09U,
|
||||
BK1080_REG_10_RSSI_STATUS = 0x0AU,
|
||||
BK1080_REG_11_RSSI_THRESHOLD = 0x0BU,
|
||||
BK1080_REG_12_INTERNAL = 0x0CU,
|
||||
BK1080_REG_13_INTERNAL = 0x0DU,
|
||||
BK1080_REG_14_INTERNAL = 0x0EU,
|
||||
BK1080_REG_15_INTERNAL = 0x0FU,
|
||||
BK1080_REG_16_INTERNAL = 0x10U,
|
||||
BK1080_REG_17_INTERNAL = 0x11U,
|
||||
BK1080_REG_18_INTERNAL = 0x12U,
|
||||
BK1080_REG_19_INTERNAL = 0x13U,
|
||||
BK1080_REG_20_INTERNAL = 0x14U,
|
||||
BK1080_REG_21_INTERNAL = 0x15U,
|
||||
BK1080_REG_22_INTERNAL = 0x16U,
|
||||
BK1080_REG_23_INTERNAL = 0x17U,
|
||||
BK1080_REG_24_INTERNAL = 0x18U,
|
||||
BK1080_REG_25_INTERNAL = 0x19U,
|
||||
BK1080_REG_26_INTERNAL = 0x1AU,
|
||||
BK1080_REG_27_INTERNAL = 0x1BU,
|
||||
BK1080_REG_28_INTERNAL = 0x1CU,
|
||||
BK1080_REG_29_INTERNAL = 0x1DU,
|
||||
BK1080_REG_30_INTERNAL = 0x1EU,
|
||||
BK1080_REG_31_INTERNAL = 0x1FU,
|
||||
BK1080_REG_32_INTERNAL = 0x20U,
|
||||
BK1080_REG_33_INTERNAL = 0x21U,
|
||||
};
|
||||
|
||||
|
||||
typedef enum BK1080_Register_t BK1080_Register_t;
|
||||
|
||||
// REG 07
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/i2c.h"
|
||||
#include "driver/system.h"
|
||||
#include "../settings.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
@@ -69,10 +70,11 @@ void BK1080_Init(uint16_t freq, uint8_t band/*, uint8_t space*/)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, gMute ? 0x0A10 : 0x0A1F);
|
||||
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A10 | (gEeprom.VOLUME_GAIN >> 2));
|
||||
#else
|
||||
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F);
|
||||
#endif
|
||||
BK1080_UpdateSysconf();
|
||||
BK1080_SetFrequency(freq, band/*, space*/);
|
||||
}
|
||||
else {
|
||||
@@ -104,6 +106,15 @@ void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value)
|
||||
I2C_Stop();
|
||||
}
|
||||
|
||||
void BK1080_UpdateSysconf(void) {
|
||||
BK1080_WriteRegister(BK1080_REG_04_SYSTEM_CONFIGURATION1,
|
||||
(gEeprom.BK1080_DEEMPHASIS_CONFIG == DEEMPHASIS_OFF ? BK1080_DEEMPHASIS_OFF : BK1080_DEEMPHASIS_ON) |
|
||||
(gEeprom.BK1080_DEEMPHASIS_CONFIG == DEEMPHASIS_EUR ? BK1080_DEEMPHASIS_EUR : BK1080_DEEMPHASIS_USA) |
|
||||
(gEeprom.BK1080_AGC_ENABLED ? BK1080_AGC_ON : BK1080_AGC_OFF) |
|
||||
(gEeprom.BK1080_BLEND_CONFIG << 6)
|
||||
);
|
||||
}
|
||||
|
||||
void BK1080_Mute(bool Mute)
|
||||
{
|
||||
BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, Mute ? 0x4201 : 0x0201);
|
||||
@@ -130,7 +141,7 @@ void BK1080_SetFrequency(uint16_t frequency, uint8_t band/*, uint8_t space*/)
|
||||
void BK1080_GetFrequencyDeviation(uint16_t Frequency)
|
||||
{
|
||||
BK1080_BaseFrequency = Frequency;
|
||||
BK1080_FrequencyDeviation = BK1080_ReadRegister(BK1080_REG_07) / 16;
|
||||
BK1080_FrequencyDeviation = BK1080_ReadRegister(BK1080_REG_07_TEST1) / 16;
|
||||
}
|
||||
|
||||
uint16_t BK1080_GetFreqLoLimit(uint8_t band)
|
||||
|
@@ -24,10 +24,20 @@
|
||||
extern uint16_t BK1080_BaseFrequency;
|
||||
extern uint16_t BK1080_FrequencyDeviation;
|
||||
|
||||
#define BK1080_DEEMPHASIS_USA (0 << 11)
|
||||
#define BK1080_DEEMPHASIS_EUR (1 << 11)
|
||||
|
||||
#define BK1080_DEEMPHASIS_ON (0 << 13)
|
||||
#define BK1080_DEEMPHASIS_OFF (1 << 13)
|
||||
|
||||
#define BK1080_AGC_ON (0 << 10)
|
||||
#define BK1080_AGC_OFF (1 << 10)
|
||||
|
||||
void BK1080_Init0(void);
|
||||
void BK1080_Init(uint16_t Frequency, uint8_t band/*, uint8_t space*/);
|
||||
uint16_t BK1080_ReadRegister(BK1080_Register_t Register);
|
||||
void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value);
|
||||
void BK1080_UpdateSysconf(void);
|
||||
void BK1080_Mute(bool Mute);
|
||||
uint16_t BK1080_GetFreqLoLimit(uint8_t band);
|
||||
uint16_t BK1080_GetFreqHiLimit(uint8_t band);
|
||||
|
@@ -226,22 +226,22 @@ uint8_t cmds[] = {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
}
|
||||
|
||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
|
||||
{
|
||||
gFrameBuffer[line][54] = 0x0c;
|
||||
gFrameBuffer[line][55] = 0x12;
|
||||
|
||||
gFrameBuffer[line][121] = 0x12;
|
||||
gFrameBuffer[line][122] = 0x0c;
|
||||
|
||||
uint8_t filled = map(value, min, max, 56, 120);
|
||||
|
||||
for (uint8_t i = 56; i <= 120; i++) {
|
||||
gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// #if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
// void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
|
||||
// {
|
||||
// gFrameBuffer[line][54] = 0x0c;
|
||||
// gFrameBuffer[line][55] = 0x12;
|
||||
//
|
||||
// gFrameBuffer[line][121] = 0x12;
|
||||
// gFrameBuffer[line][122] = 0x0c;
|
||||
//
|
||||
// uint8_t filled = map(value, min, max, 56, 120);
|
||||
//
|
||||
// for (uint8_t i = 56; i <= 120; i++) {
|
||||
// gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
void ST7565_Init(void)
|
||||
|
827
external/printf/printf.c
vendored
827
external/printf/printf.c
vendored
@@ -40,7 +40,10 @@
|
||||
// printf_config.h header file
|
||||
// default: undefined
|
||||
#ifdef PRINTF_INCLUDE_CONFIG_H
|
||||
#include "printf_config.h"
|
||||
#define PRINTF_DISABLE_SUPPORT_LONG_LONG
|
||||
#define PRINTF_DISABLE_SUPPORT_EXPONENTIAL
|
||||
#define PRINTF_DISABLE_SUPPORT_PTRDIFF_T
|
||||
#define PRINTF_DISABLE_SUPPORT_FLOAT
|
||||
#endif
|
||||
|
||||
|
||||
@@ -119,185 +122,183 @@
|
||||
|
||||
|
||||
// output function type
|
||||
typedef void (*out_fct_type)(char character, void* buffer, size_t idx, size_t maxlen);
|
||||
typedef void (*out_fct_type)(char character, void *buffer, size_t idx, size_t maxlen);
|
||||
|
||||
|
||||
// wrapper (used as buffer) for output function type
|
||||
typedef struct {
|
||||
void (*fct)(char character, void* arg);
|
||||
void* arg;
|
||||
void (*fct)(char character, void *arg);
|
||||
|
||||
void *arg;
|
||||
} out_fct_wrap_type;
|
||||
|
||||
|
||||
// internal buffer output
|
||||
static inline void _out_buffer(char character, void* buffer, size_t idx, size_t maxlen)
|
||||
{
|
||||
if (idx < maxlen) {
|
||||
((char*)buffer)[idx] = character;
|
||||
}
|
||||
static inline void _out_buffer(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||
if (idx < maxlen) {
|
||||
((char *) buffer)[idx] = character;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// internal null output
|
||||
static inline void _out_null(char character, void* buffer, size_t idx, size_t maxlen)
|
||||
{
|
||||
(void)character; (void)buffer; (void)idx; (void)maxlen;
|
||||
static inline void _out_null(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||
(void) character;
|
||||
(void) buffer;
|
||||
(void) idx;
|
||||
(void) maxlen;
|
||||
}
|
||||
|
||||
|
||||
// internal _putchar wrapper
|
||||
static inline void _out_char(char character, void* buffer, size_t idx, size_t maxlen)
|
||||
{
|
||||
(void)buffer; (void)idx; (void)maxlen;
|
||||
if (character) {
|
||||
_putchar(character);
|
||||
}
|
||||
static inline void _out_char(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||
(void) buffer;
|
||||
(void) idx;
|
||||
(void) maxlen;
|
||||
if (character) {
|
||||
_putchar(character);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// internal output function wrapper
|
||||
static inline void _out_fct(char character, void* buffer, size_t idx, size_t maxlen)
|
||||
{
|
||||
(void)idx; (void)maxlen;
|
||||
if (character) {
|
||||
// buffer is the output fct pointer
|
||||
((out_fct_wrap_type*)buffer)->fct(character, ((out_fct_wrap_type*)buffer)->arg);
|
||||
}
|
||||
static inline void _out_fct(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||
(void) idx;
|
||||
(void) maxlen;
|
||||
if (character) {
|
||||
// buffer is the output fct pointer
|
||||
((out_fct_wrap_type *) buffer)->fct(character, ((out_fct_wrap_type *) buffer)->arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// internal secure strlen
|
||||
// \return The length of the string (excluding the terminating 0) limited by 'maxsize'
|
||||
static inline unsigned int _strnlen_s(const char* str, size_t maxsize)
|
||||
{
|
||||
const char* s;
|
||||
for (s = str; *s && maxsize--; ++s);
|
||||
return (unsigned int)(s - str);
|
||||
static inline unsigned int _strnlen_s(const char *str, size_t maxsize) {
|
||||
const char *s;
|
||||
for (s = str; *s && maxsize--; ++s);
|
||||
return (unsigned int) (s - str);
|
||||
}
|
||||
|
||||
|
||||
// internal test if char is a digit (0-9)
|
||||
// \return true if char is a digit
|
||||
static inline bool _is_digit(char ch)
|
||||
{
|
||||
return (ch >= '0') && (ch <= '9');
|
||||
static inline bool _is_digit(char ch) {
|
||||
return (ch >= '0') && (ch <= '9');
|
||||
}
|
||||
|
||||
|
||||
// internal ASCII string to unsigned int conversion
|
||||
static unsigned int _atoi(const char** str)
|
||||
{
|
||||
unsigned int i = 0U;
|
||||
while (_is_digit(**str)) {
|
||||
i = i * 10U + (unsigned int)(*((*str)++) - '0');
|
||||
}
|
||||
return i;
|
||||
static unsigned int _atoi(const char **str) {
|
||||
unsigned int i = 0U;
|
||||
while (_is_digit(**str)) {
|
||||
i = i * 10U + (unsigned int) (*((*str)++) - '0');
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
// output the specified string in reverse, taking care of any zero-padding
|
||||
static size_t _out_rev(out_fct_type out, char* buffer, size_t idx, size_t maxlen, const char* buf, size_t len, unsigned int width, unsigned int flags)
|
||||
{
|
||||
const size_t start_idx = idx;
|
||||
static size_t
|
||||
_out_rev(out_fct_type out, char *buffer, size_t idx, size_t maxlen, const char *buf, size_t len, unsigned int width,
|
||||
unsigned int flags) {
|
||||
const size_t start_idx = idx;
|
||||
|
||||
// pad spaces up to given width
|
||||
if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) {
|
||||
for (size_t i = len; i < width; i++) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
// pad spaces up to given width
|
||||
if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) {
|
||||
for (size_t i = len; i < width; i++) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reverse string
|
||||
while (len) {
|
||||
out(buf[--len], buffer, idx++, maxlen);
|
||||
}
|
||||
|
||||
// append pad spaces up to given width
|
||||
if (flags & FLAGS_LEFT) {
|
||||
while (idx - start_idx < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
// reverse string
|
||||
while (len) {
|
||||
out(buf[--len], buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
|
||||
return idx;
|
||||
// append pad spaces up to given width
|
||||
if (flags & FLAGS_LEFT) {
|
||||
while (idx - start_idx < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
// internal itoa format
|
||||
static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t maxlen, char* buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags)
|
||||
{
|
||||
// pad leading zeros
|
||||
if (!(flags & FLAGS_LEFT)) {
|
||||
if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) {
|
||||
width--;
|
||||
static size_t
|
||||
_ntoa_format(out_fct_type out, char *buffer, size_t idx, size_t maxlen, char *buf, size_t len, bool negative,
|
||||
unsigned int base, unsigned int prec, unsigned int width, unsigned int flags) {
|
||||
// pad leading zeros
|
||||
if (!(flags & FLAGS_LEFT)) {
|
||||
if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) {
|
||||
width--;
|
||||
}
|
||||
while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = '0';
|
||||
}
|
||||
while ((flags & FLAGS_ZEROPAD) && (len < width) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = '0';
|
||||
}
|
||||
}
|
||||
while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = '0';
|
||||
}
|
||||
while ((flags & FLAGS_ZEROPAD) && (len < width) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
// handle hash
|
||||
if (flags & FLAGS_HASH) {
|
||||
if (!(flags & FLAGS_PRECISION) && len && ((len == prec) || (len == width))) {
|
||||
len--;
|
||||
if (len && (base == 16U)) {
|
||||
len--;
|
||||
}
|
||||
}
|
||||
if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = 'x';
|
||||
}
|
||||
else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = 'X';
|
||||
}
|
||||
else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = 'b';
|
||||
// handle hash
|
||||
if (flags & FLAGS_HASH) {
|
||||
if (!(flags & FLAGS_PRECISION) && len && ((len == prec) || (len == width))) {
|
||||
len--;
|
||||
if (len && (base == 16U)) {
|
||||
len--;
|
||||
}
|
||||
}
|
||||
if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = 'x';
|
||||
} else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = 'X';
|
||||
} else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||
buf[len++] = 'b';
|
||||
}
|
||||
if (len < PRINTF_NTOA_BUFFER_SIZE) {
|
||||
buf[len++] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
if (len < PRINTF_NTOA_BUFFER_SIZE) {
|
||||
buf[len++] = '0';
|
||||
if (negative) {
|
||||
buf[len++] = '-';
|
||||
} else if (flags & FLAGS_PLUS) {
|
||||
buf[len++] = '+'; // ignore the space if the '+' exists
|
||||
} else if (flags & FLAGS_SPACE) {
|
||||
buf[len++] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (len < PRINTF_NTOA_BUFFER_SIZE) {
|
||||
if (negative) {
|
||||
buf[len++] = '-';
|
||||
}
|
||||
else if (flags & FLAGS_PLUS) {
|
||||
buf[len++] = '+'; // ignore the space if the '+' exists
|
||||
}
|
||||
else if (flags & FLAGS_SPACE) {
|
||||
buf[len++] = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags);
|
||||
return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags);
|
||||
}
|
||||
|
||||
|
||||
// internal itoa for 'long' type
|
||||
static size_t _ntoa_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags)
|
||||
{
|
||||
char buf[PRINTF_NTOA_BUFFER_SIZE];
|
||||
size_t len = 0U;
|
||||
static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative,
|
||||
unsigned long base, unsigned int prec, unsigned int width, unsigned int flags) {
|
||||
char buf[PRINTF_NTOA_BUFFER_SIZE];
|
||||
size_t len = 0U;
|
||||
|
||||
// no hash for 0 values
|
||||
if (!value) {
|
||||
flags &= ~FLAGS_HASH;
|
||||
}
|
||||
// no hash for 0 values
|
||||
if (!value) {
|
||||
flags &= ~FLAGS_HASH;
|
||||
}
|
||||
|
||||
// write if precision != 0 and value is != 0
|
||||
if (!(flags & FLAGS_PRECISION) || value) {
|
||||
do {
|
||||
const char digit = (char)(value % base);
|
||||
buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
|
||||
value /= base;
|
||||
} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
|
||||
}
|
||||
// write if precision != 0 and value is != 0
|
||||
if (!(flags & FLAGS_PRECISION) || value) {
|
||||
do {
|
||||
const char digit = (char) (value % base);
|
||||
buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
|
||||
value /= base;
|
||||
} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
|
||||
}
|
||||
|
||||
return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags);
|
||||
return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int) base, prec, width, flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -574,341 +575,353 @@ static size_t _etoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, d
|
||||
|
||||
|
||||
// internal vsnprintf
|
||||
static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const char* format, va_list va)
|
||||
{
|
||||
unsigned int flags, width, precision, n;
|
||||
size_t idx = 0U;
|
||||
static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, const char *format, va_list va) {
|
||||
unsigned int flags, width, precision, n;
|
||||
size_t idx = 0U;
|
||||
|
||||
if (!buffer) {
|
||||
// use null output function
|
||||
out = _out_null;
|
||||
}
|
||||
|
||||
while (*format)
|
||||
{
|
||||
// format specifier? %[flags][width][.precision][length]
|
||||
if (*format != '%') {
|
||||
// no
|
||||
out(*format, buffer, idx++, maxlen);
|
||||
format++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// yes, evaluate it
|
||||
format++;
|
||||
if (!buffer) {
|
||||
// use null output function
|
||||
out = _out_null;
|
||||
}
|
||||
|
||||
// evaluate flags
|
||||
flags = 0U;
|
||||
do {
|
||||
switch (*format) {
|
||||
case '0': flags |= FLAGS_ZEROPAD; format++; n = 1U; break;
|
||||
case '-': flags |= FLAGS_LEFT; format++; n = 1U; break;
|
||||
case '+': flags |= FLAGS_PLUS; format++; n = 1U; break;
|
||||
case ' ': flags |= FLAGS_SPACE; format++; n = 1U; break;
|
||||
case '#': flags |= FLAGS_HASH; format++; n = 1U; break;
|
||||
default : n = 0U; break;
|
||||
}
|
||||
} while (n);
|
||||
|
||||
// evaluate width field
|
||||
width = 0U;
|
||||
if (_is_digit(*format)) {
|
||||
width = _atoi(&format);
|
||||
}
|
||||
else if (*format == '*') {
|
||||
const int w = va_arg(va, int);
|
||||
if (w < 0) {
|
||||
flags |= FLAGS_LEFT; // reverse padding
|
||||
width = (unsigned int)-w;
|
||||
}
|
||||
else {
|
||||
width = (unsigned int)w;
|
||||
}
|
||||
format++;
|
||||
}
|
||||
|
||||
// evaluate precision field
|
||||
precision = 0U;
|
||||
if (*format == '.') {
|
||||
flags |= FLAGS_PRECISION;
|
||||
format++;
|
||||
if (_is_digit(*format)) {
|
||||
precision = _atoi(&format);
|
||||
}
|
||||
else if (*format == '*') {
|
||||
const int prec = (int)va_arg(va, int);
|
||||
precision = prec > 0 ? (unsigned int)prec : 0U;
|
||||
format++;
|
||||
}
|
||||
}
|
||||
|
||||
// evaluate length field
|
||||
switch (*format) {
|
||||
case 'l' :
|
||||
flags |= FLAGS_LONG;
|
||||
format++;
|
||||
if (*format == 'l') {
|
||||
flags |= FLAGS_LONG_LONG;
|
||||
format++;
|
||||
while (*format) {
|
||||
// format specifier? %[flags][width][.precision][length]
|
||||
if (*format != '%') {
|
||||
// no
|
||||
out(*format, buffer, idx++, maxlen);
|
||||
format++;
|
||||
continue;
|
||||
} else {
|
||||
// yes, evaluate it
|
||||
format++;
|
||||
}
|
||||
break;
|
||||
case 'h' :
|
||||
flags |= FLAGS_SHORT;
|
||||
format++;
|
||||
if (*format == 'h') {
|
||||
flags |= FLAGS_CHAR;
|
||||
format++;
|
||||
|
||||
// evaluate flags
|
||||
flags = 0U;
|
||||
do {
|
||||
switch (*format) {
|
||||
case '0':
|
||||
flags |= FLAGS_ZEROPAD;
|
||||
format++;
|
||||
n = 1U;
|
||||
break;
|
||||
case '-':
|
||||
flags |= FLAGS_LEFT;
|
||||
format++;
|
||||
n = 1U;
|
||||
break;
|
||||
case '+':
|
||||
flags |= FLAGS_PLUS;
|
||||
format++;
|
||||
n = 1U;
|
||||
break;
|
||||
case ' ':
|
||||
flags |= FLAGS_SPACE;
|
||||
format++;
|
||||
n = 1U;
|
||||
break;
|
||||
case '#':
|
||||
flags |= FLAGS_HASH;
|
||||
format++;
|
||||
n = 1U;
|
||||
break;
|
||||
default :
|
||||
n = 0U;
|
||||
break;
|
||||
}
|
||||
} while (n);
|
||||
|
||||
// evaluate width field
|
||||
width = 0U;
|
||||
if (_is_digit(*format)) {
|
||||
width = _atoi(&format);
|
||||
} else if (*format == '*') {
|
||||
const int w = va_arg(va, int);
|
||||
if (w < 0) {
|
||||
flags |= FLAGS_LEFT; // reverse padding
|
||||
width = (unsigned int) -w;
|
||||
} else {
|
||||
width = (unsigned int) w;
|
||||
}
|
||||
format++;
|
||||
}
|
||||
break;
|
||||
|
||||
// evaluate precision field
|
||||
precision = 0U;
|
||||
if (*format == '.') {
|
||||
flags |= FLAGS_PRECISION;
|
||||
format++;
|
||||
if (_is_digit(*format)) {
|
||||
precision = _atoi(&format);
|
||||
} else if (*format == '*') {
|
||||
const int prec = (int) va_arg(va, int);
|
||||
precision = prec > 0 ? (unsigned int) prec : 0U;
|
||||
format++;
|
||||
}
|
||||
}
|
||||
|
||||
// evaluate length field
|
||||
switch (*format) {
|
||||
case 'l' :
|
||||
flags |= FLAGS_LONG;
|
||||
format++;
|
||||
if (*format == 'l') {
|
||||
flags |= FLAGS_LONG_LONG;
|
||||
format++;
|
||||
}
|
||||
break;
|
||||
case 'h' :
|
||||
flags |= FLAGS_SHORT;
|
||||
format++;
|
||||
if (*format == 'h') {
|
||||
flags |= FLAGS_CHAR;
|
||||
format++;
|
||||
}
|
||||
break;
|
||||
#if defined(PRINTF_SUPPORT_PTRDIFF_T)
|
||||
case 't' :
|
||||
flags |= (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||
format++;
|
||||
break;
|
||||
case 't' :
|
||||
flags |= (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||
format++;
|
||||
break;
|
||||
#endif
|
||||
case 'j' :
|
||||
flags |= (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||
format++;
|
||||
break;
|
||||
case 'z' :
|
||||
flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||
format++;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
// evaluate specifier
|
||||
switch (*format) {
|
||||
case 'd' :
|
||||
case 'i' :
|
||||
case 'u' :
|
||||
case 'x' :
|
||||
case 'X' :
|
||||
case 'o' :
|
||||
case 'b' : {
|
||||
// set the base
|
||||
unsigned int base;
|
||||
if (*format == 'x' || *format == 'X') {
|
||||
base = 16U;
|
||||
}
|
||||
else if (*format == 'o') {
|
||||
base = 8U;
|
||||
}
|
||||
else if (*format == 'b') {
|
||||
base = 2U;
|
||||
}
|
||||
else {
|
||||
base = 10U;
|
||||
flags &= ~FLAGS_HASH; // no hash for dec format
|
||||
}
|
||||
// uppercase
|
||||
if (*format == 'X') {
|
||||
flags |= FLAGS_UPPERCASE;
|
||||
case 'j' :
|
||||
flags |= (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||
format++;
|
||||
break;
|
||||
case 'z' :
|
||||
flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||
format++;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
// no plus or space flag for u, x, X, o, b
|
||||
if ((*format != 'i') && (*format != 'd')) {
|
||||
flags &= ~(FLAGS_PLUS | FLAGS_SPACE);
|
||||
}
|
||||
// evaluate specifier
|
||||
switch (*format) {
|
||||
case 'd' :
|
||||
case 'i' :
|
||||
case 'u' :
|
||||
case 'x' :
|
||||
case 'X' :
|
||||
case 'o' :
|
||||
case 'b' : {
|
||||
// set the base
|
||||
unsigned int base;
|
||||
if (*format == 'x' || *format == 'X') {
|
||||
base = 16U;
|
||||
} else if (*format == 'o') {
|
||||
base = 8U;
|
||||
} else if (*format == 'b') {
|
||||
base = 2U;
|
||||
} else {
|
||||
base = 10U;
|
||||
flags &= ~FLAGS_HASH; // no hash for dec format
|
||||
}
|
||||
// uppercase
|
||||
if (*format == 'X') {
|
||||
flags |= FLAGS_UPPERCASE;
|
||||
}
|
||||
|
||||
// ignore '0' flag when precision is given
|
||||
if (flags & FLAGS_PRECISION) {
|
||||
flags &= ~FLAGS_ZEROPAD;
|
||||
}
|
||||
// no plus or space flag for u, x, X, o, b
|
||||
if ((*format != 'i') && (*format != 'd')) {
|
||||
flags &= ~(FLAGS_PLUS | FLAGS_SPACE);
|
||||
}
|
||||
|
||||
// convert the integer
|
||||
if ((*format == 'i') || (*format == 'd')) {
|
||||
// signed
|
||||
if (flags & FLAGS_LONG_LONG) {
|
||||
// ignore '0' flag when precision is given
|
||||
if (flags & FLAGS_PRECISION) {
|
||||
flags &= ~FLAGS_ZEROPAD;
|
||||
}
|
||||
|
||||
// convert the integer
|
||||
if ((*format == 'i') || (*format == 'd')) {
|
||||
// signed
|
||||
if (flags & FLAGS_LONG_LONG) {
|
||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||
const long long value = va_arg(va, long long);
|
||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
||||
const long long value = va_arg(va, long long);
|
||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
||||
#endif
|
||||
}
|
||||
else if (flags & FLAGS_LONG) {
|
||||
const long value = va_arg(va, long);
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
||||
}
|
||||
else {
|
||||
const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) : (flags & FLAGS_SHORT) ? (short int)va_arg(va, int) : va_arg(va, int);
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// unsigned
|
||||
if (flags & FLAGS_LONG_LONG) {
|
||||
} else if (flags & FLAGS_LONG) {
|
||||
const long value = va_arg(va, long);
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long) (value > 0 ? value : 0 - value),
|
||||
value < 0, base, precision, width, flags);
|
||||
} else {
|
||||
const int value = (flags & FLAGS_CHAR) ? (char) va_arg(va, int) : (flags & FLAGS_SHORT)
|
||||
? (short int) va_arg(va, int)
|
||||
: va_arg(va, int);
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int) (value > 0 ? value : 0 - value),
|
||||
value < 0, base, precision, width, flags);
|
||||
}
|
||||
} else {
|
||||
// unsigned
|
||||
if (flags & FLAGS_LONG_LONG) {
|
||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags);
|
||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags);
|
||||
#endif
|
||||
}
|
||||
else if (flags & FLAGS_LONG) {
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision, width, flags);
|
||||
}
|
||||
else {
|
||||
const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char)va_arg(va, unsigned int) : (flags & FLAGS_SHORT) ? (unsigned short int)va_arg(va, unsigned int) : va_arg(va, unsigned int);
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags);
|
||||
}
|
||||
}
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
} else if (flags & FLAGS_LONG) {
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision,
|
||||
width, flags);
|
||||
} else {
|
||||
const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char) va_arg(va, unsigned int)
|
||||
: (flags & FLAGS_SHORT)
|
||||
? (unsigned short int) va_arg(va,
|
||||
unsigned int)
|
||||
: va_arg(va, unsigned int);
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags);
|
||||
}
|
||||
}
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
#if defined(PRINTF_SUPPORT_FLOAT)
|
||||
case 'f' :
|
||||
case 'F' :
|
||||
if (*format == 'F') flags |= FLAGS_UPPERCASE;
|
||||
idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
||||
format++;
|
||||
break;
|
||||
case 'f' :
|
||||
case 'F' :
|
||||
if (*format == 'F') flags |= FLAGS_UPPERCASE;
|
||||
idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
||||
format++;
|
||||
break;
|
||||
#if defined(PRINTF_SUPPORT_EXPONENTIAL)
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'g':
|
||||
case 'G':
|
||||
if ((*format == 'g')||(*format == 'G')) flags |= FLAGS_ADAPT_EXP;
|
||||
if ((*format == 'E')||(*format == 'G')) flags |= FLAGS_UPPERCASE;
|
||||
idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
||||
format++;
|
||||
break;
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'g':
|
||||
case 'G':
|
||||
if ((*format == 'g')||(*format == 'G')) flags |= FLAGS_ADAPT_EXP;
|
||||
if ((*format == 'E')||(*format == 'G')) flags |= FLAGS_UPPERCASE;
|
||||
idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
||||
format++;
|
||||
break;
|
||||
#endif // PRINTF_SUPPORT_EXPONENTIAL
|
||||
#endif // PRINTF_SUPPORT_FLOAT
|
||||
case 'c' : {
|
||||
unsigned int l = 1U;
|
||||
// pre padding
|
||||
if (!(flags & FLAGS_LEFT)) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
// char output
|
||||
out((char)va_arg(va, int), buffer, idx++, maxlen);
|
||||
// post padding
|
||||
if (flags & FLAGS_LEFT) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
case 'c' : {
|
||||
unsigned int l = 1U;
|
||||
// pre padding
|
||||
if (!(flags & FLAGS_LEFT)) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
// char output
|
||||
out((char) va_arg(va, int), buffer, idx++, maxlen);
|
||||
// post padding
|
||||
if (flags & FLAGS_LEFT) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
|
||||
case 's' : {
|
||||
const char* p = va_arg(va, char*);
|
||||
unsigned int l = _strnlen_s(p, precision ? precision : (size_t)-1);
|
||||
// pre padding
|
||||
if (flags & FLAGS_PRECISION) {
|
||||
l = (l < precision ? l : precision);
|
||||
}
|
||||
if (!(flags & FLAGS_LEFT)) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
// string output
|
||||
while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) {
|
||||
out(*(p++), buffer, idx++, maxlen);
|
||||
}
|
||||
// post padding
|
||||
if (flags & FLAGS_LEFT) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
case 's' : {
|
||||
const char *p = va_arg(va, char*);
|
||||
unsigned int l = _strnlen_s(p, precision ? precision : (size_t) -1);
|
||||
// pre padding
|
||||
if (flags & FLAGS_PRECISION) {
|
||||
l = (l < precision ? l : precision);
|
||||
}
|
||||
if (!(flags & FLAGS_LEFT)) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
// string output
|
||||
while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) {
|
||||
out(*(p++), buffer, idx++, maxlen);
|
||||
}
|
||||
// post padding
|
||||
if (flags & FLAGS_LEFT) {
|
||||
while (l++ < width) {
|
||||
out(' ', buffer, idx++, maxlen);
|
||||
}
|
||||
}
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'p' : {
|
||||
width = sizeof(void*) * 2U;
|
||||
flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE;
|
||||
case 'p' : {
|
||||
width = sizeof(void *) * 2U;
|
||||
flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE;
|
||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||
const bool is_ll = sizeof(uintptr_t) == sizeof(long long);
|
||||
if (is_ll) {
|
||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, (uintptr_t)va_arg(va, void*), false, 16U, precision, width, flags);
|
||||
}
|
||||
else {
|
||||
const bool is_ll = sizeof(uintptr_t) == sizeof(long long);
|
||||
if (is_ll) {
|
||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, (uintptr_t)va_arg(va, void*), false, 16U, precision, width, flags);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)((uintptr_t)va_arg(va, void*)), false, 16U, precision, width, flags);
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long) ((uintptr_t) va_arg(va, void*)), false, 16U,
|
||||
precision, width, flags);
|
||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
|
||||
case '%' :
|
||||
out('%', buffer, idx++, maxlen);
|
||||
format++;
|
||||
break;
|
||||
case '%' :
|
||||
out('%', buffer, idx++, maxlen);
|
||||
format++;
|
||||
break;
|
||||
|
||||
default :
|
||||
out(*format, buffer, idx++, maxlen);
|
||||
format++;
|
||||
break;
|
||||
default :
|
||||
out(*format, buffer, idx++, maxlen);
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// termination
|
||||
out((char)0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen);
|
||||
// termination
|
||||
out((char) 0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen);
|
||||
|
||||
// return written chars without terminating \0
|
||||
return (int)idx;
|
||||
// return written chars without terminating \0
|
||||
return (int) idx;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int printf_(const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
char buffer[1];
|
||||
const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
int printf_(const char *format, ...) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
char buffer[1];
|
||||
const int ret = _vsnprintf(_out_char, buffer, (size_t) -1, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int sprintf_(char* buffer, const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
const int ret = _vsnprintf(_out_buffer, buffer, (size_t)-1, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
int sprintf_(char *buffer, const char *format, ...) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
const int ret = _vsnprintf(_out_buffer, buffer, (size_t) -1, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int snprintf_(char* buffer, size_t count, const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
const int ret = _vsnprintf(_out_buffer, buffer, count, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
int snprintf_(char *buffer, size_t count, const char *format, ...) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
const int ret = _vsnprintf(_out_buffer, buffer, count, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int vprintf_(const char* format, va_list va)
|
||||
{
|
||||
char buffer[1];
|
||||
return _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
|
||||
int vprintf_(const char *format, va_list va) {
|
||||
char buffer[1];
|
||||
return _vsnprintf(_out_char, buffer, (size_t) -1, format, va);
|
||||
}
|
||||
|
||||
|
||||
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va)
|
||||
{
|
||||
return _vsnprintf(_out_buffer, buffer, count, format, va);
|
||||
int vsnprintf_(char *buffer, size_t count, const char *format, va_list va) {
|
||||
return _vsnprintf(_out_buffer, buffer, count, format, va);
|
||||
}
|
||||
|
||||
|
||||
int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
const out_fct_wrap_type out_fct_wrap = { out, arg };
|
||||
const int ret = _vsnprintf(_out_fct, (char*)(uintptr_t)&out_fct_wrap, (size_t)-1, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
int fctprintf(void (*out)(char character, void *arg), void *arg, const char *format, ...) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
const out_fct_wrap_type out_fct_wrap = {out, arg};
|
||||
const int ret = _vsnprintf(_out_fct, (char *) (uintptr_t) &out_fct_wrap, (size_t) -1, format, va);
|
||||
va_end(va);
|
||||
return ret;
|
||||
}
|
||||
|
227
frequencies.c
227
frequencies.c
@@ -24,90 +24,90 @@
|
||||
#define BX4819_band1_lower 1800000
|
||||
#define BX4819_band2_upper 130000000
|
||||
|
||||
const freq_band_table_t BX4819_band1 = {BX4819_band1_lower, 63000000};
|
||||
const freq_band_table_t BX4819_band1 = {BX4819_band1_lower, 63000000};
|
||||
const freq_band_table_t BX4819_band2 = {84000000, BX4819_band2_upper};
|
||||
|
||||
const freq_band_table_t frequencyBandTable[] =
|
||||
{
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
// QS original
|
||||
[BAND1_50MHz ]={.lower = 5000000, .upper = 7600000},
|
||||
[BAND7_470MHz]={.lower = 47000000, .upper = 60000000},
|
||||
#else
|
||||
// extended range
|
||||
[BAND1_50MHz ]={.lower = BX4819_band1_lower, .upper = 10800000},
|
||||
[BAND7_470MHz]={.lower = 47000000, .upper = BX4819_band2_upper},
|
||||
#endif
|
||||
[BAND2_108MHz]={.lower = 10800000, .upper = 13700000},
|
||||
[BAND3_137MHz]={.lower = 13700000, .upper = 17400000},
|
||||
[BAND4_174MHz]={.lower = 17400000, .upper = 35000000},
|
||||
[BAND5_350MHz]={.lower = 35000000, .upper = 40000000},
|
||||
[BAND6_400MHz]={.lower = 40000000, .upper = 47000000}
|
||||
};
|
||||
{
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
// QS original
|
||||
[BAND1_50MHz ]={.lower = 5000000, .upper = 7600000},
|
||||
[BAND7_470MHz]={.lower = 47000000, .upper = 60000000},
|
||||
#else
|
||||
// extended range
|
||||
[BAND1_50MHz]={.lower = BX4819_band1_lower, .upper = 10800000},
|
||||
[BAND7_470MHz]={.lower = 47000000, .upper = BX4819_band2_upper},
|
||||
#endif
|
||||
[BAND2_108MHz]={.lower = 10800000, .upper = 13700000},
|
||||
[BAND3_137MHz]={.lower = 13700000, .upper = 17400000},
|
||||
[BAND4_174MHz]={.lower = 17400000, .upper = 35000000},
|
||||
[BAND5_350MHz]={.lower = 35000000, .upper = 40000000},
|
||||
[BAND6_400MHz]={.lower = 40000000, .upper = 47000000}
|
||||
};
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
const uint32_t NoaaFrequencyTable[10] =
|
||||
{
|
||||
16255000,
|
||||
16240000,
|
||||
16247500,
|
||||
16242500,
|
||||
16245000,
|
||||
16250000,
|
||||
16252500,
|
||||
16152500,
|
||||
16177500,
|
||||
16327500
|
||||
};
|
||||
const uint32_t NoaaFrequencyTable[10] =
|
||||
{
|
||||
16255000,
|
||||
16240000,
|
||||
16247500,
|
||||
16242500,
|
||||
16245000,
|
||||
16250000,
|
||||
16252500,
|
||||
16152500,
|
||||
16177500,
|
||||
16327500
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// this order of steps has to be preserved for backwards compatibility with other/stock firmwares
|
||||
const uint16_t gStepFrequencyTable[] = {
|
||||
// standard steps
|
||||
[STEP_2_5kHz] = 250,
|
||||
[STEP_5kHz] = 500,
|
||||
[STEP_6_25kHz] = 625,
|
||||
[STEP_10kHz] = 1000,
|
||||
[STEP_12_5kHz] = 1250,
|
||||
[STEP_25kHz] = 2500,
|
||||
[STEP_8_33kHz] = 833,
|
||||
[STEP_2_5kHz] = 250,
|
||||
[STEP_5kHz] = 500,
|
||||
[STEP_6_25kHz] = 625,
|
||||
[STEP_10kHz] = 1000,
|
||||
[STEP_12_5kHz] = 1250,
|
||||
[STEP_25kHz] = 2500,
|
||||
[STEP_8_33kHz] = 833,
|
||||
// custom steps
|
||||
[STEP_0_01kHz] = 1,
|
||||
[STEP_0_05kHz] = 5,
|
||||
[STEP_0_1kHz] = 10,
|
||||
[STEP_0_25kHz] = 25,
|
||||
[STEP_0_5kHz] = 50,
|
||||
[STEP_1kHz] = 100,
|
||||
[STEP_1_25kHz] = 125,
|
||||
[STEP_9kHz] = 900,
|
||||
[STEP_15kHz] = 1500,
|
||||
[STEP_20kHz] = 2000,
|
||||
[STEP_30kHz] = 3000,
|
||||
[STEP_50kHz] = 5000,
|
||||
[STEP_100kHz] = 10000,
|
||||
[STEP_125kHz] = 12500,
|
||||
[STEP_200kHz] = 20000,
|
||||
[STEP_250kHz] = 25000,
|
||||
[STEP_500kHz] = 50000
|
||||
[STEP_0_01kHz] = 1,
|
||||
[STEP_0_05kHz] = 5,
|
||||
[STEP_0_1kHz] = 10,
|
||||
[STEP_0_25kHz] = 25,
|
||||
[STEP_0_5kHz] = 50,
|
||||
[STEP_1kHz] = 100,
|
||||
[STEP_1_25kHz] = 125,
|
||||
[STEP_9kHz] = 900,
|
||||
[STEP_15kHz] = 1500,
|
||||
[STEP_20kHz] = 2000,
|
||||
[STEP_30kHz] = 3000,
|
||||
[STEP_50kHz] = 5000,
|
||||
[STEP_100kHz] = 10000,
|
||||
[STEP_125kHz] = 12500,
|
||||
[STEP_200kHz] = 20000,
|
||||
[STEP_250kHz] = 25000,
|
||||
[STEP_500kHz] = 50000
|
||||
};
|
||||
|
||||
|
||||
const STEP_Setting_t StepSortedIndexes[] = {
|
||||
STEP_0_01kHz, STEP_0_05kHz, STEP_0_1kHz, STEP_0_25kHz, STEP_0_5kHz, STEP_1kHz, STEP_1_25kHz, STEP_2_5kHz, STEP_5kHz, STEP_6_25kHz,
|
||||
STEP_8_33kHz, STEP_9kHz, STEP_10kHz, STEP_12_5kHz, STEP_15kHz, STEP_20kHz, STEP_25kHz, STEP_30kHz, STEP_50kHz, STEP_100kHz,
|
||||
STEP_125kHz, STEP_200kHz, STEP_250kHz, STEP_500kHz
|
||||
STEP_0_01kHz, STEP_0_05kHz, STEP_0_1kHz, STEP_0_25kHz, STEP_0_5kHz, STEP_1kHz, STEP_1_25kHz, STEP_2_5kHz,
|
||||
STEP_5kHz, STEP_6_25kHz,
|
||||
STEP_8_33kHz, STEP_9kHz, STEP_10kHz, STEP_12_5kHz, STEP_15kHz, STEP_20kHz, STEP_25kHz, STEP_30kHz, STEP_50kHz,
|
||||
STEP_100kHz,
|
||||
STEP_125kHz, STEP_200kHz, STEP_250kHz, STEP_500kHz
|
||||
};
|
||||
|
||||
STEP_Setting_t FREQUENCY_GetStepIdxFromSortedIdx(uint8_t sortedIdx)
|
||||
{
|
||||
STEP_Setting_t FREQUENCY_GetStepIdxFromSortedIdx(uint8_t sortedIdx) {
|
||||
return StepSortedIndexes[sortedIdx];
|
||||
}
|
||||
|
||||
uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx)
|
||||
{
|
||||
for(uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++)
|
||||
if(StepSortedIndexes[i] == stepIdx)
|
||||
uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx) {
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++)
|
||||
if (StepSortedIndexes[i] == stepIdx)
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
@@ -115,25 +115,24 @@ uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx)
|
||||
static_assert(ARRAY_SIZE(gStepFrequencyTable) == STEP_N_ELEM);
|
||||
|
||||
|
||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
||||
{
|
||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency) {
|
||||
for (int32_t band = BAND_N_ELEM - 1; band >= 0; band--)
|
||||
if (Frequency >= frequencyBandTable[band].lower)
|
||||
return (FREQUENCY_Band_t)band;
|
||||
return (FREQUENCY_Band_t) band;
|
||||
|
||||
return BAND1_50MHz;
|
||||
}
|
||||
|
||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
|
||||
{
|
||||
uint8_t
|
||||
FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle,
|
||||
int32_t UpperLimit, int32_t Frequency) {
|
||||
if (Frequency <= LowerLimit)
|
||||
return TxpLow;
|
||||
|
||||
if (UpperLimit <= Frequency)
|
||||
return TxpHigh;
|
||||
|
||||
if (Frequency <= Middle)
|
||||
{
|
||||
if (Frequency <= Middle) {
|
||||
TxpMid += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit);
|
||||
return TxpMid;
|
||||
}
|
||||
@@ -144,23 +143,22 @@ uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t T
|
||||
}
|
||||
|
||||
|
||||
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step)
|
||||
{
|
||||
if(step == 833) {
|
||||
uint32_t base = freq/2500*2500;
|
||||
int chno = (freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
|
||||
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step) {
|
||||
if (step == 833) {
|
||||
uint32_t base = freq / 2500 * 2500;
|
||||
int chno =
|
||||
(freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
|
||||
return base + (chno * 833) + (chno == 3);
|
||||
}
|
||||
|
||||
if(step == 1)
|
||||
if (step == 1)
|
||||
return freq;
|
||||
if(step >= 1000)
|
||||
step = step/2;
|
||||
if (step >= 1000)
|
||||
step = step / 2;
|
||||
return (freq + (step + 1) / 2) / step * step;
|
||||
}
|
||||
|
||||
int32_t TX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
int32_t TX_freq_check(const uint32_t Frequency) { // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
||||
@@ -169,30 +167,22 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
return -1; // BX chip does not work in this range
|
||||
|
||||
switch (gSetting_F_LOCK)
|
||||
{
|
||||
switch (gSetting_F_LOCK) {
|
||||
case F_LOCK_DEF:
|
||||
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper)
|
||||
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower &&
|
||||
Frequency < frequencyBandTable[BAND3_137MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_200TX)
|
||||
#endif
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_350TX && gSetting_350EN)
|
||||
#else
|
||||
if (gSetting_350EN)
|
||||
#endif
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
||||
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower &&
|
||||
Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower &&
|
||||
Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower &&
|
||||
Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_500TX)
|
||||
#endif
|
||||
return 0;
|
||||
return 0;
|
||||
break;
|
||||
|
||||
// case F_LOCK_FCC:
|
||||
@@ -231,28 +221,28 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
||||
// break;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_PMR
|
||||
case F_LOCK_PMR:
|
||||
if (Frequency >= 44600625 && Frequency <= 44619375)
|
||||
return 0;
|
||||
break;
|
||||
case F_LOCK_PMR:
|
||||
if (Frequency >= 44600625 && Frequency <= 44619375)
|
||||
return 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_GMRS_FRS_MURS
|
||||
case F_LOCK_GMRS_FRS_MURS:
|
||||
// https://forums.radioreference.com/threads/the-great-unofficial-radioreference-frs-gmrs-murs-fact-sheet.275370/
|
||||
if ((Frequency >= 46255000 && Frequency <= 46272500) ||
|
||||
(Frequency >= 46755000 && Frequency <= 46772500)) // FRS/GMRS
|
||||
return 0;
|
||||
if (Frequency == 15182000 ||
|
||||
Frequency == 15188000 ||
|
||||
Frequency == 15194000 ||
|
||||
Frequency == 15457000 ||
|
||||
Frequency == 15460000) // MURS
|
||||
return 0;
|
||||
break;
|
||||
case F_LOCK_GMRS_FRS_MURS:
|
||||
// https://forums.radioreference.com/threads/the-great-unofficial-radioreference-frs-gmrs-murs-fact-sheet.275370/
|
||||
if ((Frequency >= 46255000 && Frequency <= 46272500) ||
|
||||
(Frequency >= 46755000 && Frequency <= 46772500)) // FRS/GMRS
|
||||
return 0;
|
||||
if (Frequency == 15182000 ||
|
||||
Frequency == 15188000 ||
|
||||
Frequency == 15194000 ||
|
||||
Frequency == 15457000 ||
|
||||
Frequency == 15460000) // MURS
|
||||
return 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_CA
|
||||
#ifdef ENABLE_FEAT_F4HWN_CA
|
||||
case F_LOCK_CA:
|
||||
if (Frequency >= 14400000 && Frequency < 14800000)
|
||||
return 0;
|
||||
@@ -275,8 +265,7 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t RX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if RX frequency is allowed
|
||||
int32_t RX_freq_check(const uint32_t Frequency) { // return '0' if RX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
||||
|
@@ -211,7 +211,7 @@ void FUNCTION_Transmit() {
|
||||
if (gAlarmState != ALARM_STATE_OFF) {
|
||||
#ifdef ENABLE_TX1750
|
||||
if (gAlarmState == ALARM_STATE_TX1750) {
|
||||
BK4819_TransmitTone(false, 1750);
|
||||
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
}
|
||||
#endif
|
||||
|
125
helper/boot.c
125
helper/boot.c
@@ -17,8 +17,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
#include "app/aircopy.h"
|
||||
#include "app/aircopy.h"
|
||||
#endif
|
||||
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/keyboard.h"
|
||||
@@ -31,98 +32,84 @@
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
BOOT_Mode_t BOOT_GetMode(void)
|
||||
{
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
BOOT_Mode_t BOOT_GetMode(void) {
|
||||
unsigned int i;
|
||||
KEY_Code_t Keys[2];
|
||||
KEY_Code_t Keys[2];
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||
return BOOT_MODE_NORMAL; // PTT not pressed
|
||||
Keys[i] = KEYBOARD_Poll();
|
||||
SYSTEM_DelayMs(20);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if (Keys[0] == (10 + gEeprom.SET_KEY))
|
||||
{
|
||||
return BOOT_MODE_RESCUE_OPS; // Secret KEY pressed
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (Keys[0] == Keys[1])
|
||||
{
|
||||
if (Keys[0] == Keys[1]) {
|
||||
gKeyReading0 = Keys[0];
|
||||
gKeyReading1 = Keys[0];
|
||||
|
||||
gDebounceCounter = 2;
|
||||
|
||||
if (Keys[0] == KEY_SIDE1)
|
||||
return BOOT_MODE_F_LOCK;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (Keys[0] == KEY_SIDE2)
|
||||
return BOOT_MODE_AIRCOPY;
|
||||
#endif
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (Keys[0] == KEY_SIDE2)
|
||||
return BOOT_MODE_AIRCOPY;
|
||||
#endif
|
||||
}
|
||||
|
||||
return BOOT_MODE_NORMAL;
|
||||
}
|
||||
|
||||
void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
{
|
||||
if (Mode == BOOT_MODE_F_LOCK)
|
||||
void BOOT_ProcessMode(BOOT_Mode_t Mode) {
|
||||
Mode = Mode;
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (Mode == BOOT_MODE_AIRCOPY)
|
||||
{
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||
gEeprom.BATTERY_SAVE = 0;
|
||||
#ifdef ENABLE_VOX
|
||||
gEeprom.VOX_SWITCH = false;
|
||||
#endif
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
|
||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 43400000); // LPD
|
||||
|
||||
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
|
||||
gCurrentVfo = gRxVfo;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
BK4819_SetupAircopy();
|
||||
BK4819_ResetFSK();
|
||||
|
||||
gAircopyState = AIRCOPY_READY;
|
||||
|
||||
gEeprom.BACKLIGHT_TIME = 61;
|
||||
gEeprom.KEY_LOCK = 0;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
|
||||
#endif
|
||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||
}
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
else
|
||||
if (Mode == BOOT_MODE_AIRCOPY)
|
||||
{
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||
gEeprom.BATTERY_SAVE = 0;
|
||||
#ifdef ENABLE_VOX
|
||||
gEeprom.VOX_SWITCH = false;
|
||||
#endif
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
|
||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 43400000); // LPD
|
||||
|
||||
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
|
||||
gCurrentVfo = gRxVfo;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
BK4819_SetupAircopy();
|
||||
BK4819_ResetFSK();
|
||||
|
||||
gAircopyState = AIRCOPY_READY;
|
||||
|
||||
gEeprom.BACKLIGHT_TIME = 61;
|
||||
gEeprom.KEY_LOCK = 0;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
|
||||
#endif
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
#endif
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||
}
|
||||
#endif
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -20,10 +20,10 @@
|
||||
#include <stdint.h>
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
enum BOOT_Mode_t
|
||||
{
|
||||
BOOT_MODE_NORMAL = 0,
|
||||
BOOT_MODE_F_LOCK,
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
BOOT_MODE_RESCUE_OPS,
|
||||
#endif
|
||||
@@ -38,4 +38,4 @@ BOOT_Mode_t BOOT_GetMode(void);
|
||||
void BOOT_ProcessMode(BOOT_Mode_t Mode);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
40
main.c
40
main.c
@@ -140,6 +140,7 @@ void Main(void) {
|
||||
AM_fix_init();
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
BOOT_Mode_t BootMode = BOOT_GetMode();
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
@@ -160,48 +161,21 @@ void Main(void) {
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if (BootMode == BOOT_MODE_F_LOCK && gEeprom.MENU_LOCK == true)
|
||||
{
|
||||
BootMode = BOOT_MODE_NORMAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (BootMode == BOOT_MODE_F_LOCK) {
|
||||
|
||||
gF_LOCK = true; // flag to say include the hidden menu items
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
gEeprom.KEY_LOCK = 0;
|
||||
SETTINGS_SaveSettings();
|
||||
#ifndef ENABLE_VOX
|
||||
gMenuCursor = 67; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
|
||||
#else
|
||||
gMenuCursor = 68; // move to hidden section, fix me if change... !!!
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
|
||||
#endif
|
||||
gSubMenuSelection = gSetting_F_LOCK;
|
||||
#endif
|
||||
}
|
||||
|
||||
// count the number of menu items
|
||||
gMenuListCount = 0;
|
||||
while (MenuList[gMenuListCount].name[0] != '\0') {
|
||||
if (!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
||||
break;
|
||||
|
||||
gMenuListCount++;
|
||||
}
|
||||
|
||||
// wait for user to release all butts before moving on
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||
KEYBOARD_Poll() != KEY_INVALID ||
|
||||
BootMode != BOOT_MODE_NORMAL) { // keys are pressed
|
||||
KEYBOARD_Poll() != KEY_INVALID
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
|| BootMode != BOOT_MODE_NORMAL
|
||||
#endif
|
||||
) { // keys are pressed
|
||||
UI_DisplayReleaseKeys();
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
@@ -249,7 +223,9 @@ void Main(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
BOOT_ProcessMode(BootMode);
|
||||
#endif
|
||||
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
|
||||
|
4
misc.c
4
misc.c
@@ -95,7 +95,6 @@ const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
||||
bool gSetting_200TX;
|
||||
bool gSetting_500TX;
|
||||
#endif
|
||||
bool gSetting_350EN = true;
|
||||
uint8_t gSetting_F_LOCK;
|
||||
bool gSetting_ScrambleEnable;
|
||||
|
||||
@@ -111,15 +110,12 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
uint8_t gSetting_set_pwr = 1;
|
||||
bool gSetting_set_ptt = 0;
|
||||
uint8_t gSetting_set_tot = 0;
|
||||
uint8_t gSetting_set_ctr = 10;
|
||||
bool gSetting_set_inv = false;
|
||||
uint8_t gSetting_set_eot = 0;
|
||||
bool gSetting_set_lck = false;
|
||||
bool gSetting_set_met = 0;
|
||||
bool gSetting_set_gui = 0;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
bool gSetting_set_nfm = 0;
|
||||
#endif
|
||||
|
4
misc.h
4
misc.h
@@ -148,7 +148,6 @@ extern bool gSetting_200TX;
|
||||
extern bool gSetting_500TX;
|
||||
#endif
|
||||
|
||||
extern bool gSetting_350EN;
|
||||
extern uint8_t gSetting_F_LOCK;
|
||||
extern bool gSetting_ScrambleEnable;
|
||||
|
||||
@@ -164,15 +163,12 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
extern uint8_t gSetting_set_pwr;
|
||||
extern bool gSetting_set_ptt;
|
||||
extern uint8_t gSetting_set_tot;
|
||||
extern uint8_t gSetting_set_ctr;
|
||||
extern bool gSetting_set_inv;
|
||||
extern uint8_t gSetting_set_eot;
|
||||
extern bool gSetting_set_lck;
|
||||
extern bool gSetting_set_met;
|
||||
extern bool gSetting_set_gui;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
extern bool gSetting_set_nfm;
|
||||
#endif
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#define PRINTF_DISABLE_SUPPORT_LONG_LONG
|
||||
#define PRINTF_DISABLE_SUPPORT_EXPONENTIAL
|
||||
#define PRINTF_DISABLE_SUPPORT_PTRDIFF_T
|
||||
#define PRINTF_DISABLE_SUPPORT_FLOAT
|
1
radio.h
1
radio.h
@@ -107,7 +107,6 @@ typedef struct VFO_Info_t
|
||||
uint8_t SquelchOpenGlitchThresh;
|
||||
|
||||
STEP_Setting_t STEP_SETTING;
|
||||
uint8_t TX_LOCK;
|
||||
uint8_t OUTPUT_POWER;
|
||||
uint8_t TXP_CalculatedSetting;
|
||||
bool FrequencyReverse;
|
||||
|
43
settings.c
43
settings.c
@@ -274,21 +274,13 @@ void SETTINGS_InitEEPROM(void) {
|
||||
gEeprom.FSKSRCAddress |= Data[1] << 8;
|
||||
gEeprom.FSKSRCAddress |= Data[2] << 16;
|
||||
gEeprom.FSKSRCAddress |= Data[3] << 24;
|
||||
gEeprom.BK1080_AGC_ENABLED = Data[4] & 0x01;
|
||||
gEeprom.BK1080_BLEND_CONFIG = (Data[4] >> 1) & 0x03;
|
||||
gEeprom.BK1080_DEEMPHASIS_CONFIG = (Data[4] >> 3) & 0x03;
|
||||
|
||||
// 0F40..0F47
|
||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
|
||||
#endif
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
|
||||
gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
|
||||
gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
|
||||
#else
|
||||
gSetting_350EN = true;
|
||||
#endif
|
||||
|
||||
gSetting_ScrambleEnable = true;
|
||||
|
||||
//gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
||||
@@ -337,7 +329,6 @@ void SETTINGS_InitEEPROM(void) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
// 1FF0..0x1FF7
|
||||
EEPROM_ReadBuffer(0x1FF0, Data, 8);
|
||||
gSetting_set_pwr = (((Data[7] & 0xF0) >> 4) < 7) ? ((Data[7] & 0xF0) >> 4) : 0;
|
||||
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0;
|
||||
|
||||
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
|
||||
@@ -348,8 +339,6 @@ void SETTINGS_InitEEPROM(void) {
|
||||
|
||||
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
||||
gSetting_set_lck = (((tmp >> 1) & 0x01) < 2) ? ((tmp >> 1) & 0x01): 0;
|
||||
gSetting_set_met = (((tmp >> 2) & 0x01) < 2) ? ((tmp >> 2) & 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_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
||||
@@ -363,8 +352,6 @@ void SETTINGS_InitEEPROM(void) {
|
||||
gSetting_set_inv = 0;
|
||||
#endif
|
||||
gSetting_set_lck = (tmp >> 1) & 0x01;
|
||||
gSetting_set_met = (tmp >> 2) & 0x01;
|
||||
gSetting_set_gui = (tmp >> 3) & 0x01;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
||||
int ctr_value = Data[5] & 0x0F;
|
||||
@@ -727,6 +714,10 @@ void SETTINGS_SaveSettings(void) {
|
||||
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
|
||||
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
|
||||
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
|
||||
State[4] = ((gEeprom.BK1080_AGC_ENABLED & 0x01) |
|
||||
((gEeprom.BK1080_BLEND_CONFIG & 0x03) << 1) |
|
||||
((gEeprom.BK1080_DEEMPHASIS_CONFIG & 0x03) << 3));
|
||||
|
||||
EEPROM_WriteBuffer(0x0F20, State);
|
||||
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
@@ -738,8 +729,6 @@ void SETTINGS_SaveSettings(void) {
|
||||
State[3] = gSetting_200TX;
|
||||
State[4] = gSetting_500TX;
|
||||
#endif
|
||||
State[5] = gSetting_350EN;
|
||||
|
||||
State[6] = gSetting_ScrambleEnable;
|
||||
|
||||
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
|
||||
@@ -776,10 +765,6 @@ void SETTINGS_SaveSettings(void) {
|
||||
tmp = tmp | (1 << 0);
|
||||
if (gSetting_set_lck == 1)
|
||||
tmp = tmp | (1 << 1);
|
||||
if (gSetting_set_met == 1)
|
||||
tmp = tmp | (1 << 2);
|
||||
if (gSetting_set_gui == 1)
|
||||
tmp = tmp | (1 << 3);
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
@@ -789,14 +774,11 @@ void SETTINGS_SaveSettings(void) {
|
||||
#endif
|
||||
|
||||
tmp = (gSetting_set_inv << 0) |
|
||||
(gSetting_set_lck << 1) |
|
||||
(gSetting_set_met << 2) |
|
||||
(gSetting_set_gui << 3);
|
||||
(gSetting_set_lck << 1);
|
||||
|
||||
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
|
||||
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
|
||||
State[7] = ((gSetting_set_pwr << 4) | (gSetting_set_ptt & 0x0F));
|
||||
|
||||
State[7] = gSetting_set_ptt & 0x0F;
|
||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
||||
|
||||
EEPROM_WriteBuffer(0x1FF0, State);
|
||||
@@ -835,7 +817,6 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
||||
State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType;
|
||||
State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
|
||||
State._8[4] = 0
|
||||
| (pVFO->TX_LOCK << 6)
|
||||
| (pVFO->BUSY_CHANNEL_LOCK << 5)
|
||||
| (pVFO->OUTPUT_POWER << 2)
|
||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||
@@ -980,9 +961,9 @@ void SETTINGS_WriteBuildOptions(void) {
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
| (1 << 4)
|
||||
#endif
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
| (1 << 5)
|
||||
#endif
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
| (1 << 5)
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
| (1 << 6)
|
||||
|
16
settings.h
16
settings.h
@@ -173,6 +173,19 @@ enum CHANNEL_DisplayMode_t {
|
||||
};
|
||||
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
||||
|
||||
enum BK1080_DEEMPHASIS {
|
||||
DEEMPHASIS_OFF = 0,
|
||||
DEEMPHASIS_USA = 1,
|
||||
DEEMPHASIS_EUR = 2
|
||||
};
|
||||
|
||||
enum BK1080_BLEND {
|
||||
BLEND_DEF = 0,
|
||||
BLEND_POS6 = 1,
|
||||
BLEND_NEG12 = 2,
|
||||
BLEND_NEG6 = 3
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint8_t ScreenChannel[2]; // current channels set in the radio (memory or frequency channels)
|
||||
uint8_t FreqChannel[2]; // last frequency channels used
|
||||
@@ -198,6 +211,9 @@ typedef struct {
|
||||
bool FM_IsMrMode;
|
||||
uint16_t FM_FrequencyPlaying;
|
||||
uint8_t FM_Band : 2;
|
||||
enum BK1080_DEEMPHASIS BK1080_DEEMPHASIS_CONFIG: 2;
|
||||
enum BK1080_BLEND BK1080_BLEND_CONFIG : 2;
|
||||
bool BK1080_AGC_ENABLED;
|
||||
//uint8_t FM_Space : 2;
|
||||
#endif
|
||||
|
||||
|
@@ -52,7 +52,7 @@ void UI_DisplayAircopy(void)
|
||||
gAircopyState = AIRCOPY_READY;
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 127, 0, 8);
|
||||
UI_PrintString(pPrintStr, 2, 127, 0 /*, 8 */);
|
||||
|
||||
if (gInputBoxIndex == 0) {
|
||||
uint32_t frequency = gRxVfo->freq_config_RX.Frequency;
|
||||
@@ -83,7 +83,7 @@ void UI_DisplayAircopy(void)
|
||||
// Draw gauge
|
||||
if(gAircopyStep != 0)
|
||||
{
|
||||
UI_PrintString(String, 2, 127, 5, 8);
|
||||
UI_PrintString(String, 2, 127, 5 /*, 8 */);
|
||||
|
||||
gFrameBuffer[4][1] = 0x3c;
|
||||
gFrameBuffer[4][2] = 0x42;
|
||||
|
62
ui/fmradio.c
62
ui/fmradio.c
@@ -29,15 +29,63 @@
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
const char gBlendStrings[][4] = {
|
||||
"DEF",
|
||||
"+6 ",
|
||||
"-12",
|
||||
"-6 "
|
||||
};
|
||||
|
||||
const char gDeemphasisStrings[][3] = {
|
||||
"NO",
|
||||
"US",
|
||||
"EU"
|
||||
};
|
||||
|
||||
bool wasStereo;
|
||||
uint8_t oldRssi;
|
||||
|
||||
void UI_UpdateFMThings(bool force) {
|
||||
force = force;
|
||||
char String[16] = {0};
|
||||
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10_RSSI_STATUS);
|
||||
|
||||
bool isStereo = Status & (1 << 9);
|
||||
uint8_t rssi = Status & 0xFF;
|
||||
|
||||
if (!force && isStereo == wasStereo && rssi == oldRssi) {
|
||||
return;
|
||||
}
|
||||
oldRssi = rssi;
|
||||
wasStereo = isStereo;
|
||||
|
||||
sprintf(String, "%s RSSI%d/255",
|
||||
isStereo ? "STER" : "MONO", rssi);
|
||||
|
||||
UI_PrintStringSmallNormal(String, 1, 0, 4);
|
||||
ST7565_BlitLine(4);
|
||||
|
||||
}
|
||||
|
||||
void UI_DisplayFM(void)
|
||||
{
|
||||
char String[16] = {0};
|
||||
char *pPrintStr = String;
|
||||
UI_DisplayClear();
|
||||
|
||||
UI_PrintString("FM", 2, 0, 0, 8);
|
||||
UI_UpdateFMThings(true);
|
||||
|
||||
sprintf(String, "%d%s-%dM",
|
||||
UI_PrintString("FM", 2, 0, 0 /*, 8 */);
|
||||
|
||||
|
||||
sprintf(String, "%s D%s B%s",
|
||||
gEeprom.BK1080_AGC_ENABLED ? " AGC" : "NAGC",
|
||||
gDeemphasisStrings[gEeprom.BK1080_DEEMPHASIS_CONFIG],
|
||||
gBlendStrings[gEeprom.BK1080_BLEND_CONFIG]);
|
||||
|
||||
UI_PrintStringSmallNormal(String, 1, 0, 5);
|
||||
|
||||
sprintf(String, "%d%s-%dM",
|
||||
BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10,
|
||||
gEeprom.FM_Band == 0 ? ".5" : "",
|
||||
BK1080_GetFreqHiLimit(gEeprom.FM_Band)/10
|
||||
@@ -55,13 +103,13 @@ void UI_DisplayFM(void)
|
||||
pPrintStr = "DEL?";
|
||||
} else if (gFM_ScanState == FM_SCAN_OFF) {
|
||||
if (gEeprom.FM_IsMrMode) {
|
||||
sprintf(String, "MR(CH%02u)", gEeprom.FM_SelectedChannel + 1);
|
||||
sprintf(String, "CH%02u", gEeprom.FM_SelectedChannel + 1);
|
||||
pPrintStr = String;
|
||||
} else {
|
||||
pPrintStr = "VFO";
|
||||
for (unsigned int i = 0; i < 20; i++) {
|
||||
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
|
||||
sprintf(String, "VF(C%02u)", i + 1);
|
||||
sprintf(String, "C%02u MHz", i + 1);
|
||||
pPrintStr = String;
|
||||
break;
|
||||
}
|
||||
@@ -74,7 +122,7 @@ void UI_DisplayFM(void)
|
||||
pPrintStr = "M-SCN";
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 0, 127, 3, 12); // memory, vfo, scan
|
||||
UI_PrintString(pPrintStr, 0, 127, 3 /*, 12 */); // memory, vfo, scan
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) {
|
||||
@@ -89,12 +137,12 @@ void UI_DisplayFM(void)
|
||||
sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
|
||||
}
|
||||
|
||||
UI_PrintString(String, 0, 20, 1, 10); // frequency
|
||||
UI_PrintString(String, 0, 20, 1 /*, 10 */); // frequency
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UI_PrintString(String, 0, 127, 1, 10);
|
||||
UI_PrintString(String, 0, 127, 1 /*, 10 */);
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
void UI_DisplayFM(void);
|
||||
void UI_UpdateFMThings(bool force);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
105
ui/helper.c
105
ui/helper.c
@@ -78,6 +78,13 @@ void *memcpy_inv(void *dst, const void *src, size_t n) {
|
||||
void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_width, const uint8_t *font, bool inv) {
|
||||
const size_t Length = strlen(pString);
|
||||
const unsigned int char_spacing = char_width + 1;
|
||||
const uint32_t total_width = Length * char_spacing; // Total width of the text
|
||||
|
||||
if (inv) {
|
||||
// Draw background rectangle from 1 px before the first char to 1 px after the last char
|
||||
memset(buffer, 0xFF, total_width + 2);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < Length; i++) {
|
||||
const unsigned int index = pString[i] - ' ' - 1;
|
||||
if (pString[i] > ' ' && pString[i] < 127) {
|
||||
@@ -91,7 +98,6 @@ void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_wi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t char_width,
|
||||
const uint8_t *font, bool inv) {
|
||||
const size_t Length = strlen(pString);
|
||||
@@ -109,26 +115,25 @@ void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End,
|
||||
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
|
||||
}
|
||||
|
||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width) {
|
||||
Width = Width;
|
||||
UI_PrintStringSmallNormal(pString, Start, End, Line);
|
||||
// size_t i;
|
||||
// size_t Length = strlen(pString);
|
||||
//
|
||||
// if (End > Start)
|
||||
// Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
||||
//
|
||||
// for (i = 0; i < Length; i++)
|
||||
// {
|
||||
// const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
// if (pString[i] > ' ' && pString[i] < 127)
|
||||
// {
|
||||
// const unsigned int index = pString[i] - ' ' - 1;
|
||||
// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
|
||||
// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 7);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line /*, uint8_t Width */) {
|
||||
// UI_PrintStringSmallNormal(pString, Start, End, Line);
|
||||
//// size_t i;
|
||||
//// size_t Length = strlen(pString);
|
||||
////
|
||||
//// if (End > Start)
|
||||
//// Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
||||
////
|
||||
//// for (i = 0; i < Length; i++)
|
||||
//// {
|
||||
//// const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
//// if (pString[i] > ' ' && pString[i] < 127)
|
||||
//// {
|
||||
//// const unsigned int index = pString[i] - ' ' - 1;
|
||||
//// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
|
||||
//// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 7);
|
||||
//// }
|
||||
//// }
|
||||
//}
|
||||
|
||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
||||
//#ifdef ENABLE_SMALL_BOLD
|
||||
@@ -149,7 +154,7 @@ void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer) {
|
||||
|
||||
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t *buffer) {
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
const uint8_t *font = (uint8_t *)gFontSmallBold;
|
||||
const uint8_t *font = (uint8_t *) gFontSmallBold;
|
||||
const uint8_t char_width = ARRAY_SIZE(gFontSmallBold[0]);
|
||||
#else
|
||||
const uint8_t *font = (uint8_t *) gFontSmall;
|
||||
@@ -283,6 +288,30 @@ void PutPixelStatus(uint8_t x, uint8_t y, bool fill) {
|
||||
UI_DrawPixelBuffer(&gStatusLine, x, y, fill);
|
||||
}
|
||||
|
||||
//void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||
// bool statusbar, bool fill) {
|
||||
// uint8_t c;
|
||||
// uint8_t pixels;
|
||||
// const uint8_t *p = (const uint8_t *) pString;
|
||||
//
|
||||
// while ((c = *p++) && c != '\0') {
|
||||
// c -= 0x20;
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// pixels = gFont3x5[c][i];
|
||||
// for (int j = 0; j < 6; ++j) {
|
||||
// if (pixels & 1) {
|
||||
// if (statusbar)
|
||||
// PutPixelStatus(x + i, y + j, fill);
|
||||
// else
|
||||
// PutPixel(x + i, y + j, fill);
|
||||
// }
|
||||
// pixels >>= 1;
|
||||
// }
|
||||
// }
|
||||
// x += 4;
|
||||
// }
|
||||
//}
|
||||
|
||||
void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||
bool statusbar, bool fill) {
|
||||
uint8_t c;
|
||||
@@ -291,22 +320,25 @@ void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||
|
||||
while ((c = *p++) && c != '\0') {
|
||||
c -= 0x20;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
pixels = gFont3x5[c][i];
|
||||
for (int j = 0; j < 6; ++j) {
|
||||
if (pixels & 1) {
|
||||
if (statusbar)
|
||||
PutPixelStatus(x + i, y + j, fill);
|
||||
else
|
||||
PutPixel(x + i, y + j, fill);
|
||||
for (int i = 0; i < (int) ARRAY_SIZE(gFontSmall[0]); ++i) {
|
||||
if (c) {
|
||||
pixels = gFontSmall[c - 1][i];
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
if (pixels & 1) {
|
||||
if (statusbar)
|
||||
PutPixelStatus(x + i, y + j, fill);
|
||||
else
|
||||
PutPixel(x + i, y + j, fill);
|
||||
}
|
||||
pixels >>= 1;
|
||||
}
|
||||
pixels >>= 1;
|
||||
}
|
||||
}
|
||||
x += 4;
|
||||
x += ARRAY_SIZE(gFontSmall[0]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) {
|
||||
@@ -352,10 +384,17 @@ void UI_DisplayPopup(const char *string) {
|
||||
// UI_DrawPixelBuffer(117, y, true);
|
||||
// }
|
||||
// DrawRectangle(9,9, 118,38, true);
|
||||
UI_PrintString(string, 9, 118, 2, 8);
|
||||
UI_PrintString(string, 9, 118, 2 /*, 8 */);
|
||||
UI_PrintStringSmallNormal("Press EXIT", 9, 118, 6);
|
||||
}
|
||||
|
||||
void UI_ClearLine(uint8_t Line) {
|
||||
if (Line < 8) { // ST7565 has 8 pages (rows of 8 pixels)
|
||||
memset(gFrameBuffer[Line], 0x00, 128); // Clear all pixels on the line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UI_DisplayClear() {
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
}
|
||||
|
@@ -22,13 +22,14 @@
|
||||
|
||||
void UI_GenerateChannelString(char *pString, const uint8_t Channel);
|
||||
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber);
|
||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width);
|
||||
//void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line /*, uint8_t Width */);
|
||||
#define UI_PrintString UI_PrintStringSmallNormal
|
||||
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer);
|
||||
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer);
|
||||
//void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center);
|
||||
|
||||
void UI_ClearLine(uint8_t Line);
|
||||
void UI_DisplayPopup(const char *string);
|
||||
|
||||
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black);
|
||||
|
@@ -37,11 +37,11 @@ static void Render(void)
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
UI_DisplayClear();
|
||||
|
||||
UI_PrintString("PASSWORD", 0, 127, 1, 10);
|
||||
UI_PrintString("PASSWORD", 0, 127, 1 /*, 10 */);
|
||||
for (i = 0; i < 6; i++)
|
||||
String[i] = (gInputBox[i] == 10) ? '-' : 'x';
|
||||
String[6] = 0;
|
||||
UI_PrintString(String, 0, 127, 3, 12);
|
||||
UI_PrintString(String, 0, 127, 3 /*, 12 */);
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
|
322
ui/main.c
322
ui/main.c
@@ -115,51 +115,19 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level, uint8_t bars
|
||||
level = MIN(level, bars);
|
||||
|
||||
for (uint8_t i = 0; i < level; i++) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_set_met) {
|
||||
const char hollowBar[] = {
|
||||
0b01111111,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01111111
|
||||
};
|
||||
const char hollowBar[] = {
|
||||
0b01111111,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01111111
|
||||
};
|
||||
|
||||
if (i < bars - 4) {
|
||||
for (uint8_t j = 0; j < 4; j++)
|
||||
p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F;
|
||||
} else {
|
||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
||||
}
|
||||
if (i < bars - 4) {
|
||||
for (uint8_t j = 0; j < 4; j++)
|
||||
p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F;
|
||||
} else {
|
||||
const char hollowBar[] = {
|
||||
0b00111110,
|
||||
0b00100010,
|
||||
0b00100010,
|
||||
0b00111110
|
||||
};
|
||||
|
||||
const char simpleBar[] = {
|
||||
0b00111110,
|
||||
0b00111110,
|
||||
0b00111110,
|
||||
0b00111110
|
||||
};
|
||||
|
||||
if (i < bars - 4) {
|
||||
memcpy(p_line + (xpos + i * 5), &simpleBar, ARRAY_SIZE(simpleBar));
|
||||
} else {
|
||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(i < bars - 4) {
|
||||
for(uint8_t j = 0; j < 4; j++)
|
||||
p_line[xpos + i * 5 + j] = (~(0x7F >> (i+1))) & 0x7F;
|
||||
}
|
||||
else {
|
||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +165,7 @@ void UI_DisplayAudioBar(void) {
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
) {
|
||||
@@ -237,7 +205,7 @@ void UI_DisplayAudioBar(void) {
|
||||
void DisplayRSSIBar(const bool now) {
|
||||
#if defined(ENABLE_RSSI_BAR)
|
||||
|
||||
const unsigned int txt_width = 7 * 8; // 8 text chars
|
||||
const unsigned int txt_width = 7 * 10; // 8 text chars
|
||||
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
@@ -266,7 +234,7 @@ void DisplayRSSIBar(const bool now) {
|
||||
|
||||
if (RxLine >= 0 && center_line != CENTER_LINE_IN_USE) {
|
||||
if (RxBlink == 0 || RxBlink == 1) {
|
||||
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
|
||||
UI_PrintStringSmallBold("RX", 24, 0, RxLine);
|
||||
if (RxBlink == 1) RxBlink = 2;
|
||||
} else {
|
||||
for (uint8_t i = 8; i < 24; i++) {
|
||||
@@ -299,7 +267,7 @@ void DisplayRSSIBar(const bool now) {
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
@@ -348,24 +316,19 @@ void DisplayRSSIBar(const bool now) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_set_gui) {
|
||||
sprintf(str, "%3d", -rssi_dBm);
|
||||
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
|
||||
} else {
|
||||
sprintf(str, "% 4d %s", -rssi_dBm, "dBm");
|
||||
if (isMainOnly())
|
||||
GUI_DisplaySmallest(str, 2, 41, false, true);
|
||||
else
|
||||
GUI_DisplaySmallest(str, 2, 25, false, true);
|
||||
}
|
||||
char tempStr[4];
|
||||
|
||||
if (overS9Bars == 0) {
|
||||
sprintf(str, "S%d", s_level);
|
||||
sprintf(tempStr, "S%d", s_level);
|
||||
} else {
|
||||
sprintf(str, "+%02d", overS9dBm);
|
||||
sprintf(tempStr, "+%02d", overS9dBm);
|
||||
}
|
||||
|
||||
UI_PrintStringSmallNormal(str, LCD_WIDTH + 38, 0, line - 1);
|
||||
sprintf(str, "%4ddBm%3s", -rssi_dBm, tempStr);
|
||||
if (isMainOnly())
|
||||
UI_PrintStringSmallNormal(str, 2, 0, 4);
|
||||
else
|
||||
UI_PrintStringSmallNormal(str, 2, 0, 3);
|
||||
#else
|
||||
if(overS9Bars == 0) {
|
||||
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
||||
@@ -377,7 +340,7 @@ void DisplayRSSIBar(const bool now) {
|
||||
|
||||
UI_PrintStringSmallNormal(str, 2, 0, line);
|
||||
#endif
|
||||
DrawLevelBar(bar_x, line, s_level + overS9Bars, 13);
|
||||
DrawLevelBar(bar_x, line, s_level + overS9Bars, 10);
|
||||
if (now)
|
||||
ST7565_BlitLine(line);
|
||||
#else
|
||||
@@ -507,7 +470,7 @@ void UI_DisplayMain(void) {
|
||||
UI_DisplayClear();
|
||||
|
||||
if (gLowBattery && !gLowBatteryConfirmed) {
|
||||
UI_DisplayPopup("LOW BATTERY");
|
||||
UI_DisplayPopup("LOW BATT");
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
}
|
||||
@@ -515,8 +478,8 @@ void UI_DisplayMain(void) {
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||
{ // tell user how to unlock the keyboard
|
||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1 /*, 8 */);
|
||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3 /*, 8 */);
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
}
|
||||
@@ -535,7 +498,7 @@ void UI_DisplayMain(void) {
|
||||
shift = 5;
|
||||
}
|
||||
//memcpy(gFrameBuffer[shift] + 2, gFontKeyLock, sizeof(gFontKeyLock));
|
||||
UI_PrintStringSmallBold("UNLOCK KEYBOARD", 12, 0, shift);
|
||||
UI_PrintStringSmallBold("KEYLOCK", 12, 0, shift);
|
||||
//memcpy(gFrameBuffer[shift] + 120, gFontKeyLock, sizeof(gFontKeyLock));
|
||||
|
||||
/*
|
||||
@@ -600,7 +563,7 @@ void UI_DisplayMain(void) {
|
||||
shift = 3;
|
||||
}
|
||||
|
||||
UI_PrintString("ScnRng", 5, 0, line + shift, 8);
|
||||
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);
|
||||
@@ -612,7 +575,7 @@ void UI_DisplayMain(void) {
|
||||
gScanRangeStart = 0;
|
||||
}
|
||||
#else
|
||||
UI_PrintString("ScnRng", 5, 0, line, 8);
|
||||
UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
|
||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||
UI_PrintStringSmallNormal(String, 56, 0, line);
|
||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||
@@ -624,21 +587,21 @@ void UI_DisplayMain(void) {
|
||||
|
||||
|
||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
UI_PrintString("SMS Dst", 0, 0, line - 1, 8);
|
||||
UI_PrintString("SMS Dst", 0, 0, line - 1 /*, 8 */);
|
||||
sprintf(String, "%d", dataPacket.dest);
|
||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
UI_PrintString("SMS Dat", 0, 0, line - 1, 8);
|
||||
UI_PrintString("SMS Dat", 0, 0, line - 1 /*, 8 */);
|
||||
sprintf(String, "%s", dataPacket.data);
|
||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gDTMF_InputMode
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx
|
||||
#endif
|
||||
) {
|
||||
@@ -657,7 +620,7 @@ void UI_DisplayMain(void) {
|
||||
}
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 2 + (vfo_num * 3) /*, 8 */);
|
||||
|
||||
pPrintStr = "";
|
||||
if (!gDTMF_InputMode) {
|
||||
@@ -680,17 +643,17 @@ void UI_DisplayMain(void) {
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (isMainOnly()) {
|
||||
UI_PrintString(pPrintStr, 2, 0, 5, 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 5 /*, 8 */);
|
||||
isMainOnlyInputDTMF = true;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
} else {
|
||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3), 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3) /*, 8 */);
|
||||
isMainOnlyInputDTMF = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3), 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3) /*, 8 */);
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
continue;
|
||||
#endif
|
||||
@@ -709,11 +672,11 @@ void UI_DisplayMain(void) {
|
||||
|
||||
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
||||
|
||||
if (TX_freq_check(frequency) != 0 && gEeprom.VfoInfo[vfo_num].TX_LOCK == true) {
|
||||
if (TX_freq_check(frequency) != 0) {
|
||||
if (isMainOnly())
|
||||
memcpy(p_line0 + 14, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
|
||||
memcpy(p_line0 + 5, gFontKeyLock, sizeof(gFontKeyLock));
|
||||
else
|
||||
memcpy(p_line0 + 24, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
|
||||
memcpy(p_line0 + 10, gFontKeyLock, sizeof(gFontKeyLock));
|
||||
}
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting
|
||||
@@ -750,7 +713,7 @@ void UI_DisplayMain(void) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
else {
|
||||
if (RxOnVfofrequency == frequency && !isMainOnly()) {
|
||||
UI_PrintStringSmallNormal(">>", 8, 0, line);
|
||||
UI_PrintStringSmallNormal(">>", 24, 0, line);
|
||||
//memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||
}
|
||||
|
||||
@@ -761,7 +724,7 @@ void UI_DisplayMain(void) {
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // channel mode
|
||||
const unsigned int x = 2;
|
||||
const unsigned int x = 20;
|
||||
const bool inputting = gInputBoxIndex != 0 && gEeprom.TX_VFO == vfo_num;
|
||||
if (!inputting)
|
||||
sprintf(String, "M%u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||
@@ -770,7 +733,7 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
||||
} else if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // frequency mode
|
||||
// show the frequency band number
|
||||
const unsigned int x = 2;
|
||||
const unsigned int x = 0;
|
||||
char *buf = gEeprom.VfoInfo[vfo_num].pRX->Frequency < _1GHz_in_KHz ? "" : "+";
|
||||
sprintf(String, "F%u%s", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST, buf);
|
||||
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
||||
@@ -802,24 +765,15 @@ void UI_DisplayMain(void) {
|
||||
#endif
|
||||
if (state != VFO_STATE_NORMAL) {
|
||||
if (state < ARRAY_SIZE(VfoStateStr))
|
||||
UI_PrintString(VfoStateStr[state], 31, 0, line, 8);
|
||||
UI_PrintString(VfoStateStr[state], 31, 0, line /*, 8 */);
|
||||
} else if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) &&
|
||||
gEeprom.TX_VFO == vfo_num) { // user entering a frequency
|
||||
const char *ascii = INPUTBOX_GetAscii();
|
||||
bool isGigaF = frequency >= _1GHz_in_KHz;
|
||||
sprintf(String, "%.*s.%.3s", 3 + isGigaF, ascii, ascii + 3 + isGigaF);
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
if (!isGigaF) {
|
||||
// show the remaining 2 small frequency digits
|
||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 32, line, false);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// show the frequency in the main font
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintString(String, 45, 0, line /*, 8 */);
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -888,19 +842,19 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 32, line, false);
|
||||
UI_DisplayFrequency(String, 20, line, false);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// show the frequency in the main font
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MDF_CHANNEL: // show the channel number
|
||||
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
break;
|
||||
|
||||
case MDF_NAME: // show the channel name
|
||||
@@ -912,20 +866,20 @@ void UI_DisplayMain(void) {
|
||||
}
|
||||
|
||||
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) {
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
} else {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (isMainOnly()) {
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
} else {
|
||||
if (activeTxVFO == vfo_num) {
|
||||
UI_PrintStringSmallBold(String, 32 + 4, 0, line);
|
||||
UI_PrintStringSmallBold(String, 40 + 4, 0, line);
|
||||
} else {
|
||||
UI_PrintStringSmallNormal(String, 32 + 4, 0, line);
|
||||
UI_PrintStringSmallNormal(String, 40 + 4, 0, line);
|
||||
}
|
||||
}
|
||||
#else
|
||||
UI_PrintStringSmallBold(String, 32 + 4, 0, line);
|
||||
UI_PrintStringSmallBold(String, 20 + 4, 0, line);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
@@ -936,19 +890,19 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
//UI_DisplayFrequency(String, 32, line + 3, false);
|
||||
UI_PrintStringSmallNormal(String, 0, 20, line + 3);
|
||||
//UI_DisplayFrequency(String, 20, line + 3, false);
|
||||
UI_PrintStringSmallBold(String, 20, 20, line + 3);
|
||||
} else {
|
||||
// show the frequency in the main font
|
||||
UI_PrintString(String, 32, 0, line + 3, 8);
|
||||
UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
|
||||
}
|
||||
} else {
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintStringSmallNormal(String, 32 + 4, 0, line + 1);
|
||||
UI_PrintStringSmallBold(String, 40 + 4, 0, line + 1);
|
||||
}
|
||||
#else // show the channel frequency below the channel number/name
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintStringSmallNormal(String, 32 + 4, 0, line + 1);
|
||||
UI_PrintStringSmallNormal(String, 20 + 4, 0, line + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -963,12 +917,12 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 32, line, false);
|
||||
UI_DisplayFrequency(String, 20, line, false);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// show the frequency in the main font
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
}
|
||||
|
||||
// show the channel symbols
|
||||
@@ -1075,70 +1029,28 @@ void UI_DisplayMain(void) {
|
||||
shift = -10;
|
||||
}
|
||||
|
||||
if (gSetting_set_gui) {
|
||||
UI_PrintStringSmallNormal(s, LCD_WIDTH + 22, 0, line + 1);
|
||||
UI_PrintStringSmallNormal(t, LCD_WIDTH + 2, 0, line + 1);
|
||||
UI_PrintStringSmallNormal(s, 50, 0, line + 2);
|
||||
UI_PrintStringSmallNormal(t, 2, 0, line + 2);
|
||||
|
||||
if (isMainOnly() && !gDTMF_InputMode) {
|
||||
if (shift == 0) {
|
||||
UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
}
|
||||
|
||||
if ((vfoInfo->StepFrequency / 100) < 100) {
|
||||
sprintf(String, "%d.%02uK", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
|
||||
} else {
|
||||
sprintf(String, "%dK", vfoInfo->StepFrequency / 100);
|
||||
}
|
||||
UI_PrintStringSmallNormal(String, 46, 0, 6);
|
||||
}
|
||||
} else {
|
||||
if ((s != NULL) && (s[0] != '\0')) {
|
||||
GUI_DisplaySmallest(s, 58, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
|
||||
if ((t != NULL) && (t[0] != '\0')) {
|
||||
GUI_DisplaySmallest(t, 3, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
|
||||
GUI_DisplaySmallest(String, 68 + shift, line == 0 ? 17 : 49, false, true);
|
||||
|
||||
//sprintf(String, "%d.%02u", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
|
||||
//GUI_DisplaySmallest(String, 91, line == 0 ? 2 : 34, false, true);
|
||||
if (shift == 0) {
|
||||
UI_PrintStringSmallNormal(String, 65, 0, line + 2);
|
||||
}
|
||||
|
||||
if ((vfoInfo->StepFrequency / 100) < 100) {
|
||||
sprintf(String, "%d.%02uK", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
|
||||
} else {
|
||||
sprintf(String, "%dK", vfoInfo->StepFrequency / 100);
|
||||
}
|
||||
UI_PrintStringSmallNormal(String, 55, 0, line + 1);
|
||||
#else
|
||||
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
|
||||
#endif
|
||||
|
||||
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
|
||||
uint8_t currentPower = vfoInfo->OUTPUT_POWER % 8;
|
||||
uint8_t arrowPos = 19;
|
||||
bool userPower = false;
|
||||
|
||||
if (currentPower == OUTPUT_POWER_USER) {
|
||||
currentPower = gSetting_set_pwr;
|
||||
userPower = true;
|
||||
} else {
|
||||
currentPower--;
|
||||
userPower = false;
|
||||
}
|
||||
|
||||
if (gSetting_set_gui) {
|
||||
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "M", "H"};
|
||||
//sprintf(String, "%s", pwr_short[currentPower]);
|
||||
//UI_PrintStringSmallNormal(String, LCD_WIDTH + 42, 0, line + 1);
|
||||
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 42, 0, line + 1);
|
||||
|
||||
arrowPos = 38;
|
||||
} else {
|
||||
const char pwr_long[][5] = {"LOW1", "LOW2", "LOW3", "LOW4", "LOW5", "MID", "HIGH"};
|
||||
//sprintf(String, "%s", pwr_long[currentPower]);
|
||||
//GUI_DisplaySmallest(String, 24, line == 0 ? 17 : 49, false, true);
|
||||
GUI_DisplaySmallest(pwr_long[currentPower], 24, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
|
||||
if (userPower == true) {
|
||||
memcpy(p_line0 + 256 + arrowPos, BITMAP_PowerUser, sizeof(BITMAP_PowerUser));
|
||||
}
|
||||
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "ME",
|
||||
"HI"};
|
||||
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 25, 0, line + 1);
|
||||
}
|
||||
|
||||
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency) { // show the TX offset symbol
|
||||
@@ -1156,22 +1068,7 @@ void UI_DisplayMain(void) {
|
||||
#endif
|
||||
|
||||
#if ENABLE_FEAT_F4HWN
|
||||
if (gSetting_set_gui) {
|
||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
|
||||
} else {
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if(i == 3)
|
||||
{
|
||||
GUI_DisplaySmallest(dir_list[i], 43, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 41, 0, line + 1);
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
|
||||
#else
|
||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
|
||||
#endif
|
||||
@@ -1181,11 +1078,7 @@ void UI_DisplayMain(void) {
|
||||
if (vfoInfo->FrequencyReverse)
|
||||
#if ENABLE_FEAT_F4HWN
|
||||
{
|
||||
if (gSetting_set_gui) {
|
||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
|
||||
} else {
|
||||
GUI_DisplaySmallest("R", 51, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
|
||||
}
|
||||
#else
|
||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
|
||||
@@ -1198,16 +1091,9 @@ void UI_DisplayMain(void) {
|
||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) {
|
||||
narrower = 1;
|
||||
}
|
||||
|
||||
if (gSetting_set_gui) {
|
||||
const char *bandWidthNames[] = {"W", "N", "N+"};
|
||||
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 80, 0,
|
||||
line + 1);
|
||||
} else {
|
||||
const char *bandWidthNames[] = {"WIDE", "NAR", "NAR+"};
|
||||
GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], 91, line == 0 ? 17 : 49, false,
|
||||
true);
|
||||
}
|
||||
const char *bandWidthNames[] = {"WID", "NAR", "NR+"};
|
||||
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 30, 0,
|
||||
line);
|
||||
#else
|
||||
if (gSetting_set_gui)
|
||||
{
|
||||
@@ -1232,49 +1118,21 @@ void UI_DisplayMain(void) {
|
||||
#endif
|
||||
|
||||
// show the audio scramble symbol
|
||||
if (vfoInfo->SCRAMBLING_TYPE > 0)
|
||||
UI_PrintStringSmallNormal("S", LCD_WIDTH + 106, 0, line);
|
||||
if (vfoInfo->SCRAMBLING_TYPE > 0) {
|
||||
sprintf(String, "S%d", vfoInfo->SCRAMBLING_TYPE + 25);
|
||||
UI_PrintStringSmallNormal(String, 105, 0, line + 2);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
/*
|
||||
if(isMainVFO)
|
||||
{
|
||||
if(gMonitor)
|
||||
{
|
||||
sprintf(String, "%s", "MONI");
|
||||
}
|
||||
|
||||
if (gSetting_set_gui)
|
||||
{
|
||||
if(!gMonitor)
|
||||
{
|
||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
||||
}
|
||||
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!gMonitor)
|
||||
{
|
||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
||||
}
|
||||
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (isMainVFO) {
|
||||
if (gMonitor) {
|
||||
strcpy(String, "MONI");
|
||||
} else {
|
||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
||||
}
|
||||
if (isMainVFO && gMonitor) {
|
||||
strcpy(String, "MONI");
|
||||
|
||||
if (gSetting_set_gui) {
|
||||
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
|
||||
} else {
|
||||
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
} else {
|
||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
||||
}
|
||||
|
||||
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1324,7 +1182,7 @@ void UI_DisplayMain(void) {
|
||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
@@ -1402,4 +1260,4 @@ void UI_DisplayMain(void) {
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
229
ui/menu.c
229
ui/menu.c
@@ -54,7 +54,6 @@ const t_menu_item MenuList[] =
|
||||
{"COMP", MENU_COMPAND},
|
||||
{"Mod", MENU_AM}, // was "AM"
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
{"TXLck", MENU_TX_LOCK},
|
||||
#endif
|
||||
{"ScAdd1", MENU_S_ADD1},
|
||||
{"ScAdd2", MENU_S_ADD2},
|
||||
@@ -131,15 +130,12 @@ const t_menu_item MenuList[] =
|
||||
{"RxMode", MENU_TDR},
|
||||
{"Sql", MENU_SQL},
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
{"SPwr", MENU_SET_PWR},
|
||||
{"SPTT", MENU_SET_PTT},
|
||||
{"STOT", MENU_SET_TOT},
|
||||
{"SEOT", MENU_SET_EOT},
|
||||
{"SCtr", MENU_SET_CTR},
|
||||
{"SInv", MENU_SET_INV},
|
||||
{"SLck", MENU_SET_LCK},
|
||||
//{"SMet", MENU_SET_MET},
|
||||
//{"SGUI", MENU_SET_GUI},
|
||||
{"STmr", MENU_SET_TMR},
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
{"SOff", MENU_SET_OFF},
|
||||
@@ -160,13 +156,6 @@ const t_menu_item MenuList[] =
|
||||
// hidden menu items from here on
|
||||
// enabled if pressing both the PTT and upper side button at power-on
|
||||
{"F Lock", MENU_F_LOCK},
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
{"Tx 200", MENU_200TX }, // was "200TX"
|
||||
{"Tx 350", MENU_350TX }, // was "350TX"
|
||||
{"Tx 500", MENU_500TX }, // was "500TX"
|
||||
{"350 En", MENU_350EN }, // was "350EN"
|
||||
#endif
|
||||
//{"ScraEn", MENU_SCREN }, // was "SCREN"
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
{"FrCali", MENU_F_CALI}, // reference xtal calibration
|
||||
#endif
|
||||
@@ -177,18 +166,15 @@ const t_menu_item MenuList[] =
|
||||
{"", 0xff} // end of list - DO NOT delete or move this this
|
||||
};
|
||||
|
||||
const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK;
|
||||
|
||||
const char gSubMenu_TXP[][6] =
|
||||
const char gSubMenu_TXP[][5] =
|
||||
{
|
||||
"USR",
|
||||
"L1",
|
||||
"L2",
|
||||
"L3",
|
||||
"L4",
|
||||
"L5",
|
||||
"M",
|
||||
"H"
|
||||
"<.02",
|
||||
".125",
|
||||
".25",
|
||||
".5",
|
||||
"1",
|
||||
"2",
|
||||
"5"
|
||||
};
|
||||
|
||||
const char gSubMenu_SFT_D[][4] =
|
||||
@@ -333,32 +319,7 @@ const char gSubMenu_BATTYP[][9] =
|
||||
"35"
|
||||
};
|
||||
|
||||
const char gSubMenu_SCRAMBLER[][7] =
|
||||
{
|
||||
"OFF",
|
||||
"26K",
|
||||
"27K",
|
||||
"28K",
|
||||
"29K",
|
||||
"30K",
|
||||
"31K",
|
||||
"32K",
|
||||
"33K",
|
||||
"34K",
|
||||
"35K"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
const char gSubMenu_SET_PWR[][6] =
|
||||
{
|
||||
"<.02",
|
||||
".125",
|
||||
".25",
|
||||
".5",
|
||||
"1",
|
||||
"2",
|
||||
"5"
|
||||
};
|
||||
|
||||
const char gSubMenu_SET_PTT[][8] =
|
||||
{
|
||||
@@ -374,12 +335,6 @@ const char gSubMenu_SET_TOT[][7] = // Use by SET_EOT too
|
||||
"ALL"
|
||||
};
|
||||
|
||||
const char gSubMenu_SET_LCK[][9] =
|
||||
{
|
||||
"KEY",
|
||||
"KEY+PTT"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
const char gSubMenu_SET_NFM[][9] =
|
||||
{
|
||||
@@ -500,7 +455,7 @@ void UI_DisplayMenu(void) {
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2 /*, 8 */);
|
||||
|
||||
// invert the current menu list item pixels
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
@@ -525,14 +480,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#else
|
||||
{ // new menu layout .. experimental & unfinished
|
||||
const int menu_index = gMenuCursor; // current selected menu item
|
||||
i = 1;
|
||||
i = 0;
|
||||
|
||||
if (!gIsInSubMenu) {
|
||||
while (i < 2) { // leading menu items - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k < 0)
|
||||
UI_PrintStringSmallNormal(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
|
||||
else if (k >= 0 && k < (int) gMenuListCount)
|
||||
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
|
||||
i); // wrap-around
|
||||
else if (k >= (int) gMenuListCount)
|
||||
UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
|
||||
else
|
||||
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
||||
i++;
|
||||
}
|
||||
@@ -546,10 +504,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
|
||||
while (i < 5) { // trailing menu item - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k >= 0 && k < (int) gMenuListCount)
|
||||
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
||||
if (k < 0)
|
||||
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
|
||||
i); // wrap-around
|
||||
else if (k >= (int) gMenuListCount)
|
||||
UI_PrintStringSmallNormal(MenuList[gMenuListCount - k].name, 0, 0, i); // wrap-a-round
|
||||
UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
|
||||
else
|
||||
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -560,7 +521,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#endif
|
||||
} else if (menu_index >= 0 && menu_index < (int) gMenuListCount) { // current menu item
|
||||
// strcat(String, ":");
|
||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8);
|
||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 0 /*, 8 */);
|
||||
// UI_PrintStringSmallNormal(String, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -615,11 +576,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
}
|
||||
|
||||
case MENU_TXP:
|
||||
if (gSubMenuSelection == 0) {
|
||||
strcpy(String, gSubMenu_TXP[gSubMenuSelection]);
|
||||
} else {
|
||||
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection], gSubMenu_SET_PWR[gSubMenuSelection - 1]);
|
||||
}
|
||||
sprintf(String, "%sW", gSubMenu_TXP[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_R_DCS:
|
||||
@@ -649,14 +606,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
case MENU_OFFSET:
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
||||
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
||||
} else {
|
||||
const char *ascii = INPUTBOX_GetAscii();
|
||||
sprintf(String, "%.3s.%.3s ", ascii, ascii + 3);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
||||
}
|
||||
|
||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3, 8);
|
||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3 /*, 8 */);
|
||||
|
||||
already_printed = true;
|
||||
break;
|
||||
@@ -666,11 +623,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
break;
|
||||
|
||||
case MENU_SCR:
|
||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
||||
if (gSubMenuSelection > 0)
|
||||
if (gSubMenuSelection > 0) {
|
||||
sprintf(String, "%d00", gSubMenuSelection + 25);
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
else
|
||||
} else {
|
||||
strcpy(String, "OFF");
|
||||
BK4819_DisableScramble();
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
@@ -757,13 +716,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
#endif
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
case MENU_350TX:
|
||||
case MENU_200TX:
|
||||
case MENU_500TX:
|
||||
#endif
|
||||
case MENU_350EN:
|
||||
//case MENU_SCREN:
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_TMR:
|
||||
#endif
|
||||
@@ -776,16 +728,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
|
||||
|
||||
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||
}
|
||||
|
||||
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
||||
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2, 8);
|
||||
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||
already_printed = true;
|
||||
break;
|
||||
}
|
||||
@@ -794,7 +746,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
|
||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
|
||||
|
||||
if (valid) {
|
||||
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
||||
@@ -805,18 +757,18 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
if (edit_index < 0) { // show the channel name
|
||||
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
||||
char *pPrintStr = String[0] ? String : "--";
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||
} else { // show the channel name being edited
|
||||
//UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2, 8);
|
||||
//UI_PrintString(edit, menu_item_x1, 0, 2 /*, 8 */);
|
||||
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||
if (edit_index < 10)
|
||||
//UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||
UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||
//UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
|
||||
UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
|
||||
}
|
||||
|
||||
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0), 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,17 +910,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI: {
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
case MENU_F_CALI: {
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
|
||||
writeXtalFreqCal(gSubMenuSelection, false);
|
||||
writeXtalFreqCal(gSubMenuSelection, false);
|
||||
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
gSubMenuSelection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
break;
|
||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||
gSubMenuSelection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BATCAL: {
|
||||
@@ -1006,10 +958,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_SET_PTT:
|
||||
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
|
||||
break;
|
||||
@@ -1038,23 +986,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MENU_TX_LOCK:
|
||||
if (TX_freq_check(gEeprom.VfoInfo[gEeprom.TX_VFO].pRX->Frequency) == 0) {
|
||||
strcpy(String, "Inside\nF Lock\nPlan");
|
||||
} else {
|
||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_SET_LCK:
|
||||
strcpy(String, gSubMenu_SET_LCK[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
//case MENU_SET_MET:
|
||||
//case MENU_SET_GUI:
|
||||
strcpy(String, gSubMenu_SET_MET[gSubMenuSelection]); // Same as SET_MET
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
case MENU_SET_NFM:
|
||||
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
|
||||
@@ -1062,25 +993,25 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||
case MENU_SET_VOL:
|
||||
if (gSubMenuSelection == 0) {
|
||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||
} else if (gSubMenuSelection < 64) {
|
||||
sprintf(String, "%02u", gSubMenuSelection);
|
||||
case MENU_SET_VOL:
|
||||
if (gSubMenuSelection == 0) {
|
||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||
} else if (gSubMenuSelection < 64) {
|
||||
sprintf(String, "%02u", gSubMenuSelection);
|
||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
|
||||
gaugeLine = 4;
|
||||
gaugeMin = 1;
|
||||
gaugeMax = 63;
|
||||
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
|
||||
gaugeLine = 4;
|
||||
gaugeMin = 1;
|
||||
gaugeMax = 63;
|
||||
#endif
|
||||
}
|
||||
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
||||
BK4819_WriteRegister(BK4819_REG_48,
|
||||
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
|
||||
(0u << 10) | // AF Rx Gain-1
|
||||
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||
break;
|
||||
}
|
||||
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
||||
BK4819_WriteRegister(BK4819_REG_48,
|
||||
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
|
||||
(0u << 10) | // AF Rx Gain-1
|
||||
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
@@ -1092,11 +1023,11 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
|
||||
}
|
||||
|
||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
if (gaugeLine != 0) {
|
||||
ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
|
||||
}
|
||||
#endif
|
||||
//#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
// if (gaugeLine != 0) {
|
||||
// ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
|
||||
// }
|
||||
//#endif
|
||||
|
||||
if (!already_printed) { // we now do multi-line text in a single string
|
||||
|
||||
@@ -1135,7 +1066,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
if (small)
|
||||
UI_PrintStringSmallNormal(String + i, menu_item_x1, menu_item_x2, y);
|
||||
else
|
||||
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
|
||||
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y /*, 8 */);
|
||||
|
||||
// look for start of next line
|
||||
while (i < len && String[i] >= 32)
|
||||
@@ -1164,21 +1095,21 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
}
|
||||
|
||||
// channel number
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0, 8);
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0 /*, 8 */);
|
||||
|
||||
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
||||
pPrintStr = String[0] ? String : "--";
|
||||
|
||||
// channel name and scan-list
|
||||
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||
} else {
|
||||
/*
|
||||
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
||||
sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
||||
@@ -1194,7 +1125,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
|
||||
if (IS_MR_CHANNEL(channel)) {
|
||||
sprintf(String, "PRI%d:%u", pri, channel + 1);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1 /*, 8 */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1202,14 +1133,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
}
|
||||
|
||||
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
|
||||
Contact[11] = 0;
|
||||
memcpy(&gDTMF_ID, Contact + 8, 4);
|
||||
sprintf(String, "ID:%4s", gDTMF_ID);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1230,7 +1161,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) { // display confirmation
|
||||
char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!";
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5, 8);
|
||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5 /*, 8 */);
|
||||
}
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
|
21
ui/menu.h
21
ui/menu.h
@@ -42,9 +42,6 @@ enum {
|
||||
MENU_W_N,
|
||||
MENU_SCR,
|
||||
MENU_BCL,
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
MENU_TX_LOCK,
|
||||
#endif
|
||||
MENU_MEM_CH,
|
||||
MENU_DEL_CH,
|
||||
MENU_MEM_NAME,
|
||||
@@ -110,13 +107,6 @@ enum {
|
||||
#endif
|
||||
MENU_RESET,
|
||||
MENU_F_LOCK,
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
MENU_200TX,
|
||||
MENU_350TX,
|
||||
MENU_500TX,
|
||||
MENU_SCREN,
|
||||
#endif
|
||||
MENU_350EN,
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
MENU_F_CALI, // reference xtal calibration
|
||||
#endif
|
||||
@@ -124,15 +114,12 @@ enum {
|
||||
MENU_SET_OFF,
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
MENU_SET_PWR,
|
||||
MENU_SET_PTT,
|
||||
MENU_SET_TOT,
|
||||
MENU_SET_EOT,
|
||||
MENU_SET_CTR,
|
||||
MENU_SET_INV,
|
||||
MENU_SET_LCK,
|
||||
MENU_SET_MET,
|
||||
MENU_SET_GUI,
|
||||
MENU_SET_TMR,
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
MENU_SET_NFM,
|
||||
@@ -156,10 +143,9 @@ enum {
|
||||
MENU_BATTYP
|
||||
};
|
||||
|
||||
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
||||
extern const t_menu_item MenuList[];
|
||||
|
||||
extern const char gSubMenu_TXP[8][6];
|
||||
extern const char gSubMenu_TXP[7][5];
|
||||
extern const char gSubMenu_SFT_D[3][4];
|
||||
extern const char gSubMenu_W_N[2][7];
|
||||
extern const char gSubMenu_OFF_ON[2][4];
|
||||
@@ -179,11 +165,8 @@ extern const char gSubMenu_D_RSP[4][11];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
extern const char gSubMenu_SET_PWR[7][6];
|
||||
extern const char gSubMenu_SET_PTT[2][8];
|
||||
extern const char gSubMenu_SET_TOT[4][7];
|
||||
extern const char gSubMenu_SET_LCK[2][9];
|
||||
extern const char gSubMenu_SET_MET[2][8];
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
extern const char gSubMenu_SET_NFM[2][9];
|
||||
#endif
|
||||
@@ -201,8 +184,6 @@ extern const char gSubMenu_RX_TX[4][6];
|
||||
extern const char gSubMenu_BAT_TXT[3][8];
|
||||
extern const char gSubMenu_BATTYP[3][9];
|
||||
|
||||
extern const char gSubMenu_SCRAMBLER[11][7];
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
uint8_t id;
|
||||
|
16
ui/scanner.c
16
ui/scanner.c
@@ -40,7 +40,7 @@ void UI_DisplayScanner(void)
|
||||
pPrintStr = "FREQ:**.*****";
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 0, 1, 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 1 /*, 8 */);
|
||||
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
|
||||
pPrintStr = "CTC:******";
|
||||
@@ -52,10 +52,10 @@ void UI_DisplayScanner(void)
|
||||
pPrintStr = String;
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 0, 3, 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 3 /*, 8 */);
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
|
||||
pPrintStr = "SAVE?";
|
||||
pPrintStr = "SAV?";
|
||||
Start = 0;
|
||||
bCentered = 1;
|
||||
} else {
|
||||
@@ -63,21 +63,21 @@ void UI_DisplayScanner(void)
|
||||
bCentered = 0;
|
||||
|
||||
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
||||
strcpy(String, "SAVE:");
|
||||
strcpy(String, "SAV:");
|
||||
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
||||
pPrintStr = String;
|
||||
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
strcpy(String, "SCAN");
|
||||
strcpy(String, "SCN");
|
||||
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
|
||||
pPrintStr = String;
|
||||
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
|
||||
pPrintStr = "SCAN CMP.";
|
||||
pPrintStr = "SCN CMP.";
|
||||
} else {
|
||||
pPrintStr = "SCAN FAIL.";
|
||||
pPrintStr = "SCN FAIL.";
|
||||
}
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5, 8);
|
||||
UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5 /*, 8 */);
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
@@ -35,8 +35,7 @@ void UI_DisplayReleaseKeys(void) {
|
||||
#endif
|
||||
UI_DisplayClear();
|
||||
|
||||
UI_PrintString("RELEASE", 0, 127, 1, 10);
|
||||
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
|
||||
UI_PrintString("RELEASE KEYS", 0, 127, 1 /*, 10 */);
|
||||
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
ST7565_BlitFullScreen();
|
||||
|
Reference in New Issue
Block a user