APM_Mavtest.pde 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
  2. /*
  3. send all possible mavlink messages
  4. Andrew Tridgell July 2011
  5. */
  6. // AVR runtime
  7. #include <avr/io.h>
  8. #include <avr/eeprom.h>
  9. #include <avr/pgmspace.h>
  10. #include <math.h>
  11. // Libraries
  12. #include <FastSerial.h>
  13. #include <AP_Common.h>
  14. #include <GCS_MAVLink.h>
  15. #include "mavtest.h"
  16. FastSerialPort0(Serial); // FTDI/console
  17. FastSerialPort1(Serial1); // GPS port
  18. FastSerialPort3(Serial3); // Telemetry port
  19. #define SERIAL0_BAUD 115200
  20. #define SERIAL3_BAUD 115200
  21. void setup() {
  22. Serial.begin(SERIAL0_BAUD, 128, 128);
  23. Serial3.begin(SERIAL3_BAUD, 128, 128);
  24. mavlink_comm_0_port = &Serial;
  25. mavlink_comm_1_port = &Serial3;
  26. }
  27. void loop()
  28. {
  29. Serial.println("Starting MAVLink test generator\n");
  30. while (1) {
  31. mavlink_msg_heartbeat_send(
  32. MAVLINK_COMM_0,
  33. mavlink_system.type,
  34. MAV_AUTOPILOT_ARDUPILOTMEGA);
  35. mavlink_msg_heartbeat_send(
  36. MAVLINK_COMM_1,
  37. mavlink_system.type,
  38. MAV_AUTOPILOT_ARDUPILOTMEGA);
  39. mavtest_generate_outputs(MAVLINK_COMM_0);
  40. mavtest_generate_outputs(MAVLINK_COMM_1);
  41. delay(500);
  42. }
  43. }