Skip to content

Commit c957228

Browse files
committed
Use VCS ID as program identification string.
1 parent b8a586d commit c957228

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

src/main.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@
1313
#include <user_interaction/guiEngine_factory_interface.hpp>
1414
#include <user_interaction/keypad_factory_interface.hpp>
1515
#include <user_interaction/statusindicators_factory_interface.hpp>
16+
#include <version.hpp>
1617

1718
void setup()
1819
{
1920
serial_port::initialize();
2021
serial_port::cout << "\x1b[20h"; // Tell the terminal to use CR/LF for newlines instead of just CR.
21-
static constexpr const auto programIdentificationString = __FILE__ " compiled at " __DATE__ " " __TIME__;
22-
serial_port::cout << std::endl
23-
<< " begin program '" << programIdentificationString << std::endl;
22+
23+
constexpr const auto programIdentificationString = []() {
24+
constexpr const auto versionString = getVersionString();
25+
if constexpr (versionString)
26+
{
27+
return versionString.value();
28+
}
29+
else
30+
{
31+
return " compiled at " __DATE__ " " __TIME__;
32+
}
33+
}();
34+
35+
serial_port::cout
36+
<< std::endl
37+
<< " begin program '" << __FILE__ << programIdentificationString << std::endl;
2438
serial_port::setCallbackForLineReception([](const serial_port::String &commandLine) {
2539
ProtocolHandler::execute(commandLine.c_str());
2640
});

0 commit comments

Comments
 (0)