Payload-SDK icon indicating copy to clipboard operation
Payload-SDK copied to clipboard

DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX1 invalid timestamp in callback

Open Ellislee1 opened this issue 1 year ago • 5 comments

We have found a bug with setting up a callback for the topic DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX1 When testing the callback function time->milliseconds always returns a constant value after armed (same a microseconds) where as the other callbacks increase correctly.

For reference this is the callback function:

T_DjiReturnCode FCSubscription::Battery_Callback(
    const uint8_t* data, uint16_t dataSize,
    const T_DjiDataTimestamp* timestamp) {
  const auto* batteryData = reinterpret_cast<const T_DjiFcSubscriptionSingleBatteryInfo*>(data);

  std::cout << "ESC Timestamp: " << timestamp->millisecond << ", "<< timestamp->microsecond << std::endl;

  return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}

And this is how we are creating the callback:

  USER_LOG_INFO("Initializing subscription DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX1...");
  returnCode = DjiFcSubscription_SubscribeTopic(
      DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX1,
      DJI_DATA_SUBSCRIPTION_TOPIC_5_HZ, FCSubscription::Battery_Callback);

  if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
    USER_LOG_ERROR("subscription battery module error. %d", returnCode);
    throw std::runtime_error("subscription battery module error.");
  } else {
    USER_LOG_INFO("subscription battery module OK");
  }

  return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;

We believe this is a bug with the PSDK and not our code.

Ellislee1 avatar Nov 29 '24 16:11 Ellislee1

Agent comment from Leon in Zendesk ticket #123224:

Hello, thank you for your feedback. May I ask what version of drone firmware and PSDK you are using?

°°°

dji-dev avatar Dec 03 '24 10:12 dji-dev

We are using the latest for both

Ellislee1 avatar Dec 03 '24 12:12 Ellislee1

Agent comment from Leon in Zendesk ticket #123224:

Hello, thank you for your feedback. Are you referring to this? (Attachment). We are using the M350 model.
image.png

°°°

dji-dev avatar Dec 04 '24 08:12 dji-dev

I can't see the image. But we are using the M3D.

Ellislee1 avatar Dec 04 '24 16:12 Ellislee1

Agent comment from Leon in Zendesk ticket #123224:

Hello, thank you for the additional information. Our phenomenon is that our "timestamp" has been fixed to a certain value and it will not be updated.

°°°

dji-dev avatar Dec 05 '24 09:12 dji-dev