Skip to content
Snippets Groups Projects
Commit 71faa44a authored by kasperlauge's avatar kasperlauge
Browse files

Made some changes to Dockerfile and ctrls

parent a2803448
No related branches found
No related tags found
1 merge request!2Features/led fix
......@@ -16,8 +16,13 @@ RUN mkdir -p /usr/src && \
make install) && \
rm -rf /usr/src/{bcm2835-1.60,pigpio}
WORKDIR /m2-iot-project/server
# Build client
WORKDIR /m2-iot-project/client
COPY ./client/package*.json ./
RUN npm install
WORKDIR /m2-iot-project/server
COPY ./server/package*.json ./
RUN npm install
COPY ./server ./
......@@ -25,15 +30,11 @@ RUN npm run clean
RUN npm run build
# Build client
WORKDIR /m2-iot-project/client
COPY ./client/package*.json ./
RUN npm install
COPY ./client ./
RUN npm run build:prod
EXPOSE 8080
WORKDIR /m2-iot-project/server
EXPOSE 8080
CMD [ "npm", "start" ]
\ No newline at end of file
{
"configurations": [
{
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/home/lars/catkin_ws/devel/include/**",
"/opt/ros/melodic/include/**",
"/home/lars/catkin_ws/src/drone_lift/include/**",
"/home/lars/catkin_ws/src/mavros/libmavconn/include/**",
"/home/lars/catkin_ws/src/mavros/mavros/include/**",
"/home/lars/catkin_ws/src/mavros/mavros_msgs/include/**",
"/home/lars/catkin_ws/src/mavros/test_mavros/include/**",
"/usr/include/**"
],
"name": "ROS",
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
\ No newline at end of file
......@@ -7,15 +7,15 @@ import { setLEDservice, getLEDservice, getAllLEDsservice } from "../services/gpi
export function setLED(req: Request, res: Response, next: NextFunction) {
//Get wanted LED and wished value
const id: string = req.params.id;
const newValue = req.body["value"];
const id = parseInt(req.params.id);
const newValue = parseInt(req.body["value"]);
if (id == null) {
res.status(401).json({ "msg": "wrong id" });
return;
}
if (id != "4" && id != "2" && id != "22") {
if (id !== 4 && id !== 2 && id !== 22) {
res.status(401).json({ "msg": "LED does not exist" });
return;
}
......@@ -31,7 +31,7 @@ export function setLED(req: Request, res: Response, next: NextFunction) {
export function getLED(req: Request, res: Response, next: NextFunction) {
const id: Number = parseInt(req.params.id);
const id = parseInt(req.params.id);
const value = getLEDservice(id);
if (value) {
......
......@@ -65,14 +65,14 @@ export function retrieveUltrasonicValue(): Promise<any> {
return Promise.resolve(216.5);
}
export function setLEDservice(lednr, value) {
export function setLEDservice(lednr: number, value: number) {
if (isProduction()) {
const led = new Gpio(lednr, { mode: Gpio.OUTPUT });
led.digitalWrite(value);
}
}
export function getLEDservice(lednr) {
export function getLEDservice(lednr: number) {
if (isProduction()) {
const led = new Gpio(lednr, { mode: Gpio.OUTPUT });
return led.digitalRead()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment