Hello duelingcats, these parameters change the measured value and allow you to use an offset for a measurement. To display the values you have to format them in an application. You can use the printf command in Bash to format numbers. To display the number 1234 as 12.34 °C, you can divide it by 100 and then format it with printf to include two decimal places and the desired suffix.
Here is the command:
Code: Select all
printf "%.2f °C\n" $(echo "1234 / 100" | bc -l)
I have created a test setup with which "1234" can be output via the variable you are using "RTDValue_1":
So in your case it should work with, i.e. that code:
Code: Select all
RTD=$(piTest -1 -q -r RTDValue_1)
printf "%.2f °C\n" $(echo "$RTD / 100" | bc -l)
12.34 °C
In general, you can of course also use a high-level language like Python just to round it off.
With an f-string (Python 3.6+):
Code: Select all
value = 1234
formatted = f"{value / 100:.2f} °C"
print(formatted)
The whole thing can then be implemented using a process image on real data:
Code: Select all
import revpimodio2
# Establishing a connection to the RevPi
rpi = revpimodio2.RevPiModIO(autorefresh=True)
# Name of the RTD channel
rtd_channel = "RTDValue_1"
# RTD-Daten auslesen
raw_value = rpi.io[rtd_channel].value # Read raw value (e.g. 1234)
# Convert and format temperature
temperature = raw_value / 100.0
formatted_temperature = f"{temperature:.2f} °C"
print(f"Channel {rtd_channel}: {formatted_temperature}")