Skip to content
Snippets Groups Projects
Commit bf11ced3 authored by yoann.archier's avatar yoann.archier
Browse files

Last commit of the Bachelor project web server

parent a0af55ff
No related branches found
No related tags found
No related merge requests found
...@@ -42,8 +42,11 @@ class VolumeControl: ...@@ -42,8 +42,11 @@ class VolumeControl:
#simulate SPI communication MSB first #simulate SPI communication MSB first
for i in range(0, 16): for i in range(0, 16):
GPIO.output(MOSI, value & 0x8000) GPIO.output(MOSI, value & 0x8000)
time.sleep(0.0001)
GPIO.output(CLK, 1) GPIO.output(CLK, 1)
time.sleep(0.0005)
GPIO.output(CLK, 0) GPIO.output(CLK, 0)
time.sleep(0.0005)
value <<= 1 value <<= 1
GPIO.output(CS, 1) GPIO.output(CS, 1)
......
...@@ -68,7 +68,7 @@ def background_thread(): ...@@ -68,7 +68,7 @@ def background_thread():
'nbDet': nbDet, 'nbDet': nbDet,
} }
socketio.emit("updateSensorData", json.dumps(datasend)) socketio.emit("updateSensorData", json.dumps(datasend))
socketio.sleep(0.2) socketio.sleep(0.15)
""" """
Function receive input from client Function receive input from client
...@@ -122,10 +122,16 @@ def detent(message): ...@@ -122,10 +122,16 @@ def detent(message):
valuePos = nbDet valuePos = nbDet
hapticControl.setPos(valuePos) hapticControl.setPos(valuePos)
if scaleBtn < 45:
scaleBtn = 45
hapticControl.setMax(nbDet) hapticControl.setMax(nbDet)
hapticControl.setDistDet(math.radians(scaleBtn/nbDet)) hapticControl.setDistDet(math.radians(scaleBtn/nbDet))
@socketio.on('resetPos')
def resetPos(data):
global valuePos
valuePos = data
hapticControl.setPos(valuePos)
""" """
Server root index file Server root index file
""" """
......
...@@ -47,6 +47,12 @@ body { ...@@ -47,6 +47,12 @@ body {
font-size: 35px; font-size: 35px;
color: black; color: black;
} }
.btn-primary:hover {
background-color: #b28958;
border-color: #b28958;
font-size: 35px;
color: white;
}
.lead { .lead {
display: inline-block; display: inline-block;
} }
...@@ -157,14 +163,14 @@ input[type="range"] { ...@@ -157,14 +163,14 @@ input[type="range"] {
pointer-events: none; pointer-events: none;
display: inline-flex; display: inline-flex;
} }
.btn-save { .btn-dartzeel {
background-color: #c6c6c6; background-color: #c6c6c6;
border-color: none; border-color: none;
color: black; color: black;
font-size: 20px; font-size: 20px;
width: 75px; width: 75px;
} }
.btn-save:hover { .btn-dartzeel:hover {
background-color: #b28958; background-color: #b28958;
border-color: none; border-color: none;
color: white; color: white;
......
...@@ -69,6 +69,7 @@ $(document).ready(function () { ...@@ -69,6 +69,7 @@ $(document).ready(function () {
if (value > document.getElementById('InputDetent').max){ if (value > document.getElementById('InputDetent').max){
SliderDetent.value = document.getElementById('InputDetent').max; SliderDetent.value = document.getElementById('InputDetent').max;
} }
InputDetent.value = SliderDetent.value;
sendDetentParam(); sendDetentParam();
} }
...@@ -109,6 +110,8 @@ $(document).ready(function () { ...@@ -109,6 +110,8 @@ $(document).ready(function () {
const InputStrenghtDet = document.getElementById('InputStrenghtDet'); const InputStrenghtDet = document.getElementById('InputStrenghtDet');
const InputSnapPoint = document.getElementById('InputSnap'); const InputSnapPoint = document.getElementById('InputSnap');
const BtnResetPos = document.getElementById('ResetButton');
SliderMin.oninput = () => controlFromSlider(SliderMin, SliderMax, InputMin); SliderMin.oninput = () => controlFromSlider(SliderMin, SliderMax, InputMin);
SliderMax.oninput = () => controlToSlider(SliderMin, SliderMax, InputMax); SliderMax.oninput = () => controlToSlider(SliderMin, SliderMax, InputMax);
InputMin.oninput = () => controlFromInput(SliderMin, InputMin, InputMax, SliderMax); InputMin.oninput = () => controlFromInput(SliderMin, InputMin, InputMax, SliderMax);
...@@ -121,6 +124,8 @@ $(document).ready(function () { ...@@ -121,6 +124,8 @@ $(document).ready(function () {
InputStrenghtDet.oninput = () => sendMessage("strenghtDet", InputStrenghtDet); InputStrenghtDet.oninput = () => sendMessage("strenghtDet", InputStrenghtDet);
InputStrenghtEnd.oninput = () => sendMessage("strenghtEnd", InputStrenghtEnd); InputStrenghtEnd.oninput = () => sendMessage("strenghtEnd", InputStrenghtEnd);
InputSnapPoint.oninput = () => sendMessage("snapPoint", InputSnapPoint); InputSnapPoint.oninput = () => sendMessage("snapPoint", InputSnapPoint);
BtnResetPos.onclick = () => sendMessage("resetPos", 0);
/* /*
socket io socket io
*/ */
......
...@@ -136,10 +136,18 @@ ...@@ -136,10 +136,18 @@
<div class="form_control_container__time lead"> <div class="form_control_container__time lead">
Sauvegarder la configuration : Sauvegarder la configuration :
</div> </div>
<button type="button" class="btn btn-save right-cell" id="SaveButton" > <button type="button" class="btn btn-dartzeel right-cell" id="SaveButton" >
<i class='bi bi-save2'></i> <i class='bi bi-save2'></i>
</button> </button>
</div> </div>
<div class="form_control_container__time form_control">
<div class="form_control_container__time lead">
Remise à zéro de la position :
</div>
<button type="button" class="btn btn-dartzeel right-cell" id="ResetButton" >
<i class='bi bi-arrow-counterclockwise'></i>
</button>
</div>
<p></p> <p></p>
</div> </div>
</div> </div>
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<div class="lead" id="Volume" style="display: inline-block;"> Volume : </div> <div class="lead" id="Volume" style="display: inline-block;"> Volume : </div>
<div class="number" id="VolumeValue" style="display: inline-block;">0 dB </div> <div class="number" id="VolumeValue" style="display: inline-block;">0 dB </div>
<!-- add button mute--> <!-- add button mute-->
<button type="button" class="btn btn-primary right-cell" id="MuteButton"> <button type="button" class="btn btn-primary btn-primary right-cell" id="MuteButton">
<i class='bi bi-volume-up'></i> <i class='bi bi-volume-up'></i>
</button> </button>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment