Skip to content

Commit

Permalink
More missing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
passeng02 committed Mar 7, 2023
1 parent 59900e7 commit bd14b22
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
10 changes: 9 additions & 1 deletion ArduinoFrontend/src/app/Libs/UndoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export abstract class UndoUtils {
* Call this function to Undo
*/
static workspaceUndo() {
console.log("Workspace undo")
if (this.undo.length > 0) {
const cng = this.undo.pop();
this.loadChange(cng, 'undo');
Expand Down Expand Up @@ -127,10 +128,12 @@ export abstract class UndoUtils {
* @param operation undo/redo
*/
static async loadChange(ele, operation) {
console.log("LoadChange")
// All elements in window.scope with similar
const grup = window.scope[ele.keyName];

// Check if dragJson is present, & jump to next operation if both dx & dy are 0
//Which case is this??
if (ele.dragJson) {
if (ele.dragJson.dx === 0 && ele.dragJson.dy === 0) {
if (operation === 'undo') {
Expand Down Expand Up @@ -280,16 +283,21 @@ export abstract class UndoUtils {
const existing = this.getExistingWindowElement(grup, ele);
if (operation === 'undo') {
if (ele.keyName === 'BreadBoard') {
console.log("BreadBoard specific drag")
existing.transformBoardPosition(-ele.dragJson.dx, -ele.dragJson.dy);
} else {
existing.transformPosition(-ele.dragJson.dx, -ele.dragJson.dy);
}
} else {
existing.transformPosition(ele.dragJson.dx, ele.dragJson.dy);

if (ele.keyName !== 'BreadBoard') {
existing.transformPosition(ele.dragJson.dx, ele.dragJson.dy);
Workspace.onDragEvent(existing);
Workspace.onDragStopEvent(existing);
}
else {
existing.transformBoardPosition(ele.dragJson.dx, ele.dragJson.dy);
}
}
for (const ec in window.scope['wires']) {
if (window.scope['wires'].hasOwnProperty(ec)) {
Expand Down
4 changes: 3 additions & 1 deletion ArduinoFrontend/src/app/Libs/outputs/Display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ export class LCD16X2 extends CircuitElement {

const posX = this.data.startX;
const posY = this.data.startY;

// Getting the number of pixel/panel rows, columns from the active data display state
const gridRows = this.dataDisplayState.getPixelRows();
const gridColumns = this.dataDisplayState.getPixelColumns();
Expand Down Expand Up @@ -696,6 +696,8 @@ export class LCD16X2 extends CircuitElement {
const isConnectedRowInFirstBlock = connectedRow <= 101;

// checking for all the nodes with the same x-coordinate
console.log(breadboard.sameXNodes)
console.log(connectedPin.x)
for (const neighbor of breadboard.sameXNodes[connectedPin.x]) {
const neighborRow = neighbor.label.charCodeAt(0);
const isSameBlock = neighborRow <= 101 === isConnectedRowInFirstBlock;
Expand Down
3 changes: 2 additions & 1 deletion ArduinoFrontend/src/assets/jsons/Arduino.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@
"SRAM": "2KB(ATmega328)",
"Clock Speed": "16MHz",
"EEPROM": "1 KB (ATmega328)",
"LED": "Inbuilt"
"LED": "Inbuilt",
"isBreadBoardPlaceable" : 0
}
}
}
7 changes: 4 additions & 3 deletions ArduinoFrontend/src/assets/jsons/Breadboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -2015,8 +2015,9 @@
}
],
"simulation": {},
"info": {},
"data" : {
"groupings" : [["a","b","c","d","e"],["f","g","h","i","j"]]
"info": {
"properties" : {
"isBreadBoardPlaceable" : 0
}
}
}
3 changes: 2 additions & 1 deletion ArduinoFrontend/src/assets/jsons/LCD16X2.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
"Operating Voltage": "4.7V to 5.3V",
"Current consumption": "1mA (without backlight)",
"Work Mode": " 8-bit and 4-bit mode",
"Voltage Rated": "3V-5V"
"Voltage Rated": "3V-5V",
"isBreadBoardPlaceable" : 1
}
}
}
3 changes: 2 additions & 1 deletion ArduinoFrontend/src/assets/jsons/LED.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
"description": "A light-emitting diode (LED) is a semiconductor light source that emits light when current flows through it.",
"properties": {
"Light Color": "White, Yellow, Red, Green & Blue",
"Voltage ": "DC 3V - 5V"
"Voltage ": "DC 3V - 5V",
"isBreadBoardPlaceable" : 1
}
}
}

0 comments on commit bd14b22

Please sign in to comment.