Skip to content

Commit

Permalink
Fix FMS, update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Techno11 committed Feb 23, 2024
1 parent 1d9f94e commit 01a8e33
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
50 changes: 48 additions & 2 deletions .github/workflows/on_commit_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ jobs:
uses: tj-actions/changed-files@v34
with:
files: |
front-end/**
back-end/api/**
bacl-end/realtime/**
lib/**
- name: Use Node.js 18.x
Expand All @@ -91,4 +92,49 @@ jobs:
- name: Build backend
if: steps.changed.outputs.any_changed == 'true'
run: |
npm run build:backend
npm run build:backend
build-frc-fms:
name: Build FRC FMS
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Detect changes
id: changed
uses: tj-actions/changed-files@v34
with:
files: |
back-end/frc-fms/**
lib/**
- name: Use Node.js 18.x
if: steps.changed.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install lib dependencies
if: steps.changed.outputs.any_changed == 'true'
run: |
npm run install:lib
- name: Build libs
if: steps.changed.outputs.any_changed == 'true'
run: |
npm run build:lib
- name: Install backend dependencies
if: steps.changed.outputs.any_changed == 'true'
run: |
cd back-end/frc-fms
npm i
- name: Build backend
if: steps.changed.outputs.any_changed == 'true'
run: |
cd back-end/frc-fms
npm run build
4 changes: 2 additions & 2 deletions back-end/frc-fms/src/devices/plc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import log from "../logger.js";
import { PlcInputs } from "../models/PlcInputs.js";
import PlcOutputCoils, { EStop, RobotStatus, StackLight } from "../models/PlcOutputCoils.js";
import { EmsFrcFms } from "../server.js";
import { MatchMode, MatchSocketEvents } from "@toa-lib/models";
import { MatchMode, MatchSocketEvent } from "@toa-lib/models";
import ModbusRTU from "modbus-serial";
import { Socket } from "socket.io-client";
import { sleep } from "../helpers/generic.js";
Expand Down Expand Up @@ -137,7 +137,7 @@ export class PlcSupport {

// Field E-STOP
if (this.plc.inputs.fieldEstop) {
SocketSupport.getInstance().socket?.emit(MatchSocketEvents.ABORT);
SocketSupport.getInstance().socket?.emit(MatchSocketEvent.ABORT);
logger.info("🛑 Field E-STOP Pressed! This can't be good!");
} else if (!this.plc.inputs.fieldEstop && this.plc.oldInputs.fieldEstop) {
logger.info("🟢 Field E-STOP Released!");
Expand Down
4 changes: 2 additions & 2 deletions back-end/frc-fms/src/devices/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Socket } from "socket.io-client";
import { SocketOptions, createSocket } from "@toa-lib/client";
import { getToken } from "../helpers/ems.js";
import { getIPv4 } from "@toa-lib/server";
import { AvaliableHardware, DriverstationMonitor, DriverstationStatus, MatchKey, MatchSocketEvents, PrestartState, PrestartStatus } from "@toa-lib/models";
import { AvaliableHardware, DriverstationMonitor, DriverstationStatus, MatchKey, MatchSocketEvent, PrestartState, PrestartStatus } from "@toa-lib/models";
import { SettingsSupport } from "./settings.js";
import { EmsFrcFms } from "../server.js";

Expand Down Expand Up @@ -56,7 +56,7 @@ export class SocketSupport {
});

// Setup Prestart
this.socket?.on(MatchSocketEvents.PRESTART, (matchKey: MatchKey) => {
this.socket?.on(MatchSocketEvent.PRESTART, (matchKey: MatchKey) => {
this.prestartStatus = {
hardware: [],
matchKey: matchKey,
Expand Down

0 comments on commit 01a8e33

Please sign in to comment.