Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.

Commit 50097a0

Browse files
committed
fix: finalize 'moved' event logic by removing debug logs
1 parent 9f511dd commit 50097a0

1 file changed

Lines changed: 0 additions & 17 deletions

File tree

src/extensions/microbitMore/index.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,7 +2876,6 @@ class MbitMoreBlocks {
28762876
* Update the last occured time of all gesture events.
28772877
*/
28782878
updatePrevGestureEvents () {
2879-
console.log(`[DEBUG MOVED] updatePrevGestureEvents at ${performance.now().toFixed(3)}ms`);
28802879
this.prevGestureEvents = {};
28812880
Object.entries(this._peripheral.gestureEvents).forEach(([gestureName, timestamp]) => {
28822881
this.prevGestureEvents[gestureName] = timestamp;
@@ -2899,7 +2898,6 @@ class MbitMoreBlocks {
28992898
const gestureName = args.GESTURE;
29002899
if (gestureName === 'MOVED') {
29012900
const now = Date.now();
2902-
const perfNow = performance.now();
29032901
const stepTime = this.runtime.currentStepTime;
29042902
const gapThreshold = stepTime * 5; // 5フレームの空白
29052903
const timeoutThreshold = stepTime * 30; // 30フレームで強制発火
@@ -2924,14 +2922,10 @@ class MbitMoreBlocks {
29242922
const timeSinceLastOccurred = this.lastGestureOccurredTime === null ?
29252923
Infinity : (now - this.lastGestureOccurredTime);
29262924
if (timeSinceLastOccurred >= gapThreshold) {
2927-
if (this.isWaitingForGap) {
2928-
console.log(`[DEBUG MOVED] Gap detected (${timeSinceLastOccurred.toFixed(1)}ms). Resetting.`);
2929-
}
29302925
this.isWaitingForGap = false;
29312926
}
29322927

29332928
let shouldFire = false;
2934-
let fireReason = '';
29352929

29362930
if (eventDetected) {
29372931
if (this.isWaitingForGap) {
@@ -2940,26 +2934,15 @@ class MbitMoreBlocks {
29402934
Infinity : (now - this.lastMovedEventTime);
29412935
if (timeSinceLastFired >= timeoutThreshold) {
29422936
shouldFire = true;
2943-
fireReason = `Continuous movement timeout (${timeSinceLastFired.toFixed(1)}ms)`;
29442937
}
29452938
} else {
29462939
shouldFire = true;
2947-
fireReason = 'Movement started after gap';
2948-
}
2949-
}
2950-
2951-
if (eventDetected || shouldFire || this.isWaitingForGap) {
2952-
console.log(`[DEBUG MOVED] Time: ${perfNow.toFixed(3)}ms, Detected: ${eventDetected}, ` +
2953-
`Waiting: ${this.isWaitingForGap}, ShouldFire: ${shouldFire}, Reason: ${fireReason}`);
2954-
if (eventDetected) {
2955-
console.log(`[DEBUG MOVED] Changes: [${changedGestures.join(', ')}]`);
29562940
}
29572941
}
29582942

29592943
if (shouldFire) {
29602944
this.lastMovedEventTime = now;
29612945
this.isWaitingForGap = true;
2962-
console.log(`[DEBUG MOVED] *** FIRED *** at ${perfNow.toFixed(3)}ms`);
29632946
}
29642947

29652948
return shouldFire;

0 commit comments

Comments
 (0)