mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-07-21 11:01:25 +00:00
* refactor: render chat rows from presentation state * Fix Meshtastic channel sync and add MeshCore CN preset * Add granular chat notification settings * Add SD settings backup and restore * Prepare 0.1.26-alpha release --------- Co-authored-by: vicliu624 <vicliu@outlook.com>
58 lines
2.2 KiB
C++
58 lines
2.2 KiB
C++
#include "nrf52_node_startup_runtime.h"
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include "boards/gat562_mesh_evb_pro/gat562_board.h"
|
|
#include "nrf52_node_app_facade_runtime.h"
|
|
#include "nrf52_node_app_runtime_access.h"
|
|
#include "nrf52_node_ui_runtime.h"
|
|
#include "platform/nrf52/debug/nrf52_debug_console.h"
|
|
#include "sys/clock.h"
|
|
|
|
namespace trailmate::apps::nrf52_node::startup_runtime
|
|
{
|
|
|
|
void run()
|
|
{
|
|
platform::nrf52::debug_console::begin();
|
|
platform::nrf52::debug_console::println();
|
|
platform::nrf52::debug_console::println("[gat562] startup begin");
|
|
auto& board = ::boards::gat562_mesh_evb_pro::Gat562Board::instance();
|
|
(void)board.begin();
|
|
sys::set_millis_provider([]() -> uint32_t
|
|
{ return millis(); });
|
|
sys::set_epoch_seconds_provider([]() -> uint32_t
|
|
{ return ::boards::gat562_mesh_evb_pro::Gat562Board::instance().currentEpochSeconds(); });
|
|
sys::set_sleep_provider([](uint32_t ms)
|
|
{ delay(ms); });
|
|
ui_runtime::initialize();
|
|
ui_runtime::appendBootLog("startup begin");
|
|
ui_runtime::appendBootLog("board/input ok");
|
|
|
|
(void)board.bindRadioIo();
|
|
const bool lora_ok = board.beginRadioIo();
|
|
platform::nrf52::debug_console::println(lora_ok ? "[gat562] startup lora io ok" : "[gat562] startup lora io failed");
|
|
ui_runtime::appendBootLog(lora_ok ? "lora io ok" : "lora io fail");
|
|
|
|
if (app_runtime_access::initialize())
|
|
{
|
|
auto& cfg = AppFacadeRuntime::instance().getConfig();
|
|
ui_runtime::bindChatObservers();
|
|
(void)board.startGpsRuntime(cfg);
|
|
platform::nrf52::debug_console::println("[gat562] startup app facade ok");
|
|
ui_runtime::appendBootLog("app/gps ok");
|
|
char freq_text[20] = {};
|
|
if (board.formatLoraFrequencyMHz(board.activeLoraFrequencyHz(), freq_text, sizeof(freq_text)))
|
|
{
|
|
ui_runtime::appendBootLog(freq_text);
|
|
}
|
|
ui_runtime::appendBootLog(cfg.mesh_protocol == chat::MeshProtocol::MeshCore ? "proto MC" : "proto MT");
|
|
}
|
|
else
|
|
{
|
|
platform::nrf52::debug_console::println("[gat562] startup app facade failed");
|
|
ui_runtime::appendBootLog("app init fail");
|
|
}
|
|
}
|
|
|
|
} // namespace trailmate::apps::nrf52_node::startup_runtime
|