Add VID/PID to build flags for ESP32 core + stronger visual indicators
- Set USB VID/PID via ESP32 core build flags (may work better than TinyUSB API) - Heartbeat on LED 9 (amber pulse every 2s) confirms device is alive - SysEx flashes ALL LEDs white for 200ms - Regular MIDI flashes LED 0 white for 50ms
This commit is contained in:
@@ -35,6 +35,8 @@ private:
|
|||||||
bool initialized;
|
bool initialized;
|
||||||
uint32_t activity_off_time = 0;
|
uint32_t activity_off_time = 0;
|
||||||
uint8_t saved_r = 0, saved_g = 0, saved_b = 0;
|
uint8_t saved_r = 0, saved_g = 0, saved_b = 0;
|
||||||
|
uint32_t heartbeat_time = 0;
|
||||||
|
uint8_t heartbeat_phase = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DefaultLedStub();
|
DefaultLedStub();
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ build_flags =
|
|||||||
-DARDUINO_USB_MODE=0
|
-DARDUINO_USB_MODE=0
|
||||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-DUSE_TINYUSB=1
|
-DUSE_TINYUSB=1
|
||||||
|
-DUSB_VID=0x1235
|
||||||
|
-DUSB_PID=0x0103
|
||||||
|
-DUSB_MANUFACTURER="Novation"
|
||||||
|
-DUSB_PRODUCT="Launchpad X"
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ void AppTask::process_midi_event(const MidiEvent& event) {
|
|||||||
uint8_t cin = event.channel;
|
uint8_t cin = event.channel;
|
||||||
uint8_t packet[3] = {event.data1, event.data2, 0};
|
uint8_t packet[3] = {event.data1, event.data2, 0};
|
||||||
process_sysex_packet(packet, cin);
|
process_sysex_packet(packet, cin);
|
||||||
|
led_driver->flash_sysex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+28
-4
@@ -277,20 +277,44 @@ void DefaultLedStub::flash_activity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flash LED 0 white
|
// Flash ALL LEDs white for SysEx (more visible), LED 0 for regular MIDI
|
||||||
mux_ptr->set_led_color(0, 255, 255, 255);
|
for (int i = 0; i < NUM_LEDS; i++) {
|
||||||
|
mux_ptr->set_led_color(i, 255, 255, 255);
|
||||||
|
}
|
||||||
mux_ptr->show();
|
mux_ptr->show();
|
||||||
activity_off_time = now + 30;
|
activity_off_time = now + 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultLedStub::flash_sysex() {
|
||||||
|
if (!initialized || !mux_ptr) return;
|
||||||
|
for (int i = 0; i < NUM_LEDS; i++) {
|
||||||
|
mux_ptr->set_led_color(i, 255, 255, 255);
|
||||||
|
}
|
||||||
|
mux_ptr->show();
|
||||||
|
activity_off_time = millis() + 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultLedStub::update() {
|
void DefaultLedStub::update() {
|
||||||
if (!initialized || !mux_ptr) return;
|
if (!initialized || !mux_ptr) return;
|
||||||
|
|
||||||
// Turn off activity flash after 30ms
|
// Turn off activity flash
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
if (activity_off_time > 0 && now >= activity_off_time) {
|
if (activity_off_time > 0 && now >= activity_off_time) {
|
||||||
mux_ptr->set_led_color(0, saved_r, saved_g, saved_b);
|
mux_ptr->set_led_color(0, saved_r, saved_g, saved_b);
|
||||||
mux_ptr->show();
|
mux_ptr->show();
|
||||||
activity_off_time = 0;
|
activity_off_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Heartbeat: pulse LED 9 slowly so we know device is alive
|
||||||
|
if (now - heartbeat_time > 2000) {
|
||||||
|
heartbeat_time = now;
|
||||||
|
heartbeat_phase = 1;
|
||||||
|
}
|
||||||
|
if (heartbeat_phase) {
|
||||||
|
uint8_t brightness = (heartbeat_phase < 100) ? (heartbeat_phase * 2) : (400 - heartbeat_phase * 2);
|
||||||
|
mux_ptr->set_led_color(9, brightness, brightness / 4, 0);
|
||||||
|
mux_ptr->show();
|
||||||
|
heartbeat_phase++;
|
||||||
|
if (heartbeat_phase > 200) heartbeat_phase = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user