Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add timelineSpeed message

  • Loading branch information...
commit d667f024558e63c3e8bb9df961c5c1bae19cf43c 1 parent 5521e2c
@potomak potomak authored
Showing with 36 additions and 10 deletions.
  1. +13 −0 README.md
  2. +4 −0 firmware.pde
  3. +19 −10 timeline.pde
View
13 README.md
@@ -107,6 +107,19 @@ Arguments:
* `id` (1 byte)<br/>
the timeline id
+### Timeline speed
+
+Change timeline speed.
+
+SysEx command: `0x09`
+
+Arguments:
+
+ * `id` (1 byte)<br/>
+ the timeline id
+ * `speed` (2 bytes)<br/>
+ timeline speed in msecs
+
## Waveform
Waveform commands rules the waveform led matrix behavior.
View
4 firmware.pde
@@ -58,6 +58,7 @@ int delayValue;
#define TIMELINE_START 0x05 // 5
#define TIMELINE_STOP 0x06 // 6
+#define TIMELINE_SPEED 0x09 // 9
#define TIMELINE_DEFAULT_OFFSET 32
#define TIMELINE_LENGTH 56
@@ -370,6 +371,9 @@ void sysexCallback(byte command, byte argc, byte *argv)
case TIMELINE_STOP:
timelineStopCallback(argc, argv);
break;
+ case TIMELINE_SPEED:
+ timelineSpeedCallback(argc, argv);
+ break;
//
// WAVEFORM
View
29 timeline.pde
@@ -91,17 +91,25 @@ void timelineReset() {
}
}
+int parseTimelineId(byte argc, byte *argv) {
+ // timeline id
+ // argv[0] --> [1, 2] --> timeline [0, 1]
+ return argv[0] - 1;
+}
+
+int parseTimelineSpeed(byte argc, byte *argv) {
+ // timeline speed
+ // argv[1..2] --> speed [0,16383] ms
+ return argv[1] + (argv[2] << 7);
+}
+
void timelineStartCallback(byte argc, byte *argv) {
timelineReset();
- // timeline id
- // argv[0] --> [1, 2] --> timeline [0, 1]
- int t_id = argv[0] - 1;
+ int t_id = parseTimelineId(argc, argv);
timelineIsOn[t_id] = true;
- // timeline speed
- // argv[1..2] --> speed [0,16383] ms
- timelineSpeed[t_id] = argv[1] + (argv[2] << 7);
+ timelineSpeed[t_id] = parseTimelineSpeed(argc, argv);
// timeline orientation
// argv[3] --> [1, 2] --> [true, false] --> [clockwise, anticlockwise]
@@ -121,11 +129,12 @@ void timelineStartCallback(byte argc, byte *argv) {
}
void timelineStopCallback(byte argc, byte *argv) {
- // timeline id
- // argv[0] --> [1, 2] --> timeline [0, 1]
- int t_id = argv[0] - 1;
- timelineIsOn[t_id] = false;
+ timelineIsOn[parseTimelineId(argc, argv)] = false;
//timelinePreviousMillis[t_id] = 0;
timelineReset();
}
+
+void timelineSpeedCallback(byte argc, byte *argv) {
+ timelineSpeed[parseTimelineId(argc, argv)] = parseTimelineSpeed(argc, argv);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.