Просмотр исходного кода

Merge pull request #4 from davidbuzz/pr-fix-undefined-vars-and-document-build-under-linux

Pr fix undefined vars and document build under linux
Andrew Tridgell 3 лет назад
Родитель
Сommit
48644ec992
4 измененных файлов с 61 добавлено и 5 удалено
  1. 53 0
      README.md
  2. 6 1
      RemoteIDModule/DroneCAN.cpp
  3. 2 2
      RemoteIDModule/RemoteIDModule.ino
  4. 0 2
      RemoteIDModule/mavlink.cpp

+ 53 - 0
README.md

@@ -51,6 +51,59 @@ the following options:
 
 ![Flashing with FlashTool](images/FlashTool.jpg "Flashing")
 
+
+## Building from Sources under linux:
+
+get prerequisites:
+sudo apt install arduino
+pip install pymavlink
+
+get code:
+cd ~
+git clone https://github.com/ardupilot/arduremoteid
+cd arduremoteid/
+git submodule init
+git submodule update --recursive
+./scripts/regen_headers.sh 
+./add_libraries.sh
+
+Open the 'arduino' software in your linux desktop:
+arduino
+
+http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://dl.espressif.com/dl/package_esp32_index.json,https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
+
+Arduino IDE -> File Menu -> Preferences -> "Additional Board Manager URLs:" cut-n-paste: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
+tip:[if you have url/s already isted, you can add it to the end of them with a comma, and then the url.]
+Arduino IDE -> File Menu -> Preferences -> Ensure 'Sketchbook location:' is set to : /home/xxxx/Arduino for your current user, it defaults to this, but check it.
+Arduino IDE -> Tools Menu -> Board -> Boards Manager -> [search for 'esp32'] ->Select Version [drop-down]-> 2.0.4 -> Install   [2.0.3 or newer should work]
+Arduino IDE -> Tools Menu -> Board -> "ESP32 Arduino" ->"ESP32S3 Dev Module" [choose it]-   - MUST select the option with 'S3' in in here.
+
+Open 'sketch - ie 'RemoteIDModule.ino 'from this repo:
+Arduino IDE -> File Menu -> Open ... [navigate to ~/arduremoteid/RemoteIDModule/ folder and open it] ...
+
+Plugin your ep32-s3 with usb cable using the port labeled "USB" on the pcb - this is for FLASHING it.
+
+Arduino IDE -> Tools Menu -> Port:... -> /dev/ttyACM0
+Press 'Upload' '"arrow" in IDE green bar.
+If board does not flash, hold-down BOOT pushbutton on pcb while pressing RESET pushbutton briefly [to force it into bootloader mode] and retry.
+done, ESP32-S3 is now running and emitting test/demo remote-id bluetooth
+
+Optional:
+Plugin your ep32-s3 with ANOTHER usb cable using the port labeled "UART" on the pcb - this is where mavlink and debug is coming/going, and you can connect to this with mavproxy, etc.
+Optional:
+Plugin your ep32-s3 into a flight-controller UART using pins RX(17)/TX(18)/GND on the pcb - this listens for mavlink from an autopilot, and expects to find REMOTE_ID* packets in the mavlink stream, and it broadcast/s this information from the drone as bluetooth/wifi on 2.4ghz in a manner that can be received by Android mobile phone App [https://play.google.com/store/apps/details?id=org.opendroneid.android_osm] and hopefully other open-drone-id compliant receivers.
+
+Optional:
+Plugin your ep32-s3 into a flight-controller CAN port by wiring a standard CAN Tranciever (such as VP231 or similar) to pins 47(tx),38(rx),GND on the pcb.
+
+Setup/Configuration of ArduPilot/Mavlink/CAN to communicate together is not documented here, please go to ArduPilot wiki for more, eg: https://ardupilot.org/copter/docs/common-remoteid.html
+
+## If youd just like to experiment with an esp32-s3 and don't have a drone to attach to it, you can flash an an alternative firmware here, which will give u a fake drone:
+
+Open the test 'remote-id' example from id_open eg:
+Arduino IDE -> File Menu -> Examples ->[scroll] Examples from Custom Libraries -> id_open -> random_flight
+... and then flash it to your ESP32-S3 like the above instructions.  It does not support mavlink or CAN etc, but it will start emitting drone and location info immediately and simply.
+
 ## ArduPilot Support
 
 Support for OpenDroneID is in ArduPilot master and is pending for

+ 6 - 1
RemoteIDModule/DroneCAN.cpp

@@ -22,6 +22,9 @@
 #define CAN_APP_NODE_NAME "ArduPilot RemoteIDModule"
 #define CAN_DEFAULT_NODE_ID 0 // use DNA
 
+#define UNUSED(x) (void)(x)
+
+
 // constructor
 DroneCAN::DroneCAN()
 {}
@@ -265,6 +268,8 @@ void DroneCAN::processRx(void)
                       rxmsg.data[4], rxmsg.data[5], rxmsg.data[6], rxmsg.data[7],
                       rx_frame.data_len,
                       err);
+#else
+        UNUSED(err);                      
 #endif
     }
 }
@@ -423,7 +428,7 @@ bool DroneCAN::do_DNA(void)
     last_DNA_start_ms = now;
 
     uint8_t node_id_allocation_transfer_id = 0;
-
+    UNUSED(node_id_allocation_transfer_id);
     send_next_node_id_allocation_request_at_ms =
         now + UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_ALLOCATION_MIN_REQUEST_PERIOD_MS +
         random(1, UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_ALLOCATION_MAX_FOLLOWUP_DELAY_MS);

+ 2 - 2
RemoteIDModule/RemoteIDModule.ino

@@ -150,7 +150,7 @@ void loop()
 
     if (mavlink.location_valid()) {
         const auto &location = mavlink.get_location();
-        const auto &operator_id = mavlink.get_operator_id();
+        //const auto &operator_id = mavlink.get_operator_id();
         const auto &system = mavlink.get_system();
 
         utm_data.heading     = location.direction * 0.01;
@@ -179,7 +179,7 @@ void loop()
 
     if (dronecan.location_valid()) {
         const auto &location = dronecan.get_location();
-        const auto &operator_id = dronecan.get_operator_id();
+        //const auto &operator_id = dronecan.get_operator_id();
         const auto &system = dronecan.get_system();
 
         utm_data.heading     = location.direction * 0.01;

+ 0 - 2
RemoteIDModule/mavlink.cpp

@@ -69,8 +69,6 @@ void MAVLinkSerial::update_receive(void)
     // receive new packets
     mavlink_message_t msg;
     mavlink_status_t status;
-    uint32_t now_ms = millis();
-
     status.packet_rx_drop_count = 0;
 
     const uint16_t nbytes = serial.available();