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,
|
||||
},
|
||||
sliceInfo: {
|
||||
margin: '10px 0'
|
||||
margin: '10px 0',
|
||||
'& p': {
|
||||
marginBottom: '5px'
|
||||
}
|
||||
},
|
||||
sliceButtons: {
|
||||
justifyContent: 'flex-end',
|
||||
|
@ -155,13 +155,14 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
||||
case 'WIFI':
|
||||
if (settings.printer === 'doodle3d_printer') {
|
||||
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 {
|
||||
wifiBox = new Doodle3DBox(settings.ip);
|
||||
if (!await wifiBox.checkAlive()) throw { message: `can't connect to printer`, code: 4 }
|
||||
|
||||
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;
|
||||
break;
|
||||
@ -203,7 +204,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
||||
const interval = setInterval(() => {
|
||||
loaded += 15 * 1024;
|
||||
updateProgress({
|
||||
action: 'Uploading',
|
||||
action: 'Uploading to printer',
|
||||
percentage: (currentStep + loaded / file.size) / steps
|
||||
});
|
||||
}, 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 fetch(`http://${settings.ip}/upload`, { method: 'POST', body, mode: 'no-cors' }, (progress) => {
|
||||
updateProgress({
|
||||
action: 'Uploading',
|
||||
action: 'Uploading to printer',
|
||||
percentage: (currentStep + progress.loaded / progress.total) / steps
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user