You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The QMI Pololu Maestro device driver is now supporting the use of the device in Dual USB or Daisy Chain modes. These are not the default modes, but an UART mode is the default of the device. So, to use the driver, the manufacturer-provided GUI needs to be used first to change the mode.
First of all, this should be mentioned in our driver. The documentation should be edited to instruct the mode change for new devices. Secondly, we could enable the UART mode as well by selectively importing a separate class for UART control, or to make the driver smart enough to recognize or figure out which mode the device is on.
The original driver that was developed for Diamondos was based largely on the example of Maestro package's maestro.py. The umaestro.py is the UART version and looks very similar in function to the maestro.py.
Describe the solution you'd like
The UART control is rather similar to the serial-to-USB control through COM ports. We could create a special transport string that recognizes if we want to use the UART mode or not. Something like
iftransport.upper().startswith("UART"):
self._transport=busio.UART(board.TX, board.RX, baudrate) # Possibly extract 'baudrate' from the transport stringelse: ... # The current self._transport line
From the first look the existing _write and _ask functions could be used for both control ways without any or little modification. Probably the stumbling point here is the self._transport.discard_read() which does not exist in the busio.UART API. But we could extend the UART class in the driver to have this call OR use the reset_input_buffer with a little detour.
The board and busio modules, needed for this driver, should be "lazy imports" as we don't want more dependencies. They are part of a larger package, https://pypi.org/project/Adafruit-Blinka/.
Describe alternatives you've considered
Without digging deeper into the code, the assumption is that the rest of the driver API can stay the same. But if not, we can then make a base class Pololu_Maestro(QMI_Instrument) and derive the mode-specific classes from it Pololu_MaestroUsb(Pololu_Maestro) and Pololu_MaestroUart(Pololu_Maestro) and create in base class a selection method to which class to use when initialized. Specific selection of the child class should in that case also be allowed.
Acceptance criteria
The driver works also for the default UART mode, and only thing needed for that would be a modification of the transport string to start with "uart:" instead of "serial:".
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The QMI Pololu Maestro device driver is now supporting the use of the device in Dual USB or Daisy Chain modes. These are not the default modes, but an UART mode is the default of the device. So, to use the driver, the manufacturer-provided GUI needs to be used first to change the mode.
First of all, this should be mentioned in our driver. The documentation should be edited to instruct the mode change for new devices. Secondly, we could enable the UART mode as well by selectively importing a separate class for UART control, or to make the driver smart enough to recognize or figure out which mode the device is on.
The original driver that was developed for Diamondos was based largely on the example of Maestro package's
maestro.py
. Theumaestro.py
is the UART version and looks very similar in function to themaestro.py
.Describe the solution you'd like
The UART control is rather similar to the serial-to-USB control through COM ports. We could create a special transport string that recognizes if we want to use the UART mode or not. Something like
From the first look the existing
_write
and_ask
functions could be used for both control ways without any or little modification. Probably the stumbling point here is theself._transport.discard_read()
which does not exist in thebusio.UART
API. But we could extend the UART class in the driver to have this call OR use the reset_input_buffer with a little detour.The
board
andbusio
modules, needed for this driver, should be "lazy imports" as we don't want more dependencies. They are part of a larger package, https://pypi.org/project/Adafruit-Blinka/.Describe alternatives you've considered
Without digging deeper into the code, the assumption is that the rest of the driver API can stay the same. But if not, we can then make a base class
Pololu_Maestro(QMI_Instrument)
and derive the mode-specific classes from itPololu_MaestroUsb(Pololu_Maestro)
andPololu_MaestroUart(Pololu_Maestro)
and create in base class a selection method to which class to use when initialized. Specific selection of the child class should in that case also be allowed.Acceptance criteria
The driver works also for the default UART mode, and only thing needed for that would be a modification of the transport string to start with "uart:" instead of "serial:".
Additional context
N/A
The text was updated successfully, but these errors were encountered: