|
|
@@ -228,6 +228,11 @@ FlightSimClass::FlightSimClass() |
|
|
|
void FlightSimClass::update(void) |
|
|
|
{ |
|
|
|
uint8_t len, maxlen, type, *p, *end; |
|
|
|
union { |
|
|
|
uint8_t b[4]; |
|
|
|
long l; |
|
|
|
float f; |
|
|
|
} data; |
|
|
|
usb_packet_t *rx_packet; |
|
|
|
uint16_t id; |
|
|
|
|
|
|
@@ -249,11 +254,27 @@ void FlightSimClass::update(void) |
|
|
|
if (type == 1) { |
|
|
|
FlightSimInteger *item = FlightSimInteger::find(id); |
|
|
|
if (!item) break; |
|
|
|
item->update(*(long *)(p + 6)); |
|
|
|
#ifdef KINETISK |
|
|
|
data.l = *(long *)(p + 6); |
|
|
|
#else |
|
|
|
data.b[0] = p[6]; |
|
|
|
data.b[1] = p[7]; |
|
|
|
data.b[2] = p[8]; |
|
|
|
data.b[3] = p[9]; |
|
|
|
#endif |
|
|
|
item->update(data.l); |
|
|
|
} else if (type == 2) { |
|
|
|
FlightSimFloat *item = FlightSimFloat::find(id); |
|
|
|
if (!item) break; |
|
|
|
item->update(*(float *)(p + 6)); |
|
|
|
#ifdef KINETISK |
|
|
|
data.f = *(float *)(p + 6); |
|
|
|
#else |
|
|
|
data.b[0] = p[6]; |
|
|
|
data.b[1] = p[7]; |
|
|
|
data.b[2] = p[8]; |
|
|
|
data.b[3] = p[9]; |
|
|
|
#endif |
|
|
|
item->update(data.f); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 0x03: // enable/disable |