|
@ -8,9 +8,9 @@ |
|
|
|
|
|
|
|
|
namespace simon { |
|
|
namespace simon { |
|
|
namespace stepper { |
|
|
namespace stepper { |
|
|
c_stepper::c_stepper(const std::string& axis) |
|
|
c_stepper::c_stepper(const std::string& axis, const std::string& fname) |
|
|
{ |
|
|
{ |
|
|
auto file_content = read_file("settings.json"); |
|
|
auto file_content = read_file(fname); |
|
|
auto j_set = json::parse(file_content); |
|
|
auto j_set = json::parse(file_content); |
|
|
if (!j_set["axis_configurations"].is_array()) { |
|
|
if (!j_set["axis_configurations"].is_array()) { |
|
|
std::cout << "Expected an array in the configuration below \"axis_configurations\"." << "\n"; |
|
|
std::cout << "Expected an array in the configuration below \"axis_configurations\"." << "\n"; |
|
@ -18,8 +18,10 @@ namespace simon { |
|
|
} |
|
|
} |
|
|
extract_settings(j_set, axis); |
|
|
extract_settings(j_set, axis); |
|
|
m_thread = std::thread(std::bind(&a4988::c_allegro_4988::run, &(*m_ptr_a4988))); |
|
|
m_thread = std::thread(std::bind(&a4988::c_allegro_4988::run, &(*m_ptr_a4988))); |
|
|
rotate(180); |
|
|
for (int i=0; i<10; i++) { |
|
|
rotate(-180); |
|
|
rotate(90); |
|
|
|
|
|
rotate(-90); |
|
|
|
|
|
} |
|
|
m_ptr_a4988->kill(); |
|
|
m_ptr_a4988->kill(); |
|
|
m_thread.join(); |
|
|
m_thread.join(); |
|
|
} |
|
|
} |
|
|