Compare commits

..

No commits in common. "9ec01c39de9ebd02b030024413be046d4a0cd3b8" and "648f2183c21bde0b68a2259dadeb98bc8cf7bbfa" have entirely different histories.

12 changed files with 53 additions and 96 deletions

View file

@ -80,7 +80,6 @@ func TelemRouter(log *slog.Logger, broker *Broker, db *TelemDb) http.Handler {
r.Use(middleware.RealIP) r.Use(middleware.RealIP)
r.Use(middleware.Logger) // TODO: integrate with slog instead of go default logger. r.Use(middleware.Logger) // TODO: integrate with slog instead of go default logger.
r.Use(middleware.Recoverer) r.Use(middleware.Recoverer)
r.Use(middleware.SetHeader("Access-Control-Allow-Origin", "*"))
// heartbeat request. // heartbeat request.
r.Get("/ping", func(w http.ResponseWriter, r *http.Request) { r.Get("/ping", func(w http.ResponseWriter, r *http.Request) {

View file

@ -18,37 +18,37 @@ import (
// SkylabFile is a yaml file from skylab. // SkylabFile is a yaml file from skylab.
type SkylabFile struct { type SkylabFile struct {
Packets []PacketDef `yaml:"packets,omitempty" json:"packets,omitempty"` Packets []PacketDef `yaml:"packets"`
Boards []BoardDef `yaml:"boards,omitempty" json:"boards,omitempty"` Boards []BoardDef `yaml:"boards"`
} }
type BoardDef struct { type BoardDef struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"` Name string `yaml:"name"`
Transmit []string `yaml:"transmit,omitempty" json:"transmit,omitempty"` Transmit []string `yaml:"transmit"`
Receive []string `yaml:"receive,omitempty" json:"receive,omitempty"` Receive []string `yaml:"receive"`
} }
// data field. // data field.
type FieldDef struct { type FieldDef struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"` Name string `yaml:"name"`
Type string `yaml:"type,omitempty" json:"type,omitempty"` Type string `yaml:"type"`
Units string `yaml:"units,omitempty" json:"units,omitempty"` Units string `yaml:"units"`
Conversion float32 `yaml:"conversion,omitempty" json:"conversion,omitempty"` Conversion float32 `yaml:"conversion"`
Bits []struct { Bits []struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"` Name string `yaml:"name"`
} `yaml:"bits,omitempty" json:"bits,omitempty"` } `yaml:"bits"`
} }
// a PacketDef is a full can packet. // a PacketDef is a full can packet.
type PacketDef struct { type PacketDef struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"` Name string `yaml:"name"`
Description string `yaml:"description,omitempty" json:"description,omitempty"` Description string `yaml:"description"`
Id uint32 `yaml:"id,omitempty" json:"id,omitempty"` Id uint32 `yaml:"id"`
Endian string `yaml:"endian,omitempty" json:"endian,omitempty"` Endian string `yaml:"endian"`
IsExtended bool `yaml:"is_extended,omitempty" json:"is_extended,omitempty"` Extended bool `yaml:"is_extended"`
Repeat int `yaml:"repeat,omitempty" json:"repeat,omitempty"` Repeat int `yaml:"repeat"`
Offset int `yaml:"offset,omitempty" json:"offset,omitempty"` Offset int `yaml:"offset"`
Data []FieldDef `yaml:"data,omitempty" json:"data,omitempty"` Data []FieldDef `yaml:"data"`
} }
// we need to generate bitfield types. // we need to generate bitfield types.
@ -278,13 +278,13 @@ func idToString(p PacketDef) string {
if p.Repeat > 0 { if p.Repeat > 0 {
resp := make([]string, p.Repeat) resp := make([]string, p.Repeat)
for idx := 0; idx < p.Repeat; idx++ { for idx := 0; idx < p.Repeat; idx++ {
resp[idx] = fmt.Sprintf("can.CanID{ Id: 0x%X, Extended: %t }", int(p.Id)+idx*p.Offset, p.IsExtended) resp[idx] = fmt.Sprintf("can.CanID{ Id: 0x%X, Extended: %t }", int(p.Id)+idx*p.Offset, p.Extended)
} }
return strings.Join(resp, ",") return strings.Join(resp, ",")
} else { } else {
return fmt.Sprintf("can.CanID{ Id: 0x%X, Extended: %t }", p.Id, p.IsExtended) return fmt.Sprintf("can.CanID{ Id: 0x%X, Extended: %t }", p.Id, p.Extended)
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -46,7 +46,7 @@ type {{$structName}} struct {
} }
func (p *{{$structName}}) CanId() (can.CanID, error) { func (p *{{$structName}}) CanId() (can.CanID, error) {
c := can.CanID{Extended: {{.IsExtended}}} c := can.CanID{Extended: {{.Extended}}}
{{- if .Repeat }} {{- if .Repeat }}
if p.Idx >= {{.Repeat}} { if p.Idx >= {{.Repeat}} {
return c, &UnknownIdError{ {{ printf "0x%X" .Id }} } return c, &UnknownIdError{ {{ printf "0x%X" .Id }} }
@ -108,10 +108,10 @@ var idMap = map[can.CanID]bool{
{{ range $p := .Packets -}} {{ range $p := .Packets -}}
{{ if $p.Repeat }} {{ if $p.Repeat }}
{{ range $idx := Nx (int $p.Id) $p.Repeat $p.Offset -}} {{ range $idx := Nx (int $p.Id) $p.Repeat $p.Offset -}}
{ Id: {{ $idx | printf "0x%X"}}, Extended: {{$p.IsExtended}} }: true, { Id: {{ $idx | printf "0x%X"}}, Extended: {{$p.Extended}} }: true,
{{ end }} {{ end }}
{{- else }} {{- else }}
{ Id: {{ $p.Id | printf "0x%X" }}, Extended: {{$p.IsExtended}} }: true, { Id: {{ $p.Id | printf "0x%X" }}, Extended: {{$p.Extended}} }: true,
{{- end}} {{- end}}
{{- end}} {{- end}}
} }

View file

@ -1,17 +0,0 @@
{
"compilerOptions": {
// "baseUrl": "./src",
"target": "es6",
"checkJs": true,
"allowJs": true,
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
"paths": {
"openmct": ["./node_modules/openmct/dist/openmct.d.ts"]
}
},
"exclude": [
"./dist/**/*",
"webpack.*.js"
]
}

3
web/package-lock.json generated
View file

@ -23,8 +23,7 @@
"typescript": "^4.9.5", "typescript": "^4.9.5",
"webpack": "^5.75.0", "webpack": "^5.75.0",
"webpack-cli": "^5.0.1", "webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1", "webpack-dev-server": "^4.11.1"
"webpack-merge": "^5.10.0"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {

View file

@ -5,8 +5,8 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.prod.js", "build": "webpack",
"serve": "webpack serve --config webpack.dev.js" "serve": "webpack serve"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
@ -25,7 +25,6 @@
"typescript": "^4.9.5", "typescript": "^4.9.5",
"webpack": "^5.75.0", "webpack": "^5.75.0",
"webpack-cli": "^5.0.1", "webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1", "webpack-dev-server": "^4.11.1"
"webpack-merge": "^5.10.0"
} }
} }

View file

@ -7,13 +7,6 @@ openmct.install(openmct.plugins.UTCTimeSystem());
openmct.time.clock('local', {start: -5 * 60 * 1000, end: 0}); openmct.time.clock('local', {start: -5 * 60 * 1000, end: 0});
openmct.time.timeSystem('utc'); openmct.time.timeSystem('utc');
openmct.install(openmct.plugins.Espresso()); openmct.install(openmct.plugins.Espresso());
openmct.install(PhoebusPlugin());
if (process.env.BASE_URL) {
console.log("got a thing")
console.log(process.env.BASE_URL)
}
function GotelemPlugin() {
}
openmct.start(); openmct.start();

11
web/tsconfig.json Normal file
View file

@ -0,0 +1,11 @@
{
"compilerOptions": {
"baseUrl": "./src",
"target": "es6",
"checkJs": true,
"moduleResolution": "node",
"paths": {
"openmct": ["node_modules/openmct/dist/openmct.d.ts"]
}
}
}

View file

@ -5,6 +5,7 @@ const Dotenv = require('dotenv-webpack');
module.exports = { module.exports = {
entry: './src/app.js', entry: './src/app.js',
mode: "development",
module: { module: {
rules: [ rules: [
{ {
@ -32,6 +33,13 @@ module.exports = {
externals: { externals: {
openmct: "openmct", openmct: "openmct",
}, },
devServer: {
static: [{
// eslint-disable-next-line no-undef
directory: path.join(__dirname, '/node_modules/openmct/dist'),
publicPath: '/node_modules/openmct/dist'
}]
},
output: { output: {
filename: 'main.js', filename: 'main.js',
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),

View file

@ -1,22 +0,0 @@
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack');
module.exports = merge(common, {
mode: "development",
devtool: 'inline-source-map',
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: "development",
BASE_URL: "http://localhost:8080"
}),
],
devServer: {
static: "./dist",
headers: {
"Access-Control-Allow-Origin": "*",
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Methods': '*',
},
},
})

View file

@ -1,13 +0,0 @@
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: "production",
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: "production",
BASE_URL: "",
});
],
devtool: 'source-map',
})