Commit e381da02 authored by Mall, Anon's avatar Mall, Anon
Browse files

linakdesk constructor

parent 1027f06e
......@@ -129,6 +129,29 @@ DummyDesk::doDeskControl()
}
}
LinakDesk::LinakDesk(std::string offset_file):
Controller(offset_file),
m_smallStep(false),
m_finished(true)
{
unique_lock<mutex> lck(m_cmdMutex);
if (libusb_init(0) != 0)
{
fprintf(stderr, "Error failed to init libusb");
}
libusb_set_debug(0, LIBUSB_LOG_LEVEL_WARNING); //and let usblib be verbose
m_udev = usb2lin06::openDevice();
if (m_udev == NULL)
{
fprintf(stderr, "Error NO device");
cout << "could not USB device" << endl;
}
initDevice(m_udev);
m_currentHeight = getInternalHeight();
lck.unlock();
}
void
LinakDesk::setHeight(int height)
{
......@@ -197,26 +220,9 @@ LinakDesk::move(Command cmd)
void
LinakDesk::doDeskControl(void)
{
m_finished = true;
unique_lock<mutex> lck(m_cmdMutex);
if (libusb_init(0) != 0)
{
fprintf(stderr, "Error failed to init libusb");
}
libusb_set_debug(0, LIBUSB_LOG_LEVEL_WARNING); //and let usblib be verbose
m_udev = usb2lin06::openDevice();
if (m_udev == NULL)
{
fprintf(stderr, "Error NO device");
cout << "could not USB device" << endl;
}
initDevice(m_udev);
m_currentHeight = getInternalHeight();
int target_height = m_currentHeight;
lck.unlock();
while (true)
{
lck.lock();
......
......@@ -91,6 +91,7 @@ class LinakDesk : public Controller
Operation operationState;
};
LinakDesk(std::string offset_file = "desk_offset.conf");
virtual void doDeskControl(void);
virtual void setHeight(int height);
virtual int getHeight();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment