mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 05:37:55 +01:00
sliceInfo
This commit is contained in:
parent
13cc1238f1
commit
602b5b35fe
@ -60,7 +60,10 @@ const styles = {
|
|||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
},
|
},
|
||||||
sliceInfo: {
|
sliceInfo: {
|
||||||
margin: '10px 0'
|
margin: '10px 0',
|
||||||
|
'& p': {
|
||||||
|
marginBottom: '5px'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sliceButtons: {
|
sliceButtons: {
|
||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
|
@ -155,13 +155,14 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
case 'WIFI':
|
case 'WIFI':
|
||||||
if (settings.printer === 'doodle3d_printer') {
|
if (settings.printer === 'doodle3d_printer') {
|
||||||
const { state } = await getMalyanStatus(settings.ip);
|
const { state } = await getMalyanStatus(settings.ip);
|
||||||
if (state !== 'idle') throw { message: 'printer must be idle before starting a print', code: 0 };
|
if (state !== 'idle') throw { message: 'printer is busy', code: 0 };
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wifiBox = new Doodle3DBox(settings.ip);
|
wifiBox = new Doodle3DBox(settings.ip);
|
||||||
if (!await wifiBox.checkAlive()) throw { message: `can't connect to printer`, code: 4 }
|
if (!await wifiBox.checkAlive()) throw { message: `can't connect to printer`, code: 4 }
|
||||||
|
|
||||||
const { state } = await wifiBox.info.status();
|
const { state } = await wifiBox.info.status();
|
||||||
if (state !== 'idle') throw { message: 'printer must be idle before starting a print', code: 0 };
|
if (state !== 'idle') throw { message: 'printer is busy', code: 0 };
|
||||||
}
|
}
|
||||||
steps = 2;
|
steps = 2;
|
||||||
break;
|
break;
|
||||||
@ -203,7 +204,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
loaded += 15 * 1024;
|
loaded += 15 * 1024;
|
||||||
updateProgress({
|
updateProgress({
|
||||||
action: 'Uploading',
|
action: 'Uploading to printer',
|
||||||
percentage: (currentStep + loaded / file.size) / steps
|
percentage: (currentStep + loaded / file.size) / steps
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@ -211,7 +212,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
// await fetchProgress(`http://${settings.ip}/set?code=M563 S4`, { method: 'GET' });
|
// await fetchProgress(`http://${settings.ip}/set?code=M563 S4`, { method: 'GET' });
|
||||||
await fetch(`http://${settings.ip}/upload`, { method: 'POST', body, mode: 'no-cors' }, (progress) => {
|
await fetch(`http://${settings.ip}/upload`, { method: 'POST', body, mode: 'no-cors' }, (progress) => {
|
||||||
updateProgress({
|
updateProgress({
|
||||||
action: 'Uploading',
|
action: 'Uploading to printer',
|
||||||
percentage: (currentStep + progress.loaded / progress.total) / steps
|
percentage: (currentStep + progress.loaded / progress.total) / steps
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user