From dbfdb38a8f1799c3c1be97667699b572522d9911 Mon Sep 17 00:00:00 2001 From: Thomas Daede Date: Fri, 8 Sep 2023 10:09:58 -0700 Subject: [PATCH] Implement (dummy) analog read command --- firmware/td-io.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/firmware/td-io.c b/firmware/td-io.c index e776d4a..14aa9c8 100644 --- a/firmware/td-io.c +++ b/firmware/td-io.c @@ -483,6 +483,22 @@ int main() { } o += 2; } + } else if ((msg_length - i) >= 2 && message[i] == 0x22) { + int channels = message[i+1]; + i += 2; + if (o + channels*2 >= JVS_MAX_LEN) { + printf("JVS response overflow!\n"); + status = JVS_STATUS_OVERFLOW; + break; + } + msg_send[o] = JVS_REPORT_GOOD; + o++; + for (int channel = 0; channel < channels; channel++) { + // analog input currently not supported + msg_send[o] = 0x80; + msg_send[o+1] = 0x00; + o += 2; + } } else if ((msg_length - i) >= 1 && message[i] == 0x2f) { printf("JVS re-transmit request!\n"); send_message(prev_status, prev_msg_send, prev_msg_size);