temp
This commit is contained in:
parent
3f498e2a9e
commit
2a3bcd312b
@ -6,4 +6,6 @@ host = "192.168.4.196:11883"
|
|||||||
username = "zxwl"
|
username = "zxwl"
|
||||||
password = "zxwl1234@"
|
password = "zxwl1234@"
|
||||||
topic = "/zxwl/vehicle/V060001/info"
|
topic = "/zxwl/vehicle/V060001/info"
|
||||||
qos = 1
|
qos = 1
|
||||||
|
[led]
|
||||||
|
num = 5
|
||||||
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
using namespace toml;
|
using namespace toml;
|
||||||
|
|
||||||
|
int led_num = 0;
|
||||||
|
|
||||||
class BreathingLight
|
class BreathingLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -18,7 +20,7 @@ public:
|
|||||||
{
|
{
|
||||||
LedCommand cmd;
|
LedCommand cmd;
|
||||||
cmd.setColor(brightness, brightness, 0); // 黄色
|
cmd.setColor(brightness, brightness, 0); // 黄色
|
||||||
cmd.setExtCount(1);
|
cmd.setExtCount(led_num);
|
||||||
auto packet = cmd.serialize();
|
auto packet = cmd.serialize();
|
||||||
if (!serial.writeData(packet.data(), packet.size()))
|
if (!serial.writeData(packet.data(), packet.size()))
|
||||||
{
|
{
|
||||||
@ -56,7 +58,7 @@ void alwaysRed(SerialPort &serial)
|
|||||||
{
|
{
|
||||||
LedCommand cmd;
|
LedCommand cmd;
|
||||||
cmd.setColor(255, 0, 0); // 红色
|
cmd.setColor(255, 0, 0); // 红色
|
||||||
cmd.setExtCount(1);
|
cmd.setExtCount(led_num);
|
||||||
auto packet = cmd.serialize();
|
auto packet = cmd.serialize();
|
||||||
|
|
||||||
std::cout << "发送常红数据包:";
|
std::cout << "发送常红数据包:";
|
||||||
@ -73,7 +75,7 @@ void alwaysGreen(SerialPort &serial)
|
|||||||
{
|
{
|
||||||
LedCommand cmd;
|
LedCommand cmd;
|
||||||
cmd.setColor(0, 255, 0); // 红色
|
cmd.setColor(0, 255, 0); // 红色
|
||||||
cmd.setExtCount(1);
|
cmd.setExtCount(led_num);
|
||||||
auto packet = cmd.serialize();
|
auto packet = cmd.serialize();
|
||||||
|
|
||||||
std::cout << "发送常红数据包:";
|
std::cout << "发送常红数据包:";
|
||||||
@ -103,6 +105,7 @@ int main()
|
|||||||
}
|
}
|
||||||
port = toml::find<std::string>(data, "serial", "port");
|
port = toml::find<std::string>(data, "serial", "port");
|
||||||
baudrate = toml::find<int>(data, "serial", "baudrate");
|
baudrate = toml::find<int>(data, "serial", "baudrate");
|
||||||
|
led_num = toml::find<int>(data, "led", "num");
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user