diff --git a/index.html b/index.html index ac764f7..671d310 100644 --- a/index.html +++ b/index.html @@ -16,7 +16,7 @@

Opamp Designer

-

Try it Out

(Works, but not completely)

+

Try it Out

Write the coefficients of all the terms in the equation with a space

diff --git a/js/execute.js b/js/execute.js index 3327fda..cd56220 100644 --- a/js/execute.js +++ b/js/execute.js @@ -1,6 +1,6 @@ function generateCircuit(){ circuit.init(ctx); - circuit.drawOpamp(ctx, 36, 24); + circuit.drawOpamp(ctx, 39, 24); circuit.drawGridX(ctx); circuit.drawGridY(ctx); circuit.evaluateInput(localStorage.getItem("query")); diff --git a/js/renderer.js b/js/renderer.js index 416ba87..b90d124 100644 --- a/js/renderer.js +++ b/js/renderer.js @@ -51,6 +51,8 @@ var circuit = { nodes["Vout"] = {x: x+4,y: y}; nodes["Vplus"] = {x: x,y: y+2}; nodes["Vminus"] = {x: x,y: y-2}; + fillText(ctx,"+",nodes.Vplus.x + 0.2,nodes.Vplus.y+0.4); + fillText(ctx,"-",nodes.Vminus.x + 0.3,nodes.Vminus.y+0.4); }, extendRight: function(ctx,node,length){ @@ -152,7 +154,7 @@ var circuit = { this.extendLeft(ctx,nodes.Vminus,8); this.markNode(ctx,nodes.current,"nodeNegative"); this.extendLeft(ctx,nodes.Vplus,4); - if(this.z < 0) { + if(this.z > 0) { this.markNode(ctx,nodes.current,"nodeX"); } this.extendLeft(ctx,nodes.current,4); @@ -169,15 +171,15 @@ var circuit = { this.z = this.z + int; if(int > 0) this.posTerms.push(obj); if(int < 0) this.negTerms.push(obj); - } + } }, drawNegative : function(ctx){ for(var i=0;i