mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-11-03 14:02:24 +00:00
Enable contact caching for high-capacity nRF52 companions
This commit is contained in:
1 parent
8a5f735bba
commit
50428f0fb7
4 files changed
+69
-8
No files matched your search
@@ -22,6 +22,25 @@ def method(source: str, signature: str) -> str:
|
||||
|
||||
|
||||
class OneKeyDMSharedQueueTest(unittest.TestCase):
|
||||
def test_standard_high_contact_nrf52_selects_shared_pool_by_default(self):
|
||||
header = (ROOT / "examples/companion_radio/MyMesh.h").read_text()
|
||||
start = header.index("#if defined(NRF52_PLATFORM) && MAX_CONTACTS > 300")
|
||||
end = header.index("#ifndef ROOM_MESSAGE_TIMESTAMP_CACHE_SIZE", start)
|
||||
policy = '#include <helpers/ContactCachePolicy.h>\n' + header[start:end]
|
||||
policy += '\nstatic_assert(MESH_CONTACT_CACHE == 1);\n'
|
||||
policy += 'static_assert(ONE_KEY_DM_SHARED_OFFLINE_QUEUE == 1);\n'
|
||||
policy += 'static_assert(OFFLINE_QUEUE_SIZE == 256);\nint main() {}\n'
|
||||
with tempfile.TemporaryDirectory(prefix="meshcore-dm-policy-") as temp:
|
||||
binary = Path(temp) / "policy.exe"
|
||||
for capacity in (301, 350):
|
||||
with self.subTest(capacity=capacity):
|
||||
result = subprocess.run([
|
||||
"c++", "-std=c++17", "-x", "c++", "-",
|
||||
"-DNRF52_PLATFORM=1", f"-DMAX_CONTACTS={capacity}",
|
||||
"-I", str(ROOT / "src"), "-o", str(binary),
|
||||
], input=policy, text=True, capture_output=True)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
|
||||
def compile_and_run(self, source: str):
|
||||
with tempfile.TemporaryDirectory(prefix="meshcore-shared-dm-") as temp:
|
||||
path = Path(temp) / "shared_dm.cpp"
|
||||
|
||||
Reference in new issue
Block a user