Skip to content

Default External Parameters Do Not Enforce Defaults #984

@LeStarch

Description

@LeStarch

External parameters allow default value specifications:

    external param SECTION_CONFIGS: SectionConfigs default TELEMETRY_SECTION_DEFAULTS

However, the loadParameters function generated does not supply the default value when it fails to load from the database:

    // Get parameter SECTION_CONFIGS
    param_valid = this->m_paramGetOut_OutputPort[0].invoke(
      _id,
      _buff
    );

    // If there was a deserialization issue, mark it invalid
    if (param_valid == Fw::ParamValid::VALID) {
      // Pass the local ID to the delegate
      constexpr FwPrmIdType _localId = PARAMID_SECTION_CONFIGS;

      FW_ASSERT(this->paramDelegatePtr != nullptr);
      // Call the delegate deserialize function for m_SECTION_CONFIGS
      _stat = this->paramDelegatePtr->deserializeParam(_baseId, _localId, param_valid, _buff);
      if (_stat != Fw::FW_SERIALIZE_OK) {
        param_valid = Fw::ParamValid::INVALID;
      }
    }
    else {
      param_valid = Fw::ParamValid::INVALID;  // <------- Here the database failed to load. However, no call to `deserializeParam` with a default value was supplied
    }

Since default is allowed with external it seems that the default value should be supplied to ensure that the default is set.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions