void
update(- {bool flash = false,
- BlinkMode blink = BlinkMode.none,
- bool disableWindow = false,
- bool neverReformat = false}
)
Implementation
void update(
{bool flash = false,
BlinkMode blink = BlinkMode.none,
bool disableWindow = false,
bool neverReformat = false}) {
if (ignoreUpdates) {
return;
}
if (_showingX && !neverReformat) {
currentShowingX = model.formatValue(model.x);
// In case window enabled setting changed
}
final LcdContents c = (blink == BlinkMode.justDigits)
? model._newLcdContentsJustDigits()
: model._newLcdContents(disableWindow: disableWindow);
if (blink.blinking || model.errorBlink) {
bool on = true;
final blank = LcdContents.blank();
final Duration d;
if (blink.blinking) {
d = const Duration(milliseconds: 400);
} else {
d = const Duration(milliseconds: 200);
}
final t = Timer.periodic(d, (_) {
on = !on;
show(on ? c : blank);
});
c._myTimer = t;
blank._myTimer = t;
show(c);
} else if (flash) {
final t = Timer(const Duration(milliseconds: 40), () {
show(c);
});
c._myTimer = t;
show(LcdContents.blank().._myTimer = t);
} else {
c._myTimer = null;
show(c);
}
}