mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
aircopy tidyup complete
This commit is contained in:
parent
0b606e6425
commit
571c722f75
@ -27,13 +27,12 @@
|
|||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
#define AIR_COPY_MAX_BLOCK 120
|
|
||||||
|
|
||||||
static const uint16_t Obfuscation[8] = {0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9};
|
static const uint16_t Obfuscation[8] = {0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9};
|
||||||
|
|
||||||
|
const uint8_t g_air_copy_block_max = 120;
|
||||||
|
uint8_t g_air_copy_block_number;
|
||||||
|
uint8_t g_errors_during_air_copy;
|
||||||
aircopy_state_t g_aircopy_state;
|
aircopy_state_t g_aircopy_state;
|
||||||
uint16_t g_air_copy_block_number;
|
|
||||||
uint16_t g_errors_during_air_copy;
|
|
||||||
uint16_t g_fsk_buffer[36];
|
uint16_t g_fsk_buffer[36];
|
||||||
|
|
||||||
void AIRCOPY_SendMessage(void)
|
void AIRCOPY_SendMessage(void)
|
||||||
@ -49,7 +48,7 @@ void AIRCOPY_SendMessage(void)
|
|||||||
for (i = 0; i < 34; i++)
|
for (i = 0; i < 34; i++)
|
||||||
g_fsk_buffer[i + 1] ^= Obfuscation[i % 8];
|
g_fsk_buffer[i + 1] ^= Obfuscation[i % 8];
|
||||||
|
|
||||||
if (++g_air_copy_block_number >= AIR_COPY_MAX_BLOCK)
|
if (++g_air_copy_block_number >= g_air_copy_block_max)
|
||||||
{
|
{
|
||||||
g_aircopy_state = AIRCOPY_TX_COMPLETE;
|
g_aircopy_state = AIRCOPY_TX_COMPLETE;
|
||||||
g_update_display = true;
|
g_update_display = true;
|
||||||
|
@ -31,9 +31,10 @@ enum aircopy_state_e
|
|||||||
};
|
};
|
||||||
typedef enum aircopy_state_e aircopy_state_t;
|
typedef enum aircopy_state_e aircopy_state_t;
|
||||||
|
|
||||||
|
extern const uint8_t g_air_copy_block_max;
|
||||||
|
extern uint8_t g_air_copy_block_number;
|
||||||
|
extern uint8_t g_errors_during_air_copy;
|
||||||
extern aircopy_state_t g_aircopy_state;
|
extern aircopy_state_t g_aircopy_state;
|
||||||
extern uint16_t g_air_copy_block_number;
|
|
||||||
extern uint16_t g_errors_during_air_copy;
|
|
||||||
extern uint16_t g_fsk_buffer[36];
|
extern uint16_t g_fsk_buffer[36];
|
||||||
|
|
||||||
void AIRCOPY_SendMessage(void);
|
void AIRCOPY_SendMessage(void);
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
56
ui/aircopy.c
56
ui/aircopy.c
@ -31,7 +31,10 @@ void UI_DisplayAircopy(void)
|
|||||||
|
|
||||||
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
|
||||||
|
|
||||||
|
// **********************************
|
||||||
|
|
||||||
strcpy(String, "AIR COPY");
|
strcpy(String, "AIR COPY");
|
||||||
|
|
||||||
switch (g_aircopy_state)
|
switch (g_aircopy_state)
|
||||||
{
|
{
|
||||||
case AIRCOPY_READY: strcat(String, " READY"); break;
|
case AIRCOPY_READY: strcat(String, " READY"); break;
|
||||||
@ -41,7 +44,9 @@ void UI_DisplayAircopy(void)
|
|||||||
case AIRCOPY_TX_COMPLETE: strcat(String, " DONE"); break;
|
case AIRCOPY_TX_COMPLETE: strcat(String, " DONE"); break;
|
||||||
default: strcat(String, " ???"); break;
|
default: strcat(String, " ???"); break;
|
||||||
}
|
}
|
||||||
UI_PrintString(String, 2, 127, 0, 8);
|
UI_PrintString(String, 0, LCD_WIDTH - 1, 0, 8);
|
||||||
|
|
||||||
|
// **********************************
|
||||||
|
|
||||||
if (g_input_box_index == 0)
|
if (g_input_box_index == 0)
|
||||||
{
|
{
|
||||||
@ -52,26 +57,49 @@ void UI_DisplayAircopy(void)
|
|||||||
else
|
else
|
||||||
UI_DisplayFrequency(g_input_box, 16, 2, 1, 0);
|
UI_DisplayFrequency(g_input_box, 16, 2, 1, 0);
|
||||||
|
|
||||||
|
// **********************************
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (g_aircopy_state)
|
switch (g_aircopy_state)
|
||||||
{
|
{
|
||||||
case AIRCOPY_READY:
|
case AIRCOPY_READY:
|
||||||
UI_PrintString("EXIT rx M tx", 0, 127, 5, 7);
|
UI_PrintString("EXIT rx M tx", 0, LCD_WIDTH - 1, 5, 7);
|
||||||
break;
|
break;
|
||||||
case AIRCOPY_RX:
|
|
||||||
case AIRCOPY_RX_COMPLETE:
|
case AIRCOPY_RX_COMPLETE:
|
||||||
sprintf(String, "RCV %u E %u", g_air_copy_block_number, g_errors_during_air_copy);
|
if (g_errors_during_air_copy == 0)
|
||||||
UI_PrintString(String, 0, 127, 5, 8);
|
{
|
||||||
break;
|
UI_PrintString("RX COMPLETE", 0, LCD_WIDTH - 1, 5, 8);
|
||||||
case AIRCOPY_TX:
|
|
||||||
case AIRCOPY_TX_COMPLETE:
|
|
||||||
sprintf(String, "SND %u", g_air_copy_block_number);
|
|
||||||
UI_PrintString(String, 0, 127, 5, 8);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(String, " ???");
|
|
||||||
UI_PrintString(String, 0, 127, 5, 8);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AIRCOPY_RX:
|
||||||
|
sprintf(String, "RX %u.%u", g_air_copy_block_number, g_air_copy_block_max);
|
||||||
|
if (g_errors_during_air_copy > 0)
|
||||||
|
sprintf(String + strlen(String), " E %u", g_errors_during_air_copy);
|
||||||
|
UI_PrintString(String, 0, LCD_WIDTH - 1, 5, 7);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AIRCOPY_TX_COMPLETE:
|
||||||
|
UI_PrintString("TX COMPLETE", 0, LCD_WIDTH - 1, 5, 8);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AIRCOPY_TX:
|
||||||
|
sprintf(String, "TX %u.%u", g_air_copy_block_number, g_air_copy_block_max);
|
||||||
|
UI_PrintString(String, 0, LCD_WIDTH - 1, 5, 7);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
strcpy(String, " ???");
|
||||||
|
UI_PrintString(String, 0, LCD_WIDTH - 1, 5, 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
// **********************************
|
||||||
|
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user