mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
fix aircopy
This commit is contained in:
parent
fca972a2f2
commit
2c007d7e50
4
Makefile
4
Makefile
@ -21,7 +21,7 @@ ENABLE_AIRCOPY_RX_REBOOT := 0
|
||||
ENABLE_FMRADIO_64_76 := 0
|
||||
ENABLE_FMRADIO_76_90 := 0
|
||||
ENABLE_FMRADIO_76_108 := 0
|
||||
ENABLE_FMRADIO_875_108 := 1
|
||||
ENABLE_FMRADIO_875_108 := 0
|
||||
ENABLE_FMRADIO_64_108 := 0
|
||||
# NOAA 1.2 kB
|
||||
ENABLE_NOAA := 0
|
||||
@ -36,7 +36,7 @@ ENABLE_REDUCE_LOW_MID_TX_POWER := 1
|
||||
ENABLE_ALARM := 0
|
||||
ENABLE_TX1750 := 0
|
||||
# MDC1200 2.8 kB
|
||||
ENABLE_MDC1200 := 0
|
||||
ENABLE_MDC1200 := 1
|
||||
ENABLE_MDC1200_SHOW_OP_ARG := 1
|
||||
ENABLE_PWRON_PASSWORD := 0
|
||||
ENABLE_RESET_AES_KEY := 0
|
||||
|
@ -693,7 +693,7 @@ static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
|
||||
g_rx_vfo->band = i;
|
||||
g_rx_vfo->channel_attributes.band = i;
|
||||
|
||||
// round the frequency to nearest step size
|
||||
Frequency = ((Frequency + (g_rx_vfo->step_freq / 2)) / g_rx_vfo->step_freq) * g_rx_vfo->step_freq;
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -80,8 +80,8 @@ void BOOT_ProcessMode(boot_mode_t Mode)
|
||||
|
||||
RADIO_InitInfo(g_rx_vfo, FREQ_CHANNEL_LAST - 1, g_aircopy_freq);
|
||||
|
||||
g_rx_vfo->channel_bandwidth = BANDWIDTH_WIDE;
|
||||
g_rx_vfo->output_power = OUTPUT_POWER_LOW;
|
||||
g_rx_vfo->channel.channel_bandwidth = BANDWIDTH_WIDE;
|
||||
g_rx_vfo->channel.tx_power = OUTPUT_POWER_LOW;
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
||||
|
||||
|
144
ui/main.c
144
ui/main.c
@ -39,6 +39,8 @@
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
//#define SHOW_RX_TEST_VALUES
|
||||
|
||||
center_line_t g_center_line = CENTER_LINE_NONE;
|
||||
|
||||
// ***************************************************************************
|
||||
@ -165,77 +167,105 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
bool UI_DisplayRSSIBar(const int16_t rssi, const int16_t glitch, const int16_t noise, const bool now)
|
||||
bool UI_DisplayRSSIBar(const int16_t rssi, const uint16_t glitch, const uint16_t noise, const bool now)
|
||||
{
|
||||
if (g_eeprom.config.setting.enable_rssi_bar)
|
||||
{
|
||||
#ifdef SHOW_RX_TEST_VALUES
|
||||
|
||||
(void)glitch; // TODO:
|
||||
(void)noise;
|
||||
const unsigned int line = 3;
|
||||
uint8_t *p_line = g_frame_buffer[line];
|
||||
char str[22];
|
||||
|
||||
// const int16_t s0_dBm = -127; // S0 .. base level
|
||||
const int16_t s0_dBm = -147; // S0 .. base level
|
||||
#ifdef ENABLE_KEYLOCK
|
||||
if (g_eeprom.config.setting.key_lock && g_keypad_locked > 0)
|
||||
return false; // display is in use
|
||||
#endif
|
||||
|
||||
const int16_t s9_dBm = s0_dBm + (6 * 9); // S9 .. 6dB/S-Point
|
||||
const int16_t bar_max_dBm = s9_dBm + 60; // S9+60dB
|
||||
// const int16_t bar_min_dBm = s0_dBm + (6 * 0); // S0
|
||||
const int16_t bar_min_dBm = s0_dBm + (6 * 4); // S4
|
||||
|
||||
// ************
|
||||
|
||||
const unsigned int txt_width = 7 * 8; // 8 text chars
|
||||
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
|
||||
const unsigned int bar_width = LCD_WIDTH - 1 - bar_x;
|
||||
|
||||
const int16_t rssi_dBm = (rssi / 2) - 160;
|
||||
const int16_t clamped_dBm = (rssi_dBm <= bar_min_dBm) ? bar_min_dBm : (rssi_dBm >= bar_max_dBm) ? bar_max_dBm : rssi_dBm;
|
||||
const unsigned int bar_range_dB = bar_max_dBm - bar_min_dBm;
|
||||
const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB;
|
||||
|
||||
const unsigned int line = 3;
|
||||
uint8_t *p_line = g_frame_buffer[line];
|
||||
|
||||
char s[16];
|
||||
|
||||
#ifdef ENABLE_KEYLOCK
|
||||
if (g_eeprom.config.setting.key_lock && g_keypad_locked > 0)
|
||||
if (g_current_function == FUNCTION_TRANSMIT || g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return false; // display is in use
|
||||
|
||||
if (now)
|
||||
memset(p_line, 0, LCD_WIDTH);
|
||||
|
||||
sprintf(str, "r %3u g %3u n %3u", (uint16_t )rssi, glitch, noise);
|
||||
UI_PrintStringSmall(str, 2, 0, line);
|
||||
|
||||
if (now)
|
||||
ST7565_BlitFullScreen();
|
||||
|
||||
return true;
|
||||
|
||||
#else
|
||||
|
||||
(void)glitch; // TODO:
|
||||
(void)noise;
|
||||
|
||||
// const int16_t s0_dBm = -127; // S0 .. base level
|
||||
const int16_t s0_dBm = -147; // S0 .. base level
|
||||
|
||||
const int16_t s9_dBm = s0_dBm + (6 * 9); // S9 .. 6dB/S-Point
|
||||
const int16_t bar_max_dBm = s9_dBm + 60; // S9+60dB
|
||||
// const int16_t bar_min_dBm = s0_dBm + (6 * 0); // S0
|
||||
const int16_t bar_min_dBm = s0_dBm + (6 * 4); // S4
|
||||
|
||||
// ************
|
||||
|
||||
const unsigned int txt_width = 7 * 8; // 8 text chars
|
||||
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
|
||||
const unsigned int bar_width = LCD_WIDTH - 1 - bar_x;
|
||||
|
||||
const int16_t rssi_dBm = (rssi / 2) - 160;
|
||||
const int16_t clamped_dBm = (rssi_dBm <= bar_min_dBm) ? bar_min_dBm : (rssi_dBm >= bar_max_dBm) ? bar_max_dBm : rssi_dBm;
|
||||
const unsigned int bar_range_dB = bar_max_dBm - bar_min_dBm;
|
||||
const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB;
|
||||
|
||||
const unsigned int line = 3;
|
||||
uint8_t *p_line = g_frame_buffer[line];
|
||||
|
||||
char s[16];
|
||||
|
||||
#ifdef ENABLE_KEYLOCK
|
||||
if (g_eeprom.config.setting.key_lock && g_keypad_locked > 0)
|
||||
return false; // display is in use
|
||||
#endif
|
||||
|
||||
if (g_current_function == FUNCTION_TRANSMIT ||
|
||||
g_current_display_screen != DISPLAY_MAIN ||
|
||||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return false; // display is in use
|
||||
|
||||
if (now)
|
||||
memset(p_line, 0, LCD_WIDTH);
|
||||
|
||||
if (rssi_dBm >= (s9_dBm + 6))
|
||||
{ // S9+XXdB, 1dB increment
|
||||
const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
|
||||
const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
|
||||
sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
|
||||
}
|
||||
else
|
||||
{ // S0 ~ S9, 6dB per S-point
|
||||
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
|
||||
sprintf(s, "%4d S%u ", rssi_dBm, s_level);
|
||||
}
|
||||
UI_PrintStringSmall(s, 2, 0, line);
|
||||
|
||||
draw_bar(p_line + bar_x, len, bar_width);
|
||||
|
||||
if (now)
|
||||
ST7565_BlitFullScreen();
|
||||
|
||||
return true;
|
||||
|
||||
#endif
|
||||
|
||||
if (g_current_function == FUNCTION_TRANSMIT ||
|
||||
g_current_display_screen != DISPLAY_MAIN ||
|
||||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return false; // display is in use
|
||||
|
||||
if (now)
|
||||
memset(p_line, 0, LCD_WIDTH);
|
||||
|
||||
if (rssi_dBm >= (s9_dBm + 6))
|
||||
{ // S9+XXdB, 1dB increment
|
||||
const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
|
||||
const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
|
||||
sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
|
||||
}
|
||||
else
|
||||
{ // S0 ~ S9, 6dB per S-point
|
||||
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
|
||||
sprintf(s, "%4d S%u ", rssi_dBm, s_level);
|
||||
}
|
||||
UI_PrintStringSmall(s, 2, 0, line);
|
||||
|
||||
draw_bar(p_line + bar_x, len, bar_width);
|
||||
|
||||
if (now)
|
||||
ST7565_BlitFullScreen();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void UI_update_rssi(const int16_t rssi, const int16_t glitch, const int16_t noise, const int vfo)
|
||||
void UI_update_rssi(const int16_t rssi, const uint16_t glitch, const uint16_t noise, const int vfo)
|
||||
{
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
if (g_center_line == CENTER_LINE_RSSI)
|
||||
|
@ -34,7 +34,7 @@ extern center_line_t g_center_line;
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
bool UI_DisplayAudioBar(const bool now);
|
||||
#endif
|
||||
void UI_update_rssi(const int16_t rssi, const int16_t glitch, const int16_t noise, const int vfo);
|
||||
void UI_update_rssi(const int16_t rssi, const uint16_t glitch, const uint16_t noise, const int vfo);
|
||||
void UI_DisplayMain(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user