Commit 0e416ebd authored by boncoi's avatar boncoi
Browse files

Prototype Elevator done

Bugs:
if you clic on multiple button at a time it breaks + animation is supposed to be 2s
the elevator doesn take in count the up/down sensor at the moment
To test the prototype, call is made in function pressButon and pressButonCabin
parent e02a4076
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.757250542" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1637907223727722171" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.286540973" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1637907223727722171" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.757250542" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1475399000198820562" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.286540973" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1475399000198820562" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>
2F62501ED4689FB349E356AB974DBE57=27A19688D8FCA27F331360B1EECE8AF0
8DF89ED150041C4CBC7CB9A9CAA90856=27A19688D8FCA27F331360B1EECE8AF0
2F62501ED4689FB349E356AB974DBE57=660202322E05665B281473ACC615FB63
8DF89ED150041C4CBC7CB9A9CAA90856=660202322E05665B281473ACC615FB63
DC22A860405A8BF2F2C095E5B6529F12=550E9617A07E2F5504F54F74A3EB2C09
eclipse.preferences.version=1
This diff is collapsed.
......@@ -55,6 +55,14 @@
.cabin {
max-width: 11.1vh !important;
position: absolute;
}
.containerCabin {
position: absolute;
height: 100%;
width: 10%;
left: 10%;
}
.sideContainerLeft {
......
......@@ -42,6 +42,7 @@
<div class='sketch'>
<div id='cabinButtons'></div>
<div id='cabinSpace'></div>
<table id='sketchTable'></table>
<div id='drcIndicators'></div>
</div>
......
......@@ -78,6 +78,7 @@ function initLastData() {
function pressedButtonOnFloor(floor){
checkAnimationCabin(floor,0)
lastDataInput[floor][5] = 1;
data = recreateData(floor);
lastDataInput[floor][5] = 0;
......@@ -98,6 +99,7 @@ function pressedButtonOnFloor(floor){
function pressedButtonCabin(nbFloorPressed){
checkAnimationCabin(nbFloorPressed)
if(nbFloorPressed==4)lastDataInput[3][6] = 1;
else lastDataInput[3][8+nbFloorPressed] = 1;
data = recreateData(3);
......
......@@ -41,9 +41,6 @@ function addFloor(cabinIsHere, floorNumber, doorState) {
let table = document.getElementById('sketchTable');
let row = document.createElement('tr');
let cabinCell = document.createElement('td');
addCabin(floorNumber, cabinIsHere, cabinCell);
let containerDoorSide = document.createElement('td');
containerDoorSide.classList.add("flexHorizontalContainer");
......@@ -84,10 +81,22 @@ function addFloor(cabinIsHere, floorNumber, doorState) {
containerUserSide.appendChild(bpImage);
containerUserSide.appendChild(indicatorImage);
row.append(cabinCell, containerDoorSide, floorCell, containerUserSide);
row.append(containerDoorSide, floorCell, containerUserSide);
table.appendChild(row);
}
function addCabin(){
let cabinCell = document.getElementById("cabinSpace");
let cabinImage = document.createElement('img');
cabinImage.classList.add("cabin");
addImage(cabinImage, "Cabin", "cabin image", "jpg", "imageCabinFloor");
cabinImage.style.top="76%";
cabinCell.appendChild(cabinImage);
cabinCell.classList.add("containerCabin");
}
function moveCabinToFloor(floor, bis) {
let newFloor;
let currentFloor;
......@@ -105,6 +114,47 @@ function moveCabinToFloor(floor, bis) {
cabin.bis = bis;
}
let minFloorToPixels=76; // in %
let maxFloorToPixels=2; // in %
let keepAnimation=false;
let timeForOneFloor=2; // in s
let fps=60;
let compteurAnimation=0;
function checkAnimationCabin(floor,upDownSensor){
let elevatorCabin=document.getElementById("imageCabinFloor");
let indicatortype;
if(upDownSensor==0)indicatortype="F"+floor;
else if(upDownSensor==1)indicatortype="UF"+floor;
else if( upDownSensor==-1)indicatortype="DF"+floor;
else return;
if(floor-cabin.floor>=2 || floor-cabin.floor<=-2){
cabin.floor=floor;
keepAnimation=false;
elevatorCabin.style.top=""+(maxFloorToPixels+(MAX_FLOOR-floor)*(minFloorToPixels-maxFloorToPixels)/MAX_FLOOR)+"%";
}else{
let facteur=cabin.floor-floor;
cabin.floor=floor;
keepAnimation=true;
compteurAnimation=0;
animationCabin(facteur);
}
}
function animationCabin(facteur){
if(!keepAnimation || compteurAnimation>=fps*timeForOneFloor)return;
let elevatorCabin=document.getElementById("imageCabinFloor");
let tmp=""+(Number(elevatorCabin.style.top.replace("%",""))+facteur*((minFloorToPixels-maxFloorToPixels)/MAX_FLOOR)/(fps*timeForOneFloor))+"%";
if(keepAnimation)elevatorCabin.style.top=tmp;
compteurAnimation++;
setTimeout(()=> {
animationCabin(facteur)
},1000/fps)
}
function changeImageDoorFloor(floor, state) {
let newFloor = document.getElementById("imageDoorFloor" + floor);
addImage(newFloor, "Door" + state, "image state" + state, "jpg", newFloor.id);
......@@ -124,6 +174,7 @@ function initSketch() {
addFloor(false, i, "CLOSE");
}
addSidesElement();
addCabin()
}
// ext : extension of the image : jpeg
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment