45 msg::Log::get().sinks.add_Serial();
46 msg::Log::get().sinks.add(&msg::StartupLog::get());
50 LOG_ALWAYS(dist::ident());
51 LOGV(
"Flash image (%d bytes) sha256 sum: %s\n", loader::flashimage::len(),
52 loader::flashimage::sha256sum().to_string().c_str());
58 LOG(ANABRID_DEBUG_INIT,
"Detecting and Initializing carrier board...");
59 auto &carrier_ = carrier::Carrier::get();
60 if (!carrier_.init()) {
61 LOG_ERROR(
"Error initializing carrier board.");
62 leds::indicate_error();
68 LOG(ANABRID_DEBUG_INIT,
"Starting up Ethernet...");
69 net::register_settings();
70 auto &netconf = net::StartupConfig::get();
71 int net_error = netconf.begin_ip();
72 if (!net_error && netconf.enable_mdns) {
76 if (!net_error && netconf.enable_jsonl)
77 msg::ApplicationServer::get().begin();
90 auto ® = msg::handlers::Registry::get();
97 if (!daq::calibrate(carrier_)) {
98 LOG_ALWAYS(
"Warning: Error during DAQ calibration. Machine will continue with reduced accuracy.");
102 carrier_.reset(entities::ResetAction::OVERLOAD_RESET);
105 mode::RealManualControl::to_ic();
108 LOG(ANABRID_DEBUG_INIT,
"Executing self-calibration, this may take a few moments...");
109 if (!carrier_.calibrate_m_blocks()) {
119 LOG_ALWAYS(
"Info: Startup self-calibration apparently did not succeed. The calibration scheme is by "
120 "default not used in this build anyway.");
124 carrier_.reset(entities::ResetAction::CIRCUIT_RESET | entities::ResetAction::OVERLOAD_RESET);
125 (void)carrier_.write_to_hardware();
129 LOG(ANABRID_DEBUG_INIT,
"Initialization done.");
131 static_plugin::setup();
133 platform::CalibrationBase::begin();
141 auto &netconf = net::StartupConfig::get();
143 if (netconf.enable_jsonl)
144 msg::ApplicationServer::get().loop();
146 if (Serial.available()) {
147 auto input_stream = std::make_shared<transport::DelimitedInputStream<Stream*>>(&Serial);
148 auto output_stream = std::make_shared<transport::DelimitedMessageOutputStream<Stream*>>(&Serial);
149 transport::Transport
transport(std::move(input_stream), output_stream, std::move(output_stream));
153 run::RunManager::get().try_run_next(carrier::Carrier::get());
154 static_plugin::loop();