| 148 | } |
| 149 | |
| 150 | void I2cScannerApp::onHide(AppContext& app) { |
| 151 | bool isRunning = false; |
| 152 | if (mutex.lock(250 / portTICK_PERIOD_MS)) { |
| 153 | auto* timer = scanTimer.get(); |
| 154 | if (timer != nullptr) { |
| 155 | isRunning = timer->isRunning(); |
| 156 | } |
| 157 | mutex.unlock(); |
| 158 | } else { |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | if (isRunning) { |
| 163 | stopScanning(); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | // endregion Lifecycle |
| 168 |