Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute prettier #4291

Merged
merged 3 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file allows ignoring commits in git blame view on Github.
# For more info, see here:
# https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view

# Execute prettier
335719b7b7d90676d76b516f67589a0389adceaa
37 changes: 14 additions & 23 deletions src/components/EscDshotDirection/EscDshotCommandQueue.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,49 @@
import MSP from '../../js/msp.js';
import MSP from "../../js/msp.js";

class EscDshotCommandQueue
{
constructor (intervalMs)
{
class EscDshotCommandQueue {
constructor(intervalMs) {
this._intervalId = null;
this._interval = intervalMs;
this._queue = [];
this._purging = false;
}

pushCommand(command, buffer)
{
pushCommand(command, buffer) {
this._queue.push([command, buffer]);
}

pushPause(milliseconds)
{
pushPause(milliseconds) {
const counter = Math.ceil(milliseconds / this._interval);

for (let i = 0; i < counter; i++) {
this.pushCommand(null, null);
}
}

start()
{
start() {
if (null === this._intervalId) {
this._intervalId = setInterval(
() => { this._checkQueue(); },
this._interval);
this._intervalId = setInterval(() => {
this._checkQueue();
}, this._interval);
}
}

stop()
{
if(null !== this._intervalId) {
stop() {
if (null !== this._intervalId) {
clearInterval(this._intervalId);
this._intervalId = null;
}
}

stopWhenEmpty()
{
stopWhenEmpty() {
this._purging = true;
}

clear()
{
clear() {
this._queue = [];
}

_checkQueue()
{
_checkQueue() {
if (0 !== this._queue.length) {
const command = this._queue.shift();

Expand Down
Loading
Loading