Skip to content

Commit

Permalink
add more messafges
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Aug 14, 2024
1 parent 1819539 commit 5f5978b
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bambulabs/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ pub enum Result {
pub enum Print {
/// Ams control.
AmsControl(AmsControl),
/// Ams change filament.
AmsChangeFilament(AmsChangeFilament),
/// Calibration.
Calibration(Calibration),
/// The status of the print.
Expand All @@ -223,6 +225,7 @@ impl Print {
pub fn sequence_id(&self) -> SequenceId {
match self {
Print::AmsControl(ams_ctrl) => ams_ctrl.sequence_id.clone(),
Print::AmsChangeFilament(ams_change_filament) => ams_change_filament.sequence_id.clone(),
Print::Calibration(calibration) => calibration.sequence_id.clone(),
Print::PushStatus(push_status) => push_status.sequence_id.clone(),
Print::GcodeLine(gcode_line) => gcode_line.sequence_id.clone(),
Expand Down Expand Up @@ -250,6 +253,25 @@ pub struct AmsControl {
other: BTreeMap<String, Value>,
}

/// An ams change filament.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct AmsChangeFilament {
/// The sequence id.
pub sequence_id: SequenceId,
/// The reason for the message.
pub reason: Option<Reason>,
/// The result of the command.
pub result: Result,
/// The error number.
pub errorno: i64,
/// The target temperature.
pub tar_temp: i64,
/// The target.
pub target: i64,
#[serde(flatten)]
other: BTreeMap<String, Value>,
}

/// A calibration command.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct Calibration {
Expand Down
61 changes: 61 additions & 0 deletions openapi/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,67 @@
],
"type": "object"
},
{
"additionalProperties": true,
"description": "Ams change filament.",
"properties": {
"command": {
"enum": [
"ams_change_filament"
],
"type": "string"
},
"errorno": {
"description": "The error number.",
"format": "int64",
"type": "integer"
},
"reason": {
"allOf": [
{
"$ref": "#/components/schemas/Reason"
}
],
"description": "The reason for the message.",
"nullable": true
},
"result": {
"allOf": [
{
"$ref": "#/components/schemas/Result"
}
],
"description": "The result of the command."
},
"sequence_id": {
"allOf": [
{
"$ref": "#/components/schemas/SequenceId"
}
],
"description": "The sequence id."
},
"tar_temp": {
"description": "The target temperature.",
"format": "int64",
"type": "integer"
},
"target": {
"description": "The target.",
"format": "int64",
"type": "integer"
}
},
"required": [
"command",
"errorno",
"result",
"sequence_id",
"tar_temp",
"target"
],
"type": "object"
},
{
"additionalProperties": true,
"description": "Calibration.",
Expand Down

0 comments on commit 5f5978b

Please sign in to comment.