Skip to content

Commit

Permalink
Led blinking runs now on a new thread.
Browse files Browse the repository at this point in the history
This feature allows the application plotting and blinking the devices leds simultaneously.

Signed-off-by: Cristi Iacob <[email protected]>
  • Loading branch information
cristi-iacob authored and AlexandraTrifan committed Sep 14, 2020
1 parent 89b8c65 commit 82ebaff
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions SMU.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <QStandardPaths>
#include <QDir>
#include <iomanip>
#include <thread>

#include "SMU.h"
#include "Plot/PhosphorRender.h"
Expand Down Expand Up @@ -435,16 +436,19 @@ m_samples_added(0)

void DeviceItem::blinkLeds()
{
m_device->set_led(1);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_device->set_led(2);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_device->set_led(1);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_device->set_led(2);
std::thread led_thread ([=] {
this->m_device->set_led(1);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
this->m_device->set_led(2);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
this->m_device->set_led(1);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
this->m_device->set_led(2);
}
);
led_thread.detach();
}


void DeviceItem::write(ChannelItem* channel)
{
for (auto chn: m_channels) {
Expand Down

0 comments on commit 82ebaff

Please sign in to comment.