Skip to content

[Bluetooth Low Energy] float64LittleEndian conversion fails to display valid data from BLE notifications #85

@mcitem

Description

@mcitem

Description

Below are my test Bluetooth data for 1.0 represented as both f64 and f32 in little-endian byte order.

This is the byte representation of 1.0_f64:

[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F]

This is the byte representation of 1.0_f32:

[0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00]

When testing with the following Phyphox experiment over Bluetooth,
I found that when using float64LittleEndian, and my device sends the notification
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F],
the CH1 display in the app keeps flickering between a dash “–” and “0.00”.

Initially, I suspected an issue with my Bluetooth device or byte order,
but after switching the conversion function to float32LittleEndian
and sending [0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00],
the display started working correctly.

I verified the data using the GattBrowser Android app,
so I believe my BLE device is working properly.
It seems likely that there’s an issue with the float64LittleEndian conversion,
but I’m not sure how to provide more diagnostic logs.

If needed, I can provide logcat output from Android Studio (ADB wireless debugging).

Android phyphox version(1.2.0)
file format(1.19)
Build:1020009

<phyphox xmlns="https://phyphox.org/xml" version="1.19">
  <title>F64_Test</title>
  <category>[email protected]</category>
  <data-containers>
    <container>CH1</container>
  </data-containers>
  <input>
    <bluetooth mode="notification" rate="1">
      <output char="cddf1002-30f7-4671-8b43-5e40ba53514a" conversion="float32LittleEndian" offset="0">CH1</output>
    </bluetooth>
  </input>
  <views>
    <view label="New View">
      <value label="CH1">
        <input>CH1</input>
      </value>
    </view>
  </views>
</phyphox>

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