0.4.1 Fixed propogation bug with IC's

This commit is contained in:
MatCat 2021-03-07 21:15:08 -08:00
parent 131cf088db
commit 9a8736491b
3 changed files with 17 additions and 2 deletions

View File

@ -12,6 +12,10 @@ To be decided, but at this moment this code is open source and free to use for n
## Changelog
### 0.4.1
* Fixed a signal propogation bug with IC's
### 0.4.0
* You can now pan the work area, hold ctrl key while mouse dragging an empty area.

View File

@ -551,6 +551,8 @@ class ICInput extends Element {
if (value === false) this.Input = false;
if (value !== false) this.Input = true;
console.log(this.Designator + " setInput " + this.Input + " = " + value);
this.Inputs[0] = this.Input;
if (!this.Task.Enabled) {
this.Task.LastCall = 0;
@ -630,7 +632,9 @@ class ICOutput extends Element {
setInput(notused = 0,value) {
if (notused > 0) return;
console.log(this.Designator + " setInput " + notused + " = " + value);
value = this._Container.isHigh(this,0);
console.log("Actual " + value);
if (value === false) this.Input = false;
if (value !== false) this.Input = true;
this.Inputs[0] = this.Input;
@ -648,6 +652,8 @@ class ICOutput extends Element {
//console.log(this);
for (let a = 0; a < this.OutputConnections.length; a++) {
this.LogicEngine.RecursionCount = 0;
console.log(this.Designator + " clockTick: Set " + this.OutputConnections[a].Element.Designator + " I[" + this.OutputConnections[a].Input + "] = " + this.getOutput());
console.log(this._Container);
this.OutputConnections[a].Element.setInput(this.OutputConnections[a].Input, this.getOutput());
}
}
@ -769,9 +775,13 @@ class ICElement extends Element {
setInput(Input, Value) {
if (this.InputConnections.length >= Input) {
// No need to worry about recursion as this goes to an input element which is buffered
//console.log(this.Designator + " setInput " + Input + " = " + Value);
Value = this._Container.isHigh(this,Input);
this.Inputs[Input] = (Value === false) ? false : true;
//console.log("Actual: " + this.Inputs[Input]);
//console.log("Calling " + this.InputConnections[Input].toElement.Designator);
this.InputConnections[Input].toElement.setInput(this.InputConnections[Input].Input,Value);
//console.log("Setting " + this.InputConnections[Input].toElement.Designator);
this.InputConnections[Input].toElement.setInput(0,Value);
}
return false;
}
@ -806,6 +816,7 @@ class ICElement extends Element {
ctx.arc(x+10,firstY + (a*24),this.inputCircleRadius,0,2*Math.PI);
ctx.strokeStyle = borderColor;
ctx.fillStyle = circleColorFalse;
//console.log(this.Designator + ": I[" + a + "]: " + this.Inputs[a]);
if (this.Inputs[a]) ctx.fillStyle = circleColorTrue;
if ((mouseDist <= (this.inputCircleRadius)) && this.LogicEngine.ActiveLink) ctx.fillStyle = circleColorHover;
ctx.fill();

View File

@ -2,7 +2,7 @@
MatCat BrowserLogic Simulator
*/
let Version = "0.4.0";
let Version = "0.4.1";
let spanVersion = document.getElementById("version");
spanVersion.innerText = Version;
// get the canvas and get the engine object going