Productive day of coding

Yesterday I decided to begin work on coding the actual software libraries that will be used for the R/C Receiver Adapter add-on. And though I put a lot of time and effort into the work, I can sum it up fairly quickly.

Currently implemented features include:

  • The basic command structure (which I'll outline below)
  • Reading of R/C channel data from a Spektrum Satellite receiver, as well as sensing of connection status (whether the signal is lost or available)
  • Servo implementation and control on any of the 6 servo outputs, with 1024 step accuracy

Features that I'm working on implementing:

  • Better interrupt driven servo control over I2C

Though it may not sound like much, getting the Tilty control boards and the add-on communicating over I2C was the difficult and most important part of getting any of the microcontroller enabled add-on boards working. And now that it has been implemented on one add-on, it is easily copied over to the others.

But as to the command structure used by the add-on, I've optimized it to minimize the time the Tilty controller and add-on must spend talking. For example: writing a 10-bit servo value uses only two bytes of data sent over I2C, which takes less than 1/10000th of a second.

The basic outliine of the R/C Adapter add-on's command structure. It is not yet finalized as the implementation process is ongoing, so features may be added/removed/changed in the final version.

The basic structure of a command (which is assembled by the software library, to simplify writing code for the add-on) uses the first two bits of the first byte to specify whether the following data is to indicate a read (such as a R/C channel value), write (such as to an attached servo), or command operation (such as binding a Satellite receiver).

For a read/write operation, the next four bits indicate the R/C channel or servo to read or write. If it's a read command, then the add-on populates it's output buffer with the requested data, which is sent to the Tilty when data is requested. This makes it so that any servo or R/C channel can be read with just three bytes of data (one sent to select channel, and two received with the channel value). If the bits indicate a write operation, the 10 bits after the channel/servo selection bits are written to the selected servo (R/C channels cannot be written to). But this command structure allows controlling a servo, with a 1024 step degree of precision (which is honestly more than the servo itself is likely to achieve), with only two bytes of data.

Command operations will eventually allow operations such as changing the add-on boards I2C address, binding Satellite receivers, and linking servos and R/C channels so they're updated automatically. basically, command operations will encompass everything not covered by read or write commands (which are purely input and output based), but will primarily instead change how the add-on board behaves.