@@ -127,6 +127,7 @@ bool QwDevTMF882X::loadFirmware(const unsigned char *firmwareBinImage, unsigned
127127 return false ;
128128 }
129129
130+ // Load the fireware.
130131 if (tmf882x_fwdl (&_TOF, FWDL_TYPE_BIN, firmwareBinImage, length))
131132 {
132133 tof_err ((void *)this , " ERROR - Upload of firmware image failed" );
@@ -147,7 +148,7 @@ bool QwDevTMF882X::loadFirmware(const unsigned char *firmwareBinImage, unsigned
147148bool QwDevTMF882X::init (void )
148149{
149150
150- if (_isInitialized)
151+ if (_isInitialized) // already init'd
151152 return true ;
152153
153154 // do we have a bus yet? is the device connected?
@@ -242,6 +243,9 @@ bool QwDevTMF882X::setI2CAddress(uint8_t address)
242243bool QwDevTMF882X::getApplicationVersion (char *pVersion, uint8_t vlen)
243244{
244245
246+ if (!_isInitialized)
247+ return false ;
248+
245249 // verify we are in app mode
246250 if (tmf882x_get_mode (&_TOF) != TMF882X_MODE_APP) // failed to open up into application mode....
247251 return false ;
@@ -385,6 +389,7 @@ int QwDevTMF882X::startMeasuring(struct tmf882x_msg_meas_results &results, uint3
385389 return -1 ;
386390 }
387391
392+ // copy over results to output struct
388393 memcpy (&results, _lastMeasurement, sizeof (tmf882x_msg_meas_results));
389394
390395 return 1 ;
@@ -435,7 +440,6 @@ int QwDevTMF882X::startMeasuring(uint32_t reqMeasurements, uint32_t timeout)
435440// Called to stop the device measuring loop. Normally called in a message
436441// handler function.
437442//
438- //
439443// Parameter Description
440444// --------- -----------------------------
441445// None
@@ -495,7 +499,6 @@ int QwDevTMF882X::measurementLoop(uint16_t reqMeasurements, uint32_t timeout)
495499 // Measurment loop
496500 do
497501 {
498-
499502 // data collection/process pump for SDK
500503 if (tmf882x_process_irq (&_TOF)) // something went wrong
501504 break ;
@@ -730,7 +733,6 @@ bool QwDevTMF882X::setTMF882XConfig(struct tmf882x_mode_app_config &tofConfig)
730733
731734uint8_t QwDevTMF882X::getCurrentSPADMap (void )
732735{
733-
734736 if (!_isInitialized)
735737 return 0 ;
736738
@@ -758,7 +760,8 @@ bool QwDevTMF882X::setCurrentSPADMap(uint8_t idSPAD)
758760{
759761 if (!_isInitialized)
760762 return false ;
761-
763+
764+ // set map using the device config
762765 struct tmf882x_mode_app_config tofConfig;
763766
764767 if (!getTMF882XConfig (tofConfig))
0 commit comments