Fix up hover script and improve bootloading.

This commit is contained in:
Anna Rose Wiggins 2021-08-06 04:57:07 -04:00
parent 75a7dfec22
commit 2099d0a284
6 changed files with 105 additions and 61 deletions

26
lib/sensors.ks Normal file
View file

@ -0,0 +1,26 @@
// we rebuild the sensor list with every invocation, because things change
function buildSensorList {
local sList is Lexicon().
list SENSORS in SensorList.
for s in SensorList {
sList:add(s:type, s).
}
return sList.
}
function HasSensor {
parameter s.
local sList is buildSensorList().
return sList:HasKey(s).
}
function ReadSensor {
parameter s.
local sList is buildSensorList().
if not sList:HasKey(s) {
return -1. // TODO: is -1 an impossible result for all sensors? I suspect not...
}
return sList[s].
}