| 255 | } |
| 256 | |
| 257 | bool I2cScannerApp::hasScanThread() { |
| 258 | bool has_thread; |
| 259 | if (mutex.lock(100 / portTICK_PERIOD_MS)) { |
| 260 | has_thread = scanTimer != nullptr; |
| 261 | mutex.unlock(); |
| 262 | return has_thread; |
| 263 | } else { |
| 264 | // Unsafe way |
| 265 | logger.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "hasScanTimer"); |
| 266 | return scanTimer != nullptr; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | void I2cScannerApp::startScanning() { |
| 271 | if (hasScanThread()) { |