Skip to content

Commit

Permalink
Populating more data in Read
Browse files Browse the repository at this point in the history
  • Loading branch information
davidinkyu-kim committed Mar 29, 2023
1 parent 440dc51 commit ff69b5e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/jsd/el6001.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ bool fastcat::El6001::ConfigFromYamlCommon(YAML::Node node)
return false;
}

if (!ParseVal(node, "use_first_byte_as_packet_length", use_first_byte_as_packet_length_)) {
return false;
}

if (!ParseVal(node, "use_last_byte_as_checksum", use_last_byte_as_checksum_)) {
return false;
}

state_->name = name_;

switch(baud_rate_){
Expand Down Expand Up @@ -71,6 +79,9 @@ bool fastcat::El6001::ConfigFromYamlCommon(YAML::Node node)
break;
}

jsd_slave_config_.el6001.use_first_byte_as_packet_length = use_first_byte_as_packet_length_;
jsd_slave_config_.el6001.use_last_byte_as_checksum = use_last_byte_as_checksum_;

jsd_slave_config_.configuration_active = true;
jsd_slave_config_.product_code = JSD_EL6001_PRODUCT_CODE;
snprintf(jsd_slave_config_.name, JSD_NAME_LEN, "%s", name_.c_str());
Expand All @@ -86,7 +97,12 @@ bool fastcat::El6001::Read()
jsd_el6001_get_state((jsd_t*)context_, slave_id_);

state_->el6001_state.statusword = jsd_state->statusword;
state_->el6001_state.controlword = jsd_state->controlword_user;
state_->el6001_state.controlword = jsd_state->controlword_user;

for(int i=0; i < JSD_EL6001_NUM_DATA_BYTES; i++){
state_->el6001_state.data_in_bytes[i] = jsd_state->received_bytes[i];
state_->el6001_state.data_out_bytes[i] = jsd_state->transmit_bytes[i];
}

return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/jsd/el6001.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class El6001 : public JsdDeviceBase
bool ConfigFromYamlCommon(YAML::Node node);

int baud_rate_;
bool use_first_byte_as_packet_length_;
bool use_last_byte_as_checksum_;

private:
jsd_slave_config_t jsd_slave_config_{0};
Expand Down

0 comments on commit ff69b5e

Please sign in to comment.