changed el3024

This commit is contained in:
93094049+kraemr@users.noreply.github.com committed 2025-03-28 14:38:57 +01:00
1 parent e5b6c950df
commit b6f15dc2d2
4 files changed
+184 -173

No files matched your search

+9 -1
View File
@@ -7,11 +7,14 @@ use crate::{
ethercat::config::{MAX_FRAMES, MAX_PDU_DATA, MAX_SUBDEVICES, PDI_LEN},
};
use bitvec::prelude::*;
use control_core::actors::analog_input_getter::{AnalogInputDevice, AnalogInputGetter};
use control_core::actors::Actor;
use control_core::identification::identify_device_groups;
use control_core::socketio::event::EventBuilder;
use control_core::socketio::room::RoomCacheingLogic;
use ethercat_hal::devices::devices_from_subdevices;
use ethercat_hal::devices::el3024::{EL3024Port, EL3024};
use ethercat_hal::devices::{devices_from_subdevices, downcast_device};
use ethercat_hal::io::analog_input::AnalogInput;
use ethercrab::std::{ethercat_now, tx_rx_task};
use ethercrab::{MainDevice, MainDeviceConfig, PduStorage, RetryBehaviour, Timeouts};
use smol::lock::RwLock;
@@ -133,6 +136,11 @@ pub async fn setup_loop(interface: &str, app_state: Arc<AppState>) -> Result<(),
}
}
let el3024 = downcast_device::<EL3024>(devices.get(1).unwrap().clone()).await.unwrap();
let analog_input = AnalogInput::new(el3024, EL3024Port::AI1);
let analog_input_getter = AnalogInputGetter::new(analog_input, AnalogInputDevice::EL305x.into());
actors.push(Arc::new(RwLock::new(analog_input_getter)));
// Write all this stuff to `app_state`
{
let mut ethercat_setup_guard = app_state.ethercat_setup.write().await;
+2 -3
View File
@@ -16,7 +16,7 @@ use ethercat_hal::devices::el2521::{EL2521Configuration, EL2521Port, EL2521};
use ethercat_hal::devices::el2522::{
EL2522ChannelConfiguration, EL2522Configuration, EL2522Port, EL2522,
};
use ethercat_hal::devices::el3001::{EL3001PdoPreset, EL3001Port, EL3001};
use ethercat_hal::devices::el3001::{EL3001Configuration, EL3001PdoPreset, EL3001Port, EL3001};
use ethercat_hal::devices::{downcast_device, subdevice_identity_to_tuple, Device};
use ethercat_hal::devices::{
ek1100::EK1100_IDENTITY_A,
@@ -28,7 +28,6 @@ use ethercat_hal::devices::{
use ethercat_hal::io::analog_input::AnalogInput;
use ethercat_hal::io::digital_output::DigitalOutput;
use ethercat_hal::io::pulse_train_output::PulseTrainOutput;
use ethercat_hal::shared_config::el30xx::EL30XXConfiguration;
use ethercat_hal::types::EthercrabSubDevicePreoperational;
use futures::executor::block_on;
use smol::lock::RwLock;
@@ -120,7 +119,7 @@ impl MachineNewTrait for WinderV1 {
.await
.write_config(
&subdevice,
&EL30XXConfiguration {
&EL3001Configuration {
pdo_assignment: EL3001PdoPreset::Compact,
..Default::default()
},