From 02126a257b04e35ec4a2172b2ab7fe298980c7f5 Mon Sep 17 00:00:00 2001 From: Josh Pieper Date: Thu, 9 Sep 2021 16:04:53 -0400 Subject: [PATCH] Make version pin detection a bit more reliable --- fw/moteus.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fw/moteus.cc b/fw/moteus.cc index c051eed8..03435142 100644 --- a/fw/moteus.cc +++ b/fw/moteus.cc @@ -213,6 +213,16 @@ int main(void) { } #endif + // I initially used a Ticker here to enqueue events at 1ms + // intervals. However, it introduced jitter into the current + // sampling interrupt, and I couldn't figure out how to get the + // interrupt priorities right. Thus for now we just poll to look + // for millisecond turnover. + MillisecondTimer timer; + + // Wait to ensure the pullups are sufficiently pulled up. + timer.wait_us(100); + const uint8_t this_hw_pins = 0x07 & (~(hwrev0.read() | (hwrev1.read() << 1) | @@ -237,13 +247,6 @@ int main(void) { }(); MJ_ASSERT(compatible); - // I initially used a Ticker here to enqueue events at 1ms - // intervals. However, it introduced jitter into the current - // sampling interrupt, and I couldn't figure out how to get the - // interrupt priorities right. Thus for now we just poll to look - // for millisecond turnover. - MillisecondTimer timer; - micro::SizedPool<14000> pool; HardwareUart rs485(&pool, &timer, []() {