Timer in Macro
Hello,
I'm trying to implement a battery status indicator which would work when device is not connected and which would start on the boot. For this I'm using data processor on fromBattery signal and periodically call settingsModule.readBatteryState() (from timer or from other processors).
All runs fine if I start the process and disconnect. Now I'm trying to make it work from Macro. When I'm programming macro - it starts, but when I'm making a soft reset - I'm not getting battery signal, while other functionality is working fine.
The first issue that I can not start timer from Macro
When I program the Macro with the code below I'm getting the single green flash followed by periodical BLUE, if I reset the device (mwBoard.getModule(Debug.class).resetDevice()) - I'm having only the single green, but no Timer events.
HW: Metawear RG FW 1.1.3), Android API 2.5.9timerModule
.scheduleTask(new Timer.Task() {
@Override
public void commands() {
ledModule.stop(true);
ledModule.configureColorChannel(Led.ColorChannel.BLUE)
.setHighIntensity((byte) 31).setLowIntensity((byte) 0)
.setRiseTime((short) 100)
.setFallTime((short) 50)
.setHighTime((short) 100).setPulseDuration((short) 250)
.setRepeatCount((byte) 1).commit();
ledModule.play(true);
settingsModule.readBatteryState(true);
}
}, 1000, true).onComplete(new AsyncOperation.CompletionHandler<Timer.Controller>() {
@Override
public void success(Timer.Controller result) {
ledModule.stop(true);
ledModule.configureColorChannel(Led.ColorChannel.GREEN)
.setHighIntensity((byte) 31).setLowIntensity((byte) 0)
.setRiseTime((short) 100)
.setFallTime((short) 50)
.setHighTime((short) 100).setPulseDuration((short) 250)
.setRepeatCount((byte) 1).commit();
ledModule.play(true);
result.start();
}
@Override
public void failure(Throwable error) {
ledModule.stop(true);
ledModule.configureColorChannel(Led.ColorChannel.RED)
.setHighIntensity((byte) 31).setLowIntensity((byte) 0)
.setRiseTime((short) 100)
.setFallTime((short) 50)
.setHighTime((short) 100).setPulseDuration((short) 250)
.setRepeatCount((byte) 1).commit();
ledModule.play(true);
}
});
This discussion has been closed.
Comments