diff --git a/app/aircopy.c b/app/aircopy.c index 674ed0dc..894956dd 100644 --- a/app/aircopy.c +++ b/app/aircopy.c @@ -27,14 +27,13 @@ #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; -uint16_t g_air_copy_block_number; -uint16_t g_errors_during_air_copy; -uint16_t g_fsk_buffer[36]; +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; +uint16_t g_fsk_buffer[36]; void AIRCOPY_SendMessage(void) { @@ -49,7 +48,7 @@ void AIRCOPY_SendMessage(void) for (i = 0; i < 34; i++) 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_update_display = true; diff --git a/app/aircopy.h b/app/aircopy.h index db480112..57d4a0cc 100644 --- a/app/aircopy.h +++ b/app/aircopy.h @@ -31,10 +31,11 @@ enum aircopy_state_e }; typedef enum aircopy_state_e aircopy_state_t; -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 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 uint16_t g_fsk_buffer[36]; void AIRCOPY_SendMessage(void); void AIRCOPY_StorePacket(void); diff --git a/firmware.bin b/firmware.bin index db36829c..eb903530 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index e241d753..bb737f14 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/ui/aircopy.c b/ui/aircopy.c index dd36646a..6e72bc25 100644 --- a/ui/aircopy.c +++ b/ui/aircopy.c @@ -31,7 +31,10 @@ void UI_DisplayAircopy(void) memset(g_frame_buffer, 0, sizeof(g_frame_buffer)); + // ********************************** + strcpy(String, "AIR COPY"); + switch (g_aircopy_state) { case AIRCOPY_READY: strcat(String, " READY"); break; @@ -41,7 +44,9 @@ void UI_DisplayAircopy(void) case AIRCOPY_TX_COMPLETE: strcat(String, " DONE"); 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) { @@ -52,26 +57,49 @@ void UI_DisplayAircopy(void) else UI_DisplayFrequency(g_input_box, 16, 2, 1, 0); + // ********************************** + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" + switch (g_aircopy_state) { 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; - 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); + if (g_errors_during_air_copy == 0) + { + UI_PrintString("RX COMPLETE", 0, LCD_WIDTH - 1, 5, 8); + 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: + case AIRCOPY_TX_COMPLETE: - sprintf(String, "SND %u", g_air_copy_block_number); - UI_PrintString(String, 0, 127, 5, 8); + 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, 127, 5, 8); + UI_PrintString(String, 0, LCD_WIDTH - 1, 5, 7); break; } + #pragma GCC diagnostic pop + + // ********************************** + ST7565_BlitFullScreen(); }