Skip to content

Commit

Permalink
Merge pull request #14 from scanner-darkly/stability
Browse files Browse the repository at this point in the history
stability improvements
  • Loading branch information
tehn authored Jun 19, 2017
2 parents 2a2e40f + c868a91 commit 6e3e779
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 40 deletions.
1 change: 1 addition & 0 deletions src/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ CSRCS = \
../libavr32/src/init_trilogy.c \
../libavr32/src/init_common.c \
../libavr32/src/i2c.c \
../libavr32/src/interrupts.c \
../libavr32/src/monome.c \
../libavr32/src/timers.c \
../libavr32/src/notes.c \
Expand Down
42 changes: 3 additions & 39 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ static void handler_None(s32 data) { ;; }
static void handler_KeyTimer(s32 data);
static void handler_Front(s32 data);
static void handler_ClockNormal(s32 data);
static void handler_II(s32 data);

u8 flash_is_fresh(void);
void flash_unfresh(void);
Expand Down Expand Up @@ -1819,43 +1818,10 @@ static void refresh_preset() {


static void es_process_ii(uint8_t *data, uint8_t l) {
// print_dbg("\r\nes: ");
// print_dbg_hex(i);
// print_dbg(" ");
// print_dbg_ulong(d);
uint8_t command = data[0];
int d = (data[1] << 8) + data[2];

uint8_t i = 0;

if (i2c_waiting_count < MAX_II_COUNT) {
while (i2c_queue[i].waiting == true) i++;

i2c_queue[i].waiting = true;
i2c_queue[i].cmd = data[0];
i2c_queue[i].data = (data[1] << 8) + data[2];

i2c_waiting_count++;

static event_t e;
e.type = kEventII;
e.data = i;
event_post(&e);
}
else {
print_dbg("\r\ni2c queue full");
}

}



static void handler_II(s32 data) {
i2c_queue[data].waiting = false;
i2c_waiting_count--;

uint8_t i = i2c_queue[data].cmd;
int d = i2c_queue[data].data;

switch(i) {
switch(command) {
case ES_PRESET:
if(d<0 || d>7)
break;
Expand Down Expand Up @@ -2404,8 +2370,6 @@ static inline void assign_main_event_handlers(void) {
app_event_handlers[ kEventMidiConnect ] = &handler_MidiConnect ;
app_event_handlers[ kEventMidiDisconnect ] = &handler_MidiDisconnect ;
app_event_handlers[ kEventMidiPacket ] = &handler_MidiPacket ;

app_event_handlers[ kEventII ] = &handler_II ;
}

// app event loop
Expand Down

0 comments on commit 6e3e779

Please sign in to comment.