Skip to content

Commit

Permalink
Switch to f-strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Feb 12, 2024
1 parent b14b2ad commit ceb0bd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/magnetometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
heading = round(heading)

# Note: Headings will not be correct until a full 360 deg calibration turn has been completed to generate amin and amax data
print("Heading: {}".format(heading))
print(f"Heading: {heading}")

time.sleep(0.1)
10 changes: 4 additions & 6 deletions icm20948/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,9 @@ def __init__(self, i2c_addr=I2C_ADDR, i2c_bus=None):
x, y, z = imu.read_magnetometer_data()
ax, ay, az, gx, gy, gz = imu.read_accelerometer_gyro_data()

print("""
Accel: {:05.2f} {:05.2f} {:05.2f}
Gyro: {:05.2f} {:05.2f} {:05.2f}
Mag: {:05.2f} {:05.2f} {:05.2f}""".format(
ax, ay, az, gx, gy, gz, x, y, z
))
print(f"""
Accel: {ax:05.2f} {ay:05.2f} {az:05.2f}
Gyro: {gx:05.2f} {gy:05.2f} {gz:05.2f}
Mag: {x:05.2f} {y:05.2f} {z:05.2f}""")

time.sleep(0.25)

0 comments on commit ceb0bd8

Please sign in to comment.