Skip to content

readRSSI value update frequency? #1133

@rithvik-doshi

Description

@rithvik-doshi

Even if I call readRSSI value every 100ms, it seems like the RSSI value only changes values every half second or so. Is this functionality intended? Code for context

useEffect(() => {
    const interval = setInterval(() => {
      if (isConnected) {
        scanIds.map((item) => retrieveRssi(item));
      }
    }, 100);
    return () => clearInterval(interval);
  }, [isConnected, scanIds, diff1, diff2]);

const retrieveRssi = (peripheralId) => {
    BleManager.readRSSI(peripheralId)
      .then((rssi) => {
        index = scanIds.indexOf(peripheralId);
        if (index == 0) {
          setDiff1(rssi);
        } else {
          setDiff2(rssi);
        }
      })
      .then(console.log(diff1, diff2))
      .catch((error) => {
        // Failure code
        console.log(error);
      });
  };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions