feat: Add --use-lighthouses argument to selectively choose lighthouses to be used for optimization
#343
+46
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new command-line argument,
--use-lighthouses, which allows specifying a comma-separated list of BaseStationIDs (hex) to use for tracking. Lighthouses whose IDs are not in this list will be disabled. Not using this argument will make the code work as usual and discover and optimize with all available lighthouses. The main reason to use this flag is if you have multiple lighthouse setups in the same room and you only want to use a specific set of lighthouses.This change also fixes bugs in the lighthouse initialization and discovery logic so that the whitelist is respected even when lighthouses are discovered at runtime (e.g., when
config.jsonis empty).Technical Changes
1.
survive.c- Configuration and InitializationSTATIC_CONFIG_ITEMforuse-lighthousesis added to register the command-line argument.survive_init_internal:use-lighthousesconfig is read before iterating through lighthouse slots.has_config == false) is pre-emptively disabled (disable = 1).BaseStationIDis checked against the whitelist. If it does not match, it is disabled.survive_get_bsd_idx:BaseStationDatastruct is no longer fully reset when a new channel is assigned to an empty slot.disable = 1flag set duringsurvive_init_internal. Previously, this flag was cleared upon discovery.2.
survive_process_gen2.c- Runtime Discoverysurvive_default_sync_process:survive_ootx_behavioris moved to run before theif (so->ctx->bsd[bsd_idx].disable)check.ootx_packet_clbk_d_gen2:BaseStationIDis checked against theuse-lighthouseswhitelist.b->disable = 0).b->disable = 1).Summary of Behavior
With these changes, if
--use-lighthousesis active:config.jsonand on the whitelist.