diff --git a/app/aircopy.c b/app/aircopy.c index 3d88b095..674ed0dc 100644 --- a/app/aircopy.c +++ b/app/aircopy.c @@ -27,6 +27,8 @@ #include "ui/inputbox.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}; aircopy_state_t g_aircopy_state; @@ -47,9 +49,9 @@ void AIRCOPY_SendMessage(void) for (i = 0; i < 34; i++) g_fsk_buffer[i + 1] ^= Obfuscation[i % 8]; - if (++g_air_copy_block_number >= 0x78) + if (++g_air_copy_block_number >= AIR_COPY_MAX_BLOCK) { - g_aircopy_state = AIRCOPY_COMPLETE; + g_aircopy_state = AIRCOPY_TX_COMPLETE; g_update_display = true; } @@ -104,12 +106,11 @@ void AIRCOPY_StorePacket(void) if (Offset == 0x1E00) { - g_aircopy_state = AIRCOPY_COMPLETE; + g_aircopy_state = AIRCOPY_RX_COMPLETE; g_update_display = true; } g_air_copy_block_number++; - return; } } diff --git a/app/aircopy.h b/app/aircopy.h index c255382b..db480112 100644 --- a/app/aircopy.h +++ b/app/aircopy.h @@ -26,7 +26,8 @@ enum aircopy_state_e AIRCOPY_READY = 0, AIRCOPY_RX, AIRCOPY_TX, - AIRCOPY_COMPLETE + AIRCOPY_RX_COMPLETE, + AIRCOPY_TX_COMPLETE }; typedef enum aircopy_state_e aircopy_state_t; diff --git a/firmware.bin b/firmware.bin index fb330867..db36829c 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 3d1e3bdd..e241d753 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/ui/aircopy.c b/ui/aircopy.c index 39f0986a..dd36646a 100644 --- a/ui/aircopy.c +++ b/ui/aircopy.c @@ -34,11 +34,12 @@ void UI_DisplayAircopy(void) strcpy(String, "AIR COPY"); switch (g_aircopy_state) { - case AIRCOPY_READY: strcat(String, " READY"); break; - case AIRCOPY_RX: strcat(String, " RX"); break; - case AIRCOPY_TX: strcat(String, " TX"); break; - case AIRCOPY_COMPLETE: strcat(String, " DONE"); break; - default: strcat(String, " ???"); break; + case AIRCOPY_READY: strcat(String, " READY"); break; + case AIRCOPY_RX: strcat(String, " RX"); break; + case AIRCOPY_TX: strcat(String, " TX"); break; + case AIRCOPY_RX_COMPLETE: strcat(String, " DONE"); break; + case AIRCOPY_TX_COMPLETE: strcat(String, " DONE"); break; + default: strcat(String, " ???"); break; } UI_PrintString(String, 2, 127, 0, 8); @@ -51,23 +52,26 @@ void UI_DisplayAircopy(void) else UI_DisplayFrequency(g_input_box, 16, 2, 1, 0); - memset(String, 0, sizeof(String)); - if (g_aircopy_state == AIRCOPY_RX) - sprintf(String, "RCV %u E %u", g_air_copy_block_number, g_errors_during_air_copy); - else - if (g_aircopy_state == AIRCOPY_TX) - sprintf(String, "SND %u", g_air_copy_block_number); - UI_PrintString(String, 2, 127, 4, 8); - switch (g_aircopy_state) { - case AIRCOPY_READY: strcpy(String, "EXIT rx M tx"); break; - case AIRCOPY_RX: strcpy(String, "receive mode"); break; - case AIRCOPY_TX: strcpy(String, "transmit mode"); break; - case AIRCOPY_COMPLETE: strcpy(String, "finished"); break; - default: strcpy(String, "???"); break; + case AIRCOPY_READY: + UI_PrintString("EXIT rx M tx", 0, 127, 5, 7); + break; + case AIRCOPY_RX: + case AIRCOPY_RX_COMPLETE: + sprintf(String, "RCV %u E %u", g_air_copy_block_number, g_errors_during_air_copy); + UI_PrintString(String, 0, 127, 5, 8); + break; + 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; } - UI_PrintStringSmall(String, 0, 127, 6); ST7565_BlitFullScreen(); }