more tinkering

This commit is contained in:
Peli de Halleux 2019-10-18 22:03:50 -07:00
parent fb4a0c2e16
commit aad9f0fd8a
4 changed files with 6 additions and 9 deletions

View File

@ -106,7 +106,7 @@ namespace sensors.internal {
}
}
function init() {
export function init() {
if (sensorInfos) return
sensorInfos = []
for (let i = 0; i < DAL.NUM_INPUTS; ++i) sensorInfos.push(new SensorInfo(i))

View File

@ -55,7 +55,7 @@ namespace motors {
Size = 12
}
function init() {
export function init() {
if (pwmMM) return
pwmMM = control.mmap("/dev/lms_pwm", 0, 0)
if (!pwmMM) control.fail("no PWM file")

View File

@ -2,5 +2,6 @@
console.addListener(function(priority: ConsolePriority, msg: string) {
control.dmesg(msg.substr(0, msg.length - 1))
})
// boot sequence
brick.showBoot();

View File

@ -194,15 +194,11 @@ namespace brick {
// pulse green, play startup sound, turn off light
brick.setStatusLight(StatusLight.GreenPulse);
// We pause for 100ms to give time to read sensor values, so they work in on_start block
pause(400)
sensors.internal.init();
motors.init();
pause(800)
// and we're ready
brick.setStatusLight(StatusLight.Off);
// always show port by default if no UI is set
control.runInParallel(function () {
// show ports if nothing is has been shown
if (screenMode != ScreenMode.None) return;
showPorts();
})
}
/**