From 0883517e09e35de547ae6d691af65bcb65fdd18b Mon Sep 17 00:00:00 2001 From: Thomas Daede Date: Tue, 10 Oct 2023 01:06:18 -0700 Subject: [PATCH] Use normal JVS turnaround delay when on default comm speed. --- firmware/td-io.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/firmware/td-io.c b/firmware/td-io.c index 14aa9c8..966c942 100644 --- a/firmware/td-io.c +++ b/firmware/td-io.c @@ -49,6 +49,8 @@ int16_t coin_count_p1 = 0; int16_t coin_count_p2 = 0; uint8_t prev_coin_p1 = 0; uint8_t prev_coin_p2 = 0; +// current JVS comm method +uint8_t jvs_comm_method = 0; /* Coins are polled between 12ms and 20ms as a min and max time. This value was picked to guarantee * a pulse of at least 120ms. The lowest rated coin meters are 10 counts/second. In the case of a @@ -130,6 +132,10 @@ void jvs_putc(uint8_t c) { void start_transmit() { gpio_put(PIN_JVS_RE, 1); // disable receive + if (jvs_comm_method == 0) { + // un-upgraded jvs needs at least 100us here + busy_wait_us_32(200); // 200us min for exa compat + } gpio_put(PIN_JVS_DE, 1); // enable transmitter } @@ -336,6 +342,7 @@ int main() { if (method_code < (sizeof(JVS_COMM_SPEEDS)/sizeof(JVS_COMM_SPEEDS[0]))) { uart_init(uart0, JVS_COMM_SPEEDS[method_code]); + jvs_comm_method = method_code; } else { printf("incompatible JVS Comm. method!\n");