1.How to paste code like your format?
2.user don't know when sensor start back pulse after start pulse(20us delay pulse),so must use for cycle check it asap,i try checked it,usually after 3-4 cycles,the pulse will arrive,so i think won't miss it.
3.i use 3 ways for process back pulse
I,mraa_gpio_isr
II,mraa_gpio_read in cycle
III.i toke pulseIn and related functions out from arduino IDE source code and use in my program.
mraa_gpio_isr is worse way,mraa_gpio_read in cycle is better,pulseIn is best way now but still has big different with sensor's tech spec
4.seem no better way could found,anyway,I will continue to work hard.
5.which linux image version you use,i upgrade to ww42 and can not upload any program to board via arduion IDE,block at "uploading"