Commit c55e7090 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Stop running script interactively

The script is now run as a SlapOS service and not manually.
parent 50afd61b
......@@ -4,16 +4,11 @@
*/
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
/*global console, me*/
/*global me*/
(function (console, me) {
(function (me) {
"use strict";
me.onStart = function () {
me.f = me.fdopen(me.in, "r");
console.log("Use q to quit");
};
me.onUpdate = function (timestamp) {
var drone_dict = {};
Object.entries(me.getDroneDict()).forEach(function ([id, drone]) {
......@@ -24,7 +19,8 @@
yaw: drone.yaw.toFixed(2),
speed: drone.speed.toFixed(2),
climbRate: drone.climbRate.toFixed(2),
timestamp: drone.timestamp
timestamp: drone.timestamp,
log: drone.log
};
});
me.writeWebsocketMessage(JSON.stringify({drone_dict: drone_dict}));
......@@ -42,8 +38,7 @@
me.sendMsg(JSON.stringify({status: "stopped"}));
break;
case "switch":
leader_id = leader_id == 0 ? 1 : 0;
me.sendMsg(JSON.stringify({leader_id: leader_id, status: "switch"}));
me.sendMsg(JSON.stringify({status: "switch"}));
break;
default:
me.writeWebsocketMessage("Unknown instruction " + msg);
......@@ -53,4 +48,4 @@
me.onGetMsg = function (msg) {
me.writeWebsocketMessage(msg);
};
}(console, me));
}(me));
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