Skip to content
Permalink
Browse files

presets for sparkmaker and FHD

Added presets to make it easier to switch between original sparkmaker and sparkmaker FHD settings. Custom settings are supported as well
  • Loading branch information...
Adukra committed Oct 4, 2018
1 parent 6dde259 commit 36c1ed877be87f105e89e7adb51214002996f5d6
Showing with 122 additions and 1 deletion.
  1. +10 −0 index.html
  2. +112 −1 js/main.js
@@ -108,6 +108,14 @@ <h3 class="panel-title">File</h3>
</span>
<small>Or drop an STL file anywhere.<br>In case of error check your model <a href="https://service.netfabb.com/service.php">here</a>!</small>
</div>
<div class="form-group">
<label for="printer-type" style="width: 25%;">Printer</label>
<select id="printer-type" class="form-control input-sm" style="width: 75%;">
<option>Sparkmaker</option>
<option>Sparkmaker FHD</option>
<option>Custom</option>
</select>
</div>
</div>
</div><!-- #file -->

@@ -391,6 +399,8 @@ <h3 class="panel-title">GCode</h3>
<p class="message">Alert message empty...</p>
</div>

<div id="dialog-confirm"></div>

<script src="vendor/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="vendor/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
@@ -7,7 +7,8 @@ var settings = new SLAcer.Settings({
panel: {
collapsed: false,
position : 0
}
},
printer: 'Custom'
},
slicer: {
layers: {
@@ -615,6 +616,7 @@ function parseUnit(value, unit) {
// File panel
var $fileBody = initPanel('file');
var $fileInput = $fileBody.find('#file-input');
var $printerType = $fileBody.find('#printer-type');
var loadedFile = null;

$fileInput.on('change', function(e) {
@@ -623,6 +625,115 @@ $fileInput.on('change', function(e) {
loader.loadFile(loadedFile);
});

$printerType.on('change', function(e) {
newPrinterType = $printerType.val();

if (newPrinterType == 'Custom') {
// update printerType setting only
settings.set('file.printer', newPrinterType);
}
else {
// TODO: need to fix slider errors when using jquery-ui full (as opposed to .min). Then we can use this confirm dialog
// // make sure user is willing to update screen, build volume, and outputType settings
// $("#dialog-confirm").html("Are you sure you want to replace screen, build volume, gcode, and outputType settings with \"" + newPrinterType + "\" defaults?");
// $("#dialog-confirm").dialog({
// resizable: false,
// modal: true,
// title: "Update Settings?",
// height: 250,
// width: 400,
// buttons: {
// "Yes": function () {
// $(this).dialog('close');
// update settings
settings.set('file.printer', newPrinterType);
printerDefaults(newPrinterType);
// },
// "No": function () {
// $(this).dialog('close');
// // revert printerType input to the old printer-type value from settings
// $printerType.val(settings.get('file.printer'));
// }
// }
// });
}
});

function printerDefaults(printerType) {
// update settings and UI
if (printerType == 'Sparkmaker') {
// screen
settings.set('screen', {
width : 854,
height : 480,
diagonal: {
size: 4.6,
unit: 'in'
}
});
$('#screen-diagonal-unit-' + settings.get('screen.diagonal.unit')).prop('checked', true);
updateScreenUI();

// build volume x,y,z,unit
settings.set('buildVolume', {
size: {
x: 102,
y: 56,
z: 125
},
unit: 'mm'
});
$('#build-volume-unit-' + settings.get('buildVolume.unit')).prop('checked', true);
updateBuildVolumeUI()

// outputType
settings.set('slicer.output', 'wow');
$outputType.val(settings.get('slicer.output'));

// gcode
resetGcodeStart(); // gcode prefix and suffix are the same for both Sparkmaker and Sparkmaker FHD for now
resetGcodeEnd();
}
else if (printerType == 'Sparkmaker FHD') {
// screen
settings.set('screen', {
width : 1920,
height : 1080,
diagonal: {
size: 4.9686,
unit: 'in'
}
});
$('#screen-diagonal-unit-' + settings.get('screen.diagonal.unit')).prop('checked', true);
updateScreenUI();

// build volume
settings.set('buildVolume', {
size: {
x: 110.016,
y: 61.8357,
z: 125
},
unit: 'mm'
});
$('#build-volume-unit-' + settings.get('buildVolume.unit')).prop('checked', true);
updateBuildVolumeUI()

// outputType
settings.set('slicer.output', 'fhd');
$outputType.val(settings.get('slicer.output'));

// gcode
resetGcodeStart(); // gcode prefix and suffix are the same for both Sparkmaker and Sparkmaker FHD for now
resetGcodeEnd();
}

// reload 3d view with new screen and build-volume settings
updateBuildVolumeSettings();
updateScreenSettings();
}


// Mesh panel
var $meshBody = initPanel('mesh');
var $meshFaces = $meshBody.find('#mesh-faces');

0 comments on commit 36c1ed8

Please sign in to comment.
You can’t perform that action at this time.