Skip to content

DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX1 invalid timestamp in callback #224

@Ellislee1

Description

@Ellislee1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions