From ca82dbbb4eaff350cab15055dd419a189fe22a13 Mon Sep 17 00:00:00 2001 From: Bogdan Silvasan Date: Wed, 14 Apr 2021 13:30:04 +0300 Subject: [PATCH 1/3] Fixed wrong reference to undefined --- .../simulators/raspberrypi/JSInterpreter/lcd_library.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/plugins/simulators/raspberrypi/JSInterpreter/lcd_library.js b/source/plugins/simulators/raspberrypi/JSInterpreter/lcd_library.js index 3704852d..b94e02e4 100644 --- a/source/plugins/simulators/raspberrypi/JSInterpreter/lcd_library.js +++ b/source/plugins/simulators/raspberrypi/JSInterpreter/lcd_library.js @@ -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; } } @@ -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); From 88b950ff537e48c673459dc76fa297e127349b00 Mon Sep 17 00:00:00 2001 From: Bogdan Silvasan Date: Wed, 14 Apr 2021 13:31:28 +0300 Subject: [PATCH 2/3] Removed check for non-existent 'active' property --- .../simulators/raspberrypi/libraries/utils/update_components.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/plugins/simulators/raspberrypi/libraries/utils/update_components.js b/source/plugins/simulators/raspberrypi/libraries/utils/update_components.js index 9fffb4f8..27828847 100644 --- a/source/plugins/simulators/raspberrypi/libraries/utils/update_components.js +++ b/source/plugins/simulators/raspberrypi/libraries/utils/update_components.js @@ -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 = ''; From 0d79565d4bf7e290d0ac1951963a659a273a0e6a Mon Sep 17 00:00:00 2001 From: Bogdan Silvasan Date: Sun, 18 Apr 2021 17:47:21 +0300 Subject: [PATCH 3/3] Initialized array in the right spot --- .../simulators/raspberrypi/views/RaspberrypiSimulator.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/plugins/simulators/raspberrypi/views/RaspberrypiSimulator.vue b/source/plugins/simulators/raspberrypi/views/RaspberrypiSimulator.vue index d8c40de5..bd8c73b1 100644 --- a/source/plugins/simulators/raspberrypi/views/RaspberrypiSimulator.vue +++ b/source/plugins/simulators/raspberrypi/views/RaspberrypiSimulator.vue @@ -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 = { @@ -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); }