mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-23 02:41:27 +00:00
core: restore upstream shape for the shared mesh core
- Mesh, Dispatcher, Packet, packet pool and the core headers rebuilt from Arduino MeshCore's text; ZephCore changes re-applied, each fenced `// ZEPHCORE:` (diff vs upstream: 4540 -> 1147 lines) - upstream header layout; MainBoard gains handleCommand/loop and the other upstream members; RNG::nextInt back in Utils.cpp - packet logging moved to the roles' log hooks (helpers/PacketLog.h) - zero-hop direct ACKs deduplicated and length-checked as upstream - RadioIncludes.h -> src/, LoRaConfig.h -> helpers/ - .editorconfig: shared files keep upstream formatting Verified: 10 role builds, per-function disassembly review, bench DM/ACK regression (T1000-E, Wio L1, XIAO S3 on 1.17.4) incl. via live repeater.
This commit is contained in:
1 parent
2e2d852f29
commit
a7d073900e
44 files changed
+2551
-2488
No files matched your search
@@ -26,6 +26,7 @@
|
||||
#include <ZephyrWiFiStation.h>
|
||||
#include <ZephyrMQTTPublisher.h>
|
||||
#endif
|
||||
#include <helpers/PacketLog.h>
|
||||
|
||||
/* Helper to get radio driver for stats — uses LoRaRadioBase (works for SX126x and LR1110) */
|
||||
static inline mesh::LoRaRadioBase& getRadioDriver(mesh::Radio* radio) {
|
||||
@@ -354,8 +355,8 @@ int RepeaterMesh::handleRequest(ClientInfo* sender, uint32_t sender_timestamp, u
|
||||
stats.n_recv_direct = getNumRecvDirect();
|
||||
stats.err_events = _err_flags;
|
||||
stats.last_snr = (int16_t)(radio_driver.getLastSNR() * 4);
|
||||
stats.n_direct_dups = ((mesh::SimpleMeshTables *)getTables())->getNumDirectDups();
|
||||
stats.n_flood_dups = ((mesh::SimpleMeshTables *)getTables())->getNumFloodDups();
|
||||
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
|
||||
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
|
||||
stats.total_rx_air_time_secs = getReceiveAirTime() / 1000;
|
||||
stats.n_recv_errors = radio_driver.getPacketsRecvErrors();
|
||||
memcpy(&reply_data[4], &stats, sizeof(stats));
|
||||
@@ -662,6 +663,7 @@ void RepeaterMesh::logRxRaw(float snr, float rssi, const uint8_t raw[], int len)
|
||||
}
|
||||
|
||||
void RepeaterMesh::logRx(mesh::Packet* pkt, int len, float score) {
|
||||
packet_log_rx(getLogDateTime(), pkt, _radio->getLastRSSI(), score, _radio->getEstAirtimeFor(len));
|
||||
if (_logging) {
|
||||
LOG_INF("RX len=%d type=%d route=%s payload_len=%d SNR=%d RSSI=%d",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F",
|
||||
@@ -674,6 +676,7 @@ void RepeaterMesh::logRx(mesh::Packet* pkt, int len, float score) {
|
||||
}
|
||||
|
||||
void RepeaterMesh::logTx(mesh::Packet* pkt, int len) {
|
||||
packet_log_tx(getLogDateTime(), pkt);
|
||||
if (_logging) {
|
||||
LOG_INF("TX len=%d type=%d route=%s payload_len=%d",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F",
|
||||
@@ -998,7 +1001,7 @@ void RepeaterMesh::sendNodeDiscoverReq() {
|
||||
|
||||
RepeaterMesh::RepeaterMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms,
|
||||
mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
|
||||
: mesh::Mesh(radio, ms, rng, rtc, *new mesh::StaticPoolPacketManager(), tables),
|
||||
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(), tables),
|
||||
_board(board),
|
||||
_cli(board, rtc, acl, &_prefs, this),
|
||||
region_map(key_store), temp_map(key_store),
|
||||
@@ -1344,7 +1347,7 @@ void RepeaterMesh::clearStats() {
|
||||
radio_driver.resetStats();
|
||||
radio_driver.resetDutyCycleTimeoutRestarts();
|
||||
resetStats();
|
||||
((mesh::SimpleMeshTables *)getTables())->resetStats();
|
||||
((SimpleMeshTables *)getTables())->resetStats();
|
||||
}
|
||||
|
||||
uint32_t RepeaterMesh::getDutyCycleTimeoutRestarts() const {
|
||||
|
||||
Reference in new issue
Block a user