Skip to content

Commit a25e7f8

Browse files
committed
added color to lamp test output
1 parent d1e65d8 commit a25e7f8

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/PPUC.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ void PPUC::SendLedConfigBlock(const YAML::Node& items, uint32_t type,
163163
new ConfigEvent(board, (uint8_t)CONFIG_TOPIC_LAMPS, index++,
164164
(uint8_t)CONFIG_TOPIC_COLOR, color));
165165

166-
m_lamps.push_back(PPUCLamp(board, port, (uint8_t)type,
167-
n_item["number"].as<uint8_t>(),
168-
n_item["description"].as<std::string>()));
166+
m_lamps.push_back(
167+
PPUCLamp(board, port, (uint8_t)type, n_item["number"].as<uint8_t>(),
168+
n_item["description"].as<std::string>(), color));
169169
}
170170
}
171171
}
@@ -631,8 +631,11 @@ void PPUC::LampTest() {
631631

632632
for (const auto& lamp : GetLamps()) {
633633
if (lamp.type == LED_TYPE_LAMP) {
634-
printf("\nBoard: %d\nPort: %d\nNumber: %d\nDescription: %s\n", lamp.board,
635-
lamp.port, lamp.number, lamp.description.c_str());
634+
printf(
635+
"\nBoard: %d\nPort: %d\nNumber: %d\nDescription: %s\Color: %08" PRIx32
636+
"\n",
637+
lamp.board, lamp.port, lamp.number, lamp.description.c_str(),
638+
lamp.color);
636639
SetLampState(lamp.number, 1);
637640
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
638641
SetLampState(lamp.number, 0);
@@ -641,8 +644,11 @@ void PPUC::LampTest() {
641644

642645
for (const auto& coil : GetCoils()) {
643646
if (coil.type == PWM_TYPE_LAMP) {
644-
printf("\nBoard: %d\nPort: %d\nNumber: %d\nDescription: %s\n",
645-
coil.board, coil.port, coil.number, coil.description.c_str());
647+
printf(
648+
"\nBoard: %d\nPort: %d\nNumber: %d\nDescription: %s\Color: "
649+
"%08" PRIx32 "\n",
650+
lamp.board, lamp.port, lamp.number, lamp.description.c_str(),
651+
lamp.color);
646652
SetSolenoidState(coil.number, 1);
647653
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
648654
SetSolenoidState(coil.number, 0);

src/PPUC_structs.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct PPUCLamp {
5050
uint8_t type;
5151
uint8_t number;
5252
std::string description;
53+
uint32_t color;
5354

54-
PPUCLamp(uint8_t b, uint8_t p, uint8_t t, uint8_t n, const std::string& d)
55-
: board(b), port(p), type(t), number(n), description(d) {}
55+
PPUCLamp(uint8_t b, uint8_t p, uint8_t t, uint8_t n, const std::string& d, uint32_t
56+
: board(b), port(p), type(t), number(n), description(d), color(c) {}
5657
};

0 commit comments

Comments
 (0)