1515 find_meshtasticd ,
1616 is_compatible_host ,
1717)
18+ from .fw_helpers import set_region
1819
1920# Use a different base port for the single-node fixture so it doesn't
2021# conflict with the multi-node mesh fixture.
@@ -41,11 +42,14 @@ def firmware_node():
4142 tests be order-independent.
4243
4344 Yields the SimNode instance. The node is booted with a fresh erased
44- config and listens on localhost at its TCP port.
45+ config and listens on localhost at its TCP port. Region is set to US
46+ so modem-preset tests work against firmware >= 2.8, which clamps
47+ presets to the legal set for the current region.
4548 """
4649 _skip_firmware_if_unavailable ()
4750 mesh = SimMesh (n_nodes = 1 , base_port = SINGLE_NODE_BASE_PORT )
4851 mesh .start ()
52+ set_region (mesh .get_node (0 ).port , "US" )
4953 yield mesh .get_node (0 )
5054 mesh .stop ()
5155
@@ -55,11 +59,24 @@ def firmware_mesh():
5559 """A 3-node chain (A-B-C) meshtasticd sim mesh for smokemesh tests.
5660
5761 Yields the SimMesh instance. Nodes are connected and the SIMULATOR_APP
58- packet bridge is running. Node DB convergence is awaited.
62+ packet bridge is running. Region is set to US for firmware >= 2.8
63+ compatibility, interfaces are reconnected after the region change, and
64+ node DB convergence is awaited.
5965 """
6066 _skip_firmware_if_unavailable ()
6167 mesh = SimMesh (n_nodes = 3 , topology = CHAIN_TOPOLOGY )
6268 mesh .start ()
69+ for node in mesh .nodes :
70+ set_region (node .port , "US" )
71+ # The region commit restarts each node's TCP listener, so reconnect the
72+ # harness interfaces before waiting for convergence.
73+ for node in mesh .nodes :
74+ if node .iface is not None :
75+ try :
76+ node .iface .close ()
77+ except Exception : # pylint: disable=broad-except
78+ pass
79+ node .connect ()
6380 mesh .wait_for_convergence (timeout = 30 )
6481 yield mesh
6582 mesh .stop ()
0 commit comments