From 91d19ddaea9c6528882a69fe006e94bc6e930bcc Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 27 Mar 2015 02:47:48 -0400 Subject: [PATCH] exponential sim speed --- js/cam/Machine.js | 6 +++--- js/main.js | 2 +- js/menus/AnimationMenuView.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/cam/Machine.js b/js/cam/Machine.js index 6a255c2f..b7ff2440 100644 --- a/js/cam/Machine.js +++ b/js/cam/Machine.js @@ -134,7 +134,7 @@ Machine.prototype._normalizeSpeed = function(startingPos, x, y, speed){//xy move }; Machine.prototype._animateObjects = function(objects, axis, speed, startingPos, target, callback){ - var increment = speed/5; + var increment = speed/25*dmaGlobals.assembler.get("simSpeed"); if (increment == 0) { if (callback) callback(); return; @@ -156,7 +156,7 @@ Machine.prototype._incrementalMove = function(objects, axis, increment, currentP if (Math.abs(target-currentPos) < Math.abs(increment)) nextPos = target;//don't overshoot self._setPosition(objects, nextPos, axis); self._incrementalMove(objects, axis, increment, nextPos, target, direction, callback) - }, 50/dmaGlobals.assembler.get("simSpeed")); + }, 10); }; Machine.prototype._setPosition = function(objects, nextPos, axis){ @@ -321,7 +321,7 @@ God.prototype._postPickUpStock = function(exporter, stockPosition, rapidHeight, return data; }; -God.prototype._postReleaseStock = function(cellPosition, cell, exporter, rapidHeight, wcs, safeHeight){ +God.prototype._postReleaseStock = function(cellPosicell, exporter, rapidHeight, wcs, safeHeight){ var data = ""; var cellPosition = cell.getPosition(); data += exporter.rapidXY(cellPosition.x-wcs.x, cellPosition.y-wcs.y); diff --git a/js/main.js b/js/main.js index 68addf3c..3e997510 100644 --- a/js/main.js +++ b/js/main.js @@ -9,7 +9,7 @@ if (typeof dmaGlobals === "undefined") dmaGlobals = {}; $(function(){ //init web workers - window.workers = persistentWorkers(8); +// window.workers = persistentWorkers(8); //init global singletons dmaGlobals.three = new ThreeModel(); diff --git a/js/menus/AnimationMenuView.js b/js/menus/AnimationMenuView.js index 80525570..e76d4fb7 100644 --- a/js/menus/AnimationMenuView.js +++ b/js/menus/AnimationMenuView.js @@ -68,7 +68,7 @@ AnimationMenuView = Backbone.View.extend({ _changeSpeedSlider: function(e){ e.preventDefault(); - dmaGlobals.assembler.set("simSpeed", $(e.target)[0].value); + dmaGlobals.assembler.set("simSpeed", Math.pow(2,$(e.target)[0].value)); }, _drawGcodeHighlighter: function(){ @@ -103,7 +103,7 @@ AnimationMenuView = Backbone.View.extend({ $('#speedSlider').slider({ formatter: function(value) { - return value + "X"; + return Math.pow(2, value) + "X"; } }); }, @@ -119,7 +119,7 @@ AnimationMenuView = Backbone.View.extend({ <a href="#" id="playStockSim" class=" btn btn-block btn-lg btn-success">Play</a>\ <% } %>\ <% } %>\ - <input id="speedSlider" data-slider-id="speedSlider" type="text" data-slider-min="1" data-slider-max="20" data-slider-step="1" data-slider-value="<%= simSpeed %>"/>\ + <input id="speedSlider" data-slider-id="speedSlider" type="text" data-slider-min="0" data-slider-max="6" data-slider-step="1" data-slider-value="<%= Math.log2(simSpeed) %>"/>\ <br/><a href="#" id="saveSendMenu" class=" btn btn-block btn-lg btn-default">Save</a><br/>\ <!--Assembly Time: <br/><br/>-->\ <% if (editsMadeToProgram && needsPostProcessing){ %>\ -- GitLab