mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-12-22 13:53:48 +01:00
move send batch to printer api
This commit is contained in:
parent
721c968341
commit
ce6824ab8b
@ -25,4 +25,17 @@ export default class Printer {
|
||||
stop(gcode = '') {
|
||||
return rest.post(`${ this.api }printer/stop`, { gcode });
|
||||
}
|
||||
async _sendBatch(gcode, start, index) {
|
||||
try {
|
||||
const response = await this.print(gcode, start, start);
|
||||
|
||||
console.log(`batch sent: ${ index }`);
|
||||
} catch(error) {
|
||||
console.log(`failed sending batch: ${ index }`);
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
await this._sendBatch(gcode, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export default class Doodle3DBox extends EventDispatcher {
|
||||
|
||||
// const progress = await this.printer.progress();
|
||||
|
||||
await this._sendBatch(batch, start, index);
|
||||
await this.printer._sendBatch(batch, start, index);
|
||||
|
||||
start = false;
|
||||
lastIndex = index + 1; //skip next \n
|
||||
@ -92,17 +92,4 @@ export default class Doodle3DBox extends EventDispatcher {
|
||||
await sleep(this.updateInterval);
|
||||
}
|
||||
}
|
||||
async _sendBatch(gcode, start, index) {
|
||||
try {
|
||||
const response = await this.printer.print(gcode, start, start);
|
||||
|
||||
console.log(`batch sent: ${ index }`);
|
||||
} catch(error) {
|
||||
console.log(`failed sending batch: ${ index }`);
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
await this._sendBatch(gcode, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user