/* test that SBUS decoding matches SBUS encoding */ #include #include #include #include #define SBUS_RANGE_MIN 200 #define SBUS_RANGE_MAX 1800 #define SBUS_RANGE_RANGE (SBUS_RANGE_MAX - SBUS_RANGE_MIN) #define SBUS_TARGET_MIN 1000 #define SBUS_TARGET_MAX 2000 #define SBUS_TARGET_RANGE (SBUS_TARGET_MAX - SBUS_TARGET_MIN) // this is 875 #define SBUS_SCALE_OFFSET (SBUS_TARGET_MIN - ((SBUS_TARGET_RANGE * SBUS_RANGE_MIN / SBUS_RANGE_RANGE))) TEST(SBUSEncodeDecode, test_sbus_encode_decode) { const uint8_t num_channels = 8; uint16_t values_in[num_channels]; uint16_t values_out[num_channels]; uint8_t frame[25]; for (uint16_t v=875;v<2155; v++) { for (uint8_t i=0; i