Improve Air Copy and enable restart

This commit is contained in:
Armel FAUVEAU
2024-08-15 01:43:26 +02:00
parent 19c0c05aae
commit 75480cac10
4 changed files with 19 additions and 2 deletions

View File

@@ -41,6 +41,14 @@ uint8_t gAirCopyIsSendMode;
uint16_t g_FSK_Buffer[36]; uint16_t g_FSK_Buffer[36];
static void AIRCOPY_clear()
{
for (uint8_t i = 0; i < 15; i++)
{
crc[i] = 0;
}
}
bool AIRCOPY_SendMessage(void) bool AIRCOPY_SendMessage(void)
{ {
static uint8_t gAircopySendCountdown = 1; static uint8_t gAircopySendCountdown = 1;
@@ -183,12 +191,15 @@ static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
} }
if (gInputBoxIndex == 0) { if (gInputBoxIndex == 0) {
gAircopyStep = 1;
gFSKWriteIndex = 0; gFSKWriteIndex = 0;
gAirCopyBlockNumber = 0; gAirCopyBlockNumber = 0;
gInputBoxIndex = 0; gInputBoxIndex = 0;
gErrorsDuringAirCopy = 0; gErrorsDuringAirCopy = lErrorsDuringAirCopy = 0;
gAirCopyIsSendMode = 0; gAirCopyIsSendMode = 0;
AIRCOPY_clear();
BK4819_PrepareFSKReceive(); BK4819_PrepareFSKReceive();
gAircopyState = AIRCOPY_TRANSFER; gAircopyState = AIRCOPY_TRANSFER;
@@ -205,6 +216,7 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
return; return;
} }
gAircopyStep = 1;
gFSKWriteIndex = 0; gFSKWriteIndex = 0;
gAirCopyBlockNumber = 0; gAirCopyBlockNumber = 0;
gInputBoxIndex = 0; gInputBoxIndex = 0;
@@ -213,6 +225,8 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
g_FSK_Buffer[1] = 0; g_FSK_Buffer[1] = 0;
g_FSK_Buffer[35] = 0xDCBA; g_FSK_Buffer[35] = 0xDCBA;
AIRCOPY_clear();
GUI_DisplayScreen(); GUI_DisplayScreen();
gAircopyState = AIRCOPY_TRANSFER; gAircopyState = AIRCOPY_TRANSFER;

1
misc.c
View File

@@ -121,6 +121,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
bool gSaveRxMode = false; bool gSaveRxMode = false;
uint8_t crc[15] = { 0 }; uint8_t crc[15] = { 0 };
uint8_t lErrorsDuringAirCopy = 0; uint8_t lErrorsDuringAirCopy = 0;
uint8_t gAircopyStep = 0;
#endif #endif
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR

1
misc.h
View File

@@ -173,6 +173,7 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern bool gSaveRxMode; extern bool gSaveRxMode;
extern uint8_t crc[15]; extern uint8_t crc[15];
extern uint8_t lErrorsDuringAirCopy; extern uint8_t lErrorsDuringAirCopy;
extern uint8_t gAircopyStep;
#endif #endif
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR

View File

@@ -49,6 +49,7 @@ void UI_DisplayAircopy(void)
pPrintStr = "AIR COPY"; pPrintStr = "AIR COPY";
} else { } else {
pPrintStr = "AIR COPY(CMP)"; pPrintStr = "AIR COPY(CMP)";
gAircopyState = AIRCOPY_READY;
} }
UI_PrintString(pPrintStr, 2, 127, 0, 8); UI_PrintString(pPrintStr, 2, 127, 0, 8);
@@ -78,7 +79,7 @@ void UI_DisplayAircopy(void)
} }
// Draw gauge // Draw gauge
if(gAircopyState != AIRCOPY_READY) if(gAircopyStep != 0)
{ {
UI_PrintString(String, 2, 127, 5, 8); UI_PrintString(String, 2, 127, 5, 8);