Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added buttons and layout for board pings #34

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,228 changes: 774 additions & 454 deletions RocketControlUnitGUI/package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion RocketControlUnitGUI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@skeletonlabs/skeleton": "2.5.1",
"@skeletonlabs/tw-plugin": "0.2.4",
"@sveltejs/adapter-node": "^4.0.1",
"@sveltejs/kit": "2.7.1",
"@tailwindcss/forms": "0.5.7",
"@tailwindcss/typography": "0.5.10",
"@types/node": "20.10.0",
Expand All @@ -33,11 +34,14 @@
"tailwindcss": "3.3.5",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.4.9",
"vite-plugin-tailwind-purgecss": "^0.2.1"
},
"type": "module",
"dependencies": {
"@floating-ui/dom": "1.5.3",
"pocketbase": "^0.20.3"
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"pocketbase": "^0.20.3",
"vite-plugin-svelte": "^3.0.1"
}
}
51 changes: 50 additions & 1 deletion RocketControlUnitGUI/src/lib/components/Diagram.svelte

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions RocketControlUnitGUI/src/lib/hooks/usePocketbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ export const usePocketbase = (timestamps: Timestamps, stores: Stores) => {

timestamps.heartbeat = Date.now();
});

// Subscribe to changes in the 'BoardStatus' collection
pocketbase.collection('BoardStatus').subscribe('*', function (e) {
stores.dmb_status.set(e.record.dmb_status);
stores.pmb_status.set(e.record.pmb_status);
stores.daq_status.set(e.record.daq_status);
stores.cam_status.set(e.record.cam_status);
stores.bms_status.set(e.record.bms_status);
stores.fab_status.set(e.record.fab_status);
stores.lrb_status.set(e.record.lrb_status);

timestamps.board_status = Date.now();
});
};

return {
Expand Down
16 changes: 15 additions & 1 deletion RocketControlUnitGUI/src/lib/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ export interface Stores {
timer_state: Writable<string | undefined>;
timer_period: Writable<number | undefined>;
timer_remaining: Writable<number | undefined>;
dmb_status: Writable<string | undefined>;
pmb_status: Writable<string | undefined>;
daq_status: Writable<string | undefined>;
cam_status: Writable<string | undefined>;
bms_status: Writable<string | undefined>;
fab_status: Writable<string | undefined>;
lrb_status: Writable<string | undefined>;
}

export const initStores = () => {
Expand Down Expand Up @@ -83,6 +90,13 @@ export const initStores = () => {
system_state: writable<string | undefined>(undefined),
timer_state: writable<string | undefined>(undefined),
timer_period: writable<number | undefined>(undefined),
timer_remaining: writable<number | undefined>(undefined)
timer_remaining: writable<number | undefined>(undefined),
dmb_status: writable<string | undefined>(undefined),
pmb_status: writable<string | undefined>(undefined),
daq_status: writable<string | undefined>(undefined),
cam_status: writable<string | undefined>(undefined),
bms_status: writable<string | undefined>(undefined),
fab_status: writable<string | undefined>(undefined),
lrb_status: writable<string | undefined>(undefined),
};
};
6 changes: 4 additions & 2 deletions RocketControlUnitGUI/src/lib/timestamps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ export interface Timestamps {
sob_temperature: number;
sys_state: number;
heartbeat: number;
board_status: number;
}

export const initTimestamps = () => {
export const initTimestamps = (): Timestamps => {
const now = Date.now();

return {
Expand All @@ -32,6 +33,7 @@ export const initTimestamps = () => {
rcu_pressure: now,
sob_temperature: now,
sys_state: now,
heartbeat: now
heartbeat: now,
board_status: now,
};
};
Loading