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

usb + panel both works now

parent a2517663
......@@ -198,6 +198,7 @@ void
LinakDesk::doDeskControl(void)
{
m_finished = true;
unique_lock<mutex> lck(m_cmdMutex);
if (libusb_init(0) != 0)
{
......@@ -226,23 +227,24 @@ LinakDesk::doDeskControl(void)
if (target_height >= (m_currentHeight - STOP_DELAY) && target_height <= (m_currentHeight + STOP_DELAY) && !m_smallStep)
{
// stop
// TODO: how to stop?
// wait for new command
m_finished = true;
do
{
try
{
target_height = m_queue.getMessage(chrono::seconds(1));
m_finished = false;
}
catch (TimeoutException &e)
{
cout << "Checking height" << endl;
cout << "Timeoute Checking height" << endl;
lck.lock();
m_currentHeight = getInternalHeight();
lck.unlock();
cout << "currentHeight exception=" << m_currentHeight << endl;
cout << "currentHeight=" << m_currentHeight << endl;
}
} while (target_height == m_currentHeight);
} while (m_finished == true);
target_height -= m_offset;
uint delta = abs(m_currentHeight - target_height);
m_smallStep = (delta <= STOP_DELAY) ? true : false;
......
......@@ -103,6 +103,7 @@ class LinakDesk : public Controller
std::mutex m_busMutex;
libusb_device_handle *m_udev;
bool m_smallStep;
bool m_finished;
};
};
......
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