-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Hi
Great library, thank you for all your work.
A few ways to save more memory - I saved 562 bytes of flash and 530 bytes of flash with these changes through suggestions made to me:
Moved the tables from jt65_merge_sync_vector, jt9_merge_sync_vector, jt4_merge_sync_vector and wspr_sync_vector all to PROGMEM and read back via pgm_read_byte(wspr_sync_vector +i) etc.
In ft8_merge_sync_vector moved costas7x7 and graymap to PROGMEM. Then memcpy_P and pgm_read_byte(&graymap[idx]) to read them back:
`void JTEncode::ft8_merge_sync_vector(uint8_t* symbols, uint8_t* output)
{
static const uint8_t PROGMEM costas7x7[7] = {3, 1, 4, 0, 6, 5, 2};
static const uint8_t PROGMEM graymap[8] = {0, 1, 3, 2, 5, 6, 4, 7};
uint8_t i, j, k, idx;
// Insert Costas sync arrays
memcpy_P(output, costas7x7, 7);
memcpy_P(output + 36, costas7x7, 7);
memcpy_P(output + FT8_SYMBOL_COUNT - 7, costas7x7, 7);
k = 6;
for(j = 0; j < 58; ++j) // 58 data symbols
{
i = 3 * j;
++k;
if(j == 29)
{
k += 7;
}
idx = symbols[i] * 4 + symbols[i + 1] * 2 + symbols[i + 2];
output[k] = pgm_read_byte(&graymap[idx]);
}
}`
If you would rather a pull request I can do that.
Thanks very much
Kevin