You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
606 B
23 lines
606 B
import express from "express";
|
|
import { delay } from "../utils/helper";
|
|
import { wsSend } from "../utils/wss";
|
|
import { StatusDatagram } from "../types/wsTypes";
|
|
const router = express.Router();
|
|
|
|
router.post("/railArm", async (req, res) => {
|
|
// await delay(200);
|
|
const curr: StatusDatagram["data"] = req.app.locals["status"];
|
|
setTimeout(() => {
|
|
curr.railArm.x = req.body.x;
|
|
curr.railArm.y = req.body.y;
|
|
curr.railArm.z = req.body.z;
|
|
wsSend(req.app.locals["wss"], {
|
|
type: "status",
|
|
data: curr,
|
|
});
|
|
}, 1000);
|
|
|
|
res.json({ code: "00000", msg: "执行成功" });
|
|
});
|
|
|
|
export default router;
|