fossekall-interface 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,49 @@
1
+ import bin, { MaxValue, Schema, type IMeasurer, type ISerialInput, type ISerialOutput } from 'typed-binary';
2
+ declare class UInt64Schema extends Schema<bigint> {
3
+ readonly maxSize = 8;
4
+ read(input: ISerialInput): bigint;
5
+ write(output: ISerialOutput, value: bigint): void;
6
+ measure(_: bigint | typeof MaxValue, measurer?: IMeasurer): IMeasurer;
7
+ }
8
+ export declare const STATE_NAME: {
9
+ readonly IDLE: 0;
10
+ readonly N2_FILL: 1;
11
+ readonly N2_FILL_HOLD: 2;
12
+ readonly PRESSURIZE: 3;
13
+ readonly RUN: 4;
14
+ readonly HOLD: 5;
15
+ readonly CALIBRATE: 6;
16
+ };
17
+ export type STATE_NAME = (typeof STATE_NAME)[keyof typeof STATE_NAME];
18
+ export declare const BLDCTelemetry: import("typed-binary").ObjectSchema<{
19
+ valve_position: import("typed-binary").Float32Schema;
20
+ motor_position: import("typed-binary").Float32Schema;
21
+ upstream_pressure: import("typed-binary").Float32Schema;
22
+ downstream_pressure: import("typed-binary").Float32Schema;
23
+ venturi_pressure: import("typed-binary").Float32Schema;
24
+ timestamp: UInt64Schema;
25
+ current_draw: import("typed-binary").Float32Schema;
26
+ u_p: import("typed-binary").Float32Schema;
27
+ u_i: import("typed-binary").Float32Schema;
28
+ u_d: import("typed-binary").Float32Schema;
29
+ u_pid: import("typed-binary").Float32Schema;
30
+ u_ff: import("typed-binary").Float32Schema;
31
+ u_set: import("typed-binary").Float32Schema;
32
+ u_total: import("typed-binary").Float32Schema;
33
+ position_raw: import("typed-binary").Float32Schema;
34
+ servo_encoder: import("typed-binary").Float32Schema;
35
+ calibrated: import("typed-binary").ByteSchema;
36
+ fsm_state: import("typed-binary").Uint16Schema;
37
+ }>;
38
+ export type BLDCTelemetry = bin.Parsed<typeof BLDCTelemetry>;
39
+ export declare const FsmTelemetry: import("typed-binary").ObjectSchema<{
40
+ currentState: import("typed-binary").Uint16Schema;
41
+ }>;
42
+ export type FsmTelemetry = bin.Parsed<typeof FsmTelemetry>;
43
+ export declare const SawWaveTelemetry: import("typed-binary").ObjectSchema<{
44
+ value: import("typed-binary").Float32Schema;
45
+ inverse: import("typed-binary").Float32Schema;
46
+ derivative: import("typed-binary").Float32Schema;
47
+ }>;
48
+ export type SawWaveTelemetry = bin.Parsed<typeof SawWaveTelemetry>;
49
+ export {};
@@ -0,0 +1,99 @@
1
+ import bin, { Measurer, Schema } from 'typed-binary';
2
+ // This file was generated by FRICC on 2026-03-05 14:48:28. Do not edit manually!
3
+ // The current version of typed-binary does not support 64-bit primitives.
4
+ // So for we'll implement our own schemas. :)
5
+ const __littleEndian = true;
6
+ class UInt64Schema extends Schema {
7
+ maxSize = 8;
8
+ read(input) {
9
+ const bytes = new Uint8Array(8);
10
+ input.readSlice(bytes, 0, 8);
11
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
12
+ return view.getBigUint64(0, __littleEndian);
13
+ }
14
+ write(output, value) {
15
+ const bytes = new Uint8Array(8);
16
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
17
+ view.setBigUint64(0, value, __littleEndian);
18
+ output.writeSlice(bytes);
19
+ }
20
+ measure(_, measurer = new Measurer()) {
21
+ return measurer.add(8);
22
+ }
23
+ }
24
+ class Int64Schema extends Schema {
25
+ maxSize = 8;
26
+ read(input) {
27
+ const bytes = new Uint8Array(8);
28
+ input.readSlice(bytes, 0, 8);
29
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
30
+ return view.getBigInt64(0, __littleEndian);
31
+ }
32
+ write(output, value) {
33
+ const bytes = new Uint8Array(8);
34
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
35
+ view.setBigInt64(0, value, __littleEndian);
36
+ output.writeSlice(bytes);
37
+ }
38
+ measure(_, measurer = new Measurer()) {
39
+ return measurer.add(8);
40
+ }
41
+ }
42
+ class Float64Schema extends Schema {
43
+ maxSize = 8;
44
+ read(input) {
45
+ const bytes = new Uint8Array(8);
46
+ input.readSlice(bytes, 0, 8);
47
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
48
+ return view.getFloat64(0, __littleEndian);
49
+ }
50
+ write(output, value) {
51
+ const bytes = new Uint8Array(8);
52
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
53
+ view.setFloat64(0, value, __littleEndian);
54
+ output.writeSlice(bytes);
55
+ }
56
+ measure(_, measurer = new Measurer()) {
57
+ return measurer.add(8);
58
+ }
59
+ }
60
+ const u64 = new UInt64Schema();
61
+ const i64 = new Int64Schema();
62
+ const f64 = new Float64Schema();
63
+ export const STATE_NAME = {
64
+ IDLE: 0,
65
+ N2_FILL: 1,
66
+ N2_FILL_HOLD: 2,
67
+ PRESSURIZE: 3,
68
+ RUN: 4,
69
+ HOLD: 5,
70
+ CALIBRATE: 6,
71
+ };
72
+ export const BLDCTelemetry = bin.object({
73
+ valve_position: bin.f32, // float
74
+ motor_position: bin.f32, // float
75
+ upstream_pressure: bin.f32, // float
76
+ downstream_pressure: bin.f32, // float
77
+ venturi_pressure: bin.f32, // float
78
+ timestamp: u64, // unsigned long long
79
+ current_draw: bin.f32, // float
80
+ u_p: bin.f32, // float
81
+ u_i: bin.f32, // float
82
+ u_d: bin.f32, // float
83
+ u_pid: bin.f32, // float
84
+ u_ff: bin.f32, // float
85
+ u_set: bin.f32, // float
86
+ u_total: bin.f32, // float
87
+ position_raw: bin.f32, // float
88
+ servo_encoder: bin.f32, // float
89
+ calibrated: bin.u8, // unsigned char
90
+ fsm_state: bin.u16, // STATE_NAME
91
+ });
92
+ export const FsmTelemetry = bin.object({
93
+ currentState: bin.u16, // STATE_NAME
94
+ });
95
+ export const SawWaveTelemetry = bin.object({
96
+ value: bin.f32, // float
97
+ inverse: bin.f32, // float
98
+ derivative: bin.f32, // float
99
+ });
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- export * from "./fc/anothertest";
2
- export * from "./ecu/test";
1
+ export * from "./ecu/telemetry";
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./fc/anothertest";
2
- export * from "./ecu/test";
1
+ export * from "./ecu/telemetry";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fossekall-interface",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "API contracts between client and server (rocket and GUI)",
5
5
  "license": "ISC",
6
6
  "author": "Propulse",
@@ -17,5 +17,8 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "typescript": "^5.9.3"
20
+ },
21
+ "dependencies": {
22
+ "typed-binary": "^4.3.2"
20
23
  }
21
24
  }
@@ -1,4 +0,0 @@
1
- export declare const EcuTestObject: {
2
- name: string;
3
- description: string;
4
- };
package/dist/ecu/test.js DELETED
@@ -1,4 +0,0 @@
1
- export const EcuTestObject = {
2
- name: "Test object",
3
- description: "This is a test object for the ECU module.",
4
- };
@@ -1,4 +0,0 @@
1
- export declare const FcTestObject: {
2
- name: string;
3
- description: string;
4
- };
@@ -1,4 +0,0 @@
1
- export const FcTestObject = {
2
- name: "Test object",
3
- description: "This is a test object for the FC module.",
4
- };