Browse Source

BlueMark db210pro support

BlueMark Innovations BV 2 years ago
parent
commit
a54512ef6a

+ 8 - 2
RemoteIDModule/DroneCAN.cpp

@@ -46,6 +46,12 @@ static bool shouldAcceptTransfer_trampoline(const CanardInstance* ins, uint64_t*
 
 void DroneCAN::init(void)
 {
+
+#if defined(BOARD_BLUEMARK_DB210)
+    gpio_reset_pin(GPIO_NUM_19);
+    gpio_reset_pin(GPIO_NUM_20);
+#endif
+
     can_driver.init(1000000);
 
     canardInit(&canard, (uint8_t *)canard_memory_pool, sizeof(canard_memory_pool),
@@ -92,7 +98,7 @@ void DroneCAN::arm_status_send(void)
     uint8_t buffer[DRONECAN_REMOTEID_ARMSTATUS_MAX_SIZE];
     dronecan_remoteid_ArmStatus arm_status {};
 
-    const uint8_t status = parse_fail==nullptr?MAV_ODID_ARM_STATUS_GOOD_TO_ARM:MAV_ODID_ARM_STATUS_PRE_ARM_FAIL_GENERIC;
+    const uint8_t status = parse_fail==nullptr? MAV_ODID_GOOD_TO_ARM:MAV_ODID_PRE_ARM_FAIL_GENERIC;
     const char *reason = parse_fail==nullptr?"":parse_fail;
 
     arm_status.status = status;
@@ -731,7 +737,7 @@ void DroneCAN::handle_SecureCommand(CanardInstance* ins, CanardRxTransfer* trans
         reply.result = DRONECAN_REMOTEID_SECURECOMMAND_RESPONSE_RESULT_DENIED;
         goto send_reply;
     }
-    
+
     switch (req.operation) {
     case DRONECAN_REMOTEID_SECURECOMMAND_REQUEST_SECURE_COMMAND_GET_REMOTEID_SESSION_KEY: {
         make_session_key(session_key);

+ 4 - 1
RemoteIDModule/Makefile

@@ -15,7 +15,7 @@ export PATH := $(HOME)/.local/bin:$(PATH)
 
 .PHONY: headers
 
-all: headers esp32s3dev esp32c3dev bluemark-db200 bluemark-db110 jw-tbd mro-rid jwrid-esp32s3 bluemark-db202
+all: headers esp32s3dev esp32c3dev bluemark-db200 bluemark-db110 jw-tbd mro-rid jwrid-esp32s3 bluemark-db202 bluemark-db210
 
 esp32s3dev: CHIP=esp32s3
 esp32s3dev: ArduRemoteID-ESP32S3_DEV.bin
@@ -41,6 +41,9 @@ mro-rid: ArduRemoteID-MRO_RID.bin
 bluemark-db202: CHIP=esp32c3
 bluemark-db202: ArduRemoteID-BLUEMARK_DB202.bin
 
+bluemark-db210: CHIP=esp32s3
+bluemark-db210: ArduRemoteID-BLUEMARK_DB210.bin
+
 setup:
 	@echo "Installing ESP32 support"
 	$(ARDUINO_CLI) core update-index --config-file arduino-cli.yaml

+ 8 - 1
RemoteIDModule/RemoteIDModule.ino

@@ -25,6 +25,7 @@
 #include "efuse.h"
 #include "led.h"
 
+
 #if AP_DRONECAN_ENABLED
 static DroneCAN dronecan;
 #endif
@@ -49,7 +50,7 @@ static WebInterface webif;
 #include "soc/rtc_cntl_reg.h"
 
 static bool arm_check_ok = false; // goes true for LED arm check status
-static bool pfst_check_ok = false; 
+static bool pfst_check_ok = false;
 
 /*
   setup serial ports
@@ -108,6 +109,12 @@ void setup()
     digitalWrite(PIN_CAN_TERM, HIGH);
 #endif
 
+#if defined(BUZZER_PIN)
+    //set BuZZER OUTPUT ACTIVE, just to show it works
+    pinMode(GPIO_NUM_39, OUTPUT);
+    digitalWrite(GPIO_NUM_39, HIGH);
+#endif
+
     pfst_check_ok = true;   // note - this will need to be expanded to better capture PFST test status
 
     // initially set LED for fail

+ 22 - 0
RemoteIDModule/board_config.h

@@ -101,6 +101,28 @@
 // LED off when ready to arm
 #define STATUS_LED_OK 0
 
+#elif defined(BOARD_BLUEMARK_DB210)
+#define BOARD_ID 10
+#define PIN_CAN_TX GPIO_NUM_19
+#define PIN_CAN_RX GPIO_NUM_20
+
+#define PIN_UART_TX 7
+#define PIN_UART_RX 6
+//#define PIN_UART_CTS 15 //not used, perhaps useful if TELEM 1 is used for different purpose
+//#define PIN_UART_RTS 16 //not used, perhaps useful if TELEM 1 is used for different purpose
+
+//#define PIN_UART_TX_2 2 //TELEM 2
+//#define PIN_UART_RX_2 1 //TELEM 2
+//#define PIN_UART_CTS_2 5 //TELEM 2, not used, perhaps useful if TELEM is used for different purpose
+//#define PIN_UART_RTS_2 4 //TELEM 2, not used, perhaps useful if TELEM is used for different purpose
+
+#define BUZZER_PIN GPIO_NUM_39 //at the moment easiest is to have active buzzer support. (Buzzer on if GPIO is high)
+
+#define WS2812_LED_PIN GPIO_NUM_8 //there are two WS2812 LEDs on this GPIO
+
+#define CAN_APP_NODE_NAME "BlueMark DB210PRO"
+//#define PIN_CAN_TERM GPIO_NUM_42 // if set to ON, the termination resistors of the CAN bus are enabled
+
 #else
 #error "unsupported board"
 #endif

+ 2 - 0
RemoteIDModule/led.cpp

@@ -48,10 +48,12 @@ void Led::update(void)
     switch (state) {
     case LedState::ARM_OK:
         ledStrip.setPixelColor(0, ledStrip.Color(0, 255, 0));
+        ledStrip.setPixelColor(0, ledStrip.Color(1, 255, 0)); //for db210pro, set the second LED to have the same output (for now)
         break;
 
     default:
         ledStrip.setPixelColor(0, ledStrip.Color(255, 0, 0));
+        ledStrip.setPixelColor(1, ledStrip.Color(255, 0, 0)); //for db210pro, set the second LED to have the same output (for now)
         break;
     }
     if (now_ms - last_led_strip_ms >= 200) {

+ 1 - 1
RemoteIDModule/led.h

@@ -29,7 +29,7 @@ private:
 
 #ifdef WS2812_LED_PIN
     uint32_t last_led_strip_ms;
-    Adafruit_NeoPixel ledStrip{1, WS2812_LED_PIN, NEO_GRB + NEO_KHZ800};
+    Adafruit_NeoPixel ledStrip{2, WS2812_LED_PIN, NEO_GRB + NEO_KHZ800}; //the BlueMark db210pro boards has two LEDs, therefore we need to use 2.
 #endif
 };
 

+ 1 - 1
RemoteIDModule/mavlink.cpp

@@ -273,7 +273,7 @@ void MAVLinkSerial::process_packet(mavlink_status_t &status, mavlink_message_t &
 
 void MAVLinkSerial::arm_status_send(void)
 {
-    const uint8_t status = parse_fail==nullptr?MAV_ODID_ARM_STATUS_GOOD_TO_ARM:MAV_ODID_ARM_STATUS_PRE_ARM_FAIL_GENERIC;
+    const uint8_t status = parse_fail==nullptr?MAV_ODID_GOOD_TO_ARM:MAV_ODID_PRE_ARM_FAIL_GENERIC;
     const char *reason = parse_fail==nullptr?"":parse_fail;
     mavlink_msg_open_drone_id_arm_status_send(
         chan,

+ 1 - 1
RemoteIDModule/parameters.cpp

@@ -318,7 +318,7 @@ void Parameters::init(void)
         // setup public keys
         set_by_name_char64("PUBLIC_KEY1", ROMFS::find_string("public_keys/ArduPilot_public_key1.dat"));
         set_by_name_char64("PUBLIC_KEY2", ROMFS::find_string("public_keys/ArduPilot_public_key2.dat"));
-#if defined(BOARD_BLUEMARK_DB200) || defined(BOARD_BLUEMARK_DB110) || defined(BOARD_BLUEMARK_DB202)
+#if defined(BOARD_BLUEMARK_DB200) || defined(BOARD_BLUEMARK_DB110) || defined(BOARD_BLUEMARK_DB202) || defined(BOARD_BLUEMARK_DB210)
         set_by_name_char64("PUBLIC_KEY3", ROMFS::find_string("public_keys/BlueMark_public_key1.dat"));
 #else
         set_by_name_char64("PUBLIC_KEY3", ROMFS::find_string("public_keys/ArduPilot_public_key3.dat"));

+ 4 - 4
RemoteIDModule/transport.cpp

@@ -37,11 +37,11 @@ uint8_t Transport::arm_status_check(const char *&reason)
     const uint32_t max_age_other_ms = 22000;
     const uint32_t now_ms = millis();
 
-    uint8_t status = MAV_ODID_ARM_STATUS_PRE_ARM_FAIL_GENERIC;
+    uint8_t status = MAV_ODID_PRE_ARM_FAIL_GENERIC;
 
     //return status OK if we have enabled the force arm option
     if (g.options & OPTIONS_FORCE_ARM_OK) {
-        status = MAV_ODID_ARM_STATUS_GOOD_TO_ARM;
+        status = MAV_ODID_GOOD_TO_ARM;
         return status;
     }
 
@@ -62,7 +62,7 @@ uint8_t Transport::arm_status_check(const char *&reason)
     } else if (system.operator_latitude == 0 && system.operator_longitude == 0) {
         reason = "Bad operator location";
     } else if (reason == nullptr) {
-        status = MAV_ODID_ARM_STATUS_GOOD_TO_ARM;
+        status = MAV_ODID_GOOD_TO_ARM;
     }
 
     return status;
@@ -101,7 +101,7 @@ bool Transport::check_signature(uint8_t sig_length, uint8_t data_len, uint32_t s
         // monocypher signatures are 64 bytes
         return false;
     }
-    
+
     /*
       loop over all public keys, if one matches then we are OK
      */

+ 6 - 0
RemoteIDModule/web/js/tools.js

@@ -55,6 +55,12 @@ function page_fill_json_html(json) {
                     document.getElementById("STATUS:BOARD").innerText = "BlueMark db110";
                     document.getElementById("documentation").innerHTML = "<ul><li><a href='https://download.bluemark.io/db110.pdf'>db110 manual</a></li><li><a href='https://ardupilot.org/ardupilot/index.html'>ArduPilot Project</a></li><li><a href='https://github.com/ArduPilot/ArduRemoteID'>ArduRemoteID Project</a></li><li><a href='https://ardupilot.org/plane/docs/common-remoteid.html'>ArduPilot RemoteID Documentation</a></li><li><a href='https://www.opendroneid.org/'>OpenDroneID Website</a></li></ul>";
                     document.body.style.background = "#fafafa";
+                } else if (json[v] == "10") {
+                    document.getElementById("logo").src="images/bluemark.png";
+                    document.getElementById("logo").alt="BlueMark";
+                    document.getElementById("STATUS:BOARD").innerText = "BlueMark db210pro";
+                    document.getElementById("documentation").innerHTML = "<ul><li><a href='https://download.bluemark.io/db200.pdf'>db210pro manual</a></li><li><a href='https://ardupilot.org/ardupilot/index.html'>ArduPilot Project</a></li><li><a href='https://github.com/ArduPilot/ArduRemoteID'>ArduRemoteID Project</a></li><li><a href='https://ardupilot.org/plane/docs/common-remoteid.html'>ArduPilot RemoteID Documentation</a></li><li><a href='https://www.opendroneid.org/'>OpenDroneID Website</a></li></ul>";
+                    document.body.style.background = "#fafafa";
                 } else {
                     document.getElementById("logo").src="images/logo.jpg";
                     document.getElementById("logo").alt="ArduPilot";