Due to a scheduled upgrade to version 14.10, GitLab will be unavailabe on Monday 30.05., from 19:00 until 20:00.

Commit ee06fe79 authored by Jens-Christian Fischer's avatar Jens-Christian Fischer
Browse files

working version with DKAH

parent 52cc30da
......@@ -14,13 +14,9 @@ defmodule Grains.AccelerationChannel do
Logger.info("acceleration #{inspect(params)}")
uuid = socket.assigns.user_uuid
x = params["x"]
y = params["y"]
z = params["z"]
Grengine.Performance.set_values(uuid, %{
x: x,
y: y,
z: z
} )
......
......@@ -21,14 +21,10 @@ defmodule Grains.OrientationChannel do
uuid = socket.assigns.user_uuid
pitch = params["pitch"]
roll = params["roll"]
yaw = params["yaw"]
heading = params["heading"]
Grengine.Performance.set_values(uuid, %{
pitch: pitch,
roll: roll,
yaw: yaw,
heading: heading
} )
# Grains.Endpoint.broadcast("osc", "orientation", %{user: socket.assigns.user_uuid,
......
......@@ -6,7 +6,7 @@ let AccelerationPanel = {
accelerationChannel : null,
sliders: {},
slider_titles: ["x", "y", "z"],
slider_titles: ["z"],
old_values: [0,0,0],
init(socket, domId) {
......@@ -35,12 +35,10 @@ let AccelerationPanel = {
});
console.log("adding acceleration");
this.orientation = new Interface.Accelerometer({
onvaluechange: function(x,y,z) {
that.sliders['x'].setValue(x);
that.sliders['y'].setValue(y);
onvaluechange: function(_x, _y,z) {
that.sliders['z'].setValue(z);
that.send_value([z,y,z]);
that.send_value([z]);
}
}).start();
......@@ -67,10 +65,8 @@ let AccelerationPanel = {
});
if (!_.isEqual(scaled, this.old_values)) {
console.log(scaled);
let payload = {x: scaled[0],
y: scaled[1],
z: scaled[2]
};
let payload = {z: scaled[0]};
this.accelerationChannel.push("acceleration", payload)
.receive("error", e => console.log(e));
this.old_values = scaled;
......
......@@ -6,7 +6,7 @@ let OrientationPanel = {
orientationChannel : null,
sliders: {},
slider_titles: ["pitch", "roll", "yaw", "heading"],
slider_titles: ["pitch", "roll"],
old_values: [0,0,0,0],
init(socket, domId) {
......@@ -35,13 +35,11 @@ let OrientationPanel = {
});
console.log("adding orientation");
this.orientation = new Interface.Orientation({
onvaluechange: function(pitch, roll, yaw, heading) {
onvaluechange: function(pitch, roll, _yaw, _heading) {
that.sliders['pitch'].setValue(pitch);
that.sliders['roll'].setValue(roll);
that.sliders['yaw'].setValue(yaw);
that.sliders['heading'].setValue(heading);
that.send_value([pitch, roll, yaw, heading]);
that.send_value([pitch, roll]);
}
}).start();
......@@ -71,9 +69,7 @@ let OrientationPanel = {
if (!_.isEqual(scaled, this.old_values)) {
// console.log(scaled);
let payload = {pitch: scaled[0],
roll: scaled[1],
yaw: scaled[2],
heading: scaled[3]
roll: scaled[1]
};
this.orientationChannel.push("orientation", payload)
.receive("error", e => console.log(e));
......
......@@ -2,3 +2,5 @@
<p>Orientation</p>
<div id="orientationPanel" class="interfacePanel"></div>
Acceleration
<div id="accelerationPanel" class="interfacePanel"></div>
Markdown is supported
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