KryoFlux - New Interrupt Encoding System


Implemented new communication code that works and seems to pass integrity checks on the host side, but not the internal sanity checks done by the firmware. This is probably down to synchronisation issues.

In order to have a guaranteed working version, more synchronisation would be needed to guard the ring buffer content, but that would be very expensive in terms of execution time.

We came up with loads of variations on how to do it, until finally we ended up with a completely new way of encoding where the number of instructions is now less for the interrupt. The interrupt servicing each sampled flux reversal is the most expensive part of the entire process and instruction count should be as low as possible.

Previously, with some missing synchronisation, the reading and encoding of one flux change interval was 26 instructions (on this CPU running in SRAM that corresponds to 26 cycles), now it is always 24 cycles or 30 when the buffer wraps around - but the data is completely synced and guarded. Now we need to rewrite the code sending data for the new encoding system.