Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX1 invalid timestamp in callback #224

Open
Ellislee1 opened this issue Nov 29, 2024 · 5 comments

Comments

@Ellislee1
Copy link

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.

@dji-dev
Copy link
Contributor

dji-dev commented Dec 3, 2024

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?

°°°

@Ellislee1
Copy link
Author

We are using the latest for both

@dji-dev
Copy link
Contributor

dji-dev commented Dec 4, 2024

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

°°°

@Ellislee1
Copy link
Author

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

@dji-dev
Copy link
Contributor

dji-dev commented Dec 5, 2024

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.

°°°

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants