summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2012-07-31 01:49:16 +0200
committerSebastian Reichel <sre@ring0.de>2012-07-31 01:49:16 +0200
commit8366c5ab7d4f00e9bb71e4b028c27367aa9fd9e3 (patch)
tree51cfaa5416f9a142ca82ba32c8fb50467b625dbd
parent88c3e067d541c193663b5787a3ddfe86318cc0ce (diff)
downloadmicrocopterd-8366c5ab7d4f00e9bb71e4b028c27367aa9fd9e3.tar.bz2
add temporary set speed remote command
-rw-r--r--main.vala14
-rw-r--r--receiver.vala2
-rw-r--r--receiver/socket.vala2
3 files changed, 12 insertions, 6 deletions
diff --git a/main.vala b/main.vala
index d398367..790e0fc 100644
--- a/main.vala
+++ b/main.vala
@@ -45,14 +45,18 @@ int main(string[] args) {
cfg = new Config();
Log.init();
- //gyroscope = cfg.get_gyroscope();
- //accelerometer = cfg.get_accelerometer();
- //compass = cfg.get_compass();
- //barometer = cfg.get_barometer();
- //motorCtrl = cfg.get_motor_controller();
+ gyroscope = cfg.get_gyroscope();
+ accelerometer = cfg.get_accelerometer();
+ compass = cfg.get_compass();
+ barometer = cfg.get_barometer();
+ motorCtrl = cfg.get_motor_controller();
model = cfg.get_model();
receiver = cfg.get_receiver();
+ receiver.set_speed.connect((id, speed) => {
+ motorCtrl.set_single(id, speed);
+ });
+
kinematics = new Kinematics(0, 0); // TODO: Compass
flightCtrl = new FlightControl();
diff --git a/receiver.vala b/receiver.vala
index 7ea5c9f..f1c4655 100644
--- a/receiver.vala
+++ b/receiver.vala
@@ -18,4 +18,6 @@ public abstract class Receiver : Object {
public abstract void init(KeyFile cfg) throws Error;
public abstract int32 get_value(uint8 channel) throws Error;
public abstract void set_value(uint8 channel, int32 value) throws Error;
+
+ public abstract signal void set_speed(uint8 id, uint8 speed);
}
diff --git a/receiver/socket.vala b/receiver/socket.vala
index e9d8eed..79eec85 100644
--- a/receiver/socket.vala
+++ b/receiver/socket.vala
@@ -85,7 +85,7 @@ public class Socket : Receiver {
uint16 port = (uint16) cfg.get_uint64("Socket", "port");
srv = new RPCServer(port);
- srv.set_speed_all.connect((speed) => {channel_data[0] = speed;});
+ srv.set_speed.connect((id, speed) => {set_speed(id, speed);});
}
public override int32 get_value(uint8 channel) {