Skip to content

Commit

Permalink
kria: support reading step duration via ii (#74)
Browse files Browse the repository at this point in the history
* add KR.DUR support and fix duration latching bug

* update libavr32
  • Loading branch information
csboling authored and tehn committed Dec 2, 2019
1 parent 0780a47 commit 4f7bd2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libavr32
Submodule libavr32 updated 1 files
+1 −0 src/ii.h
15 changes: 10 additions & 5 deletions src/ansible_grid.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,11 +918,6 @@ void clock_kria_track( uint8_t trackNum ) {

bool trNextStep = kria_next_step(trackNum, mTr);
bool isTrigger = track->tr[pos[trackNum][mTr]];
if(trNextStep) {
f32 clock_scale = (clock_deltas[trackNum] * track->tmul[mTr]) / (f32)380.0;
f32 uncscaled = (track->dur[pos[trackNum][mDur]]+1) * (track->dur_mul<<2);
dur[trackNum] = (u16)(uncscaled * clock_scale);
}

// if the track isn't in trigger_step mode, or if there is a trigger
// THEN we clock the other parameters
Expand Down Expand Up @@ -1443,6 +1438,16 @@ void ii_kria(uint8_t *d, uint8_t l) {
ii_tx_queue(k.p[k.pattern].t[d[1] - 1].direction);
}
break;
case II_KR_DURATION + II_GET:
if ( d[1] < 0
|| d[1] >= KRIA_NUM_TRACKS) {
ii_tx_queue(0);
ii_tx_queue(0);
break;
}
ii_tx_queue(dur[d[1]] >> 8);
ii_tx_queue(dur[d[1]] & 0xFF);
break;
default:
ii_grid(d, l);
ii_ansible(d, l);
Expand Down

0 comments on commit 4f7bd2f

Please sign in to comment.