public static async Task Aggregator(
            FPGA.InputSignal <bool> RXD,
            FPGA.OutputSignal <bool> TXD
            )
        {
            Sequential handler = () =>
            {
                FPU.FPUScopeNoSync();

                while (true)
                {
                    FPGA.Optimizations.AddOptimizer <DefaultOptimizer>();

                    const uint baud = 115200;
                    UART.ReadFloat(baud, RXD, out float mass);
                    UART.ReadFloat(baud, RXD, out float innerRadius);
                    UART.ReadFloat(baud, RXD, out float outerRadius);

                    var deltaV = FPGAOrbitalCalc.DeltaVOuterOrbit(mass, innerRadius, outerRadius);

                    UART.WriteFloat(baud, deltaV, TXD);
                }
            };

            FPGA.Config.OnStartup(handler);
        }
        public void Quokka_DeltaVOuterOrbit()
        {
            using (var port = new QuokkaPort())
            {
                var r0 = 6371e+3f;

                // http://www.satsig.net/orbit-research/delta-v-geo-injection-calculator.htm
                var cases = new[]
                {
                    // low orbit
                    new
                    {
                        R1 = r0 + 176e+3f,
                        R2 = r0 + 350e+3f,
                        M  = 5.972e+24f,
                        DV = 50.58f
                    },
                    // to ISS
                    new
                    {
                        R1 = r0 + 100e+3f,
                        R2 = r0 + 410e+3f,
                        M  = 5.972e+24f,
                        DV = 90.06f
                    },
                    // low orbit to GSO
                    new
                    {
                        R1 = r0 + 200e+3f,
                        R2 = r0 + 35786e+3f,
                        M  = 5.972e+24f,
                        DV = 1477.27f
                    },
                };

                foreach (var testCase in cases)
                {
                    float calculated = FPGAOrbitalCalc.DeltaVOuterOrbit(testCase.M, testCase.R1, testCase.R2);

                    var err = Math.Abs((calculated - testCase.DV) / testCase.DV);
                    Assert.IsTrue(err < 0.01);

                    port.WriteFloat(testCase.M);
                    port.WriteFloat(testCase.R1);
                    port.WriteFloat(testCase.R2);

                    var actualBytes = port.Read(4, true, port.DefaultTimeout);
                    var actual      = TestConverters.FloatFromByteArray(actualBytes);

                    Assert.AreEqual(calculated, actual, $"Failed for {testCase}");
                }
            }
        }