|
|
|
@ -40,12 +40,6 @@ void EFI_MegaSquirt::update()
@@ -40,12 +40,6 @@ void EFI_MegaSquirt::update()
|
|
|
|
|
if (!sitl || sitl->efi_type == SIM::EFI_TYPE_NONE) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!connected) { |
|
|
|
|
connected = sock.connect("127.0.0.1", 5763); |
|
|
|
|
} |
|
|
|
|
if (!connected) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
float rpm = sitl->state.rpm[0]; |
|
|
|
|
|
|
|
|
|
table7.rpm = rpm; |
|
|
|
@ -59,13 +53,9 @@ void EFI_MegaSquirt::update()
@@ -59,13 +53,9 @@ void EFI_MegaSquirt::update()
|
|
|
|
|
table7.ct_cF = 3940; |
|
|
|
|
table7.afr_target1 = 148; |
|
|
|
|
|
|
|
|
|
if (!sock.pollin(0)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// receive command
|
|
|
|
|
while (ofs < sizeof(r_command)) { |
|
|
|
|
if (sock.recv(&buf[ofs], 1, 0) != 1) { |
|
|
|
|
if (read_from_autopilot((char*)&buf[ofs], 1) != 1) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
switch (ofs) { |
|
|
|
@ -141,8 +131,8 @@ void EFI_MegaSquirt::send_table(void)
@@ -141,8 +131,8 @@ void EFI_MegaSquirt::send_table(void)
|
|
|
|
|
outbuf[0] = 0; |
|
|
|
|
swab(table_offset+(const uint8_t *)&table7, &outbuf[1], table_size); |
|
|
|
|
|
|
|
|
|
sock.send(&len, sizeof(len)); |
|
|
|
|
sock.send(outbuf, sizeof(outbuf)); |
|
|
|
|
write_to_autopilot((const char*)&len, sizeof(len)); |
|
|
|
|
write_to_autopilot((const char*)outbuf, sizeof(outbuf)); |
|
|
|
|
uint32_t crc = htobe32(CRC32_MS(outbuf, sizeof(outbuf))); |
|
|
|
|
sock.send((const uint8_t *)&crc, sizeof(crc)); |
|
|
|
|
write_to_autopilot((const char *)&crc, sizeof(crc)); |
|
|
|
|
} |
|
|
|
|