Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffdcf17bdb | ||
|
|
070f09e32b | ||
|
|
07bb10e668 |
No files matched your search
@@ -1,12 +1,12 @@
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use crate::extruder1::ExtruderV2;
|
||||
use crate::extruder1::ExtruderV1;
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use crate::{MachineAct, MachineMessage};
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl MachineAct for ExtruderV2 {
|
||||
impl MachineAct for ExtruderV1 {
|
||||
fn act(&mut self, now: Instant) {
|
||||
let msg = self.api_receiver.try_recv();
|
||||
match msg {
|
||||
@@ -21,17 +21,17 @@ impl MachineAct for ExtruderV2 {
|
||||
self.temperature_controller_front.update(now);
|
||||
self.temperature_controller_middle.update(now);
|
||||
|
||||
if self.mode == super::ExtruderV2Mode::Extrude {
|
||||
if self.mode == super::ExtruderV1Mode::Extrude {
|
||||
self.screw_speed_controller.update(now, true);
|
||||
} else {
|
||||
self.screw_speed_controller.update(now, false);
|
||||
}
|
||||
|
||||
if self.mode == super::ExtruderV2Mode::Standby {
|
||||
if self.mode == super::ExtruderV1Mode::Standby {
|
||||
self.turn_heating_off();
|
||||
}
|
||||
|
||||
if self.mode == super::ExtruderV2Mode::Extrude
|
||||
if self.mode == super::ExtruderV1Mode::Extrude
|
||||
&& !self.screw_speed_controller.get_motor_enabled()
|
||||
{
|
||||
self.switch_to_heat();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::{ExtruderV2Mode, mitsubishi_cs80::MotorStatus};
|
||||
use super::{ExtruderV1Mode, mitsubishi_cs80::MotorStatus};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use super::ExtruderV2;
|
||||
use super::ExtruderV1;
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use crate::{MachineMessage, extruder1::HeatingType};
|
||||
@@ -115,7 +115,7 @@ pub struct RotationState {
|
||||
|
||||
#[derive(Serialize, Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ModeState {
|
||||
pub mode: ExtruderV2Mode,
|
||||
pub mode: ExtruderV1Mode,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug, Clone, PartialEq, Eq)]
|
||||
@@ -205,7 +205,7 @@ pub struct PidSettingsStates {
|
||||
pub pressure: PidSettings,
|
||||
}
|
||||
|
||||
pub enum ExtruderV2Events {
|
||||
pub enum ExtruderV1Events {
|
||||
LiveValues(Event<LiveValuesEvent>),
|
||||
State(Event<StateEvent>),
|
||||
}
|
||||
@@ -221,7 +221,7 @@ pub enum Mutation {
|
||||
SetInverterRegulation(bool),
|
||||
|
||||
//Mode
|
||||
SetExtruderMode(ExtruderV2Mode),
|
||||
SetExtruderMode(ExtruderV1Mode),
|
||||
SetFrontHeatingTargetTemperature(f64),
|
||||
SetBackHeatingTargetTemperature(f64),
|
||||
SetMiddleHeatingTemperature(f64),
|
||||
@@ -240,13 +240,13 @@ pub enum Mutation {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExtruderV2Namespace {
|
||||
pub struct ExtruderV1Namespace {
|
||||
pub namespace: Option<Namespace>,
|
||||
}
|
||||
|
||||
impl NamespaceCacheingLogic<ExtruderV2Events> for ExtruderV2Namespace {
|
||||
impl NamespaceCacheingLogic<ExtruderV1Events> for ExtruderV1Namespace {
|
||||
#[instrument(skip_all)]
|
||||
fn emit(&mut self, events: ExtruderV2Events) {
|
||||
fn emit(&mut self, events: ExtruderV1Events) {
|
||||
let event = Arc::new(events.event_value());
|
||||
let buffer_fn = events.event_cache_fn();
|
||||
|
||||
@@ -257,7 +257,7 @@ impl NamespaceCacheingLogic<ExtruderV2Events> for ExtruderV2Namespace {
|
||||
}
|
||||
}
|
||||
|
||||
impl CacheableEvents<Self> for ExtruderV2Events {
|
||||
impl CacheableEvents<Self> for ExtruderV1Events {
|
||||
fn event_value(&self) -> GenericEvent {
|
||||
match self {
|
||||
Self::LiveValues(event) => event.into(),
|
||||
@@ -275,7 +275,7 @@ impl CacheableEvents<Self> for ExtruderV2Events {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl MachineApi for ExtruderV2 {
|
||||
impl MachineApi for ExtruderV1 {
|
||||
fn api_get_sender(&self) -> Sender<MachineMessage> {
|
||||
self.api_sender.clone()
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
// Contains Implementations for All functions that use emit_state
|
||||
use crate::extruder1::{
|
||||
ExtruderV2, ExtruderV2Mode, HeatingType,
|
||||
ExtruderV1, ExtruderV1Mode, HeatingType,
|
||||
api::{
|
||||
ExtruderSettingsState, ExtruderV2Events, HeatingState, HeatingStates, InverterStatusState,
|
||||
ExtruderSettingsState, ExtruderV1Events, HeatingState, HeatingStates, InverterStatusState,
|
||||
LiveValuesEvent, ModeState, PidSettings, PidSettingsStates, PressureState, RegulationState,
|
||||
RotationState, ScrewState, StateEvent, TemperaturePid,
|
||||
},
|
||||
@@ -24,7 +24,7 @@ use units::thermodynamic_temperature::ThermodynamicTemperature;
|
||||
use units::{angular_velocity::revolution_per_minute, thermodynamic_temperature::degree_celsius};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV2 {
|
||||
impl ExtruderV1 {
|
||||
pub fn build_state_event(&mut self) -> StateEvent {
|
||||
use crate::extruder1::api::{TemperaturePid, TemperaturePidStates};
|
||||
|
||||
@@ -144,13 +144,13 @@ impl ExtruderV2 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV2 {
|
||||
impl ExtruderV1 {
|
||||
pub fn emit_state(&mut self) {
|
||||
let state = self.build_state_event();
|
||||
let hash = hash_with_serde_model(self.screw_speed_controller.get_inverter_status());
|
||||
self.last_status_hash = Some(hash);
|
||||
let event = state.build();
|
||||
self.namespace.emit(ExtruderV2Events::State(event));
|
||||
self.namespace.emit(ExtruderV1Events::State(event));
|
||||
}
|
||||
|
||||
pub fn maybe_emit_state_event(&mut self) {
|
||||
@@ -214,7 +214,7 @@ impl ExtruderV2 {
|
||||
};
|
||||
|
||||
let event = live_values.build();
|
||||
self.namespace.emit(ExtruderV2Events::LiveValues(event));
|
||||
self.namespace.emit(ExtruderV1Events::LiveValues(event));
|
||||
}
|
||||
|
||||
// === Steuerungsfunktionen mit emit_state ===
|
||||
@@ -244,7 +244,7 @@ impl ExtruderV2 {
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV2Mode) {
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV1Mode) {
|
||||
self.switch_mode(mode);
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::ExtruderV2;
|
||||
use super::ExtruderV1;
|
||||
use crate::MachineAct;
|
||||
use crate::MachineMessage;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
impl MachineAct for ExtruderV2 {
|
||||
impl MachineAct for ExtruderV1 {
|
||||
fn act(&mut self, now: Instant) {
|
||||
let msg = self.api_receiver.try_recv();
|
||||
match msg {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::ExtruderV2;
|
||||
use super::ExtruderV1;
|
||||
use crate::{
|
||||
MachineApi,
|
||||
extruder1::{HeatingType, api::Mutation},
|
||||
};
|
||||
|
||||
impl MachineApi for ExtruderV2 {
|
||||
impl MachineApi for ExtruderV1 {
|
||||
fn api_mutate(&mut self, request_body: serde_json::Value) -> Result<(), anyhow::Error> {
|
||||
// there are multiple Modbus Frames that are "prebuilt"
|
||||
let control: Mutation = serde_json::from_value(request_body)?;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::extruder1::{
|
||||
ExtruderV2Mode, HeatingType,
|
||||
api::{ExtruderV2Events, LiveValuesEvent, ModeState, PidSettings, StateEvent, TemperaturePid},
|
||||
mock::ExtruderV2,
|
||||
ExtruderV1Mode, HeatingType,
|
||||
api::{ExtruderV1Events, LiveValuesEvent, ModeState, PidSettings, StateEvent, TemperaturePid},
|
||||
mock::ExtruderV1,
|
||||
};
|
||||
|
||||
use control_core::{
|
||||
@@ -9,7 +9,7 @@ use control_core::{
|
||||
socketio::{event::BuildEvent, namespace::NamespaceCacheingLogic},
|
||||
};
|
||||
|
||||
impl ExtruderV2 {
|
||||
impl ExtruderV1 {
|
||||
pub fn build_state_event(&mut self) -> StateEvent {
|
||||
// bad performance wise, but doesnt matter its only a mock machine
|
||||
StateEvent {
|
||||
@@ -27,13 +27,13 @@ impl ExtruderV2 {
|
||||
}
|
||||
}
|
||||
|
||||
impl ExtruderV2 {
|
||||
impl ExtruderV1 {
|
||||
pub fn emit_state(&mut self) {
|
||||
let state = self.build_state_event();
|
||||
let hash = hash_with_serde_model(self.inverter_status_state.clone());
|
||||
self.last_status_hash = Some(hash);
|
||||
let event = state.build();
|
||||
self.namespace.emit(ExtruderV2Events::State(event));
|
||||
self.namespace.emit(ExtruderV1Events::State(event));
|
||||
}
|
||||
|
||||
pub fn maybe_emit_state_event(&mut self) {
|
||||
@@ -68,7 +68,7 @@ impl ExtruderV2 {
|
||||
};
|
||||
|
||||
let event = live_values.build();
|
||||
self.namespace.emit(ExtruderV2Events::LiveValues(event));
|
||||
self.namespace.emit(ExtruderV1Events::LiveValues(event));
|
||||
}
|
||||
|
||||
pub fn set_nozzle_pressure_limit_is_enabled(&mut self, enabled: bool) {
|
||||
@@ -94,7 +94,7 @@ impl ExtruderV2 {
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV2Mode) {
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV1Mode) {
|
||||
self.mode_state = ModeState { mode };
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ use std::time::Instant;
|
||||
use crate::{
|
||||
MACHINE_EXTRUDER_V1, VENDOR_QITECH,
|
||||
extruder1::{
|
||||
ExtruderV2Mode,
|
||||
ExtruderV1Mode,
|
||||
api::{
|
||||
ExtruderSettingsState, ExtruderV2Namespace, HeatingStates, InverterStatusState,
|
||||
ExtruderSettingsState, ExtruderV1Namespace, HeatingStates, InverterStatusState,
|
||||
ModeState, MotorStatusValues, PidSettingsStates, PressureState, RegulationState,
|
||||
RotationState, ScrewState,
|
||||
},
|
||||
@@ -38,7 +38,7 @@ pub mod mock_emit;
|
||||
pub mod new;
|
||||
|
||||
#[cfg(feature = "mock-machine")]
|
||||
impl Machine for ExtruderV2 {
|
||||
impl Machine for ExtruderV1 {
|
||||
fn get_machine_identification_unique(&self) -> MachineIdentificationUnique {
|
||||
self.machine_identification_unique.clone()
|
||||
}
|
||||
@@ -50,17 +50,17 @@ impl Machine for ExtruderV2 {
|
||||
|
||||
#[cfg(feature = "mock-machine")]
|
||||
#[derive(Debug)]
|
||||
pub struct ExtruderV2 {
|
||||
pub struct ExtruderV1 {
|
||||
api_receiver: Receiver<MachineMessage>,
|
||||
api_sender: Sender<MachineMessage>,
|
||||
main_sender: Option<Sender<AsyncThreadMessage>>,
|
||||
|
||||
machine_identification_unique: MachineIdentificationUnique,
|
||||
|
||||
namespace: ExtruderV2Namespace,
|
||||
namespace: ExtruderV1Namespace,
|
||||
last_measurement_emit: Instant,
|
||||
last_status_hash: Option<u64>,
|
||||
mode: ExtruderV2Mode,
|
||||
mode: ExtruderV1Mode,
|
||||
/// Energy tracking for total consumption calculation
|
||||
pub total_energy_kwh: f64,
|
||||
pub last_energy_calculation_time: Option<Instant>,
|
||||
@@ -121,7 +121,7 @@ pub struct ExtruderV2 {
|
||||
}
|
||||
|
||||
#[cfg(feature = "mock-machine")]
|
||||
impl ExtruderV2 {
|
||||
impl ExtruderV1 {
|
||||
pub const MACHINE_IDENTIFICATION: MachineIdentification = MachineIdentification {
|
||||
vendor: VENDOR_QITECH,
|
||||
machine: MACHINE_EXTRUDER_V1,
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
use crate::{
|
||||
MachineNewHardware, MachineNewParams, MachineNewTrait,
|
||||
extruder1::{
|
||||
ExtruderV2Mode,
|
||||
ExtruderV1Mode,
|
||||
api::{
|
||||
ExtruderSettingsState, ExtruderV2Namespace, HeatingState, HeatingStates,
|
||||
ExtruderSettingsState, ExtruderV1Namespace, HeatingState, HeatingStates,
|
||||
InverterStatusState, ModeState, MotorStatusValues, PidSettings, PidSettingsStates,
|
||||
PressureState, RegulationState, RotationState, ScrewState, TemperaturePid,
|
||||
TemperaturePidStates,
|
||||
},
|
||||
mock::ExtruderV2,
|
||||
mock::ExtruderV1,
|
||||
},
|
||||
};
|
||||
|
||||
impl MachineNewTrait for ExtruderV2 {
|
||||
impl MachineNewTrait for ExtruderV1 {
|
||||
fn new(params: &MachineNewParams<'_, '_, '_, '_, '_, '_, '_>) -> Result<Self, anyhow::Error>
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -39,12 +39,12 @@ impl MachineNewTrait for ExtruderV2 {
|
||||
api_receiver: receiver,
|
||||
api_sender: sender,
|
||||
machine_identification_unique: params.get_machine_identification_unique(),
|
||||
namespace: ExtruderV2Namespace {
|
||||
namespace: ExtruderV1Namespace {
|
||||
namespace: params.namespace.clone(),
|
||||
},
|
||||
last_measurement_emit: now,
|
||||
|
||||
mode: ExtruderV2Mode::Standby, // Start in standby mode
|
||||
mode: ExtruderV1Mode::Standby, // Start in standby mode
|
||||
emitted_default_state: false,
|
||||
last_status_hash: None,
|
||||
total_energy_kwh: 0.0,
|
||||
@@ -52,7 +52,7 @@ impl MachineNewTrait for ExtruderV2 {
|
||||
is_default_state: false,
|
||||
rotation_state: RotationState { forward: false },
|
||||
mode_state: ModeState {
|
||||
mode: ExtruderV2Mode::Standby,
|
||||
mode: ExtruderV1Mode::Standby,
|
||||
},
|
||||
regulation_state: RegulationState { uses_rpm: true },
|
||||
pressure_state: PressureState {
|
||||
|
||||
@@ -23,7 +23,7 @@ use units::thermodynamic_temperature::degree_celsius;
|
||||
use crate::{
|
||||
MACHINE_EXTRUDER_V1, MachineMessage, VENDOR_QITECH,
|
||||
extruder1::{
|
||||
api::ExtruderV2Namespace, screw_speed_controller::ScrewSpeedController,
|
||||
api::ExtruderV1Namespace, screw_speed_controller::ScrewSpeedController,
|
||||
temperature_controller::TemperatureController,
|
||||
},
|
||||
machine_identification::{MachineIdentification, MachineIdentificationUnique},
|
||||
@@ -39,7 +39,7 @@ pub mod screw_speed_controller;
|
||||
pub mod temperature_controller;
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ExtruderV2Mode {
|
||||
pub enum ExtruderV1Mode {
|
||||
Standby,
|
||||
Heat,
|
||||
Extrude,
|
||||
@@ -73,17 +73,17 @@ pub enum HeatingType {
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
#[derive(Debug)]
|
||||
pub struct ExtruderV2 {
|
||||
pub struct ExtruderV1 {
|
||||
api_receiver: Receiver<MachineMessage>,
|
||||
api_sender: Sender<MachineMessage>,
|
||||
main_sender: Option<Sender<AsyncThreadMessage>>,
|
||||
|
||||
machine_identification_unique: MachineIdentificationUnique,
|
||||
namespace: ExtruderV2Namespace,
|
||||
namespace: ExtruderV1Namespace,
|
||||
|
||||
last_measurement_emit: Instant,
|
||||
last_status_hash: Option<u64>,
|
||||
mode: ExtruderV2Mode,
|
||||
mode: ExtruderV1Mode,
|
||||
|
||||
screw_speed_controller: ScrewSpeedController,
|
||||
temperature_controller_front: TemperatureController,
|
||||
@@ -101,7 +101,7 @@ pub struct ExtruderV2 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl Machine for ExtruderV2 {
|
||||
impl Machine for ExtruderV1 {
|
||||
fn get_machine_identification_unique(&self) -> MachineIdentificationUnique {
|
||||
self.machine_identification_unique.clone()
|
||||
}
|
||||
@@ -112,14 +112,14 @@ impl Machine for ExtruderV2 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl std::fmt::Display for ExtruderV2 {
|
||||
impl std::fmt::Display for ExtruderV1 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "ExtruderV2")
|
||||
write!(f, "ExtruderV1")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV2 {
|
||||
impl ExtruderV1 {
|
||||
pub const MACHINE_IDENTIFICATION: MachineIdentification = MachineIdentification {
|
||||
vendor: VENDOR_QITECH,
|
||||
machine: MACHINE_EXTRUDER_V1,
|
||||
@@ -127,7 +127,7 @@ impl ExtruderV2 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV2 {
|
||||
impl ExtruderV1 {
|
||||
/// Calculate combined power consumption in watts
|
||||
fn calculate_combined_power(&mut self) -> f64 {
|
||||
let motor_power = {
|
||||
@@ -175,58 +175,58 @@ impl ExtruderV2 {
|
||||
|
||||
fn switch_to_standby(&mut self) {
|
||||
match self.mode {
|
||||
ExtruderV2Mode::Standby => (),
|
||||
ExtruderV2Mode::Heat => {
|
||||
ExtruderV1Mode::Standby => (),
|
||||
ExtruderV1Mode::Heat => {
|
||||
self.turn_heating_off();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
ExtruderV2Mode::Extrude => {
|
||||
ExtruderV1Mode::Extrude => {
|
||||
self.turn_heating_off();
|
||||
self.screw_speed_controller.turn_motor_off();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
};
|
||||
self.mode = ExtruderV2Mode::Standby;
|
||||
self.mode = ExtruderV1Mode::Standby;
|
||||
}
|
||||
|
||||
fn switch_to_heat(&mut self) {
|
||||
match self.mode {
|
||||
ExtruderV2Mode::Standby => self.enable_heating(),
|
||||
ExtruderV2Mode::Heat => (),
|
||||
ExtruderV2Mode::Extrude => {
|
||||
ExtruderV1Mode::Standby => self.enable_heating(),
|
||||
ExtruderV1Mode::Heat => (),
|
||||
ExtruderV1Mode::Extrude => {
|
||||
self.screw_speed_controller.turn_motor_off();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
}
|
||||
self.mode = ExtruderV2Mode::Heat;
|
||||
self.mode = ExtruderV1Mode::Heat;
|
||||
}
|
||||
|
||||
fn switch_to_extrude(&mut self) {
|
||||
match self.mode {
|
||||
ExtruderV2Mode::Standby => {
|
||||
ExtruderV1Mode::Standby => {
|
||||
self.screw_speed_controller.turn_motor_on();
|
||||
self.enable_heating();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
ExtruderV2Mode::Heat => {
|
||||
ExtruderV1Mode::Heat => {
|
||||
self.screw_speed_controller.turn_motor_on();
|
||||
self.enable_heating();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
ExtruderV2Mode::Extrude => (),
|
||||
ExtruderV1Mode::Extrude => (),
|
||||
}
|
||||
self.mode = ExtruderV2Mode::Extrude;
|
||||
self.mode = ExtruderV1Mode::Extrude;
|
||||
}
|
||||
|
||||
fn switch_mode(&mut self, mode: ExtruderV2Mode) {
|
||||
fn switch_mode(&mut self, mode: ExtruderV1Mode) {
|
||||
if self.mode == mode {
|
||||
return;
|
||||
}
|
||||
|
||||
match mode {
|
||||
ExtruderV2Mode::Standby => self.switch_to_standby(),
|
||||
ExtruderV2Mode::Heat => self.switch_to_heat(),
|
||||
ExtruderV2Mode::Extrude => self.switch_to_extrude(),
|
||||
ExtruderV1Mode::Standby => self.switch_to_standby(),
|
||||
ExtruderV1Mode::Heat => self.switch_to_heat(),
|
||||
ExtruderV1Mode::Extrude => self.switch_to_extrude(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,12 +51,12 @@ use crate::extruder1::temperature_controller::TemperatureController;
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use super::{
|
||||
ExtruderV2, ExtruderV2Mode, Heating, api::ExtruderV2Namespace, mitsubishi_cs80::MitsubishiCS80,
|
||||
ExtruderV1, ExtruderV1Mode, Heating, api::ExtruderV1Namespace, mitsubishi_cs80::MitsubishiCS80,
|
||||
screw_speed_controller::ScrewSpeedController,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl MachineNewTrait for ExtruderV2 {
|
||||
impl MachineNewTrait for ExtruderV1 {
|
||||
fn new<'maindevice>(params: &MachineNewParams) -> Result<Self, Error> {
|
||||
// validate general stuff
|
||||
use crate::{
|
||||
@@ -223,16 +223,16 @@ impl MachineNewTrait for ExtruderV2 {
|
||||
);
|
||||
let (sender, receiver) = smol::channel::unbounded();
|
||||
|
||||
let mut extruder: ExtruderV2 = Self {
|
||||
let mut extruder: ExtruderV1 = Self {
|
||||
main_sender: params.main_thread_channel.clone(),
|
||||
api_receiver: receiver,
|
||||
api_sender: sender,
|
||||
machine_identification_unique: params.get_machine_identification_unique(),
|
||||
namespace: ExtruderV2Namespace {
|
||||
namespace: ExtruderV1Namespace {
|
||||
namespace: params.namespace.clone(),
|
||||
},
|
||||
last_measurement_emit: Instant::now(),
|
||||
mode: ExtruderV2Mode::Standby,
|
||||
mode: ExtruderV1Mode::Standby,
|
||||
total_energy_kwh: 0.0,
|
||||
last_energy_calculation_time: None,
|
||||
temperature_controller_front,
|
||||
|
||||
@@ -5,10 +5,10 @@ use std::time::Instant;
|
||||
use crate::{MachineAct, MachineMessage};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use super::ExtruderV3;
|
||||
use super::ExtruderV2;
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl MachineAct for ExtruderV3 {
|
||||
impl MachineAct for ExtruderV2 {
|
||||
fn act(&mut self, now: Instant) {
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -25,17 +25,17 @@ impl MachineAct for ExtruderV3 {
|
||||
self.temperature_controller_front.update(now);
|
||||
self.temperature_controller_middle.update(now);
|
||||
|
||||
if self.mode == super::ExtruderV3Mode::Extrude {
|
||||
if self.mode == super::ExtruderV2Mode::Extrude {
|
||||
self.screw_speed_controller.update(now, true);
|
||||
} else {
|
||||
self.screw_speed_controller.update(now, false);
|
||||
}
|
||||
|
||||
if self.mode == super::ExtruderV3Mode::Standby {
|
||||
if self.mode == super::ExtruderV2Mode::Standby {
|
||||
self.turn_heating_off();
|
||||
}
|
||||
|
||||
if self.mode == super::ExtruderV3Mode::Extrude
|
||||
if self.mode == super::ExtruderV2Mode::Extrude
|
||||
&& !self.screw_speed_controller.get_motor_enabled()
|
||||
{
|
||||
self.switch_to_heat();
|
||||
@@ -57,7 +57,7 @@ impl MachineAct for ExtruderV3 {
|
||||
MachineMessage::SubscribeNamespace(namespace) => {
|
||||
self.namespace.namespace = Some(namespace);
|
||||
self.emit_state();
|
||||
tracing::info!("extruder1 received subscribe");
|
||||
tracing::info!("extruder2 received subscribe");
|
||||
}
|
||||
MachineMessage::UnsubscribeNamespace => self.namespace.namespace = None,
|
||||
MachineMessage::HttpApiJsonRequest(value) => {
|
||||
|
||||
@@ -28,8 +28,8 @@ use units::{
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use super::ExtruderV3;
|
||||
use super::ExtruderV3Mode;
|
||||
use super::ExtruderV2;
|
||||
use super::ExtruderV2Mode;
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize)]
|
||||
pub struct MotorStatusValues {
|
||||
@@ -114,10 +114,10 @@ pub struct StateEvent {
|
||||
|
||||
#[derive(Serialize, Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ModeState {
|
||||
pub mode: ExtruderV3Mode,
|
||||
pub mode: ExtruderV2Mode,
|
||||
}
|
||||
|
||||
pub enum ExtruderV3Events {
|
||||
pub enum ExtruderV2Events {
|
||||
LiveValues(Event<LiveValuesEvent>),
|
||||
State(Event<StateEvent>),
|
||||
}
|
||||
@@ -133,7 +133,7 @@ pub enum Mutation {
|
||||
SetInverterRegulation(bool),
|
||||
|
||||
//Mode
|
||||
SetExtruderMode(ExtruderV3Mode),
|
||||
SetExtruderMode(ExtruderV2Mode),
|
||||
SetFrontHeatingTargetTemperature(f64),
|
||||
SetBackHeatingTargetTemperature(f64),
|
||||
SetMiddleHeatingTemperature(f64),
|
||||
@@ -152,13 +152,13 @@ pub enum Mutation {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExtruderV3Namespace {
|
||||
pub struct ExtruderV2Namespace {
|
||||
pub namespace: Option<Namespace>,
|
||||
}
|
||||
|
||||
impl NamespaceCacheingLogic<ExtruderV3Events> for ExtruderV3Namespace {
|
||||
impl NamespaceCacheingLogic<ExtruderV2Events> for ExtruderV2Namespace {
|
||||
#[instrument(skip_all)]
|
||||
fn emit(&mut self, events: ExtruderV3Events) {
|
||||
fn emit(&mut self, events: ExtruderV2Events) {
|
||||
let event = Arc::new(events.event_value());
|
||||
let buffer_fn = events.event_cache_fn();
|
||||
|
||||
@@ -169,7 +169,7 @@ impl NamespaceCacheingLogic<ExtruderV3Events> for ExtruderV3Namespace {
|
||||
}
|
||||
}
|
||||
|
||||
impl CacheableEvents<Self> for ExtruderV3Events {
|
||||
impl CacheableEvents<Self> for ExtruderV2Events {
|
||||
fn event_value(&self) -> GenericEvent {
|
||||
match self {
|
||||
Self::LiveValues(event) => event.into(),
|
||||
@@ -187,7 +187,7 @@ impl CacheableEvents<Self> for ExtruderV3Events {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl MachineApi for ExtruderV3 {
|
||||
impl MachineApi for ExtruderV2 {
|
||||
fn api_get_sender(&self) -> Sender<MachineMessage> {
|
||||
self.api_sender.clone()
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ use units::thermodynamic_temperature::ThermodynamicTemperature;
|
||||
use units::{angular_velocity::revolution_per_minute, thermodynamic_temperature::degree_celsius};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use super::{ExtruderV3, ExtruderV3Mode, api::StateEvent};
|
||||
use super::{ExtruderV2, ExtruderV2Mode, api::StateEvent};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV3 {
|
||||
impl ExtruderV2 {
|
||||
pub fn build_state_event(&mut self) -> StateEvent {
|
||||
use crate::{
|
||||
extruder1::api::{TemperaturePid, TemperaturePidStates},
|
||||
@@ -150,15 +150,15 @@ impl ExtruderV3 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV3 {
|
||||
impl ExtruderV2 {
|
||||
pub fn emit_state(&mut self) {
|
||||
use super::api::ExtruderV3Events;
|
||||
use super::api::ExtruderV2Events;
|
||||
|
||||
let state = self.build_state_event();
|
||||
let hash = hash_with_serde_model(self.screw_speed_controller.get_inverter_status());
|
||||
self.last_status_hash = Some(hash);
|
||||
let event = state.build();
|
||||
self.namespace.emit(ExtruderV3Events::State(event));
|
||||
self.namespace.emit(ExtruderV2Events::State(event));
|
||||
}
|
||||
|
||||
pub fn maybe_emit_state_event(&mut self) {
|
||||
@@ -179,7 +179,7 @@ impl ExtruderV3 {
|
||||
pub fn emit_live_values(&mut self) {
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::extruder2::api::{ExtruderV3Events, LiveValuesEvent};
|
||||
use crate::extruder2::api::{ExtruderV2Events, LiveValuesEvent};
|
||||
let now = Instant::now();
|
||||
let combined_power = self.calculate_combined_power();
|
||||
self.update_total_energy(combined_power, now);
|
||||
@@ -224,7 +224,7 @@ impl ExtruderV3 {
|
||||
};
|
||||
|
||||
let event = live_values.build();
|
||||
self.namespace.emit(ExtruderV3Events::LiveValues(event));
|
||||
self.namespace.emit(ExtruderV2Events::LiveValues(event));
|
||||
}
|
||||
|
||||
// === Steuerungsfunktionen mit emit_state ===
|
||||
@@ -254,7 +254,7 @@ impl ExtruderV3 {
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV3Mode) {
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV2Mode) {
|
||||
self.switch_mode(mode);
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ impl MachineAct for ExtruderV2 {
|
||||
MachineMessage::SubscribeNamespace(namespace) => {
|
||||
self.namespace.namespace = Some(namespace);
|
||||
self.emit_state();
|
||||
tracing::info!("extruder1 received subscribe");
|
||||
tracing::info!("extruder2 received subscribe");
|
||||
}
|
||||
MachineMessage::UnsubscribeNamespace => self.namespace.namespace = None,
|
||||
MachineMessage::HttpApiJsonRequest(value) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::extruder1::{
|
||||
ExtruderV2Mode, HeatingType,
|
||||
api::{ExtruderV2Events, LiveValuesEvent, ModeState, PidSettings, StateEvent, TemperaturePid},
|
||||
ExtruderV1Mode, HeatingType,
|
||||
api::{ExtruderV1Events, LiveValuesEvent, ModeState, PidSettings, StateEvent, TemperaturePid},
|
||||
};
|
||||
use crate::extruder2::mock::ExtruderV2;
|
||||
|
||||
@@ -33,7 +33,7 @@ impl ExtruderV2 {
|
||||
let hash = hash_with_serde_model(self.inverter_status_state.clone());
|
||||
self.last_status_hash = Some(hash);
|
||||
let event = state.build();
|
||||
self.namespace.emit(ExtruderV2Events::State(event));
|
||||
self.namespace.emit(ExtruderV1Events::State(event));
|
||||
}
|
||||
|
||||
pub fn maybe_emit_state_event(&mut self) {
|
||||
@@ -68,7 +68,7 @@ impl ExtruderV2 {
|
||||
};
|
||||
|
||||
let event = live_values.build();
|
||||
self.namespace.emit(ExtruderV2Events::LiveValues(event));
|
||||
self.namespace.emit(ExtruderV1Events::LiveValues(event));
|
||||
}
|
||||
|
||||
pub fn set_nozzle_pressure_limit_is_enabled(&mut self, enabled: bool) {
|
||||
@@ -94,7 +94,7 @@ impl ExtruderV2 {
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV2Mode) {
|
||||
pub fn set_mode_state(&mut self, mode: ExtruderV1Mode) {
|
||||
self.mode_state = ModeState { mode };
|
||||
self.emit_state();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ use std::time::Instant;
|
||||
use crate::{
|
||||
MACHINE_EXTRUDER_V2, VENDOR_QITECH,
|
||||
extruder1::{
|
||||
ExtruderV2Mode,
|
||||
ExtruderV1Mode,
|
||||
api::{
|
||||
ExtruderSettingsState, ExtruderV2Namespace, HeatingStates, InverterStatusState,
|
||||
ExtruderSettingsState, ExtruderV1Namespace, HeatingStates, InverterStatusState,
|
||||
ModeState, MotorStatusValues, PidSettingsStates, PressureState, RegulationState,
|
||||
RotationState, ScrewState,
|
||||
},
|
||||
@@ -57,10 +57,10 @@ pub struct ExtruderV2 {
|
||||
|
||||
machine_identification_unique: MachineIdentificationUnique,
|
||||
|
||||
namespace: ExtruderV2Namespace,
|
||||
namespace: ExtruderV1Namespace,
|
||||
last_measurement_emit: Instant,
|
||||
last_status_hash: Option<u64>,
|
||||
mode: ExtruderV2Mode,
|
||||
mode: ExtruderV1Mode,
|
||||
/// Energy tracking for total consumption calculation
|
||||
pub total_energy_kwh: f64,
|
||||
pub last_energy_calculation_time: Option<Instant>,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::{
|
||||
MachineNewHardware, MachineNewParams, MachineNewTrait,
|
||||
extruder1::{
|
||||
ExtruderV2Mode,
|
||||
ExtruderV1Mode,
|
||||
api::{
|
||||
ExtruderSettingsState, ExtruderV2Namespace, HeatingState, HeatingStates,
|
||||
ExtruderSettingsState, ExtruderV1Namespace, HeatingState, HeatingStates,
|
||||
InverterStatusState, ModeState, MotorStatusValues, PidSettings, PidSettingsStates,
|
||||
PressureState, RegulationState, RotationState, ScrewState, TemperaturePid,
|
||||
TemperaturePidStates,
|
||||
@@ -39,12 +39,12 @@ impl MachineNewTrait for ExtruderV2 {
|
||||
api_receiver: receiver,
|
||||
api_sender: sender,
|
||||
machine_identification_unique: params.get_machine_identification_unique(),
|
||||
namespace: ExtruderV2Namespace {
|
||||
namespace: ExtruderV1Namespace {
|
||||
namespace: params.namespace.clone(),
|
||||
},
|
||||
last_measurement_emit: now,
|
||||
|
||||
mode: ExtruderV2Mode::Standby, // Start in standby mode
|
||||
mode: ExtruderV1Mode::Standby, // Start in standby mode
|
||||
emitted_default_state: false,
|
||||
last_status_hash: None,
|
||||
total_energy_kwh: 0.0,
|
||||
@@ -52,7 +52,7 @@ impl MachineNewTrait for ExtruderV2 {
|
||||
is_default_state: false,
|
||||
rotation_state: RotationState { forward: false },
|
||||
mode_state: ModeState {
|
||||
mode: ExtruderV2Mode::Standby,
|
||||
mode: ExtruderV1Mode::Standby,
|
||||
},
|
||||
regulation_state: RegulationState { uses_rpm: true },
|
||||
pressure_state: PressureState {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
use std::time::Instant;
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use api::ExtruderV3Namespace;
|
||||
use api::ExtruderV2Namespace;
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use smol::channel::Receiver;
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
@@ -39,7 +39,7 @@ pub mod new;
|
||||
pub mod temperature_controller;
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ExtruderV3Mode {
|
||||
pub enum ExtruderV2Mode {
|
||||
Standby,
|
||||
Heat,
|
||||
Extrude,
|
||||
@@ -54,17 +54,17 @@ pub enum HeatingType {
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
#[derive(Debug)]
|
||||
pub struct ExtruderV3 {
|
||||
pub struct ExtruderV2 {
|
||||
api_receiver: Receiver<MachineMessage>,
|
||||
api_sender: Sender<MachineMessage>,
|
||||
main_sender: Option<Sender<AsyncThreadMessage>>,
|
||||
|
||||
machine_identification_unique: MachineIdentificationUnique,
|
||||
namespace: ExtruderV3Namespace,
|
||||
namespace: ExtruderV2Namespace,
|
||||
|
||||
last_measurement_emit: Instant,
|
||||
last_status_hash: Option<u64>,
|
||||
mode: ExtruderV3Mode,
|
||||
mode: ExtruderV2Mode,
|
||||
|
||||
screw_speed_controller: ScrewSpeedController,
|
||||
temperature_controller_front: TemperatureController,
|
||||
@@ -82,7 +82,7 @@ pub struct ExtruderV3 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl Machine for ExtruderV3 {
|
||||
impl Machine for ExtruderV2 {
|
||||
fn get_machine_identification_unique(&self) -> MachineIdentificationUnique {
|
||||
self.machine_identification_unique.clone()
|
||||
}
|
||||
@@ -93,14 +93,14 @@ impl Machine for ExtruderV3 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl std::fmt::Display for ExtruderV3 {
|
||||
impl std::fmt::Display for ExtruderV2 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "ExtruderV3")
|
||||
write!(f, "ExtruderV2")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV3 {
|
||||
impl ExtruderV2 {
|
||||
pub const MACHINE_IDENTIFICATION: MachineIdentification = MachineIdentification {
|
||||
vendor: VENDOR_QITECH,
|
||||
machine: MACHINE_EXTRUDER_V2,
|
||||
@@ -108,7 +108,7 @@ impl ExtruderV3 {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl ExtruderV3 {
|
||||
impl ExtruderV2 {
|
||||
/// Calculate combined power consumption in watts
|
||||
fn calculate_combined_power(&mut self) -> f64 {
|
||||
let motor_power = {
|
||||
@@ -156,58 +156,58 @@ impl ExtruderV3 {
|
||||
|
||||
fn switch_to_standby(&mut self) {
|
||||
match self.mode {
|
||||
ExtruderV3Mode::Standby => (),
|
||||
ExtruderV3Mode::Heat => {
|
||||
ExtruderV2Mode::Standby => (),
|
||||
ExtruderV2Mode::Heat => {
|
||||
self.turn_heating_off();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
ExtruderV3Mode::Extrude => {
|
||||
ExtruderV2Mode::Extrude => {
|
||||
self.turn_heating_off();
|
||||
self.screw_speed_controller.turn_motor_off();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
};
|
||||
self.mode = ExtruderV3Mode::Standby;
|
||||
self.mode = ExtruderV2Mode::Standby;
|
||||
}
|
||||
|
||||
fn switch_to_heat(&mut self) {
|
||||
match self.mode {
|
||||
ExtruderV3Mode::Standby => self.enable_heating(),
|
||||
ExtruderV3Mode::Heat => (),
|
||||
ExtruderV3Mode::Extrude => {
|
||||
ExtruderV2Mode::Standby => self.enable_heating(),
|
||||
ExtruderV2Mode::Heat => (),
|
||||
ExtruderV2Mode::Extrude => {
|
||||
self.screw_speed_controller.turn_motor_off();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
}
|
||||
self.mode = ExtruderV3Mode::Heat;
|
||||
self.mode = ExtruderV2Mode::Heat;
|
||||
}
|
||||
|
||||
fn switch_to_extrude(&mut self) {
|
||||
match self.mode {
|
||||
ExtruderV3Mode::Standby => {
|
||||
ExtruderV2Mode::Standby => {
|
||||
self.screw_speed_controller.turn_motor_on();
|
||||
self.enable_heating();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
ExtruderV3Mode::Heat => {
|
||||
ExtruderV2Mode::Heat => {
|
||||
self.screw_speed_controller.turn_motor_on();
|
||||
self.enable_heating();
|
||||
self.screw_speed_controller.reset_pid();
|
||||
}
|
||||
ExtruderV3Mode::Extrude => (),
|
||||
ExtruderV2Mode::Extrude => (),
|
||||
}
|
||||
self.mode = ExtruderV3Mode::Extrude;
|
||||
self.mode = ExtruderV2Mode::Extrude;
|
||||
}
|
||||
|
||||
fn switch_mode(&mut self, mode: ExtruderV3Mode) {
|
||||
fn switch_mode(&mut self, mode: ExtruderV2Mode) {
|
||||
if self.mode == mode {
|
||||
return;
|
||||
}
|
||||
|
||||
match mode {
|
||||
ExtruderV3Mode::Standby => self.switch_to_standby(),
|
||||
ExtruderV3Mode::Heat => self.switch_to_heat(),
|
||||
ExtruderV3Mode::Extrude => self.switch_to_extrude(),
|
||||
ExtruderV2Mode::Standby => self.switch_to_standby(),
|
||||
ExtruderV2Mode::Heat => self.switch_to_heat(),
|
||||
ExtruderV2Mode::Extrude => self.switch_to_extrude(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ use units::thermodynamic_temperature::{ThermodynamicTemperature, degree_celsius}
|
||||
use crate::extruder1::temperature_controller::TemperatureController;
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use super::ExtruderV3;
|
||||
use super::ExtruderV2;
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
impl MachineNewTrait for ExtruderV3 {
|
||||
impl MachineNewTrait for ExtruderV2 {
|
||||
fn new<'maindevice>(params: &MachineNewParams) -> Result<Self, Error> {
|
||||
// validate general stuff
|
||||
|
||||
@@ -88,7 +88,7 @@ impl MachineNewTrait for ExtruderV3 {
|
||||
Heating, mitsubishi_cs80::MitsubishiCS80,
|
||||
screw_speed_controller::ScrewSpeedController,
|
||||
},
|
||||
extruder2::{ExtruderV3Mode, api::ExtruderV3Namespace},
|
||||
extruder2::{ExtruderV2Mode, api::ExtruderV2Namespace},
|
||||
};
|
||||
let _ek1100 =
|
||||
get_ethercat_device::<EK1100>(hardware, params, 0, [EK1100_IDENTITY_A].to_vec());
|
||||
@@ -222,16 +222,16 @@ impl MachineNewTrait for ExtruderV3 {
|
||||
);
|
||||
let (sender, receiver) = smol::channel::unbounded();
|
||||
|
||||
let mut extruder: ExtruderV3 = Self {
|
||||
let mut extruder: ExtruderV2 = Self {
|
||||
main_sender: params.main_thread_channel.clone(),
|
||||
api_receiver: receiver,
|
||||
api_sender: sender,
|
||||
machine_identification_unique: params.get_machine_identification_unique(),
|
||||
namespace: ExtruderV3Namespace {
|
||||
namespace: ExtruderV2Namespace {
|
||||
namespace: params.namespace.clone(),
|
||||
},
|
||||
last_measurement_emit: Instant::now(),
|
||||
mode: ExtruderV3Mode::Standby,
|
||||
mode: ExtruderV2Mode::Standby,
|
||||
total_energy_kwh: 0.0,
|
||||
last_energy_calculation_time: None,
|
||||
temperature_controller_front,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#[cfg(feature = "mock-machine")]
|
||||
use crate::{
|
||||
extruder1::mock::ExtruderV2 as ExtruderV2Mock1, extruder2::mock::ExtruderV2 as ExtruderV2Mock2,
|
||||
extruder1::mock::ExtruderV1 as ExtruderV2Mock1, extruder2::mock::ExtruderV2 as ExtruderV2Mock2,
|
||||
mock::MockMachine, winder2::mock::Winder2,
|
||||
};
|
||||
|
||||
@@ -10,10 +10,10 @@ use crate::{
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use crate::extruder1::ExtruderV2;
|
||||
use crate::extruder1::ExtruderV1;
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
use crate::{
|
||||
aquapath1::AquaPathV1, buffer1::BufferV1, extruder2::ExtruderV3, laser::LaserMachine,
|
||||
aquapath1::AquaPathV1, buffer1::BufferV1, extruder2::ExtruderV2, laser::LaserMachine,
|
||||
winder2::Winder2,
|
||||
};
|
||||
|
||||
@@ -104,10 +104,10 @@ lazy_static! {
|
||||
mc.register::<ExtruderV2Mock2>(ExtruderV2Mock2::MACHINE_IDENTIFICATION);
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
mc.register::<ExtruderV2>(ExtruderV2::MACHINE_IDENTIFICATION);
|
||||
mc.register::<ExtruderV1>(ExtruderV1::MACHINE_IDENTIFICATION);
|
||||
|
||||
#[cfg(not(feature = "mock-machine"))]
|
||||
mc.register::<ExtruderV3>(ExtruderV3::MACHINE_IDENTIFICATION);
|
||||
mc.register::<ExtruderV2>(ExtruderV2::MACHINE_IDENTIFICATION);
|
||||
|
||||
#[cfg(feature = "mock-machine")]
|
||||
mc.register::<MockMachine>(MockMachine::MACHINE_IDENTIFICATION);
|
||||
|
||||
@@ -24,7 +24,7 @@ impl MachineAct for Winder2 {
|
||||
MachineMessage::SubscribeNamespace(namespace) => {
|
||||
self.namespace.namespace = Some(namespace);
|
||||
self.emit_state();
|
||||
tracing::info!("extruder1 received subscribe");
|
||||
tracing::info!("winder2 received subscribe");
|
||||
}
|
||||
MachineMessage::UnsubscribeNamespace => self.namespace.namespace = None,
|
||||
MachineMessage::HttpApiJsonRequest(value) => {
|
||||
|
||||
Reference in new issue
Block a user