Skip to content

Commit

Permalink
Merge pull request #62 from silbogdan/master
Browse files Browse the repository at this point in the history
Fixed Running Code on Raspberry Pi Simulator With LCD
  • Loading branch information
alexandruradovici authored Apr 18, 2021
2 parents 610eebe + 0d79565 commit e17238d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ let lcd_library = {
if (correctPins) {
let createLcd = true;

for (let pin of Object.keys(dataNumber.properties)) {
if (generic_raspberrypi.dataLoaded.assignedPins.includes(dataNumber.properties[pin])) {
for (let pin of Object.keys(dataNumber)) {
if (generic_raspberrypi.dataLoaded.assignedPins.includes(dataNumber[pin])) {
createLcd = false;
}
}
Expand All @@ -82,8 +82,8 @@ let lcd_library = {
}

if (createLcd) {
for (let pin of Object.keys(dataNumber.properties)) {
generic_raspberrypi.dataLoaded.assignedPins.push(dataNumber.properties[pin]);
for (let pin of Object.keys(dataNumber)) {
generic_raspberrypi.dataLoaded.assignedPins.push(dataNumber[pin]);
}

generic_raspberrypi.dataLoaded.assignedPins.push(rsNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function update_components() {
}

for (let component of Object.keys(generic_raspberrypi.dataLoaded.components)) {
if (generic_raspberrypi.dataLoaded.components[component].name === 'lcd' && generic_raspberrypi.dataLoaded.components[component].active) {
if (generic_raspberrypi.dataLoaded.components[component].name === 'lcd') {
for (let i = 0; i < 16; i ++) {
if (generic_raspberrypi.dataLoaded.components[component].segments[0][i + generic_raspberrypi.dataLoaded.components[component].shift] === undefined) {
document.getElementById('segment ' + 0 + '-' + i).innerHTML = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ export default {
document.getElementById('lcd_display').removeChild(document.getElementById('lcd_display').firstChild);
}
// Create an array for LCD segments simulation
this.lcdComponents = [];
// Create the list needed for the table of components
for (let component of Object.keys(this.projectData.components)) {
let newComponent = {
Expand Down Expand Up @@ -209,8 +212,7 @@ export default {
// Add the component to the table
this.componentsTable.push(newComponent);
// Create the LCD segments simulation and add them to the HTML
this.lcdComponents = [];
// Push the LCD segments simulation to add them to the HTML
if (this.projectData.components[component].name === 'lcd') {
this.lcdComponents.push(component);
}
Expand Down

0 comments on commit e17238d

Please sign in to comment.