Rename variable count to scanCount for clarity
Improves code readability by using a more descriptive variable name that better indicates the variable holds the device count from a BLE scan.
This commit is contained in:
@@ -182,14 +182,14 @@ void BluetoothSettingsActivity::loop() {
|
|||||||
if (view == View::Menu) {
|
if (view == View::Menu) {
|
||||||
handleMenuConfirm();
|
handleMenuConfirm();
|
||||||
} else if (view == View::Scan) {
|
} else if (view == View::Scan) {
|
||||||
const int count = BleHid.deviceCount();
|
const int scanCount = BleHid.deviceCount();
|
||||||
if (!awaitingConnect && count == 0 && !BleHid.isScanning()) {
|
if (!awaitingConnect && scanCount == 0 && !BleHid.isScanning()) {
|
||||||
LOG_INF("BLEUI", "scan view: restart scan requested");
|
LOG_INF("BLEUI", "scan view: restart scan requested");
|
||||||
BleHid.startScan(kScanMs);
|
BleHid.startScan(kScanMs);
|
||||||
LOG_INF("BLEUI", "scan view: restart scan state scanning=%d devices=%u", BleHid.isScanning(),
|
LOG_INF("BLEUI", "scan view: restart scan state scanning=%d devices=%u", BleHid.isScanning(),
|
||||||
BleHid.deviceCount());
|
BleHid.deviceCount());
|
||||||
requestUpdate();
|
requestUpdate();
|
||||||
} else if (!awaitingConnect && scanIndex < count) {
|
} else if (!awaitingConnect && scanIndex < scanCount) {
|
||||||
if (BleHid.isScanning()) BleHid.stopScan();
|
if (BleHid.isScanning()) BleHid.stopScan();
|
||||||
const auto& d = BleHid.device(static_cast<uint8_t>(scanIndex));
|
const auto& d = BleHid.device(static_cast<uint8_t>(scanIndex));
|
||||||
LOG_INF("BLEUI", "scan view: connect addr=%s name='%s' rssi=%d type=%u hid=%d conn=%d", d.addr, d.name, d.rssi,
|
LOG_INF("BLEUI", "scan view: connect addr=%s name='%s' rssi=%d type=%u hid=%d conn=%d", d.addr, d.name, d.rssi,
|
||||||
|
|||||||
Reference in New Issue
Block a user