f0821f8d6c
* cooperate pause * fix math * update lastPause before pausing * faster cooperation Co-authored-by: Peli de Halleux <peli@DESKTOP-5B7QRAM.corp.microsoft.com>
11 lines
270 B
TypeScript
11 lines
270 B
TypeScript
namespace control {
|
|
let lastPause = 0;
|
|
const COOPERATION_INTERVAL = 20
|
|
export function cooperate() {
|
|
const now = control.millis()
|
|
if (now - lastPause > COOPERATION_INTERVAL) {
|
|
lastPause = now
|
|
pause(1)
|
|
}
|
|
}
|
|
} |