Skip to content

Unified init() method #335

@runger1101001

Description

@runger1101001

Unify the init method. Create a clear paradigm:

  1. user declares objects for use by the code, with their static initialisation data, like the BLDCDriver with its pins
  2. user initialises parameters in the setup method. Parameters can be initialised in any order.
    Note: part of the parameters that get set are the sensor, current-sense, driver and other objects "linked" to the motor. Why treat them differently?
  3. user calls motor.init(). The motor init method also initialises any uninitialised linked objects like driver, sensor, etc.
  4. the motor init method checks parametrisation and inits the system accordingly.
  5. the motor init method performs calibration if needed (e.g. if closed loop mode is selected and electric zero is not set)

This will simply the API for users, who can currently do a lot of things wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIv2.5Features/Changes for near term API changeenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions