various bugs fix

This commit is contained in:
Ryan Tang 2024-05-24 15:14:15 -04:00
parent fdb4aa54c4
commit 24a2d39562
3 changed files with 7 additions and 3 deletions

View File

@ -123,7 +123,11 @@ while True:
else: else:
with open(tri_file, 'r') as file: with open(tri_file, 'r') as file:
tri_reading = file.read() tri_reading = file.read()
point.field("Tritium", float(tri_reading)) try:
point.field("Tritium", float(tri_reading))
except:
tri_reading = nan
print("cannot read TRI_reading.txt")
with open(outFile, "w") as file: with open(outFile, "w") as file:
for key, value in format_value.items(): for key, value in format_value.items():

View File

@ -28,7 +28,7 @@ try:
print("Received:", data, ":", data[3:8], "=", int(data[3:8],16),":",round(reading)) print("Received:", data, ":", data[3:8], "=", int(data[3:8],16),":",round(reading))
#write to file #write to file
with open(file_path, 'w') as file: with open(file_path, 'w') as file:
file.write(str(round(reading))) file.write(str(float(reading)))
if reading >50: if reading >50:
GPIO.output(17, GPIO.LOW) GPIO.output(17, GPIO.LOW)
#print ("ON") #print ("ON")

View File

@ -266,7 +266,7 @@ int main() {
} }
} }
textDisplay( "Tritium Sensor : " + FormatDouble(tritiumReading) + " mCr", 720, 200, isTritiumError ? redColor : blueColor); textDisplay( "Tritium Sensor : " + FormatDouble(tritiumReading) + " uCr/m3", 720, 200, isTritiumError ? redColor : blueColor);
textDisplay( "Vaccum : " + FormatDouble(vaccumReading) + "x1e-6 Torr", 630, 20, isVaccumError ? redColor: blueColor); textDisplay( "Vaccum : " + FormatDouble(vaccumReading) + "x1e-6 Torr", 630, 20, isVaccumError ? redColor: blueColor);
textDisplay( "SubPump : " + FormatDouble(subPumpReading*1000) + " mA", 300, 40, blueColor); textDisplay( "SubPump : " + FormatDouble(subPumpReading*1000) + " mA", 300, 40, blueColor);