ShiftX2

Revision as of 05:27, 8 June 2017 by Brentp (talk | contribs)

Introduction

(Introduction about ShiftX2)

Scripts

Disco Lights Demo

This is a test script that exercises all of the LEDs on ShiftX2. Use this as a first time test.

Script

Copy and paste this entire script into the scripting window, replacing any existing script.

function onTick()
--implement me
end

Shift Light + Twin Alert Example

(this script is a complete example that does a sequential shift light + two alert indicators)

Script

Copy and paste this entire script into the scripting window, replacing any existing script.

function onTick()
--implement me
end

Predictive Lap Timer Indicator

This script enables predictive lap time visualization.

How it works

A bar extends left or right from the center of the linear graph:

  • Green bar extending to the right indicates you're beating the best time
  • Orange bar extending to the left means you're falling behind.

Script

Copy and paste this entire script into the scripting window, replacing any existing script.

function onTick()
--implement me
end

Boost Gauge

This script visualizes a single analog input channel on the linear graph.

How it works

The script configures the linear graph, then reads an analog channel and updates the graph with the current value. In this case, the value represents boost level measured from a MAP sensor.

Script

Copy and paste this entire script into the scripting window, replacing any existing script.

function onTick()
--implement me
end

Only Alerts

This script enables 3 alert channels:

  • Left alert for oil pressure
  • Right alert for engine temperature
  • Center alert for Air/Fuel ratio

How it works

The script configures the left and right alert indicators, then configures the center graph to visualize safe and dangerous AFR ranges. During operation, the analog channels for oil pressure and engine temperature are read and updates the alert indicators. The AFR channel is read and updates the linear graph.

Script

Copy and paste this entire script into the scripting window, replacing any existing script.

function onTick()
--implement me
end

ShiftX2 starter script

Use this as a starter for your own custom script

function onTick()
--implement me
end

ShiftX2 CAN bus API

Overview

The CAN bus API provides the configuration and control interface for ShiftX2.

Two styles of control are available:

  • Low level control of LEDs - the ability to discretely set LED color and flash behavior
  • High level control - configuring alert thresholds and linear graph up front, and then providing simple value updates

CAN Messages

CAN base ID

CAN base ID is 744389

If the device supports hardware configurable ID offsets, such as via DIP switches or breakable jumpers, each incremental offset will add 1000 to the base ID.

Configuration / Runtime Options

Announcement

Broadcast by the device upon power up

CAN ID: Base + 0

Offset What Value
0 Total LEDs Total number of LEDs on the device
1 Alert Indicators Number of logical alert indicators
2 Linear Bar Graph Length Number of LEDs in linear graph
3 Major Version Firmware major version number
4 Minor Version Firmware minor version number
5 Patch Version Firmware patch version number

Reset Device

Resets the device, loading defaults

CAN ID: Base + 1

Offset What Value
(no data)

Statistics

Statistics information, broadcast periodically by device

CAN ID: Base + 2

Offset What Value
(no data)

Set Configuration Parameters Group 1

Sets various configuration options.

CAN ID: Base + 3

Offset What Value
0 Brightness 0 - 100 (0=automatic brightness)

Set Discrete LED

A low level function to directly set any LED on the device.

CAN ID: Base + 10

Offset What Value
0 LED index 0 -> # of LEDs on device
1 Number of LEDs to set 0 -> # of LEDs on device (0 = set all remaining)
2 Red 0 - 255
3 Green 0 - 255
4 Blue 0 - 255
5 Flash 0-10Hz (0 = full on)

Alert Indicators

Alert Indicators are typically single LEDs or a group of LEDs treated as one logical unit. This is defined by the hardware configuration of the device.

Set Alert

Directly set an alert indicator

CAN ID: Base + 11

Offset What Value
0 Alert ID 0 -> # of Alert indicators
1 Red 0 - 255
2 Green 0 - 255
3 Blue 0 - 255
4 Flash 0-10Hz (0 = full on)

Set Alert Threshold

Configures an alert threshold. Up to 5 thresholds can be configured per alert indicator.

Notes:

  • Threshold value must be > 0 to be valid
  • Alerts are processed in descending order by alert ID and will be handled by the first threshold the current value exceeds.

CAN ID: Base + 12

Offset What Value
0 Alert ID 0 -> # of Alert indicators
1 Threshold ID 0 - 4
2 Threshold (low byte)
3 Threshold (high byte)
4 Red 0 - 255
5 Green 0 - 255
6 Blue 0 - 255
7 Flash Hz 0 - 10 (0 = full on)

Update Current Alert Value

Updates the current value for an alert indicator. The configured alert thresholds will be applied to the current value.

CAN ID: Base + 13

Offset What Value
0 Alert ID 0 -> # of Alert indicators
1 Value (low byte)
2 Value (high byte)

Linear Graph

The linear graph mode provides visualizations for common scenarios:

  • Sequential RPM shift light where the progression is stepped
  • Linear bar graph to linearly indicate a sensor value
  • Center left/right graph to indicate +/- performance against a reference - such as visualizing current predictive time vs best time

Power up default configuration

Upon power up the linear graph is configured:

  • Rendering style: left->right
  • Linear style: stepped
  • Low Range: 0
  • High Range: N/A
  • Threshold :
    • Threshold value: 3000 / segment length: 3 / color RGB: (0, 255, 0) / flash: 0
    • Threshold value: 5000 / segment length: 5 / color RGB: (0, 255, 255) / flash: 0
    • Threshold value: 7000 / segment length: 7 / color RGB: (255, 0, 0) / flash: 5

Configure Linear Graph

Configures the options for the linear graph portion of the device.

Rendering style:

  • If left->right, linear graph illuminates left to right
  • If centered, values below the mid-point in the range extend from the center to the left, and values above the mid-point extend from the center to the right.
  • If right->left, linear graph illuminates right to left

Linear style:

  • if smooth, graph length is updated smoothly by interpolating the current value in-between LEDs
  • If stepped, creates the visual effect of stepped progressions by setting the segment length of the threshold configuration. High Range of configuration is ignored.

CAN ID: Base + 14

Offset What Value
0 Rendering Style 0 = left->right, 1=center, 2=right->left
1 Linear Style 0 = Smooth / interpolated, 1 = stepped
2 Low Range (low byte)
3 Low Range (high byte)
4 High Range (low byte) (ignored if linear style = stepped)
5 High Range (high byte) (ignored if linear style = stepped)

Set Linear Graph Threshold

Configures a linear threshold. Up to 5 thresholds can be configured

CAN ID: Base + 15

Offset What Value
0 Threshold ID 0 - 4
1 Segment Length 0 -> # of LEDs on device (ignored if linear style is ‘smooth’)
2 Threshold (low byte)
3 Threshold (high byte)
4 Red 0 - 255
5 Green 0 - 255
6 Blue 0 - 255
7 Flash Hz 0 - 10 (0 = full on)

Update Current Linear Graph Value

Updates the current value for the linear graph

CAN ID: Base + 16

Offset What Value
0 Threshold ID 0 - 4
1 Threshold ID 0 - 4