Skip to content

Commit

Permalink
aircopy update
Browse files Browse the repository at this point in the history
  • Loading branch information
OneOfEleven authored and OneOfEleven committed Oct 12, 2023
1 parent e05e17f commit 0b606e6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
9 changes: 5 additions & 4 deletions app/aircopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/aircopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Binary file modified firmware.bin
Binary file not shown.
Binary file modified firmware.packed.bin
Binary file not shown.
42 changes: 23 additions & 19 deletions ui/aircopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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();
}

0 comments on commit 0b606e6

Please sign in to comment.