Skip to content

Commit ce08972

Browse files
committed
Make suggested changes
1 parent d18ae60 commit ce08972

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

examples/ina260_latch.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
for _ in enumerate(range(5)):
3535
time.sleep(ConversionTime.get_seconds(ina260.current_conversion_time))
3636
print(
37-
"Current: %.2f mA Voltage: %.2f V Power:%.2f mW"
38-
% (ina260.current, ina260.voltage, ina260.power)
37+
f"Current: {ina260.current:.2f} mA, "
38+
f"Voltage: {ina260.voltage:.2f} V, "
39+
f"Power: {ina260.power:.2f} mW"
3940
)
4041

4142
# supposing meanwhile the alert limit was exceeded, setting an higher limit
@@ -44,14 +45,12 @@
4445
ina260.alert_limit = 0x0100
4546

4647
# alert function flag bit should be true if alert threshold was exceeded
47-
print("Alert function flag: {}".format(ina260.alert_function_flag))
48+
print("Alert function flag: ", ina260.alert_function_flag)
4849

4950
# in latch mode, reading the register clears the ALERT & alert function flag
50-
print("MASK register: {}".format(ina260.mask_enable))
51+
print("MASK register:", ina260.mask_enable)
5152

5253
# reset the whole chip and wait 2 sec
5354
ina260.reset_bit = True
5455
time.sleep(2)
55-
print(
56-
"MASK_REGISTER check, must be 0x0000 after reset: {}".format(ina260.mask_enable)
57-
)
56+
print("MASK_REGISTER check, must be 0x0000 after reset:", ina260.mask_enable)

0 commit comments

Comments
 (0)