Skip to content

Commit

Permalink
when measuring current, keep 2 decimals for readings
Browse files Browse the repository at this point in the history
  • Loading branch information
ftylitak committed Nov 13, 2023
1 parent e182269 commit f224c70
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions insighioNode/apps/demo_console/scenario_advind_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ def measure_4_20_mA_on_port(measurements, port_id):
gpio_handler.set_pin_value(sensor_on_pin, 1)

raw_mV = analog_generic.get_reading(sensor_out_pin)
current_mA = (raw_mV - 0) / (cfg._SHUNT_OHMS * cfg._INA_GAIN)
current_mA = round(current_mA)
current_mA = round((raw_mV / (cfg._SHUNT_OHMS * cfg._INA_GAIN) ) * 100) / 100
logging.debug("ANLG SENSOR @ pin {}: {} mV, Current = {} mA".format(sensor_out_pin, raw_mV, current_mA))
set_value_float(measurements, "4_20_{}_current".format(port_id), current_mA, SenmlSecondaryUnits.SENML_SEC_UNIT_MILLIAMPERE)

Expand Down

0 comments on commit f224c70

Please sign in to comment.