tfmini
tfmini copied to clipboard
External trigger issue
During my tests I was not able to get the external trigger to work, after some tests using a usb to UART I noticed that its not needed to change to config mode the sensor.
commenting out the setConfigMode() calls worked for me.
At the end I used it as below.
// Set single scan mode (external trigger)
void TFMini::setSingleScanMode() {
// not needed ->setConfigMode();
// setting trigger source to external
streamPtr->write((uint8_t)0x42);
streamPtr->write((uint8_t)0x57);
streamPtr->write((uint8_t)0x02);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x40);
}
// Send external trigger
void TFMini::externalTrigger() {
// not needed -> setConfigMode();
// send trigger
streamPtr->write((uint8_t)0x42);
streamPtr->write((uint8_t)0x57);
streamPtr->write((uint8_t)0x02);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x00);
streamPtr->write((uint8_t)0x41);
}
I can confirm that this is how it works. Don't know why this is the case