 /// This is the TCP/IP listener on the ESP32.
 WiFiServer openMRNServer(OPENMRN_TCP_PORT);
 
+OVERRIDE_CONST(gridconnect_buffer_size, 512);
+OVERRIDE_CONST(gridconnect_buffer_delay_usec, 2000);
+
+#endif // USE_WIFI
+
+#if defined(USE_CAN)
+/// This is the ESP32 pin connected to the SN6565HVD23x/MCP2551 R (RX) pin.
+/// Recommended pins: 4, 16, 21.
+/// Note: Any pin can be used for this other than 6-11 which are connected to
+/// the onboard flash.
+/// Note: If you are using a pin other than 4 you will likely need to adjust
+/// the GPIO pin definitions for the outputs.
+constexpr gpio_num_t CAN_RX_PIN = GPIO_NUM_4;
+
+/// This is the ESP32 pin connected to the SN6565HVD23x/MCP2551 D (TX) pin.
+/// Recommended pins: 5, 17, 22.
+/// Note: Any pin can be used for this other than 6-11 which are connected to
+/// the onboard flash and 34-39 which are input only.
+/// Note: If you are using a pin other than 5 you will likely need to adjust
+/// the GPIO pin definitions for the outputs.
+constexpr gpio_num_t CAN_TX_PIN = GPIO_NUM_5;
+
+#endif // USE_CAN
+
 /// This is the primary entrypoint for the OpenMRN/LCC stack.
 OpenMRN openmrn(NODE_ID);
 

            openmrn.add_gridconnect_port(new Esp32WiFiClientAdapter(client));
        }
    }

    // Call the OpenMRN executor, this needs to be done as often
    // as possible from the loop() method.
    openmrn.loop();
}

    // have performance impact.
    // openmrn.stack()->print_all_packets();

#if defined(USE_CAN)
    // When using the hardware can device it is recommended to also utilize the
    // background task on the ESP32 rather than call openmrn.loop() from the
    // loop method.
    openmrn.start_background_task();

    // Add the hardware CAN device as a bridge
    openmrn.add_can_port(
        new Esp32HardwareCan("esp32can", CAN_RX_PIN, CAN_TX_PIN));
#endif // USE_CAN

#if defined(USE_WIFI)
    // Broadcast this node's hostname with the mDNS service name
    // for a TCP GridConnect endpoint.
    MDNS.addService(openlcb::TcpDefs::MDNS_SERVICE_NAME_GRIDCONNECT_CAN,
        openlcb::TcpDefs::MDNS_PROTOCOL_TCP, OPENMRN_TCP_PORT);
#endif // USE_WIFI
}

void loop()
{
#if defined(USE_WIFI)
    // if the TCP/IP listener has a new client accept it and add it
    // as a new GridConnect port.
    if (openMRNServer.hasClient())
