mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
Updated aircopy
This commit is contained in:
parent
906c470567
commit
b315d29a81
134
app/aircopy.c
134
app/aircopy.c
@ -195,7 +195,7 @@ void AIRCOPY_start_fsk_tx(const int request_block_num)
|
||||
BK4819_WriteRegister(BK4819_REG_59, (1u << 13) | (1u << 11) | fsk_reg59);
|
||||
}
|
||||
|
||||
void AIRCOPY_stop_fsk_tx(const bool inc_block)
|
||||
void AIRCOPY_stop_fsk_tx(void)
|
||||
{
|
||||
if (g_aircopy_state != AIRCOPY_TX && g_fsk_tx_timeout_10ms == 0)
|
||||
return;
|
||||
@ -209,27 +209,16 @@ void AIRCOPY_stop_fsk_tx(const bool inc_block)
|
||||
|
||||
BK4819_reset_fsk();
|
||||
|
||||
if (inc_block)
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
{
|
||||
if (++g_aircopy_block_number >= g_aircopy_block_max)
|
||||
{ // transfer is complete
|
||||
g_aircopy_state = AIRCOPY_TX_COMPLETE;
|
||||
}
|
||||
else
|
||||
{ // TX pause/gap time till we start the next packet
|
||||
aircopy_send_count_down_10ms = 220 / 10; // 220ms
|
||||
}
|
||||
g_aircopy_block_number++;
|
||||
|
||||
// RX mode
|
||||
BK4819_start_fsk_rx(AIRCOPY_REQ_PACKET_SIZE);
|
||||
// TX pause/gap time till we start the next packet
|
||||
aircopy_send_count_down_10ms = 250 / 10; // 250ms
|
||||
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
else
|
||||
{ // RX mode
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void AIRCOPY_process_fsk_tx_10ms(void)
|
||||
@ -242,18 +231,25 @@ void AIRCOPY_process_fsk_tx_10ms(void)
|
||||
if (g_fsk_tx_timeout_10ms == 0)
|
||||
{ // not currently TX'ing
|
||||
|
||||
if (g_aircopy_state == AIRCOPY_TX && g_aircopy_block_number < g_aircopy_block_max)
|
||||
{ // not yet finished the complete transfer
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
{ // we're still TX transferring
|
||||
|
||||
if (g_fsk_write_index > 0)
|
||||
return; // currently RX'ing a packet
|
||||
|
||||
if (aircopy_send_count_down_10ms > 0)
|
||||
if (--aircopy_send_count_down_10ms > 0)
|
||||
return; // not yet time to TX next packet
|
||||
|
||||
if (g_fsk_write_index > 0)
|
||||
return; // currently RX'ing a packet
|
||||
|
||||
// start next TX packet
|
||||
AIRCOPY_start_fsk_tx(-1);
|
||||
if (g_aircopy_block_number >= g_aircopy_block_max)
|
||||
{ // transfer is complete
|
||||
g_aircopy_state = AIRCOPY_TX_COMPLETE;
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
}
|
||||
else
|
||||
{ // start next TX packet
|
||||
AIRCOPY_start_fsk_tx(-1);
|
||||
}
|
||||
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
@ -272,7 +268,19 @@ void AIRCOPY_process_fsk_tx_10ms(void)
|
||||
return; // TX not yet finished
|
||||
}
|
||||
|
||||
AIRCOPY_stop_fsk_tx(true);
|
||||
AIRCOPY_stop_fsk_tx();
|
||||
|
||||
if (g_aircopy_state == AIRCOPY_RX)
|
||||
{
|
||||
g_fsk_write_index = 0;
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
}
|
||||
else
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
{
|
||||
g_fsk_write_index = 0;
|
||||
BK4819_start_fsk_rx(AIRCOPY_REQ_PACKET_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
@ -407,9 +415,11 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
if ((status & (1u << 4)) != 0)
|
||||
{
|
||||
g_aircopy_rx_errors_fsk_crc++;
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("aircopy status %04X\r\n", status);
|
||||
#endif
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
return;
|
||||
}
|
||||
@ -437,9 +447,11 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
if (crc2 != crc1)
|
||||
{ // invalid CRC
|
||||
g_aircopy_rx_errors_crc++;
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("aircopy invalid CRC %04X %04X\r\n", crc2, crc1);
|
||||
#endif
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
return;
|
||||
}
|
||||
@ -457,9 +469,18 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
#endif
|
||||
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
{ // send them the block they want
|
||||
g_aircopy_block_number = block_num; // go to the block number they want
|
||||
aircopy_send_count_down_10ms = 0; // TX asap
|
||||
{ // we are the TX'ing radio
|
||||
if (block_num >= g_aircopy_block_max)
|
||||
{ // they have all the blocks .. transfer is complete
|
||||
g_aircopy_block_number = g_aircopy_block_max;
|
||||
g_aircopy_state = AIRCOPY_TX_COMPLETE;
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
}
|
||||
else
|
||||
{ // send them the block they want
|
||||
g_aircopy_block_number = block_num; // go to the block number they want
|
||||
aircopy_send_count_down_10ms = 0; // TX asap
|
||||
}
|
||||
}
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
@ -486,7 +507,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
}
|
||||
|
||||
if (block_num != g_aircopy_block_number)
|
||||
{ // not the block number we're expecting .. request the correct block
|
||||
{ // not the block number we're expecting .. request the correct one
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
|
||||
@ -508,13 +529,15 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
g_fsk_tx_timeout_10ms = 0; // TX is complete
|
||||
}
|
||||
}
|
||||
AIRCOPY_stop_fsk_tx(false);
|
||||
AIRCOPY_stop_fsk_tx();
|
||||
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ((eeprom_addr + block_size) > AIRCOPY_LAST_EEPROM_ADDR)
|
||||
{
|
||||
{ // ignore it
|
||||
g_fsk_write_index = 0;
|
||||
return;
|
||||
}
|
||||
@ -555,7 +578,10 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
g_fsk_write_index = 0;
|
||||
|
||||
if (eeprom_addr >= AIRCOPY_LAST_EEPROM_ADDR)
|
||||
g_aircopy_state = AIRCOPY_RX_COMPLETE; // reached end of eeprom config area
|
||||
{ // transfer is complete
|
||||
g_aircopy_state = AIRCOPY_RX_COMPLETE;
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
}
|
||||
}
|
||||
|
||||
static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
@ -565,9 +591,10 @@ static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
|
||||
if (g_aircopy_state != AIRCOPY_READY)
|
||||
{
|
||||
AIRCOPY_stop_fsk_tx(false);
|
||||
g_aircopy_state = AIRCOPY_READY;
|
||||
|
||||
AIRCOPY_stop_fsk_tx();
|
||||
|
||||
g_aircopy_state = AIRCOPY_READY;
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
@ -638,10 +665,15 @@ static void AIRCOPY_Key_EXIT(bool key_pressed, bool key_held)
|
||||
// turn the green LED off
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
|
||||
AIRCOPY_stop_fsk_tx(false);
|
||||
|
||||
g_input_box_index = 0;
|
||||
g_aircopy_state = AIRCOPY_READY;
|
||||
|
||||
AIRCOPY_stop_fsk_tx();
|
||||
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
|
||||
AIRCOPY_init();
|
||||
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
@ -670,17 +702,21 @@ static void AIRCOPY_Key_EXIT(bool key_pressed, bool key_held)
|
||||
|
||||
g_input_box_index = 0;
|
||||
|
||||
g_aircopy_state = AIRCOPY_RX;
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
|
||||
AIRCOPY_init();
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
g_aircopy_block_number = 0;
|
||||
g_aircopy_rx_errors_fsk_crc = 0;
|
||||
g_aircopy_rx_errors_magic = 0;
|
||||
g_aircopy_rx_errors_crc = 0;
|
||||
g_aircopy_state = AIRCOPY_RX;
|
||||
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@ -695,22 +731,24 @@ static void AIRCOPY_Key_MENU(bool key_pressed, bool key_held)
|
||||
{ // key released
|
||||
|
||||
// enter TX mode
|
||||
g_input_box_index = 0;
|
||||
|
||||
g_aircopy_state = AIRCOPY_TX;
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
|
||||
g_input_box_index = 0;
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
g_aircopy_block_number = 0;
|
||||
g_aircopy_rx_errors_fsk_crc = 0;
|
||||
g_aircopy_rx_errors_magic = 0;
|
||||
g_aircopy_rx_errors_crc = 0;
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
|
||||
AIRCOPY_init();
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
g_aircopy_block_number = 0;
|
||||
g_aircopy_rx_errors_fsk_crc = 0;
|
||||
g_aircopy_rx_errors_magic = 0;
|
||||
g_aircopy_rx_errors_crc = 0;
|
||||
g_fsk_tx_timeout_10ms = 0;
|
||||
aircopy_send_count_down_10ms = 0;
|
||||
g_aircopy_state = AIRCOPY_TX;
|
||||
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
9
audio.c
9
audio.c
@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
#include "app/aircopy.h"
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
@ -85,13 +88,11 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (g_screen_to_display == DISPLAY_AIRCOPY)
|
||||
return;
|
||||
// if (g_screen_to_display == DISPLAY_AIRCOPY || g_aircopy_state != AIRCOPY_READY)
|
||||
// return;
|
||||
#endif
|
||||
|
||||
if (g_current_function == FUNCTION_RECEIVE)
|
||||
return;
|
||||
|
||||
if (g_current_function == FUNCTION_MONITOR)
|
||||
return;
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
4
main.c
4
main.c
@ -68,8 +68,6 @@ void Main(void)
|
||||
BOARD_Init();
|
||||
UART_Init();
|
||||
|
||||
g_boot_counter_10ms = 250; // 2.5 sec
|
||||
|
||||
#if defined(ENABLE_UART)
|
||||
UART_SendText(UART_Version_str);
|
||||
UART_SendText("\r\n");
|
||||
@ -162,7 +160,7 @@ void Main(void)
|
||||
#endif
|
||||
|
||||
if (g_eeprom.pwr_on_display_mode != PWR_ON_DISPLAY_MODE_NONE)
|
||||
{ // 2.55 second boot-up screen
|
||||
{ // 3 second boot-up screen
|
||||
while (g_boot_counter_10ms > 0)
|
||||
{
|
||||
if (KEYBOARD_Poll() != KEY_INVALID)
|
||||
|
2
misc.c
2
misc.c
@ -258,7 +258,7 @@ volatile bool g_flag_tail_tone_elimination_complete;
|
||||
volatile bool g_schedule_fm;
|
||||
#endif
|
||||
|
||||
volatile uint8_t g_boot_counter_10ms;
|
||||
volatile uint16_t g_boot_counter_10ms = 4000 / 10; // 4 seconds
|
||||
|
||||
int16_t g_current_rssi[2] = {0, 0}; // now one per VFO
|
||||
|
||||
|
2
misc.h
2
misc.h
@ -337,7 +337,7 @@ extern volatile bool g_flag_tail_tone_elimination_complete;
|
||||
extern volatile bool g_schedule_fm;
|
||||
#endif
|
||||
extern int16_t g_current_rssi[2]; // now one per VFO
|
||||
extern volatile uint8_t g_boot_counter_10ms;
|
||||
extern volatile uint16_t g_boot_counter_10ms;
|
||||
|
||||
unsigned int get_TX_VFO(void);
|
||||
unsigned int get_RX_VFO(void);
|
||||
|
26
settings.h
26
settings.h
@ -214,8 +214,8 @@ typedef struct {
|
||||
} __attribute__((packed)) vhf_squelch[6];
|
||||
|
||||
// 0x1EC0
|
||||
uint16_t rssi_uhf[4];
|
||||
uint16_t rssi_vhf[4];
|
||||
uint16_t rssi_band_4567[4];
|
||||
uint16_t rssi_band_123[4];
|
||||
|
||||
// 0x1ED0
|
||||
struct
|
||||
@ -270,7 +270,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
// 0x0D60
|
||||
struct { // all these channel settings could have been in the t_channel structure !
|
||||
struct { // these channel attribute settings could have been in the t_channel structure !
|
||||
uint8_t band:4; // why do QS have these 4 bits ? .. band can/is computed from the frequency
|
||||
uint8_t compander:2; // TODO: move this to the t_channel structure
|
||||
uint8_t scanlist2:1; // set if is in scan list 2
|
||||
@ -293,13 +293,13 @@ typedef struct {
|
||||
uint8_t vox_switch;
|
||||
uint8_t vox_level;
|
||||
uint8_t mic_sensitivity;
|
||||
uint8_t unused4;
|
||||
uint8_t mdf;
|
||||
uint8_t wx;
|
||||
uint8_t lcd_contrast; // 1of11
|
||||
uint8_t channel_display_mode;
|
||||
uint8_t cross_vfo;
|
||||
uint8_t battery_save;
|
||||
uint8_t tdr;
|
||||
uint8_t dual_watch;
|
||||
uint8_t backlight;
|
||||
uint8_t site;
|
||||
uint8_t tail_tone_elimination;
|
||||
uint8_t vfo_open;
|
||||
|
||||
// 0x0E80
|
||||
@ -322,8 +322,8 @@ typedef struct {
|
||||
uint8_t key1_long;
|
||||
uint8_t key2_short;
|
||||
uint8_t key2_long;
|
||||
uint8_t sc_rev;
|
||||
uint8_t auto_lock;
|
||||
uint8_t carrier_search_mode; // sc_rev;
|
||||
uint8_t auto_key_lock;
|
||||
uint8_t display_mode;
|
||||
uint32_t power_on_password;
|
||||
uint8_t unused6[4];
|
||||
@ -333,9 +333,9 @@ typedef struct {
|
||||
uint8_t unused7[7];
|
||||
uint8_t alarm_mode;
|
||||
uint8_t roger_mode;
|
||||
uint8_t rp_ste;
|
||||
uint8_t repeater_tail_tone_elimination; // rp_ste
|
||||
uint8_t tx_channel;
|
||||
uint8_t unused8[4];
|
||||
uint8_t air_copy_freq; // 1of11
|
||||
|
||||
// 0x0EB0
|
||||
char welcome_line1[16];
|
||||
@ -394,7 +394,7 @@ typedef struct {
|
||||
uint8_t battery_text:2; // 0 = no battery text, 1 = voltage, 2 = percent .. on the status bar
|
||||
uint8_t mic_bar:1; // 1 = on-screen TX audio level
|
||||
uint8_t am_fix:1; // 1 = RX AM fix
|
||||
uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when RX, 2 = when TX, 3 = both RX/TX
|
||||
uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when TX, 2 = when RX, 3 = both RX/TX
|
||||
|
||||
uint8_t unused12[8];
|
||||
#endif
|
||||
|
@ -1017,9 +1017,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add the date and time
|
||||
strcat(String, "\n" __DATE__);
|
||||
strcat(String, "\n" __TIME__);
|
||||
strcat(String, "\n \n" __DATE__ "\n" __TIME__);
|
||||
break;
|
||||
}
|
||||
|
||||
|
19
ui/welcome.c
19
ui/welcome.c
@ -32,8 +32,8 @@ void UI_DisplayReleaseKeys(void)
|
||||
memset(g_status_line, 0, sizeof(g_status_line));
|
||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||
|
||||
UI_PrintString("RELEASE", 0, 127, 1, 10);
|
||||
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
|
||||
UI_PrintString("RELEASE", 0, LCD_WIDTH, 1, 10);
|
||||
UI_PrintString("ALL KEYS", 0, LCD_WIDTH, 3, 10);
|
||||
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
ST7565_BlitFullScreen();
|
||||
@ -61,7 +61,7 @@ void UI_DisplayWelcome(void)
|
||||
{
|
||||
unsigned int slen = strlen(Version_str);
|
||||
if (slen > (sizeof(str2) - 1))
|
||||
slen = sizeof(str2) - 1;
|
||||
slen = sizeof(str2) - 1;
|
||||
|
||||
memset(str0, 0, sizeof(str0));
|
||||
memset(str1, 0, sizeof(str1));
|
||||
@ -83,14 +83,11 @@ void UI_DisplayWelcome(void)
|
||||
|
||||
memmove(str2, Version_str, slen);
|
||||
|
||||
UI_PrintString(str0, 0, 127, 0, 10);
|
||||
UI_PrintString(str1, 0, 127, 2, 10);
|
||||
|
||||
if (strlen(str2) <= 12)
|
||||
UI_PrintString(str2, 0, 127, 5, 10);
|
||||
else
|
||||
UI_PrintStringSmall(str2, 0, 127, 5);
|
||||
|
||||
UI_PrintString(str0, 0, LCD_WIDTH, 0, 10);
|
||||
UI_PrintString(str1, 0, LCD_WIDTH, 2, 10);
|
||||
UI_PrintStringSmall(str2, 0, LCD_WIDTH, 4);
|
||||
UI_PrintStringSmall(__DATE__, 0, LCD_WIDTH, 5);
|
||||
UI_PrintStringSmall(__TIME__, 0, LCD_WIDTH, 6);
|
||||
|
||||
#if 1
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
|
Loading…
x
Reference in New Issue
Block a user