MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / updateViews

Method updateViews

Tactility/Source/app/i2cscanner/I2cScanner.cpp:337–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void I2cScannerApp::updateViews() {
338 if (mutex.lock(100 / portTICK_PERIOD_MS)) {
339 if (scanState == ScanStateScanning) {
340 lv_label_set_text(scanButtonLabelWidget, STOP_SCAN_TEXT);
341 lv_obj_remove_flag(portDropdownWidget, LV_OBJ_FLAG_CLICKABLE);
342 } else {
343 lv_label_set_text(scanButtonLabelWidget, START_SCAN_TEXT);
344 lv_obj_add_flag(portDropdownWidget, LV_OBJ_FLAG_CLICKABLE);
345 }
346
347 lv_obj_clean(scanListWidget);
348 if (scanState == ScanStateStopped) {
349 lv_obj_remove_flag(scanListWidget, LV_OBJ_FLAG_HIDDEN);
350
351 if (!scannedAddresses.empty()) {
352 for (auto address: scannedAddresses) {
353 std::string address_text = getAddressText(address);
354 lv_list_add_text(scanListWidget, address_text.c_str());
355 }
356 } else {
357 lv_list_add_text(scanListWidget, "No devices found");
358 }
359 } else {
360 lv_obj_add_flag(scanListWidget, LV_OBJ_FLAG_HIDDEN);
361 }
362
363 mutex.unlock();
364 } else {
365 logger.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "updateViews");
366 }
367}
368
369void I2cScannerApp::updateViewsSafely() {
370 if (lvgl::lock(200 / portTICK_PERIOD_MS)) {

Callers

nothing calls this directly

Calls 4

getAddressTextFunction · 0.85
warnMethod · 0.80
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected