Add sensor button, fix sensor code.

This commit is contained in:
Anna Rose Wiggins 2021-08-09 13:51:24 -04:00
parent 8e012799eb
commit 224a076b8b
4 changed files with 73 additions and 3 deletions

View file

@ -24,5 +24,31 @@ function ReadSensor {
if not sList:HasKey(s) {
return -1. // TODO: is -1 an impossible result for all sensors? I suspect not...
}
return s:DISPLAY:TOSCALAR.
if not sList[s]:ACTIVE {
sList[s]:Toggle().
}
// UGH, this appears to be the only way to do this.
local ret is -1.
if s = "PRES" {
set ret to SHIP:SENSORS:PRES.
}
if s = "TEMP" {
set ret to SHIP:SENSORS:TEMP.
}
if s = "ACC" {
set ret to SHIP:SENSORS:ACC:MAG.
}
if s = "GRAV" {
set ret to SHIP:SENSORS:GRAV.
}
if s = "LIGHT" {
set ret to SHIP:SENSORS:LIGHT.
}
// turn off the sensor when we're done with it
sList[s]:Toggle().
return ret.
}