This commit is contained in:
Dooho Yi 2021-06-14 17:23:14 +09:00
parent f66d5315f7
commit 87fcb123bf
4 changed files with 38 additions and 30 deletions

View file

@ -43,3 +43,10 @@ board = d1_mini_pro
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
upload_speed = 460800 ; 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 upload_speed = 460800 ; 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
[env:huzzah]
platform = espressif8266
board = huzzah
lib_deps =
${env.lib_deps}
upload_speed = 921600 ; 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600

View file

@ -224,23 +224,11 @@ void onDataReceive(uint8_t * mac, uint8_t *incomingData, uint8_t len) {
if (incomingData[0] == '[' && incomingData[len - 1] == ']' && len == (sizeof(Note) + 2)) { if (incomingData[0] == '[' && incomingData[len - 1] == ']' && len == (sizeof(Note) + 2)) {
Note note; Note note;
memcpy((uint8_t *) &note, incomingData + 1, sizeof(Note)); memcpy((uint8_t *) &note, incomingData + 1, sizeof(Note));
//
MONITORING_SERIAL.println(note.to_string());
//
#if defined(REPLICATE_NOTE_REQ)
if (millis() - new_note_time > NEW_NOTE_TIMEOUT) {
note_now = note;
repeat_task.restart();
new_note_time = millis();
}
#endif
#if defined(HAVE_CLIENT_I2C)
//is this for me & my client? //is this for me & my client?
if (note.id == MY_GROUP_ID || note.id == MY_ID) { if (note.id == MY_GROUP_ID || note.id == MY_ID) {
#if defined(HAVE_CLIENT_I2C)
// (struct --> obsolete I2C format.) // (struct --> obsolete I2C format.)
// --> we want to open & re-construct the msg. // --> we want to open & re-construct the msg.
@ -272,12 +260,23 @@ void onDataReceive(uint8_t * mac, uint8_t *incomingData, uint8_t len) {
Wire.write(msg.c_str(), POST_LENGTH); Wire.write(msg.c_str(), POST_LENGTH);
Wire.endTransmission(); Wire.endTransmission();
#endif
// //
hello_delay = note.ps; hello_delay = note.ps;
if (hello_delay > 0 && hello_task.isEnabled() == false) { if (hello_delay > 0 && hello_task.isEnabled() == false) {
hello_task.restart(); hello_task.restart();
} }
} }
//
MONITORING_SERIAL.println(note.to_string());
#if defined(REPLICATE_NOTE_REQ)
if (millis() - new_note_time > NEW_NOTE_TIMEOUT) {
note_now = note;
repeat_task.restart();
new_note_time = millis();
}
#endif #endif
} }
} }

View file

@ -344,8 +344,11 @@ void onNoteHandler(Note & n) {
screen_cmd_notify_task.restart(); screen_cmd_notify_task.restart();
// //
if (n.onoff == 1) { if (n.onoff == 1) {
sample_now = n.pitch; // filter out re-triggering same note while it is playing.
sample_player_start_task.restartDelayed(10); if (!audio.isRunning() || sample_now != n.pitch) {
sample_now = n.pitch;
sample_player_start_task.restartDelayed(10);
}
} else if (n.onoff == 0) { } else if (n.onoff == 0) {
sample_now = n.pitch; sample_now = n.pitch;
sample_player_stop_task.restartDelayed(10); sample_player_stop_task.restartDelayed(10);
@ -358,7 +361,7 @@ void onNoteHandler(Note & n) {
void onDataReceive(const uint8_t * mac, const uint8_t *incomingData, int32_t len) { void onDataReceive(const uint8_t * mac, const uint8_t *incomingData, int32_t len) {
// //
// MONITORING_SERIAL.write(incomingData, len); //MONITORING_SERIAL.write(incomingData, len);
// //
#if defined(HAVE_CLIENT) #if defined(HAVE_CLIENT)
@ -388,6 +391,7 @@ void onDataReceive(const uint8_t * mac, const uint8_t *incomingData, int32_t len
} }
} }
//
MONITORING_SERIAL.println(note.to_string()); MONITORING_SERIAL.println(note.to_string());
#if defined(REPLICATE_NOTE_REQ) #if defined(REPLICATE_NOTE_REQ)
@ -397,7 +401,6 @@ void onDataReceive(const uint8_t * mac, const uint8_t *incomingData, int32_t len
new_note_time = millis(); new_note_time = millis();
} }
#endif #endif
} }
} }

25
post.h
View file

@ -111,9 +111,8 @@ struct AddressLibrary {
{ {
AddressBook book = AddressBook("audioooo"); AddressBook book = AddressBook("audioooo");
// //
// samplers don't have ID_KEY, they will just get all messages, // book.add(Address(0xAC, 0x67, 0xB2, 0x0B, 0xAE, 0x0C, "audioooo #1 (Q)")); //WROOM <- sender(the Q injector)
// then open the content to get **midi** 'key' in the 'note' message. book.add(Address(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, "BROADCAST")); //a broadcast (ESP32 will ignore this, but ESP8266 will do process this. let's expect them to work!)
book.add(Address(0xAC, 0x67, 0xB2, 0x0B, 0xAE, 0x0C, "audioooo #1 (Q)")); //WROOM
book.add(Address(0xAC, 0x67, 0xB2, 0x0B, 0xAD, 0xB0, "audioooo #2")); //WROOM book.add(Address(0xAC, 0x67, 0xB2, 0x0B, 0xAD, 0xB0, "audioooo #2")); //WROOM
book.add(Address(0xA8, 0x03, 0x2A, 0x6C, 0x88, 0x78, "audioooo #3")); //WROVER book.add(Address(0xA8, 0x03, 0x2A, 0x6C, 0x88, 0x78, "audioooo #3")); //WROVER
book.add(Address(0xA8, 0x03, 0x2A, 0x6C, 0x88, 0x5C, "audioooo #4")); //WROVER book.add(Address(0xA8, 0x03, 0x2A, 0x6C, 0x88, 0x5C, "audioooo #4")); //WROVER
@ -123,18 +122,18 @@ struct AddressLibrary {
book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x37, 0xAE, "sampler #2")); //TEENSY+ESP8266 book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x37, 0xAE, "sampler #2")); //TEENSY+ESP8266
book.add(Address(0xEC, 0xFA, 0xBC, 0x63, 0x19, 0x84, "sampler #3")); //TEENSY+ESP8266 book.add(Address(0xEC, 0xFA, 0xBC, 0x63, 0x19, 0x84, "sampler #3")); //TEENSY+ESP8266
book.add(Address(0x98, 0xF4, 0xAB, 0xB3, 0xB4, 0x19, "sampler #4")); //TEENSY+ESP8266 book.add(Address(0x98, 0xF4, 0xAB, 0xB3, 0xB4, 0x19, "sampler #4")); //TEENSY+ESP8266
book.add(Address(0xDC, 0x4F, 0x22, 0x18, 0xD9, 0x1E, "sampler #5")); //TEENSY+ESP8266 book.add(Address(0x98, 0xF4, 0xAB, 0xB3, 0xBA, 0x44, "sampler #5")); //TEENSY+ESP8266
book.add(Address(0x98, 0xF4, 0xAB, 0xB3, 0xB5, 0xC2, "sampler #6")); //TEENSY+ESP8266 (WIP) book.add(Address(0x98, 0xF4, 0xAB, 0xB3, 0xB5, 0xC2, "sampler #6")); //TEENSY+ESP8266
book.add(Address(0xDC, 0x4F, 0x22, 0x19, 0xA5, 0x1C, "sampler #7")); //TEENSY+ESP8266 book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x09, 0x92, "sampler #7")); //TEENSY+ESP8266
book.add(Address(0x68, 0xC6, 0x3A, 0xD5, 0x3E, 0xF3, "sampler #8")); //TEENSY+ESP8266 book.add(Address(0x68, 0xC6, 0x3A, 0xD5, 0x3E, 0xF3, "sampler #8")); //TEENSY+ESP8266
book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x45, 0xF5, "sampler #9")); //TEENSY+ESP8266 book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x45, 0xF5, "sampler #9")); //TEENSY+ESP8266
book.add(Address(0xBC, 0xDD, 0xC2, 0xB2, 0xAF, 0xD4, "sampler #A")); //TEENSY+ESP8266 // <== 15 sets book.add(Address(0xBC, 0xDD, 0xC2, 0xB2, 0xAF, 0xD4, "sampler #A")); //TEENSY+ESP8266
// B book.add(Address(0x84, 0xCC, 0xA8, 0xA3, 0xA7, 0xB5, "sampler #B")); //TEENSY+ESP8266
book.add(Address(0xDC, 0x4F, 0x22, 0x19, 0xA0, 0xAC, "sampler #C")); //TEENSY+ESP8266 (WIP) book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x11, 0xE6, "sampler #C")); //TEENSY+ESP8266
book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x18, 0xAE, "sampler #D")); //TEENSY+ESP8266
book.add(Address(0xB4, 0xE6, 0x2D, 0x37, 0x0A, 0x07, "sampler #E")); //TEENSY+ESP8266
book.add(Address(0xF4, 0xCF, 0xA2, 0xED, 0xB7, 0x21, "sampler #F")); //TEENSY+ESP8266 //20 sets => FULL
// // + we have 5 more un-registered devices. esp8266 devices will broadcast for them. hopely all get to contact w/ msg. on time.
lib.push_back(book); lib.push_back(book);
} }
} }