Fix plotImage and showImage behavior in the sim (#387)
* Fix plotImage and showImage behavior in the sim * Minor fix
This commit is contained in:
parent
3721eb32ca
commit
43bad888dc
@ -131,15 +131,33 @@ namespace pxsim.images {
|
||||
namespace pxsim.ImageMethods {
|
||||
export function showImage(leds: Image, offset: number, interval: number) {
|
||||
pxtrt.nullCheck(leds)
|
||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||
runtime.queueDisplayUpdate()
|
||||
basic.pause(interval);
|
||||
let cb = getResume();
|
||||
let first = true;
|
||||
|
||||
board().ledMatrixState.animationQ.enqueue({
|
||||
interval,
|
||||
frame: () => {
|
||||
if (first) {
|
||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||
first = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
whenDone: cb
|
||||
})
|
||||
}
|
||||
|
||||
export function plotImage(leds: Image, offset: number): void {
|
||||
pxtrt.nullCheck(leds)
|
||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||
runtime.queueDisplayUpdate()
|
||||
|
||||
board().ledMatrixState.animationQ.enqueue({
|
||||
interval: 0,
|
||||
frame: () => {
|
||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function height(leds: Image): number {
|
||||
|
Loading…
Reference in New Issue
Block a user