From 4c67dd12b8363da79eeba894aaaff7df8863bad1 Mon Sep 17 00:00:00 2001 From: Patrick Grawehr Date: Sun, 19 Oct 2025 14:10:54 +0200 Subject: [PATCH] Add support for SAMPLING_INTERVAL_QUERY --- src/ConfigurableFirmata.h | 2 +- src/FirmataReporting.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ConfigurableFirmata.h b/src/ConfigurableFirmata.h index 85eb30a..aa0d52f 100644 --- a/src/ConfigurableFirmata.h +++ b/src/ConfigurableFirmata.h @@ -91,7 +91,7 @@ #define REPORT_FIRMWARE 0x79 // report name and version of the firmware #define SAMPLING_INTERVAL 0x7A // set the poll rate of the main loop #define SCHEDULER_DATA 0x7B // send a createtask/deletetask/addtotask/schedule/querytasks/querytask request to the scheduler -#define ANALOG_CONFIG 0x7C // (reserved) +#define SAMPLING_INTERVAL_QUERY 0x7C // request the current sampling interval #define FREQUENCY_COMMAND 0x7D // Command for the Frequency module #define SYSEX_NON_REALTIME 0x7E // MIDI Reserved for non-realtime messages #define SYSEX_REALTIME 0x7F // MIDI Reserved for realtime messages diff --git a/src/FirmataReporting.cpp b/src/FirmataReporting.cpp index c3dadb3..6fa8164 100644 --- a/src/FirmataReporting.cpp +++ b/src/FirmataReporting.cpp @@ -44,6 +44,13 @@ boolean FirmataReporting::handleSysex(byte command, byte argc, byte* argv) return true; } } + if (command == SAMPLING_INTERVAL_QUERY) { + Firmata.startSysex(); + Firmata.write(SAMPLING_INTERVAL); + Firmata.sendPackedUInt14(samplingInterval); + Firmata.endSysex(); + return true; + } return false; }