-
-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds Moonraker analysis support
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
- Loading branch information
1 parent
83ab04a
commit dff000d
Showing
13 changed files
with
172 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { ActionTree } from 'vuex' | ||
import type { AnalysisState, AnalysisStatus, AnalysisEstimate } from './types' | ||
import type { RootState } from '../types' | ||
import { SocketActions } from '@/api/socketActions' | ||
import type { ObjectWithRequest } from '@/plugins/socketClient' | ||
|
||
export const actions: ActionTree<AnalysisState, RootState> = { | ||
async reset ({ commit }) { | ||
commit('setReset') | ||
}, | ||
|
||
async init () { | ||
SocketActions.serverAnalysisStatus() | ||
}, | ||
|
||
async onAnalysisStatus ({ commit }, payload: AnalysisStatus) { | ||
if (payload) { | ||
commit('setAnalysisStatus', payload) | ||
} | ||
}, | ||
|
||
async onAnalysisEstimate (_, payload: ObjectWithRequest<AnalysisEstimate>) { | ||
if (payload) { | ||
const { filename, update_metadata } = payload.__request__.params ?? {} | ||
|
||
if (update_metadata) { | ||
SocketActions.serverFilesMetadata(filename) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { GetterTree } from 'vuex' | ||
import type { AnalysisState } from './types' | ||
import type { RootState } from '../types' | ||
|
||
export const getters: GetterTree<AnalysisState, RootState> = { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Module } from 'vuex' | ||
import { state } from './state' | ||
import { getters } from './getters' | ||
import { actions } from './actions' | ||
import { mutations } from './mutations' | ||
import type { AnalysisState } from './types' | ||
import type { RootState } from '../types' | ||
|
||
const namespaced = true | ||
|
||
export const analysis: Module<AnalysisState, RootState> = { | ||
namespaced, | ||
state, | ||
getters, | ||
actions, | ||
mutations | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { MutationTree } from 'vuex' | ||
import type { AnalysisState, AnalysisStatus } from './types' | ||
import { defaultState } from './state' | ||
|
||
export const mutations: MutationTree<AnalysisState> = { | ||
/** | ||
* Reset state | ||
*/ | ||
setReset (state) { | ||
Object.assign(state, defaultState()) | ||
}, | ||
|
||
setAnalysisStatus (state, payload: AnalysisStatus) { | ||
state.status = payload | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { AnalysisState } from './types' | ||
|
||
export const defaultState = (): AnalysisState => { | ||
return { | ||
status: null | ||
} | ||
} | ||
|
||
export const state = defaultState() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export interface AnalysisState { | ||
status: AnalysisStatus | null; | ||
} | ||
|
||
export interface AnalysisStatus { | ||
estimator_executable: string; | ||
estimator_ready: boolean; | ||
estimator_version: string; | ||
estimator_config_exists: boolean; | ||
using_default_config: boolean; | ||
} | ||
|
||
export interface AnalysisEstimate { | ||
total_time: number; | ||
total_distance: number; | ||
total_extrude_distance: number; | ||
max_flow: number; | ||
max_speed: number; | ||
num_moves: number; | ||
total_z_time: number; | ||
total_output_time: number; | ||
total_travel_time: number; | ||
total_extrude_only_time: number; | ||
phase_times: { | ||
acceleration: number; | ||
cruise: number; | ||
deceleration: number; | ||
}; | ||
kind_times: Record<string, number>; | ||
layer_times: [number, number][] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters