Glassmark Developer Guide

Wired Mode

The Glassmark I lens encoder can be operated in a wired mode. This enables developers to access encoder values and use the device with their own systems.

Wired communication is done through the USB port on the encoder. The encoder will enumerate as a USB CDC communication device. The serial settings are as follows:

Baud Rate: 115200 Data Bits: 8 Parity Bits: 0 Stop Bits: 1

Enabling Wired Mode

In order to activate wired mode, the boot sequence must be interrupted. Once connected, the encoder will send a serial packet with the following string:

"######"

Once the encoder sends this packet, the host device will have a window of two seconds to interrupt the boot. Any serial data received in this two second window will enable wired mode.

Wired Mode Commands

Once in wired mode, the following commands may be used:

$g : Gets device current status. The device will respond with a JSON string of the following format

{"cam":"\"A\"","num":"\"2\"","pos":1234}

Where 'cam' is the current camera assignment, 'num' is the current encoder slot, and 'pos' is the position of the encoder.

$w[int] : Writes a new encoder value to the device. An integer after the 'w' will become the new encoder position. Ex: $w12345

$s : Toggles data streaming mode. In streaming mode, the device will send data automatically when the encoders position changes. The device will respond with a JSON string of the following format

{"cam":"\"A\"","num":"\"2\"","pos":320}

Where 'cam' is the current camera assignment, 'num' is the current encoder slot, and 'pos' is the position of the encoder.

$c[char] : Sets the encoders assigned camera letter. Currently supported letters are A-D, or 0 for unassigned. Ex: $cA

Letters must be capitalized. This value is retained through power cycles.

$n[int] : Sets the encoders assigned slot number. Currently supported numbers are 1-3, or 0 for unassigned. Ex: $n2

This value is retained through power cycles.

$b : Toggles blackout mode. In blackout mode, all LEDs on the encoder will be turned off.