Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Running Code on Raspberry Pi Simulator With LCD #62

Merged
merged 3 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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