Public Access
- MeshCore joins the presets (EU/UK Narrow: 869.618 MHz, 62.5 kHz, SF8, CR 4/8, sync 0x12), after the Meshtastic ones so stored choices keep their number; `lora preset MeshCore` on the console - lib/meshcore reads what MeshCore sends in clear: header, path, and a node's advert (name, kind, key, position) - the list row, the details, a Capture's viewer and the console echo read a packet by the sync word it was received on - the bandwidth is printed as 62.5, not 62 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0162FokPdvY2KsS4NBfwyWPk
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
#include "scan_presets.h"
|
|
|
|
#include <cctype>
|
|
|
|
#include "meshcore_packet.h"
|
|
#include "meshtastic_presets.h"
|
|
|
|
namespace roro::lora {
|
|
|
|
size_t scanPresetCount() { return meshtastic::kEu868PresetCount + 1; }
|
|
|
|
ScanPreset scanPreset(size_t i) {
|
|
if (i < meshtastic::kEu868PresetCount) {
|
|
const meshtastic::Preset& p = meshtastic::kEu868Presets[i];
|
|
return {p.name, meshtastic::eu868FrequencyHz(p), p.bwKHz, p.sf, p.cr, meshtastic::kSyncWord, meshtastic::kPreambleLength, Protocol::Meshtastic};
|
|
}
|
|
return {meshcore::kPresetName, meshcore::kEuNarrowHz, meshcore::kEuNarrowBwKHz, meshcore::kEuNarrowSf, meshcore::kEuNarrowCr,
|
|
meshcore::kSyncWord, meshcore::kPreambleLength, Protocol::MeshCore};
|
|
}
|
|
|
|
bool findScanPreset(const char* name, ScanPreset& out) {
|
|
for (size_t i = 0; i < scanPresetCount(); ++i) {
|
|
ScanPreset p = scanPreset(i);
|
|
const char *a = p.name, *b = name;
|
|
while (*a && *b && std::tolower(static_cast<unsigned char>(*a)) == std::tolower(static_cast<unsigned char>(*b))) ++a, ++b;
|
|
if (!*a && !*b) {
|
|
out = p;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // namespace roro::lora
|